Exemple #1
0
 protected override void Visit(UnaryExpression node)
 {
   VisitNode(node.Expression);
   Visit((Expression)node);
 }
Exemple #2
0
      void Visit(UnaryExpression node, Types.MethodCache1 opearation)
      {
        PushLocation(node);

        var stackState = _localVars.GetTemporaryStackState();
        VisitNode(node.Expression);
        _localVars.PopTemporariesAfter(stackState);

        var mi = opearation.Get(_result.ValueType);
        _result.ValueType = opearation.ReturnType(_result.ValueType);

        if (_result.ValueType == mdr.ValueTypes.DValueRef)
        {
          Debug.Assert(mi.GetParameters().Length == 2 && mi.GetParameters()[1].ParameterType == Types.TypeOf(mdr.ValueTypes.DValueRef), "Invalid situation, method {0} must get a second 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();
      }
      protected override void Visit(UnaryExpression node)
      {
        PushLocation(node);

        VisitNode(node.Expression);
        var operandType = _result.ValueType;

        _stackModel.Pop(1);

        BeginICMethod(node);
        Operations.ICMethods.CreateUnaryOperationIC(_ilGen, node.NodeType, _stackModel.StackPointer, operandType, true);
        EndICMethod();

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

        PopLocation();
      }