@malloydata/malloy 0.0.117-dev240110202509 → 0.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tags.js +11 -5
- package/package.json +1 -1
package/dist/tags.js
CHANGED
|
@@ -293,7 +293,9 @@ function getBuildOn(ctx) {
|
|
|
293
293
|
* so that the caller can delete the tag with delete parent.tagName
|
|
294
294
|
* or assign to it with parent[tagName] = new_value
|
|
295
295
|
*/
|
|
296
|
-
function
|
|
296
|
+
function buildAccessPath(buildOn, path) {
|
|
297
|
+
var _a;
|
|
298
|
+
var _b;
|
|
297
299
|
let parentPropertyObject = buildOn.getProperties();
|
|
298
300
|
for (const p of path.slice(0, path.length - 1)) {
|
|
299
301
|
let next;
|
|
@@ -302,6 +304,10 @@ function pathToAccess(buildOn, path) {
|
|
|
302
304
|
parentPropertyObject[p] = next;
|
|
303
305
|
}
|
|
304
306
|
else {
|
|
307
|
+
// The access that we are performing requires that `.properties` be the
|
|
308
|
+
// same JS object (not equal, but identical), and `Tag.tagFrom` only copies
|
|
309
|
+
// the exact object in if it is actually present.
|
|
310
|
+
(_a = (_b = parentPropertyObject[p]).properties) !== null && _a !== void 0 ? _a : (_b.properties = {});
|
|
305
311
|
next = Tag.tagFrom(parentPropertyObject[p]);
|
|
306
312
|
}
|
|
307
313
|
parentPropertyObject = next.getProperties();
|
|
@@ -420,7 +426,7 @@ class TaglineParser extends tree_1.AbstractParseTreeVisitor {
|
|
|
420
426
|
visitTagEq(ctx) {
|
|
421
427
|
const buildOn = getBuildOn(ctx);
|
|
422
428
|
const name = this.getPropName(ctx.propName());
|
|
423
|
-
const [writeKey, writeInto] =
|
|
429
|
+
const [writeKey, writeInto] = buildAccessPath(buildOn, name);
|
|
424
430
|
const eq = this.visit(ctx.eqValue());
|
|
425
431
|
const propCx = ctx.properties();
|
|
426
432
|
if (propCx) {
|
|
@@ -443,7 +449,7 @@ class TaglineParser extends tree_1.AbstractParseTreeVisitor {
|
|
|
443
449
|
visitTagReplaceProperties(ctx) {
|
|
444
450
|
const buildOn = getBuildOn(ctx);
|
|
445
451
|
const name = this.getPropName(ctx.propName());
|
|
446
|
-
const [writeKey, writeInto] =
|
|
452
|
+
const [writeKey, writeInto] = buildAccessPath(buildOn, name);
|
|
447
453
|
const propCx = ctx.properties();
|
|
448
454
|
const props = this.visitProperties(propCx);
|
|
449
455
|
if (ctx.DOTTY() === undefined) {
|
|
@@ -459,7 +465,7 @@ class TaglineParser extends tree_1.AbstractParseTreeVisitor {
|
|
|
459
465
|
visitTagUpdateProperties(ctx) {
|
|
460
466
|
const buildOn = getBuildOn(ctx);
|
|
461
467
|
const name = this.getPropName(ctx.propName());
|
|
462
|
-
const [writeKey, writeInto] =
|
|
468
|
+
const [writeKey, writeInto] = buildAccessPath(buildOn, name);
|
|
463
469
|
const propCx = ctx.properties();
|
|
464
470
|
propCx['buildOn'] = Tag.tagFrom(writeInto[writeKey]);
|
|
465
471
|
const props = this.visitProperties(propCx);
|
|
@@ -471,7 +477,7 @@ class TaglineParser extends tree_1.AbstractParseTreeVisitor {
|
|
|
471
477
|
visitTagDef(ctx) {
|
|
472
478
|
const buildOn = getBuildOn(ctx);
|
|
473
479
|
const path = this.getPropName(ctx.propName());
|
|
474
|
-
const [writeKey, writeInto] =
|
|
480
|
+
const [writeKey, writeInto] = buildAccessPath(buildOn, path);
|
|
475
481
|
if (ctx.MINUS()) {
|
|
476
482
|
delete writeInto[writeKey];
|
|
477
483
|
}
|