Пример #1
0
        static ResolveResult Resolve(AstNode node, NFile file)
        {
            if (file.CSharpAstResolver == null)
            {
                file.Project.ApplyNavigator(file);
            }
            var res = node.Annotation <ResolveResult>();// NodesToResults.TryGetValue(node);

            if (res == null)
            {
                var resolver = file.CSharpAstResolver;
                res = resolver.Resolve(node);
            }
            return(res);
        }
Пример #2
0
 public void ApplyNavigator(NFile file)
 {
     if (file.CSharpAstResolver != null)
     {
         return;
     }
     try
     {
         //WriteLine("ApplyNavigator(" + file.ParsedFile.FileName + ")");
         file.CSharpAstResolver = new CSharpAstResolver(file.Project.Compilation, file.SyntaxTree, file.UnresolvedFile);
         file.CSharpAstResolver.ApplyNavigator(CreateNavigator(file.CSharpAstResolver));
     }
     catch (Exception e)
     {
         //file.Project.Compiler.Log.Debug(e.ToString());
         throw new CompilerException(file.Filename, 1, 1, "Error while applying navigator on file: " + file.Filename + " " + e);
     }
 }
Пример #3
0
        private void ParseSkFile(NFile file)
        {
            using (var fs = File.OpenRead(file.Filename))
            {
                file.SyntaxTree = CSharpParser.Parse(fs, file.Filename);
                fs.Close();
            }

            var q = new QueryExpressionExpander().ExpandQueryExpressions(file.SyntaxTree);

            if (q != null)
            {
                file.SyntaxTree = (SyntaxTree)q.AstNode;
            }

            file.UnresolvedFile     = file.SyntaxTree.ToMappedTypeSystem();
            file.UnresolvedFile.Tag = file;
            file.SyntaxTree.AddAnnotation(file);
        }