protected override void InitializeCore() { // Getting the AST node this.tree = ASTExtractor.Extract(this.source); var node = this.tree.GetRoot(); // Loading the semantic model if (this.assemblyPath != null) { this.LoadSemanticModel(this.assemblyPath, this.tree); } // Creating the walker // If no semantic model was loaded, null will just be passed this.walker = ProgramASTWalker.Create(node, null, this.semanticModel); (this.walker as ProgramASTWalker).Logger = this.Logger; // Translating this.output = this.walker.Walk().Translate(); }
private void Initialize() { // Getting the AST node this.tree = ASTExtractor.Extract(this.source); var node = this.tree.GetRoot(); // Loading the semantic model if (this.assemblyPath != null) { this.LoadSemanticModel(this.assemblyPath, this.tree); } // Creating the walker // If no semantic model was loaded, null will just be passed this.walker = ProgramASTWalker.Create(node, null, this.semanticModel); // Translating this.output = this.walker.Walk().Translate(); this.initialized = true; }
/// <summary> /// Copy initializes a new instance of the <see cref="ProgramASTWalker"/> class. /// </summary> /// <param name="other"></param> /// <remarks> /// For testability. /// </remarks> public ProgramASTWalker(ProgramASTWalker other) : base(other) { this.program = other.program; }
private void Initialize() { // Getting the AST node this.tree = ASTExtractor.Extract(this.source); // Loading the semantic model CSharpCompilation compilation = null; if (this.assemblyPath != null) { compilation = this.GetCompilation(this.assemblyPath, this.tree); } IASTTransformer transformer = new ScriptNamespaceBasedASTTransformer(); if (compilation != null) { transformer.Transform(ref this.tree, ref compilation); this.semanticModel = SemanticUtils.RetrieveSemanticModel(compilation, this.tree); } else { transformer.Transform(ref this.tree); } // Creating the walker // If no semantic model was loaded, null will just be passed var node = this.tree.GetRoot(); this.walker = ProgramDefinitionASTWalker.Create(node, null, this.semanticModel); // Translating this.output = this.walker.Walk().Translate(); this.initialized = true; }