@@ -24,9 +24,9 @@ class NextLineWalker extends Lint.RuleWalker {
2424 const elseKeyword = getFirstChildOfKind ( node , ts . SyntaxKind . ElseKeyword ) ;
2525 if ( this . hasOption ( OPTION_ELSE ) && ! ! elseKeyword ) {
2626 const thenStatementEndLoc = sourceFile . getLineAndCharacterOfPosition ( thenStatement . getEnd ( ) ) ;
27- const elseKeywordLoc = sourceFile . getLineAndCharacterOfPosition ( elseKeyword . getStart ( ) ) ;
27+ const elseKeywordLoc = sourceFile . getLineAndCharacterOfPosition ( elseKeyword . getStart ( sourceFile ) ) ;
2828 if ( thenStatementEndLoc . line !== ( elseKeywordLoc . line - 1 ) ) {
29- const failure = this . createFailure ( elseKeyword . getStart ( ) , elseKeyword . getWidth ( ) , Rule . ELSE_FAILURE_STRING ) ;
29+ const failure = this . createFailure ( elseKeyword . getStart ( sourceFile ) , elseKeyword . getWidth ( sourceFile ) , Rule . ELSE_FAILURE_STRING ) ;
3030 this . addFailure ( failure ) ;
3131 }
3232 }
@@ -40,17 +40,15 @@ class NextLineWalker extends Lint.RuleWalker {
4040 const catchClause = node . catchClause ;
4141
4242 // "visit" try block
43- const tryKeyword = node . getChildAt ( 0 ) ;
4443 const tryBlock = node . tryBlock ;
45- const tryOpeningBrace = tryBlock . getChildAt ( 0 ) ;
4644
4745 if ( this . hasOption ( OPTION_CATCH ) && ! ! catchClause ) {
48- const tryClosingBrace = node . tryBlock . getChildAt ( node . tryBlock . getChildCount ( ) - 1 ) ;
49- const catchKeyword = catchClause . getChildAt ( 0 ) ;
46+ const tryClosingBrace = tryBlock . getLastToken ( sourceFile ) ;
47+ const catchKeyword = catchClause . getFirstToken ( sourceFile ) ;
5048 const tryClosingBraceLoc = sourceFile . getLineAndCharacterOfPosition ( tryClosingBrace . getEnd ( ) ) ;
51- const catchKeywordLoc = sourceFile . getLineAndCharacterOfPosition ( catchKeyword . getStart ( ) ) ;
49+ const catchKeywordLoc = sourceFile . getLineAndCharacterOfPosition ( catchKeyword . getStart ( sourceFile ) ) ;
5250 if ( tryClosingBraceLoc . line !== ( catchKeywordLoc . line - 1 ) ) {
53- const failure = this . createFailure ( catchKeyword . getStart ( ) , catchKeyword . getWidth ( ) , Rule . CATCH_FAILURE_STRING ) ;
51+ const failure = this . createFailure ( catchKeyword . getStart ( sourceFile ) , catchKeyword . getWidth ( sourceFile ) , Rule . CATCH_FAILURE_STRING ) ;
5452 this . addFailure ( failure ) ;
5553 }
5654 }
0 commit comments