1 // gen-il.cs: Generates MSIL code from the CIR.Tree
3 // Author: Miguel de Icaza (miguel@ximian.com)
5 // Licensed under the terms of the GNU GPL
7 // (C) 2001 Ximian, Inc. (http://www.ximian.com)
12 using System
.Collections
;
17 public class Generator
: CIR
.ITreeDump
{
21 void output (string s
)
29 output (new String (' ', indent
* 2));
32 void ioutput (string s
)
38 void ioutputl (string s
)
43 string ClassAttributes (Class c
)
49 string ILName (string name
)
54 string ClassExtends (Class c
)
59 void GenerateFromClass (Class c
)
61 ioutputl (".class " + ClassAttributes (c
) + " " + ILName (c
.Name
));
62 ioutputl (ClassExtends (c
));
72 void GenerateFromTypes (TypeContainer types
)
74 if (types
.Types
== null)
77 foreach (DictionaryEntry de
in types
.Types
){
78 TypeContainer type
= (TypeContainer
) de
.Value
;
81 GenerateFromClass ((Class
) type
);
86 public int GenerateFromTree (Tree tree
, StreamWriter os
)
90 ioutputl (".assembly test.exe { }");
91 GenerateFromTypes (tree
.Types
);
95 public void ParseOptions (string options
)