internal InstanceAccessExpression(LeftHandValueExpression lvalue, List <FunctionArgument> callArgs) { Value = lvalue; Arguments = callArgs; }
internal AssignmentExpression(LeftHandValueExpression left, Expression right, ExpressionType assignType) { Left = left; Right = right ?? Constant(null); ExtraNodeType = assignType; }
internal ConditionalAssignmentExpression(LeftHandValueExpression left, Expression right, KumaExpressionType conditionalAssignmentType) : base(left, right, ExpressionType.Assign) { ConditionalAssignmentType = conditionalAssignmentType; }
public override Expression Reduce() { var forLabel = Label("<kuma_for>"); VariableExpression forReturn = null; LeftHandValueExpression forReturnLh = null; var useReturn = true; if (Body.Type == typeof(void)) { useReturn = false; } else { forReturn = Variable(Constant("<kuma_for_return>")); forReturnLh = LeftHandValue(forReturn); forReturn.Scope = ((KumaExpression)Body).Scope; forReturnLh.Scope = ((KumaExpression)Body).Scope; } var forTest = Variable(Constant("<kuma_for_test>")); var forTestLh = LeftHandValue(forTest); forTest.Scope = ((KumaExpression)Body).Scope; forTestLh.Scope = ((KumaExpression)Body).Scope; var realBody = new List <Expression> { Init, Label(forLabel), }; var testAssign = Assign(forTestLh, Test); realBody.Add(Label(KumaParser.RetryTarget)); testAssign.Scope = (Body as KumaExpression).Scope; realBody.Add(testAssign); IfExpression testIf; if (useReturn) { var returnAssign = Assign(forReturnLh, Body); returnAssign.Scope = (Body as KumaExpression).Scope; testIf = IfThen(forTest, returnAssign); } else { testIf = IfThen(forTest, Body); } testIf.Scope = ((KumaExpression)Body).Scope; realBody.Add(testIf); realBody.Add(Label(KumaParser.ContinueTarget)); realBody.Add(Step); realBody.Add(IfThen(forTest, Goto(forLabel))); realBody.Add(Label(KumaParser.BreakTarget)); if (useReturn) { realBody.Add(forReturn); } var block = new BlockExpression(realBody) { Scope = (Body as KumaExpression).Scope }; return(Convert(block, Type)); }
public static ConditionalAssignmentExpression ConditionalAssign(LeftHandValueExpression left, Expression right, KumaExpressionType conditionalAssignmentType) { return(new ConditionalAssignmentExpression(left, right, conditionalAssignmentType)); }
public static AssignmentExpression Assign(LeftHandValueExpression left, Expression right, ExpressionType type) { return(new AssignmentExpression(left, right, type)); }
public static AssignmentExpression Assign(LeftHandValueExpression left, Expression right) { return(Assign(left, right, ExpressionType.Assign)); }