aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser.zig
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-04-17 15:26:18 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-17 15:26:18 -0700
commit1ce60275d083665ce0988969c2e97c5fae8daa95 (patch)
treeecd1887548bb59d0da39e58ba5dc9c7bd325a024 /src/js_parser.zig
parent93a43c8fc1864e8460839fc952763a31115fae20 (diff)
downloadbun-1ce60275d083665ce0988969c2e97c5fae8daa95.tar.gz
bun-1ce60275d083665ce0988969c2e97c5fae8daa95.tar.zst
bun-1ce60275d083665ce0988969c2e97c5fae8daa95.zip
fix typescript decorators with index and number keys (#2677)
* handle index property key case * non-method number property * tests for property keys
Diffstat (limited to 'src/js_parser.zig')
-rw-r--r--src/js_parser.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig
index afa91a48a..f596c2dcd 100644
--- a/src/js_parser.zig
+++ b/src/js_parser.zig
@@ -19001,7 +19001,8 @@ fn NewParser_(
.e_identifier => |k| p.newExpr(E.Identifier{ .ref = k.ref }, loc),
.e_number => |k| p.newExpr(E.Number{ .value = k.value }, loc),
.e_string => |k| p.newExpr(E.String{ .data = k.data }, loc),
- else => undefined,
+ .e_index => |k| p.newExpr(E.Index{ .target = k.target, .index = k.index }, loc),
+ else => unreachable,
};
const descriptor_kind: f64 = if (!prop.flags.contains(.is_method)) 2 else 1;
@@ -19042,7 +19043,7 @@ fn NewParser_(
target = p.newExpr(E.This{}, prop.key.?.loc);
}
- if (prop.flags.contains(.is_computed)) {
+ if (prop.flags.contains(.is_computed) or prop.key.?.data == .e_number) {
target = p.newExpr(E.Index{
.target = target,
.index = prop.key.?,