public void Visit(IridioSyntax boundScript) { boundScript.Procedures.ForEach(function => { function.Accept(this); }); }
public Either <Errors, Script> Bind(IridioSyntax syntax) { procedures.Clear(); initializedVariables.Clear(); errors.Clear(); var procs = syntax.Procedures.Select(Bind); var boundProcedures = procs.ToList(); var main = boundProcedures.FirstOrNone(b => b.Name == "Main"); main.MatchNone(() => errors.Add(new Error(ErrorKind.UndefinedMainFunction, "Main procedure is undefined"))); if (errors.Any()) { return(Either.Error <Errors, Script>(new Errors(errors))); } var script = new Script(boundProcedures, main.ValueOrFailure()); return(Either.Success <Errors, Script>(script)); }