Exemple #1
0
        private void RunAnalysisPhases(AstNode astRoot, CompilerContext context, params CodeAnalysisPhase[] phases)
        {
            CodeAnalysisArgs args = new CodeAnalysisArgs(context);
              foreach (CodeAnalysisPhase phase in phases) {
            switch (phase) {
              case CodeAnalysisPhase.AssignScopes:
            astRoot.Scope = new Scope(astRoot, null);
            break;

              case CodeAnalysisPhase.MarkTailCalls:
            if (!Grammar.FlagIsSet(LanguageFlags.TailRecursive)) continue;//foreach loop - don't run the phase
            astRoot.Flags |= AstNodeFlags.IsTail;
            break;
            }//switch
            args.Phase = phase;
            astRoot.OnCodeAnalysis(args);
              }//foreach phase
        }