public override bool Walk(Arg node) { node.Parent = _currentScope; return base.Walk(node); }
// arg: ( identifier ':' )? expression private Arg ParseArg() { Arg ret; int start = GetStart(); Expression value = ParseExpression(); if (value is NameExpression) { string name = ((NameExpression)value).Name; int end = GetEnd(); if (MaybeEat(TokenKind.Colon)) { value = ParseExpression(); ret = new Arg(name, value); ret.SetLoc(_globalParent, start, GetEnd()); return ret; } else if (MaybeEat(TokenKind.Arrow)) { var param = new Parameter(name); param.SetLoc(_globalParent, start, end); ret = new Arg(ParseLambdaBody(start, param)); ret.SetLoc(_globalParent, start, GetEnd()); return ret; } } ret = new Arg(value); ret.SetLoc(_globalParent, value.IndexSpan); return ret; }
public CallExpression(Expression target, Arg[] args) { _target = target; _args = args; }