private FunctionDefinition(TypeNode returnType, string name, ArgListDefinition args, Statement body, TextRegion region) { this.returnType = returnType; this.name = name; this.args = args; this.body = body; returnType.Parent = args.Parent = body.Parent = this; this.region = region; }
public override Node Make(Parser parser) { TypeNode type = parser.AssertNode <TypeNode>(); IdentifierToken nameToken = parser.AssertToken <IdentifierToken>(); TextRegion region = type.Region | nameToken.Region; region = region | parser.AssertOperator(Operator.Tag.LeftPar).Region; ArgListDefinition args = parser.AssertNode <ArgListDefinition>(); region = region | args.Region; region = region | parser.AssertOperator(Operator.Tag.RightPar).Region; Statement body = parser.AssertNode <Block>(); region = region | body.Region; return(new FunctionDefinition(type, nameToken.Text, args, body, region)); }