public ScriptAssignExpr(AstNodeArgs args) : base(args) { var varExpr = args.ChildNodes[0] as ScriptVarExpr; if (varExpr != null) { var id = varExpr.ChildNodes[1] as TokenAst; _nameExpr = new ScriptQualifiedName(new AstNodeArgs(args.Term, args.Span, new AstNodeList { id, new AstNode(new AstNodeArgs(args.Term, new SourceSpan(new SourceLocation(0, 0, 0), 0), new AstNodeList())) })) { IsVar = true }; } else { _nameExpr = (ScriptQualifiedName)args.ChildNodes[0]; } _oper = ((TokenAst)args.ChildNodes[1]).Text; if (args.ChildNodes.Count == 3) _rightExpr = (ScriptExpr)args.ChildNodes[2]; Debug.Assert(_oper == "=" || _oper == ":=" || _oper == "+=" || _oper == "-=" || _oper == "++" || _oper == "--" || _oper == ":="); switch (_oper) { case "=": _assignOperation = Assign; break; case ":=": _assignOperation = AssignEx; break; case "++": _assignOperation = PlusPlus; break; case "--": _assignOperation = MinusMinus; break; case "+=": _assignOperation = PlusEqual; break; case "-=": _assignOperation = MinusEqual; break; default: throw new System.InvalidOperationException(string.Format(Strings.AssignmentOperatorNotSupported, _oper)); } _minus = RuntimeHost.GetBinaryOperator(OperatorCodes.Sub); _plus = RuntimeHost.GetBinaryOperator(OperatorCodes.Add); if (_plus == null || _minus == null) throw new ScriptRuntimeException(string.Format(Strings.MissingOperatorError, "+,-")); }
public ScriptAssignExpr(AstNodeArgs args) : base(args) { nameExpr = (ScriptQualifiedName)args.ChildNodes[0]; oper = ((Token)args.ChildNodes[1]).Text; if (args.ChildNodes.Count == 3) { rightExpr = (ScriptExpr)args.ChildNodes[2]; } Debug.Assert(oper == "=" || oper == ":=" || oper == "+=" || oper == "-=" || oper == "++" || oper == "--" || oper == ":="); switch (oper) { case "=": assignOperation = Assign; break; case ":=": assignOperation = AssignEx; break; case "++": assignOperation = PlusPlus; break; case "--": assignOperation = MinusMinus; break; case "+=": assignOperation = PlusEqual; break; case "-=": assignOperation = MinusEqual; break; default: throw new ScriptException("Assignment operator:" + oper + " is not supported"); } minus = RuntimeHost.GetBinaryOperator("-"); plus = RuntimeHost.GetBinaryOperator("+"); if (plus == null || minus == null) { throw new ScriptException("RuntimeHost did not initialize property. Can't find binary operators."); } }
public ScriptAssignExpr(AstNodeArgs args) : base(args) { nameExpr = (ScriptQualifiedName)args.ChildNodes[0]; oper = ((Token)args.ChildNodes[1]).Text; if (args.ChildNodes.Count == 3) rightExpr = (ScriptExpr)args.ChildNodes[2]; Debug.Assert(oper == "=" || oper == ":=" || oper == "+=" || oper == "-=" || oper == "++" || oper == "--" || oper == ":="); switch (oper) { case "=": assignOperation = Assign; break; case ":=": assignOperation = AssignEx; break; case "++": assignOperation = PlusPlus; break; case "--": assignOperation = MinusMinus; break; case "+=": assignOperation = PlusEqual; break; case "-=": assignOperation = MinusEqual; break; default: throw new ScriptException("Assignment operator:" + oper + " is not supported"); } minus = RuntimeHost.GetBinaryOperator("-"); plus = RuntimeHost.GetBinaryOperator("+"); if (plus == null || minus == null) throw new ScriptException("RuntimeHost did not initialize property. Can't find binary operators."); }
public ScriptAssignExpr(AstNodeArgs args) : base(args) { var varExpr = args.ChildNodes[0] as ScriptVarExpr; if (varExpr != null) { var id = varExpr.ChildNodes[1] as TokenAst; _nameExpr = new ScriptQualifiedName(new AstNodeArgs(args.Term, args.Span, new AstNodeList { id, new AstNode(new AstNodeArgs(args.Term, new SourceSpan(new SourceLocation(0, 0, 0), 0), new AstNodeList())) })) { IsVar = true }; } else { _nameExpr = (ScriptQualifiedName)args.ChildNodes[0]; } _oper = ((TokenAst)args.ChildNodes[1]).Text; if (args.ChildNodes.Count == 3) { _rightExpr = (ScriptExpr)args.ChildNodes[2]; } Debug.Assert(_oper == "=" || _oper == ":=" || _oper == "+=" || _oper == "-=" || _oper == "++" || _oper == "--" || _oper == ":="); switch (_oper) { case "=": _assignOperation = Assign; break; case ":=": _assignOperation = AssignEx; break; case "++": _assignOperation = PlusPlus; break; case "--": _assignOperation = MinusMinus; break; case "+=": _assignOperation = PlusEqual; break; case "-=": _assignOperation = MinusEqual; break; default: throw new System.InvalidOperationException(string.Format(Strings.AssignmentOperatorNotSupported, _oper)); } _minus = RuntimeHost.GetBinaryOperator(OperatorCodes.Sub); _plus = RuntimeHost.GetBinaryOperator(OperatorCodes.Add); if (_plus == null || _minus == null) { throw new ScriptRuntimeException(string.Format(Strings.MissingOperatorError, "+,-")); } }