Ejemplo n.º 1
0
        public JNode Visit(ResolveResult res)
        {
            try
            {
                if (CompilerConfig.Current.EnableLogging)
                {
                    var node3 = res.GetFirstNode();
                    Log.WriteLine("JsCodeImporter: Visit ResolveResult: {0}, AstNode: {1}", res, ToDebug(node3));
                }
                if (BeforeConvertCsToJsResolveResult != null)
                {
                    BeforeConvertCsToJsResolveResult(res);
                }
                var node2 = res.AcceptVisitor(this);
                if (node2 is JExpression)
                {
                    node2 = ParenthesizeIfNeeded(res, (JExpression)node2);
                }

                var node = res.GetFirstNode();
                if (node != null && node2 != null)
                {
                    var ex = node2.Ex(true);
                    if (ex.AstNode == null)
                    {
                        ex.AstNode = node;
                    }
                }
                if (AfterConvertCsToJsResolveResult != null)
                {
                    AfterConvertCsToJsResolveResult(res, node2);
                }
                return(node2);
            }
            catch (CompilerException e)
            {
                if (e.AstNode == null)
                {
                    e.AstNode = res.GetFirstNode();
                }
                throw e;
            }
            catch (Exception e)
            {
                throw new CompilerException(res.GetFirstNode(), e);
            }
        }
Ejemplo n.º 2
0
 public object Visit(ResolveResult res)
 {
     return(res.AcceptVisitor(this));
 }