Skip to content

Commit

Permalink
avoid overwriting All function
Browse files Browse the repository at this point in the history
  • Loading branch information
valkjsaaa committed Dec 2, 2023
1 parent 510935e commit d56791d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
23 changes: 12 additions & 11 deletions lib/decorators/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,17 +504,18 @@ export function GenieClass(comment: string = "") {
return allObjects;
}

target.All = All;

// append additional function descriptor to class descriptor
target.ClassDescriptor.functions.add(
new FuncDescriptor(
"All",
[],
target.ClassDescriptor.className + "[]",
true
)
);
if (!target.All) {
target.All = All;
// append additional function descriptor to class descriptor
target.ClassDescriptor.functions.add(
new FuncDescriptor(
"All",
[],
target.ClassDescriptor.className + "[]",
true
)
);
}
}

if (genieClassModifier) {
Expand Down
7 changes: 7 additions & 0 deletions lib/dsl-descriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export class GenieObject {
return
}

/**
* This function is called object's property is updated.
*/
sync(): void | Promise<void> {
return
}

// placeholder, should be replaced by GenieClass decorator
static _createObject<T extends typeof GenieObject>(
this: T,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactgenie-dsl",
"version": "0.0.55",
"version": "0.0.56",
"description": "A natural language parser based on a large language model",
"scripts": {
"prepare": "peggy lib/dsl/parser.pegjs -o lib/dsl/parser.gen.js && tsc",
Expand Down

0 comments on commit d56791d

Please sign in to comment.