output (s);
}
- string GetType (Type type)
- {
- return type.Name;
- }
-
string GetParameter (Parameter par)
{
Parameter.Modifier f = par.ModFlags;
case Parameter.Modifier.NONE:
mod = ""; break;
}
- return mod + GetType (par.Type) + " " + par.Name;
+ return mod + par.Type + " " + par.Name;
}
string GetUnary (Unary u, int paren_level)
int prec = 0;
switch (u.Oper){
- case Unary.Operator.Plus:
+ case Unary.Operator.UnaryPlus:
prec = 10;
s = "+";
break;
- case Unary.Operator.Minus:
+ case Unary.Operator.UnaryNegation:
prec = 10;
s = "-";
break;
- case Unary.Operator.Negate:
+ case Unary.Operator.LogicalNot:
s = "!";
prec = 10;
break;
- case Unary.Operator.BitComplement:
+ case Unary.Operator.OnesComplement:
prec = 10;
s = "~";
break;
prec = 9;
op = "*"; break;
- case Binary.Operator.Divide:
+ case Binary.Operator.Division:
prec = 9;
op = "/"; break;
- case Binary.Operator.Modulo:
+ case Binary.Operator.Modulus:
prec = 9;
op = "%"; break;
- case Binary.Operator.Add:
+ case Binary.Operator.Addition:
prec = 8;
op = "+"; break;
- case Binary.Operator.Substract:
+ case Binary.Operator.Subtraction:
prec = 8;
op = "-"; break;
- case Binary.Operator.ShiftLeft:
+ case Binary.Operator.LeftShift:
prec = 7;
op = "<<"; break;
- case Binary.Operator.ShiftRight:
+ case Binary.Operator.RightShift:
prec = 7;
op = ">>"; break;
prec = 6;
op = "<"; break;
- case Binary.Operator.GreatherThan:
+ case Binary.Operator.GreaterThan:
prec = 6;
op = ">"; break;
- case Binary.Operator.LessOrEqual:
+ case Binary.Operator.LessThanOrEqual:
prec = 6;
op = "<="; break;
- case Binary.Operator.GreatherOrEqual:
+ case Binary.Operator.GreaterThanOrEqual:
prec = 6;
op = ">="; break;
- case Binary.Operator.Equal:
+ case Binary.Operator.Equality:
prec = 5;
op = "=="; break;
- case Binary.Operator.NotEqual:
+ case Binary.Operator.Inequality:
prec = 5;
op = "!="; break;
string GetCast (Cast c)
{
- return "(" + c.TargetType.Name + ") (" + GetExpression (c.Expr, 0) + ")";
+ return "(" + c.TargetType + ") (" + GetExpression (c.Expr, 0) + ")";
}
string GetConditional (Conditional c)
for (int i = 0; i < top; i++){
Argument arg = (Argument) args [i];
- switch (arg.Type){
+ switch (arg.ArgType){
case Argument.AType.Ref:
r += "ref "; break;
case Argument.AType.Out:
string GetNew (New n)
{
- return "new " + n.RequestedType.Name + GetArguments (n.Arguments);
+ return "new " + n.RequestedType + GetArguments (n.Arguments);
}
string GetTypeOf (TypeOf t)
{
- return "typeof (" + t.QueriedType.Name + ")";
+ return "typeof (" + t.QueriedType + ")";
}
string GetSizeOf (SizeOf t)
{
- return "sizeof (" + t.QueriedType.Name + ")";
+ return "sizeof (" + t.QueriedType + ")";
}
string GetMemberAccess (MemberAccess m)
else
s += "UNHANDLED";
- s += GetType (p.ProbeType);
+ s += p.ProbeType;
return s;
}
void GenerateParameters (Parameters pars)
{
- ParameterCollection pfixed;
+ Parameter [] pfixed;
Parameter parray;
pfixed = pars.FixedParameters;
if (pfixed != null){
- for (int i = 0; i < pfixed.Count; i++){
- output (GetParameter ((Parameter) pfixed [i]));
- if (i+1 != pfixed.Count)
+ for (int i = 0; i < pfixed.Length; i++){
+ output (GetParameter (pfixed [i]));
+ if (i+1 != pfixed.Length)
output (", ");
}
}
void GenerateFor (For s)
{
output ("for (");
- if (! (s.InitStatement is EmptyStatement))
+ if (! (s.InitStatement == EmptyStatement.Value))
GenerateStatement (s.InitStatement, true, true, true);
output ("; ");
output (GetExpression (s.Test, 0));
output ("; ");
- if (! (s.InitStatement is EmptyStatement))
+ if (! (s.Increment == EmptyStatement.Value))
GenerateStatement (s.Increment, true, true, true);
output (") ");
GenerateStatement (s.Statement, true, true, false);
output ("catch ");
if (c.Type != null){
- output ("(" + GetType (c.Type) +
+ output ("(" + c.Type +
(c.Name != null ? " " + c.Name : "") + ")");
}
GenerateBlock (c.Block, false, false);
output_newline ("break;");
else if (s is Continue)
output_newline ("continue;");
- else if (s is EmptyStatement)
+ else if (s == EmptyStatement.Value)
output_newline ("/* empty statement */;");
else if (s is Block)
GenerateBlock ((Block) s, doPlacement, embedded);
if (b.Variables != null){
foreach (DictionaryEntry entry in b.Variables){
+ VariableInfo vi = (VariableInfo) entry.Value;
+
space ();
output_newline (
- (((CIR.TypeRef)entry.Value).Type).Name + " " +
- (string)entry.Key + ";");
+ vi.Type + " " +
+ (string) entry.Key + ";");
}
newline ();
}
void GenerateMethod (Method m)
{
ioutput (GetModifiers (m.ModFlags) +
- GetType (m.ReturnType) + " " +
+ m.ReturnType + " " +
m.Name + " (");
GenerateParameters (m.Parameters);
output_newline (")");
newline ();
}
- void GenerateMethodGroup (MethodGroup mg)
- {
- foreach (DictionaryEntry de in mg.Methods){
- Method m = (Method) de.Value;
-
- GenerateMethod (m);
- }
- }
-
void GenerateInterfaceMethod (InterfaceMethod imethod)
{
space ();
output (imethod.IsNew ? "new " : "");
- output (GetType (imethod.ReturnType) + " " + imethod.Name + " (");
+ output (imethod.ReturnType + " " + imethod.Name + " (");
GenerateParameters (imethod.Parameters);
output (");");
newline ();
{
space ();
output (iprop.IsNew ? "new " : "");
- output (GetType (iprop.Type) + " " + iprop.Name + " { ");
+ output (iprop.Type + " " + iprop.Name + " { ");
if (iprop.HasGet) output ("get; ");
if (iprop.HasSet) output ("set; ");
output ("}");
{
space ();
output ((ievent.IsNew ? "new " : "") + "event ");
- output (GetType (ievent.Type) + " " + ievent.Name + ";");
+ output (ievent.Type + " " + ievent.Name + ";");
newline ();
}
{
space ();
output (iindexer.IsNew ? "new " : "");
- output (GetType (iindexer.Type) + " this [");
+ output (iindexer.Type + " this [");
output (iindexer.Parameters + "] {");
if (iindexer.HasGet) output ("get; ");
if (iindexer.HasSet) output ("set; ");
{
space ();
output (GetModifiers (f.ModFlags) +
- GetType (f.Type) + " " + f.Name);
+ f.Type + " " + f.Name);
if (f.Initializer != null){
if (f.Initializer is Expression)
output (" = " + GetExpression ((Expression) f.Initializer, 0));
void GenerateProperty (Property prop)
{
space ();
- output (GetModifiers (prop.ModFlags) + GetType (prop.Type) +
+ output (GetModifiers (prop.ModFlags) + prop.Type +
" " + prop.Name + " {");
newline ();
indent++;
void GenerateTypeContainerData (TypeContainer tc)
{
if (tc.Constants != null){
- foreach (DictionaryEntry cde in tc.Constants){
- Constant c = tc.GetConstant ((string) cde.Key);
-
+ foreach (Constant c in tc.Constants){
space ();
- output ("const " + c.ConstantType.Name + " " + c.name + " = " +
+ output ("const " + c.ConstantType + " " + c.Name + " = " +
GetExpression (c.Expr, 0) + ";");
newline ();
}
}
if (tc.Enums != null){
- foreach (DictionaryEntry ede in tc.Enums){
- CIR.Enum e = (CIR.Enum) ede.Value;
-
+ foreach (CIR.Enum e in tc.Enums)
GenerateEnum (e);
- }
}
if (tc.Fields != null){
- foreach (DictionaryEntry de in tc.Fields){
- Field f = (Field) de.Value;
-
+ foreach (Field f in tc.Fields)
GenerateField (f);
- }
newline ();
}
if (tc.Constructors != null){
- foreach (DictionaryEntry de in tc.Constructors){
- Constructor c = (Constructor) de.Value;
-
+ foreach (Constructor c in tc.Constructors)
GenerateConstructor (c);
- }
+
newline ();
}
if (tc.Properties != null){
- foreach (DictionaryEntry de in tc.Properties){
- Property prop = (Property) de.Value;
-
+ foreach (Property prop in tc.Properties)
GenerateProperty (prop);
- }
}
GenerateFromTypes (tc);
- if (tc.MethodGroups != null){
- foreach (DictionaryEntry de in tc.MethodGroups){
- MethodGroup mg = (MethodGroup) de.Value;
-
- GenerateMethodGroup (mg);
+ if (tc.Methods != null){
+ foreach (Method m in tc.Methods){
+ GenerateMethod (m);
}
}
}
string ClassName (string name)
{
return name;
- //return name.Substring (1 + name.LastIndexOf ("."));
+ //return name.Substring (1 + name.LastIndexOf ('.'));
}
string GenBases (ArrayList bases)