public void Visit(WithNode node) { if (node != null) { node.Index = NextOrderIndex; if (node.WithObject != null) { node.WithObject.Accept(this); } if (node.Body != null) { // create the with-scope and recurse the block. // the block itself will push the scope onto the stack and pop it off, so we don't have to. node.Body.BlockScope = new WithScope(CurrentLexicalScope, node.Body.Context, m_settings); try { ++m_withDepth; node.Body.Accept(this); } finally { --m_withDepth; } } } }
public void Visit(WithNode node) { // invalid! ignore IsValid = false; }
public void Visit(WithNode node) { Debug.Fail("shouldn't get here"); }
public void Visit(WithNode node) { // not applicable; terminate }
public override void Visit(WithNode node) { if (node != null) { // throw a warning discouraging the use of this statement if (m_scopeStack.Peek().UseStrict) { // with-statements not allowed in strict code at all node.Context.HandleError(JSError.StrictModeNoWith, true); } else { // not strict, but still not recommended node.Context.HandleError(JSError.WithNotRecommended, false); } // hold onto the with-scope in case we need to do something with it BlockScope withScope = (node.Body == null ? null : node.Body.BlockScope); if (m_parser.Settings.StripDebugStatements && m_parser.Settings.IsModificationAllowed(TreeModifications.StripDebugStatements) && node.Body != null && node.Body.IsDebuggerStatement) { node.Body = null; } // recurse base.Visit(node); // we'd have to know what the object (obj) evaluates to before we // can figure out what to add to the scope -- not possible without actually // running the code. This could throw a whole bunch of 'undefined' errors. if (node.Body != null && node.Body.Count == 0) { node.Body = null; } // we got rid of the block -- tidy up the no-longer-needed scope if (node.Body == null && withScope != null) { // because the scope is empty, we now know it (it does nothing) withScope.IsKnownAtCompileTime = true; } } }