예제 #1
0
        protected internal virtual GeneratorResults GenerateCodeCore(ITextDocument input, string className, string rootNamespace, string sourceFileName, CancellationToken?cancelToken)
        {
            className     = (className ?? Host.DefaultClassName) ?? DefaultClassName;
            rootNamespace = (rootNamespace ?? Host.DefaultNamespace) ?? DefaultNamespace;

            // Run the parser
            RazorParser parser = CreateParser();

            Debug.Assert(parser != null);
            ParserResults results = parser.Parse(input);

            // Generate code
            RazorCodeGenerator generator = CreateCodeGenerator(className, rootNamespace, sourceFileName);

            generator.DesignTimeMode = Host.DesignTimeMode;
            generator.Visit(results);

            var builder       = CreateCodeBuilder(generator.Context);
            var builderResult = builder.Build();

            // Collect results and return
            return(new GeneratorResults(results, builderResult));
        }
예제 #2
0
 public GeneratorResults(ParserResults parserResults,
                         CodeBuilderResult codeBuilderResult)
     : this(parserResults.Document, parserResults.ParserErrors, codeBuilderResult)
 {
 }
예제 #3
0
 public GeneratorResults(ParserResults parserResults,
                 CodeBuilderResult codeBuilderResult)
     : this(parserResults.Document, parserResults.ParserErrors, codeBuilderResult)
 {
 }
예제 #4
0
 public GeneratorResults(ParserResults parserResults,
                         CodeCompileUnit generatedCode,
                         IDictionary<int, GeneratedCodeMapping> designTimeLineMappings)
     : this(parserResults.Document, parserResults.ParserErrors, generatedCode, designTimeLineMappings)
 {
 }