@@ -744,8 +744,9 @@ module.exports = function convert(config) {
744744 case SyntaxKind . SetAccessor :
745745 case SyntaxKind . MethodDeclaration : {
746746
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 ( ) ) ,
749750 nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
750751 method = {
751752 type : AST_NODE_TYPES . FunctionExpression ,
@@ -758,7 +759,7 @@ module.exports = function convert(config) {
758759 loc : {
759760 start : {
760761 line : methodLoc . line + 1 ,
761- column : methodLoc . character - 1
762+ column : methodLoc . character
762763 } ,
763764 end : result . loc . end
764765 }
@@ -865,7 +866,8 @@ module.exports = function convert(config) {
865866 }
866867 } ;
867868
868- const constructorIdentifierLoc = ast . getLineAndCharacterOfPosition ( firstConstructorToken . getStart ( ) ) ,
869+ const constructorIdentifierLocStart = ast . getLineAndCharacterOfPosition ( firstConstructorToken . getStart ( ) ) ,
870+ constructorIdentifierLocEnd = ast . getLineAndCharacterOfPosition ( firstConstructorToken . getEnd ( ) ) ,
869871 constructorIsComputed = ! ! node . name && nodeUtils . isComputedProperty ( node . name ) ;
870872
871873 let constructorKey ;
@@ -878,12 +880,12 @@ module.exports = function convert(config) {
878880 range : [ firstConstructorToken . getStart ( ) , firstConstructorToken . end ] ,
879881 loc : {
880882 start : {
881- line : constructorIdentifierLoc . line + 1 ,
882- column : constructorIdentifierLoc . character
883+ line : constructorIdentifierLocStart . line + 1 ,
884+ column : constructorIdentifierLocStart . character
883885 } ,
884886 end : {
885- line : constructor . loc . start . line ,
886- column : constructor . loc . start . column
887+ line : constructorIdentifierLocEnd . line + 1 ,
888+ column : constructorIdentifierLocEnd . character
887889 }
888890 }
889891 } ;
@@ -894,12 +896,12 @@ module.exports = function convert(config) {
894896 range : [ firstConstructorToken . getStart ( ) , firstConstructorToken . end ] ,
895897 loc : {
896898 start : {
897- line : constructorIdentifierLoc . line + 1 ,
898- column : constructorIdentifierLoc . character
899+ line : constructorIdentifierLocStart . line + 1 ,
900+ column : constructorIdentifierLocStart . character
899901 } ,
900902 end : {
901- line : constructor . loc . start . line ,
902- column : constructor . loc . start . column
903+ line : constructorIdentifierLocEnd . line + 1 ,
904+ column : constructorIdentifierLocEnd . character
903905 }
904906 }
905907 } ;
0 commit comments