Skip to content

Commit

Permalink
add class method case
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Apr 12, 2024
1 parent 4ee6e1d commit 26728a2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,16 @@ impl<C: Comments> VisitMut for ServerActions<C> {
self.in_default_export_decl = old_in_default_export_decl;
}

fn visit_mut_class_method(&mut self, m: &mut ClassMethod) {
let old_in_export_decl = self.in_export_decl;
let old_in_default_export_decl = self.in_default_export_decl;
self.in_export_decl = false;
self.in_default_export_decl = false;
m.visit_mut_children_with(self);
self.in_export_decl = old_in_export_decl;
self.in_default_export_decl = old_in_default_export_decl;
}

fn visit_mut_arrow_expr(&mut self, a: &mut ArrowExpr) {
// Arrow expressions need to be visited in prepass to determine if it's
// an action function or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ export const action = {
})()
},
}.f

export const action2 = new (class X {
async f(x) {
;(() => {
console.log(x)
})()
}
})().f
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* __next_internal_action_entry_do_not_use__ {"f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"abf760c735ba66c4c26a2913864dd7e28fb88a91":"action2","f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const action = {
async f (x) {
Expand All @@ -8,8 +8,18 @@ export const action = {
})();
}
}.f;
export const action2 = new class X {
async f(x) {
;
(()=>{
console.log(x);
})();
}
}().f;
import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([
action
action,
action2
]);
registerServerReference("f14702b5a021dd117f7ec7a3c838f397c2046d3b", action);
registerServerReference("f14702b5a021dd117f7ec7a3c838f397c2046d3b", action);
registerServerReference("abf760c735ba66c4c26a2913864dd7e28fb88a91", action2);

0 comments on commit 26728a2

Please sign in to comment.