public override void Visit(NewExpression node) { PushLocation(node); var stackState = _localVars.GetTemporaryStackState(); var callFrame = CreateCallFrame(node); LoadArguments(node, callFrame); GenExecTimerStop(true); //TODO: technically, we should lookup ".constructor" field, and if it exists, call ".ToDFunction().Construct()" on it. _ilGen.Ldloca(callFrame); _ilGen.Ldfld(Types.CallFrame.Function); _ilGen.Ldloca(callFrame); _ilGen.Callvirt(Types.DFunction.Construct); GenExecTimerStart(true); _localVars.PopTemporariesAfter(stackState); //We need to immediately copy the return value on caller's stack before it gets destroyed var result = _localVars.PushTemporary(Types.DObject.TypeOf); _ilGen.Ldloca(callFrame); _ilGen.Ldfld(Types.CallFrame.This); _ilGen.Stloc(result); _ilGen.Ldloc(result); _result.ValueType = mdr.ValueTypes.Object; PopLocation(); }
public override void Visit(NewExpression node) { base.Visit(node); node.ValueType = GetType(node); }
public override void Visit(NewExpression node) { Visit((Invocation)node); }
internal static mdr.ValueTypes GetType(NewExpression expression) { return mdr.ValueTypes.DValueRef; /*It may return subtypes of .Object, so we cannot be particular about iot!;*/ }
public override void Visit(NewExpression node) { PushLocation(node); VisitNode(node.Function); VisitNodes(node.Arguments); _stackModel.Pop(1 + node.Arguments.Count); BeginICMethod(node); _ilGen.Ldarg_CallFrame(); _ilGen.Ldc_I4(node.Arguments.Count); _ilGen.Ldc_I4(_stackModel.StackPointer); _ilGen.Call(Types.Operations.ICMethods.New); EndICMethod(); _result.ValueType = mdr.ValueTypes.DValueRef; _stackModel.Push(1); PopLocation(); }
public NewExpression MakeNewExpression(Scope scope, IExpression function, IExpressionList arguments = null) { scope.HasCall = true; var n = new NewExpression(MakeToFunction((Expression)function), arguments ?? MakeExpressionList()); scope.Invocations.Add(n); return n; }
public override void Visit(NewExpression node) { PushLocation(node); VisitNode(node.Function); VisitNodes(node.Arguments); //GenExecTimerStop(true); _ilGen.Ldc_I4(node.Arguments.Count); Call(Types.Operations.Stack.New, 1 + node.Arguments.Count, 1); //GenExecTimerStart(true); PopLocation(); }
public override void Visit(NewExpression node) { AssignToImplicitReturn(node); }