Ejemplo n.º 1
0
 public void EmitIR(CILEmitter Emitter, bool Reference)
 {
     if (Reference)
     {
         if (Type.IsArray && reference.ArrayIndex != null)
         {
             Emitter.LoadVariable(reference.Name);
             reference.ArrayIndex.EmitIR(Emitter, false);
             Emitter.LoadArrayIndexAddress(Type);
         }
         else
         {
             Emitter.LoadVariableAddress(reference.Name);
         }
     }
     else if (variable.IsReference)
     {
         Emitter.LoadReferenceVariable(variable);
     }
     else
     {
         Emitter.LoadVariable(reference.Name);
         if (reference.ArrayIndex != null)
         {
             reference.ArrayIndex.EmitIR(Emitter, false);
             Emitter.LoadArrayVariable(variable);
         }
     }
 }
Ejemplo n.º 2
0
 public void EmitIR(CILEmitter Emitter)
 {
     if (variable.IsReference)
     {
         if (reference.ArrayIndex == null)
         {
             Emitter.LoadVariable(reference.Name);
             assigment.EmitIR(Emitter, false);
             Emitter.SaveReferenceVariable(variable);
         }
         else
         {
             Emitter.LoadReferenceVariable(variable);
             reference.ArrayIndex.EmitIR(Emitter, false);
             assigment.EmitIR(Emitter, false);
             Emitter.SaveArray(variable);
         }
     }
     else
     {
         if (reference.ArrayIndex == null)
         {
             assigment.EmitIR(Emitter, false);
             Emitter.SaveVariable(reference.Name);
         }
         else
         {
             Emitter.LoadVariable(variable.Identifier);
             reference.ArrayIndex.EmitIR(Emitter, false);
             assigment.EmitIR(Emitter, false);
             Emitter.SaveArray(variable);
         }
     }
 }
Ejemplo n.º 3
0
 public void EmitIR(CILEmitter Emitter, bool Reference)
 {
     if (Reference)
     {
         throw new InvalidByReferenceException();
     }
     for (int i = 0; i < arguments.Count; i++)
     {
         IExpression expr          = arguments.Expression(i);
         bool        loadReference = ToCall.Parameters.At(i).IsReference;
         expr.EmitIR(Emitter, loadReference);
     }
     foreach (Variable prevVar in ToCall.Parameters.PreviousVariables)
     {
         if (current.Variable(prevVar.Identifier).IsReference)
         {
             Emitter.LoadVariable(prevVar.Identifier);
         }
         else
         {
             Emitter.LoadVariableAddress(prevVar.Identifier);
         }
     }
     Emitter.Call(toBeCalled);
 }