public void Visit(JsWithNode 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 JsWithScope(CurrentLexicalScope, node.Body.Context, m_settings); try { ++m_withDepth; node.Body.Accept(this); } finally { --m_withDepth; } } } }
public void Visit(JsWithNode node) { // starts with 'with', so we don't care }
public void Visit(JsWithNode node) { // starts with 'with', so we don't care }
public void Visit(JsWithNode node) { // invalid! ignore IsValid = false; }
public void Visit(JsWithNode node) { // invalid! ignore IsValid = false; }
public void Visit(JsWithNode node) { // not applicable; terminate }
public void Visit(JsWithNode node) { // not applicable; terminate }
public void Visit(JsWithNode node) { Debug.Fail("shouldn't get here"); }
public void Visit(JsWithNode 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 JsWithScope(CurrentLexicalScope, node.Body.Context, m_settings); try { ++m_withDepth; node.Body.Accept(this); } finally { --m_withDepth; } } } }
public void Visit(JsWithNode node) { Debug.Fail("shouldn't get here"); }
public void Visit(JsWithNode node) { if (node != null) { var symbol = StartSymbol(node); Output("with"); SetContextOutputPosition(node.Context); if (m_settings.OutputMode == MinifierOutputMode.MultipleLines) { OutputPossibleLineBreak(' '); } OutputPossibleLineBreak('('); m_startOfStatement = false; if (node.WithObject != null) { node.WithObject.Accept(this); } OutputPossibleLineBreak(')'); OutputBlock(node.Body); EndSymbol(symbol); } }
public override void Visit(JsWithNode 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 JsBlockScope withScope = (node.Body == null ? null : node.Body.BlockScope); if (m_parser.Settings.StripDebugStatements && m_parser.Settings.IsModificationAllowed(JsTreeModifications.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; } } }