@@ -744,8 +744,9 @@ module.exports = function convert(config) {
744
744
case SyntaxKind . SetAccessor :
745
745
case SyntaxKind . MethodDeclaration : {
746
746
747
- // TODO: double-check that these positions are correct
748
- const methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
747
+ const openingParen = nodeUtils . findNextToken ( node . name , ast ) ;
748
+
749
+ const methodLoc = ast . getLineAndCharacterOfPosition ( openingParen . getStart ( ) ) ,
749
750
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
750
751
method = {
751
752
type : AST_NODE_TYPES . FunctionExpression ,
@@ -758,7 +759,7 @@ module.exports = function convert(config) {
758
759
loc : {
759
760
start : {
760
761
line : methodLoc . line + 1 ,
761
- column : methodLoc . character - 1
762
+ column : methodLoc . character
762
763
} ,
763
764
end : result . loc . end
764
765
}
@@ -865,7 +866,8 @@ module.exports = function convert(config) {
865
866
}
866
867
} ;
867
868
868
- const constructorIdentifierLoc = ast . getLineAndCharacterOfPosition ( firstConstructorToken . getStart ( ) ) ,
869
+ const constructorIdentifierLocStart = ast . getLineAndCharacterOfPosition ( firstConstructorToken . getStart ( ) ) ,
870
+ constructorIdentifierLocEnd = ast . getLineAndCharacterOfPosition ( firstConstructorToken . getEnd ( ) ) ,
869
871
constructorIsComputed = ! ! node . name && nodeUtils . isComputedProperty ( node . name ) ;
870
872
871
873
let constructorKey ;
@@ -878,12 +880,12 @@ module.exports = function convert(config) {
878
880
range : [ firstConstructorToken . getStart ( ) , firstConstructorToken . end ] ,
879
881
loc : {
880
882
start : {
881
- line : constructorIdentifierLoc . line + 1 ,
882
- column : constructorIdentifierLoc . character
883
+ line : constructorIdentifierLocStart . line + 1 ,
884
+ column : constructorIdentifierLocStart . character
883
885
} ,
884
886
end : {
885
- line : constructor . loc . start . line ,
886
- column : constructor . loc . start . column
887
+ line : constructorIdentifierLocEnd . line + 1 ,
888
+ column : constructorIdentifierLocEnd . character
887
889
}
888
890
}
889
891
} ;
@@ -894,12 +896,12 @@ module.exports = function convert(config) {
894
896
range : [ firstConstructorToken . getStart ( ) , firstConstructorToken . end ] ,
895
897
loc : {
896
898
start : {
897
- line : constructorIdentifierLoc . line + 1 ,
898
- column : constructorIdentifierLoc . character
899
+ line : constructorIdentifierLocStart . line + 1 ,
900
+ column : constructorIdentifierLocStart . character
899
901
} ,
900
902
end : {
901
- line : constructor . loc . start . line ,
902
- column : constructor . loc . start . column
903
+ line : constructorIdentifierLocEnd . line + 1 ,
904
+ column : constructorIdentifierLocEnd . character
903
905
}
904
906
}
905
907
} ;
0 commit comments