// Add a specific set of methods into a new scope // Pop the scope but keep a pointer to it in a look up table private void AddBuiltinMethods(PredefScopes predefscope, Type codetype, Type deftype, PredefKinds kind) { var scope = CurrentScope.Push(); PredefScopeDict[predefscope] = new BuiltinScopeInfo { Predef = predefscope, CodeType = codetype, DefType = deftype, Scope = scope, Kind = kind, }; foreach (var binfo in CallInfo.GetBuiltinInfo(codetype)) { AddMethod(binfo.Name, binfo, predefscope); } scope.Pop(); }
// Compile top level scoped program block, scoped expression or variant merge private void CompileProg(BuiltinScopeInfo info, NodeListParser nlp) { if (info.Kind == PredefKinds.PROGM) { CompileGameOrVariant(info.Predef, nlp); } else if (info.Kind == PredefKinds.PROG) { CompileProg(info.Predef, nlp); } else if (info.Kind == PredefKinds.EXPR) { CompileExpr(info.Predef, nlp); } else { throw Error.Assert("{0}", info.Kind); } }