Skip to content

Commit

Permalink
add update for array functions
Browse files Browse the repository at this point in the history
  • Loading branch information
valkjsaaa committed Nov 23, 2023
1 parent e5b8c6e commit 56d7ea9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions lib/dsl/dsl-interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ export class DslInterpreter {
}
} else {
if (isObject) {
await this.strip(parent).update();
if (!this.dry_run) {
await this.strip(parent).update();
}
fieldValue = this.strip(parent)[ast.access];
} else {
fieldValue = classDescriptor.classConstructor[ast.access];
Expand Down Expand Up @@ -711,6 +713,11 @@ export class DslInterpreter {
}

if (isArray) {
for (const element of env.value) {
if ((element as any).type == "object" && !this.dry_run) {
await (element as any).value.update();
}
}
matchedParameters["array"] = this.strip(env);
}

Expand Down Expand Up @@ -769,7 +776,7 @@ export class DslInterpreter {
}],
};
} else {
if (env.type === "object") {
if (env.type === "object" && !this.dry_run) {
await targetImplementation.update();
}
return {
Expand All @@ -793,7 +800,7 @@ export class DslInterpreter {
objectType: returnType.original_type,
};
} else {
if (env.type === "object") {
if (env.type === "object" && !this.dry_run) {
await targetImplementation.update();
}
return {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.46",
"version": "0.0.47",
"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 56d7ea9

Please sign in to comment.