private static SlothCompilation CreateCompilation(TestSource source) { var syntaxTree = source.GetSyntaxTree(); SlothCompilation compilation = SlothCompilation.Create(syntaxTree); return(compilation); }
public void TestParsePrintStatement() { var text = @"print 3 + 4 * ""foo"";"; var tree = SyntaxTree.ParseText(text); var compilation = new SlothCompilation(tree); var model = compilation.GetSemanticModel(tree); var root = tree.GetRoot() as CompilationUnitSyntax; var printStmt = root.Statements[0] as PrintStatementSyntax; var binder = new Binder.Binder(compilation); var diagnostics = new BindingDiagnosticBag(); var boundExpression = SyntaxTreeSemanticModel.GetBoundExpressionHelper(binder, printStmt.Expression, diagnostics); Assert.AreEqual(2, diagnostics.DiagnosticBag.AsCollection().Count); }
internal static NamedTypeSymbol GetSpecialType(SlothCompilation compilation, SpecialType typeId, SyntaxNode node) { NamedTypeSymbol typeSymbol = compilation.GetSpecialType(typeId); return(typeSymbol); }
/// <summary> /// Used to create a root binder. /// </summary> public Binder(SlothCompilation compilation) { Debug.Assert(compilation != null); this.Compilation = compilation; }