aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-09-27 23:37:53 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-27 23:37:53 -0700
commit31d96a1b7f8a72a1976bee92e6c3f08faade8c31 (patch)
tree7d90077409aa380e3debe8afc6bba8d3bc064d4f /src
parent3ee09bfe798b91a6de6076b572d0dc606246c2a9 (diff)
downloadbun-31d96a1b7f8a72a1976bee92e6c3f08faade8c31.tar.gz
bun-31d96a1b7f8a72a1976bee92e6c3f08faade8c31.tar.zst
bun-31d96a1b7f8a72a1976bee92e6c3f08faade8c31.zip
fix typescript metadata for import identifiers (#6130)
* handle import identifiers * a test * handle dot case
Diffstat (limited to 'src')
-rw-r--r--src/js_parser.zig30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig
index 13e264251..449d1cbab 100644
--- a/src/js_parser.zig
+++ b/src/js_parser.zig
@@ -19556,6 +19556,15 @@ fn NewParser_(
.m_identifier => |ref| {
p.recordUsage(ref);
+ if (p.is_import_item.contains(ref)) {
+ return p.maybeDefinedHelper(p.newExpr(
+ E.ImportIdentifier{
+ .ref = ref,
+ },
+ logger.Loc.Empty,
+ ));
+ }
+
return p.maybeDefinedHelper(p.newExpr(
E.Identifier{ .ref = ref },
logger.Loc.Empty,
@@ -19588,12 +19597,21 @@ fn NewParser_(
i -= 1;
}
- current_expr.* = p.newExpr(
- E.Identifier{
- .ref = refs.items[0],
- },
- logger.Loc.Empty,
- );
+ if (p.is_import_item.contains(refs.items[0])) {
+ current_expr.* = p.newExpr(
+ E.ImportIdentifier{
+ .ref = refs.items[0],
+ },
+ logger.Loc.Empty,
+ );
+ } else {
+ current_expr.* = p.newExpr(
+ E.Identifier{
+ .ref = refs.items[0],
+ },
+ logger.Loc.Empty,
+ );
+ }
const dot_identifier = current_expr.*;
var current_dot = dots;