public override void LeaveMethodInvocationExpression(MethodInvocationExpression node) { IEntityWithParameters parameters = node.get_Target().get_Entity() as IEntityWithParameters; if (parameters != null) { ExpressionCollection args = node.get_Arguments(); if (parameters.get_AcceptVarArgs() && UnityCallableResolutionServiceModule.IsArrayArgumentExplicitlyProvided(parameters.GetParameters(), args)) { UnaryExpression expression2; Expression expression = args.get_Item(-1); UnaryExpression expression1 = expression2 = new UnaryExpression(); expression2.set_Operator(7); expression2.set_Operand(expression); expression2.set_ExpressionType(this.GetExpressionType(expression)); args.ReplaceAt(-1, expression2); } } }
public MethodInvocationExpression CreateEvaluatorInvocation(MethodInvocationExpression node) { return this.get_CodeBuilder().CreateMethodInvocation(Evaluator_Eval, this.CreateEvaluationContextReference(), node.get_Arguments().get_Item(0)); }
protected Expression typeof_with_expression() { Expression expression = null; IToken token = null; try { Expression expression2; token = this.LT(1); this.match(0x2c); if ((this.LA(1) == 0x3f) && tokenSet_16_.member(this.LA(2))) { this.match(0x3f); expression2 = this.expression(); this.match(0x40); } else { if (!tokenSet_16_.member(this.LA(1)) || !tokenSet_20_.member(this.LA(2))) { throw new NoViableAltException(this.LT(1), this.getFilename()); } expression2 = this.expression(); } if (base.inputState.guessing == 0) { ReferenceExpression expression4; MethodInvocationExpression expression3 = new MethodInvocationExpression(ToLexicalInfo(token)); ReferenceExpression expression1 = expression4 = new ReferenceExpression(ToLexicalInfo(token)); expression4.set_Name(token.getText()); expression3.set_Target(expression4); expression3.get_Arguments().Add(expression2); expression = expression3; } } catch (RecognitionException exception) { if (base.inputState.guessing != 0) { throw; } this.reportError(exception); this.recover(exception, tokenSet_20_); return expression; } return expression; }
public Expression slicing_expression() { Expression target = null; IToken token = null; IToken token2 = null; SlicingExpression se = null; MethodInvocationExpression expression3 = null; ExpressionCollection ec = null; try { target = this.atom(); while (true) { while ((this.LA(1) == 0x44) && tokenSet_54_.member(this.LA(2))) { token = this.LT(1); this.match(0x44); if (base.inputState.guessing == 0) { se = new SlicingExpression(ToLexicalInfo(token)); se.set_Target(target); target = se; } this.slice(se); while (this.LA(1) == 0x43) { this.match(0x43); this.slice(se); } this.match(0x45); } if ((this.LA(1) == 0x41) && tokenSet_55_.member(this.LA(2))) { this.match(0x41); target = this.member_reference_expression(target); } else { if ((this.LA(1) != 0x3f) || !tokenSet_22_.member(this.LA(2))) { return target; } token2 = this.LT(1); this.match(0x3f); if (base.inputState.guessing == 0) { expression3 = new MethodInvocationExpression(ToLexicalInfo(token2)); expression3.set_Target(target); target = expression3; ec = expression3.get_Arguments(); } this.expression_list(ec); this.match(0x40); } } } catch (RecognitionException exception) { if (base.inputState.guessing != 0) { throw; } this.reportError(exception); this.recover(exception, tokenSet_20_); return target; } return target; }
public override void PropagateChanges(MethodInvocationExpression eval, List chain) { ExpressionCollection expressions = new ExpressionCollection(); foreach (object local1 in chain.Reversed) { if (!(local1 is ProcessAssignmentsToSpecialMembers.ChainItem)) { } ProcessAssignmentsToSpecialMembers.ChainItem item = (ProcessAssignmentsToSpecialMembers.ChainItem) RuntimeServices.Coerce(local1, typeof(ProcessAssignmentsToSpecialMembers.ChainItem)); if (item.Container is MethodInvocationExpression) { break; } if (item.Container is SlicingExpression) { SlicingExpression expression = item.Container; Expression[] expressionArray1 = new Expression[] { expression.get_Target().CloneNode(), expression.get_Indices().get_Item(0).get_Begin().CloneNode(), this.get_CodeBuilder().CreateReference(item.Local) }; expressions.Add(this.CreateConstructorInvocation(this._sliceValueTypeChangeConstructor, expressionArray1)); break; } MemberReferenceExpression container = item.Container; Expression[] args = new Expression[] { container.get_Target().CloneNode(), this.get_CodeBuilder().CreateStringLiteral(container.get_Name()), this.get_CodeBuilder().CreateReference(item.Local) }; expressions.Add(this.CreateConstructorInvocation(this._valueTypeChangeConstructor, args)); } MethodInvocationExpression expression3 = this.get_CodeBuilder().CreateMethodInvocation(this._propagateChanges); IArrayType type = this._valueTypeChangeType.MakeArrayType(1); expression3.get_Arguments().Add(this.get_CodeBuilder().CreateArray(type, expressions)); eval.get_Arguments().Add(expression3); }
private void ProcessTypeofBuiltin(MethodInvocationExpression node) { if (node.get_Arguments().get_Count() != 1) { this.Error(node, new CompilerError("UCE0001", node.get_Target().get_LexicalInfo(), "'typeof' takes a single argument.", null)); } else { IType type = node.get_Arguments().get_Item(0).get_Entity() as IType; if (type != null) { node.get_ParentNode().Replace(node, this.get_CodeBuilder().CreateTypeofExpression(type)); } else { node.set_Target(this.get_CodeBuilder().CreateReference(this._UnityRuntimeServices_GetTypeOf)); this.BindExpressionType(node, this.get_TypeSystemServices().TypeType); } } }