public override Tree VisitStructDef(StructDefContext context) { String name = context.name.Text; Tree[] members = new Tree[context._members.Count]; for (var i = 0; i < context._members.Count; i++) { members[i] = VisitMemberDef(context._members[i]); } return(new StructDef(context.Start.Line, context.Start.Column, context.Stop.Line, context.Stop.Column, name, members)); }
public override Tree VisitDeclaration(DeclarationContext context) { FuncDeclarationContext func = context.funcDeclaration(); if (func != null) { return(VisitFuncDeclaration(func)); } StructDefContext sd = context.structDef(); if (sd != null) { return(VisitStructDef(sd)); } throw new ArgumentOutOfRangeException(); }