private Module DoAnalyze(Modules modules, string name, Statement root)
        {
            GlobalSuite global = new GlobalSuite(root);
            module = new Module(modules, name, global, scopes);

            ModuleScope modsc;
            module.ModuleScope = modsc = new ModuleScope(module, null, global);

            PushScope(modsc);

            root.Walk(this);

            foreach (FieldAssignment fer in this.fields) {
                fer.Infer(module);
            }
            return module;
        }
        public static Module Analyze(Modules modules, CompilerSink sink, string name, string text)
        {
            CompilerContext context = new CompilerContext(name, sink);
            Parser parser = Parser.FromString(state, context, text);
            Statement Statement = parser.ParseFileInput();

            Analyzer analyzer = new Analyzer();
            return analyzer.DoAnalyze(modules, name, Statement);
        }
 public Module(Modules references, string name, GlobalSuite global, Dictionary<ScopeStatement, Scope> scopes)
 {
     this.references = references;
     this.name = name;
     this.scopes = scopes;
     this.global = global;
 }