Exemplo n.º 1
0
 private IDisposable EnterFunction(string name)
 {
     var fn = scope = function = new AnalysisScope.Function(scope, name);
     return new Disposable(() =>
     {
         Assert.IsTrue(() => scope == function && function == fn);
         scope = function.ParentScope;
         if (scope is AnalysisScope.Function)
         {
             function = (AnalysisScope.Function)scope;
         }
         else
         {
             var s = scope.ParentScope;
             var set = false;
             while (s != null)
             {
                 if (s is AnalysisScope.Function)
                 {
                     function = (AnalysisScope.Function)s;
                     set = true;
                     break;
                 }
                 s = s.ParentScope;
             }
             if (!set)
                 throw new InvalidOperationException("Invalid scope-chain");
         }
     });
 }
Exemplo n.º 2
0
 private AstGenerator(AnalysisScope.TopLevel global)
 {
     this.global = global;
     this.engine = global.Engine;
     this.scope = this.function = new AnalysisScope.Function(global, "module", true);
 }