示例#1
0
        private static SlothCompilation CreateCompilation(TestSource source)
        {
            var syntaxTree = source.GetSyntaxTree();

            SlothCompilation compilation = SlothCompilation.Create(syntaxTree);

            return(compilation);
        }
示例#2
0
        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);
        }
示例#3
0
        internal static NamedTypeSymbol GetSpecialType(SlothCompilation compilation, SpecialType typeId, SyntaxNode node)
        {
            NamedTypeSymbol typeSymbol = compilation.GetSpecialType(typeId);

            return(typeSymbol);
        }
示例#4
0
 /// <summary>
 /// Used to create a root binder.
 /// </summary>
 public Binder(SlothCompilation compilation)
 {
     Debug.Assert(compilation != null);
     this.Compilation = compilation;
 }