summaryrefslogtreecommitdiff
path: root/cli/tests/runtime_decorators.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/runtime_decorators.ts')
-rw-r--r--cli/tests/runtime_decorators.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/cli/tests/runtime_decorators.ts b/cli/tests/runtime_decorators.ts
new file mode 100644
index 000000000..5da109110
--- /dev/null
+++ b/cli/tests/runtime_decorators.ts
@@ -0,0 +1,42 @@
+// deno-lint-ignore-file
+function A() {
+ console.log("@A evaluated");
+ return function (
+ target: any,
+ propertyKey: string,
+ descriptor: PropertyDescriptor,
+ ) {
+ console.log("@A called");
+ const fn = descriptor.value;
+ descriptor.value = function () {
+ console.log("fn() called from @A");
+ fn();
+ };
+ };
+}
+
+function B() {
+ console.log("@B evaluated");
+ return function (
+ target: any,
+ propertyKey: string,
+ descriptor: PropertyDescriptor,
+ ) {
+ console.log("@B called");
+ const fn = descriptor.value;
+ descriptor.value = function () {
+ console.log("fn() called from @B");
+ fn();
+ };
+ };
+}
+
+class C {
+ @A()
+ @B()
+ static test() {
+ console.log("C.test() called");
+ }
+}
+
+C.test();