Ejemplo n.º 1
0
        public bool Compile(CompilationCache pCompilation)
        {
            Module = new PreTypeRewriter(pCompilation).VisitModule(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            new TypeDiscoveryVisitor(pCompilation).Visit(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            //Info gathering passes
            new PreTypeValidation(pCompilation).Visit(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            //Type inference
            new TypeInferenceVisitor(pCompilation).Visit(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            //TODO need to poly referenced methods

            //More advanced transformations that require type information
            Module = new PostTypeRewriter(pCompilation).VisitModule(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            //Validation passes
            new TypeChecker(pCompilation).Visit(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            new PostTypeValidationVisitor(pCompilation).Visit(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            new PolyRewriter(pCompilation).Visit(Module);
            if (CompilerErrors.ErrorOccurred)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
 public CompilationModule(ModuleSyntax pModule, string pNamespace)
 {
     Cache  = new CompilationCache(pNamespace);
     Module = pModule;
 }