19 using System.Collections.Generic;
26 using ErrorManagement;
28 namespace CodeGeneration {
38 abstract class VisitorRrotorCodeGeneration<T>: VisitorILCodeGeneration <T> where T:
RrotorCodeGenerator{
43 public VisitorRrotorCodeGeneration(
string moduleName, T codeGenerator)
50 : base(moduleName, codeGenerator) { }
54 #region Visit(InvocationExpression node, Object obj)
60 if (actualMethodCalled != null)
64 if (fieldAccessExpression != null) {
66 Object o = node.Identifier.Accept(
this, obj);
67 node.Arguments.Accept(
this, objArgs);
68 if ((o is
SynthesizedAttributes) && (((SynthesizedAttributes)o).IdentifierExpressionMode == IdentifierMode.Instance)) {
70 if (actualMethodCalled != null)
71 klass = actualMethodCalled.MemberInfo.Class;
72 this.codeGenerator.CallVirt(this.indent, actualMethodCalled, klass, fieldAccessExpression.FieldName.Identifier, node.Arguments);
75 this.codeGenerator.Call(this.indent, actualMethodCalled, actualMethodCalled.MemberInfo.Class, actualMethodCalled.MemberInfo.MemberIdentifier);
80 if ((((
MethodType)node.Identifier.ExpressionType).MemberInfo.ModifierMask &
Modifier.Static) == 0)
81 this.codeGenerator.ldarg(
this.indent, 0);
82 node.Arguments.Accept(
this, objArgs);
83 this.codeGenerator.Call(this.indent, actualMethodCalled, actualMethodCalled.MemberInfo.Class, ((SingleIdentifierExpression)node.
Identifier).Identifier);
87 node.Arguments.Accept(
this, objArgs);
88 this.codeGenerator.constructorCall(this.indent, actualMethodCalled, ((BaseExpression)node.
Identifier).ExpressionType,
".ctor");
94 this.codeGenerator.WriteLine();
102 throw new NotImplementedException();
Encapsulates a 'base' expression.
Expression Identifier
Gets the expression to invoke
bool IsParentNodeAnInvocation
Gets or sets true if the parent node is an InvocationExpression. Otherwise, false.
Encapsulates the expression to access a field.
Encapsulates a invocation expression.
This class encapsulates the IL CLR code generator IL.
Abstract class that represents all different types.
bool ArrayAccessFound
Gets or sets true if array access expression found. Otherwise, gets or sets false.
MethodDefinition CurrentMethod
Gets or sets the current method definition node.
Encapsulates a identifier expression of our programming language.
Expression Reference
Gets or sets the reference of a concrete identifier.
override Object Visit(InvocationExpression node, Object obj)
This class encapsulates several inherited attributes used in code generation process.
Modifier
Indicates differents modifiers to use in class (only public, internal or static), fields or methods...
bool Assignment
Gets or sets true if assignment expression found. Otherwise, gets or sets false.
Representa a method type.
override void AddExceptionCode()
Adds the intermediate code for exception to include in the file.
This class encapsulates several inherited attributes used in code generation process.