Exemple #1
0
 public Node VisitXamlSnippet(XamlSnippet snippet){
   Microsoft.XamlCompiler.Compiler xamlCompiler = new Microsoft.XamlCompiler.Compiler(snippet.XamlDocument, this.currentModule, 
     snippet.ErrorHandler, snippet.ParserFactory, snippet.Options);
   CompilationUnit cu = xamlCompiler.GetCompilationUnit();
   if (cu.Nodes != null && cu.Nodes.Length >= 1 && cu.Nodes[0] is Namespace)
     return this.VisitNamespace((Namespace)cu.Nodes[0]);
   else{
     Debug.Assert(false);
     return null;
   }
 }
Exemple #2
0
        public Node VisitXamlSnippet(XamlSnippet snippet)
        {
            Microsoft.XamlCompiler.Compiler xamlCompiler = new Microsoft.XamlCompiler.Compiler(snippet.XamlDocument, this.currentModule,
                                                                                               snippet.ErrorHandler, snippet.ParserFactory, snippet.Options);
            CompilationUnit cu = xamlCompiler.GetCompilationUnit();

            if (cu.Nodes != null && cu.Nodes.Length >= 1 && cu.Nodes[0] is Namespace)
            {
                return(this.VisitNamespace((Namespace)cu.Nodes[0]));
            }
            else
            {
                Debug.Assert(false);
                return(null);
            }
        }
Exemple #3
0
 public void ParseCompilationUnit(CompilationUnit compilationUnit){
   CompilationUnitSnippet cuSnippet = compilationUnit as CompilationUnitSnippet;
   if (cuSnippet == null || cuSnippet.Compilation == null){Debug.Assert(false); return;}
   XamlSnippet xamlSnippet = new XamlSnippet();
   xamlSnippet.CodeModule = cuSnippet.Compilation.TargetModule;
   xamlSnippet.ErrorHandler = new Microsoft.XamlCompiler.ErrorHandler(this.errorNodes);
   xamlSnippet.Options = this.options;
   xamlSnippet.ParserFactory = new ParserFactory();
   xamlSnippet.XamlDocument = cuSnippet.SourceContext.Document;
   cuSnippet.Nodes = new NodeList(xamlSnippet);
 }