Example #1
0
      void Visit(BinaryExpression node, Types.MethodCache2 operation)
      {
        PushLocation(node);

        var stackState = _localVars.GetTemporaryStackState();
        VisitNode(node.Left);
        var leftType = _result.ValueType;
        VisitNode(node.Right);
        var rightType = _result.ValueType;
        _localVars.PopTemporariesAfter(stackState);

        var mi = operation.Get(leftType, rightType);
        _result.ValueType = operation.ReturnType(leftType, rightType);
        if (_result.ValueType == mdr.ValueTypes.DValueRef)
        {
          Debug.Assert(mi.GetParameters().Length == 3 && mi.GetParameters()[2].ParameterType == Types.TypeOf(mdr.ValueTypes.DValueRef), "Invalid situation, method {0} must get a third parameter of type 'ref DValue'", mi);
          var local = _localVars.PushTemporary(mdr.ValueTypes.DValue);
          _ilGen.Ldloca(local);
          _ilGen.Call(mi);
          _ilGen.Ldloca(local);
        }
        else
        {
          _ilGen.Call(mi);
        }
        PopLocation();
      }
Example #2
0
 protected override void Visit(BinaryExpression node) { Visit((Expression)node); }
Example #3
0
 protected override void Visit(BinaryExpression node)
 {
   VisitNode(node.Left);
   VisitNode(node.Right);
   Visit((Expression)node);
 }
      protected override void Visit(BinaryExpression node)
      {
        PushLocation(node);

        VisitNode(node.Left);
        var leftType = _result.ValueType;
        VisitNode(node.Right);
        var rightType = _result.ValueType;

        _stackModel.Pop(2);

        BeginICMethod(node);
        Operations.ICMethods.CreateBinaryOperationIC(_ilGen, node.NodeType, _stackModel.StackPointer, leftType, rightType, true, true);
        EndICMethod();

        _result.ValueType = mdr.ValueTypes.DValueRef;
        _stackModel.Push(1);

        PopLocation();
      }