File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1910,6 +1910,7 @@ func (tx *CommonJSModuleTransformer) visitExpressionIdentifier(node *ast.Identif
1910
1910
ast .NodeFlagsNone ,
1911
1911
)
1912
1912
tx .emitContext .AssignCommentAndSourceMapRanges (reference , node )
1913
+ reference .Loc = node .Loc
1913
1914
return reference
1914
1915
}
1915
1916
@@ -1923,6 +1924,7 @@ func (tx *CommonJSModuleTransformer) visitExpressionIdentifier(node *ast.Identif
1923
1924
ast .NodeFlagsNone ,
1924
1925
)
1925
1926
tx .emitContext .AssignCommentAndSourceMapRanges (reference , node )
1927
+ reference .Loc = node .Loc
1926
1928
return reference
1927
1929
}
1928
1930
if ast .IsImportSpecifier (importDeclaration ) {
@@ -1946,6 +1948,7 @@ func (tx *CommonJSModuleTransformer) visitExpressionIdentifier(node *ast.Identif
1946
1948
)
1947
1949
}
1948
1950
tx .emitContext .AssignCommentAndSourceMapRanges (reference , node )
1951
+ reference .Loc = node .Loc
1949
1952
return reference
1950
1953
}
1951
1954
}
Original file line number Diff line number Diff line change @@ -947,6 +947,17 @@ var E;
947
947
})(E || (exports.E = E = {}));
948
948
E.A;` ,
949
949
},
950
+ {
951
+ title : "Identifier#4 (preserve location)" ,
952
+ input : `import { a } from "other";
953
+ x ||
954
+ a` ,
955
+ output : `"use strict";
956
+ Object.defineProperty(exports, "__esModule", { value: true });
957
+ const other_1 = require("other");
958
+ x ||
959
+ other_1.a;` ,
960
+ },
950
961
951
962
{
952
963
title : "Other" ,
You can’t perform that action at this time.
0 commit comments