Skip to content

Commit 8dc859d

Browse files
committed
Basic conformance to TC39 decorator proposal
1 parent b7ecbac commit 8dc859d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/core/friendly_errors/param_validator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,11 @@ function validateParams(p5, fn, lifecycles) {
570570
}
571571
};
572572

573-
fn._validate = validate; // For unit tests
573+
fn._validate = validate; // TEMP: For unit tests
574574

575575
p5.decorateHelper(
576576
/^(?!_).+$/,
577-
function(target, name){
577+
function(target, { name }){
578578
return function(...args){
579579
if (!p5.disableFriendlyErrors && !p5.disableParameterValidator) {
580580
validate(name, args);

src/core/main.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,14 @@ const p5Proxy = new Proxy(p5, {
761761
}
762762
})) continue;
763763

764-
p5.prototype[member] = decoration(p5.prototype[member], member);
764+
p5.prototype[member] = decoration(p5.prototype[member], {
765+
kind: 'method',
766+
name: member,
767+
access: {},
768+
static: false,
769+
private: false,
770+
addInitializer(initializer){}
771+
});
765772
}
766773
}
767774

0 commit comments

Comments
 (0)