public void Visit(TryNode node)
 {
     if (node != null)
     {
         DoesRequire = false;
     }
 }
Example #2
0
 public void Visit(TryNode node)
 {
     // starts with 'try', so we don't care
 }
 public void Visit(TryNode node)
 {
     DebugEx.Fail("shouldn't get here");
 }
Example #4
0
        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);
                    }
                }
            }
        }
Example #5
0
 public void Visit(TryNode node)
 {
     ReportError(node);
 }
 public void Visit(TryNode node)
 {
     // invalid! ignore
     IsValid = false;
 }