コード例 #1
0
 public void Visit(TryNode node)
 {
     if (node != null)
     {
         DoesRequire = false;
     }
 }
コード例 #2
0
 public void Visit(TryNode node)
 {
     // starts with 'try', so we don't care
 }
コード例 #3
0
 public void Visit(TryNode node)
 {
     DebugEx.Fail("shouldn't get here");
 }
コード例 #4
0
ファイル: AnalyzeNodeVisitor.cs プロジェクト: nuxleus/ajaxmin
        public override void Visit(TryNode node)
        {
            if (node != null)
            {
                // get the field -- it should have been generated when the scope was analyzed
                if (node.CatchBlock != null && !string.IsNullOrEmpty(node.CatchVarName))
                {
                    node.SetCatchVariable(node.CatchBlock.BlockScope[node.CatchVarName]);
                }

                // anaylze the blocks
                base.Visit(node);

                // if the try block is empty, then set it to null
                if (node.TryBlock != null && node.TryBlock.Count == 0)
                {
                    node.ReplaceChild(node.TryBlock, null);
                }

                // eliminate an empty finally block UNLESS there is no catch block.
                if (node.FinallyBlock != null && node.FinallyBlock.Count == 0 && node.CatchBlock != null
                    && m_parser.Settings.IsModificationAllowed(TreeModifications.RemoveEmptyFinally))
                {
                    node.ReplaceChild(node.FinallyBlock, null);
                }

                // check strict-mode restrictions
                if (ScopeStack.Peek().UseStrict && !string.IsNullOrEmpty(node.CatchVarName))
                {
                    // catch variable cannot be named "eval" or "arguments"
                    if (string.CompareOrdinal(node.CatchVarName, "eval") == 0
                        || string.CompareOrdinal(node.CatchVarName, "arguments") == 0)
                    {
                        node.CatchVarContext.HandleError(JSError.StrictModeVariableName, true);
                    }
                }
            }
        }
コード例 #5
0
ファイル: BindingsVisitor.cs プロジェクト: zls3201/ajaxmin
 public void Visit(TryNode node)
 {
     ReportError(node);
 }
コード例 #6
0
 public void Visit(TryNode node)
 {
     // invalid! ignore
     IsValid = false;
 }