From 56d7ea91cf67a26366cfcba5256ea667ea37340e Mon Sep 17 00:00:00 2001 From: Jackie Yang Date: Wed, 22 Nov 2023 23:43:35 -0800 Subject: [PATCH] add update for array functions --- lib/dsl/dsl-interpreter.ts | 13 ++++++++++--- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/dsl/dsl-interpreter.ts b/lib/dsl/dsl-interpreter.ts index 1726bd8..d416736 100644 --- a/lib/dsl/dsl-interpreter.ts +++ b/lib/dsl/dsl-interpreter.ts @@ -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]; @@ -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); } @@ -769,7 +776,7 @@ export class DslInterpreter { }], }; } else { - if (env.type === "object") { + if (env.type === "object" && !this.dry_run) { await targetImplementation.update(); } return { @@ -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 { diff --git a/package-lock.json b/package-lock.json index a8f4e1f..8032ed1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "reactgenie-dsl", - "version": "0.0.45", + "version": "0.0.47", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "reactgenie-dsl", - "version": "0.0.45", + "version": "0.0.47", "license": "Apache-2.0", "dependencies": { "@babel/cli": "^7.23.0", diff --git a/package.json b/package.json index 2fe461a..06dbab3 100644 --- a/package.json +++ b/package.json @@ -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",