public override bool Walk(TryNode node) { if (node != null) { if (node.TryBlock != null) { node.TryBlock.Walk(this); } // add this catch parameter to the list of catch parameters the variable // scope will need to ghost later. if (node.CatchParameter != null) { CurrentVariableScope.GhostedCatchParameters.Add(node.CatchParameter); } if (node.CatchBlock != null) { // create the catch-scope, add the catch parameter to it, and recurse the catch block. // the block itself will push the scope onto the stack and pop it off, so we don't have to. SetScope( node.CatchBlock, new CatchScope(node.CatchBlock, CurrentLexicalScope, node.CatchParameter, _errorSink) { IsInWithScope = m_withDepth > 0 } ); GetScope(node.CatchBlock).LexicallyDeclaredNames.Add(node.CatchParameter); node.CatchBlock.Walk(this); } if (node.FinallyBlock != null) { node.FinallyBlock.Walk(this); } } return(false); }
public override bool Walk(TryNode node) { UpdateChildRanges(node); return base.Walk(node); }
public override bool Walk(TryNode node) { AddNode(node); return true; }
public override bool Walk(TryNode node) { if (node != null) { if (node.TryBlock != null) { node.TryBlock.Walk(this); } // add this catch parameter to the list of catch parameters the variable // scope will need to ghost later. if (node.CatchParameter != null) { CurrentVariableScope.GhostedCatchParameters.Add(node.CatchParameter); } if (node.CatchBlock != null) { // create the catch-scope, add the catch parameter to it, and recurse the catch block. // the block itself will push the scope onto the stack and pop it off, so we don't have to. SetScope( node.CatchBlock, new CatchScope(node.CatchBlock, CurrentLexicalScope, node.CatchParameter, _errorSink) { IsInWithScope = m_withDepth > 0 } ); GetScope(node.CatchBlock).LexicallyDeclaredNames.Add(node.CatchParameter); node.CatchBlock.Walk(this); } if (node.FinallyBlock != null) { node.FinallyBlock.Walk(this); } } return false; }
public override bool Walk(TryNode node) { if (CheckBlock(node.TryBlock) || CheckBlock(node.FinallyBlock) || CheckBlock(node.CatchBlock)) { Span = GetTargetStatement(node).GetSpan(_tree.LocationResolver); return false; } return base.Walk(node); }
public override bool Walk(TryNode node) { ReplacePreceedingIncludingNewLines( node.TryBlock.GetStartIndex( _tree.LocationResolver), GetFlowControlBraceInsertion( node.GetStartIndex(_tree.LocationResolver) + "try".Length, false, node.TryBlock.GetStartIndex(_tree.LocationResolver) ) ); WalkBlock(node.TryBlock); if (node.CatchParameter != null) { if (node.CatchStart != -1) { ReplacePreceedingWhiteSpace(node.CatchStart, " ", _closeBrace); ReplaceFollowingWhiteSpace(node.CatchStart + "catch".Length, " "); } ReplacePreceedingWhiteSpace( node.CatchParameter.GetStartIndex(_tree.LocationResolver), _options.SpaceAfterOpeningAndBeforeClosingNonEmptyParenthesis ? " " : "", _openParen ); ReplaceFollowingWhiteSpace( node.CatchParameter.GetEndIndex(_tree.LocationResolver), _options.SpaceAfterOpeningAndBeforeClosingNonEmptyParenthesis ? " " : "" ); ReplacePreceedingIncludingNewLines( node.CatchBlock.GetStartIndex(_tree.LocationResolver), GetFlowControlBraceInsertion(node.CatchParameter.GetEndIndex(_tree.LocationResolver), true, node.CatchBlock.GetStartIndex(_tree.LocationResolver)) ); WalkBlock(node.CatchBlock); } if (node.FinallyBlock != null && node.FinallyStart != -1) { if (node.FinallyStart != -1) { ReplacePreceedingWhiteSpace(node.FinallyStart, " ", _closeBrace); } ReplacePreceedingIncludingNewLines( node.FinallyBlock.GetStartIndex(_tree.LocationResolver), GetFlowControlBraceInsertion(node.FinallyStart + "finally".Length, false, node.FinallyBlock.GetStartIndex(_tree.LocationResolver)) ); WalkBlock(node.FinallyBlock); } return false; }