aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-07-26 16:31:08 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-26 16:31:08 -0700
commit1a558ef7538a19545e5934dfc99edf86ec436892 (patch)
treee59975b2d2803fee123feadb09533cfc39dec10d /src
parentf3200ac0ca2f15cce329be8f9652958240367934 (diff)
downloadbun-1a558ef7538a19545e5934dfc99edf86ec436892.tar.gz
bun-1a558ef7538a19545e5934dfc99edf86ec436892.tar.zst
bun-1a558ef7538a19545e5934dfc99edf86ec436892.zip
fix decorator and declare (#3828)
* return the prop if there are decorators * test and comment
Diffstat (limited to 'src')
-rw-r--r--src/js_ast.zig1
-rw-r--r--src/js_parser.zig11
2 files changed, 11 insertions, 1 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig
index b5f47474a..358fe3197 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -840,6 +840,7 @@ pub const G = struct {
get,
set,
spread,
+ declare,
class_static_block,
pub fn jsonStringify(self: @This(), opts: anytype, o: anytype) !void {
diff --git a/src/js_parser.zig b/src/js_parser.zig
index 6390dfdba..076815e54 100644
--- a/src/js_parser.zig
+++ b/src/js_parser.zig
@@ -12062,7 +12062,14 @@ fn NewParser_(
// https://github.com/oven-sh/bun/issues/1907
if (opts.is_class and is_typescript_enabled and strings.eqlComptime(raw, "declare")) {
const scope_index = p.scopes_in_order.items.len;
- _ = try p.parseProperty(kind, opts, null);
+ if (try p.parseProperty(kind, opts, null)) |_prop| {
+ var prop = _prop;
+ if (prop.kind == .normal and prop.value == null and opts.ts_decorators.len > 0) {
+ prop.kind = .declare;
+ return prop;
+ }
+ }
+
p.discardScopesUpTo(scope_index);
return null;
}
@@ -19512,6 +19519,8 @@ fn NewParser_(
}
}
+ // TODO: prop.kind == .declare and prop.value == null
+
if (prop.ts_decorators.len > 0) {
const loc = prop.key.?.loc;
const descriptor_key = switch (prop.key.?.data) {