diff --git a/src/generators/nodes/Binding.ts b/src/generators/nodes/Binding.ts index 6b1b74bd93..4aca1807e0 100644 --- a/src/generators/nodes/Binding.ts +++ b/src/generators/nodes/Binding.ts @@ -92,7 +92,7 @@ export default class Binding extends Node { // special cases if (this.name === 'group') { - const bindingGroup = getBindingGroup(this.compiler, this.value); + const bindingGroup = getBindingGroup(this.compiler, this.value.node); block.builders.hydrate.addLine( `#component._bindingGroups[${bindingGroup}].push(${node.var});` @@ -267,7 +267,7 @@ function getValueFromDom( // if (binding.name === 'group') { - const bindingGroup = getBindingGroup(compiler, binding.value); + const bindingGroup = getBindingGroup(compiler, binding.value.node); if (type === 'checkbox') { return `@getBindingGroupValue(#component._bindingGroups[${bindingGroup}])`; } diff --git a/src/generators/nodes/shared/Expression.ts b/src/generators/nodes/shared/Expression.ts index 010ae3c446..a75ba23940 100644 --- a/src/generators/nodes/shared/Expression.ts +++ b/src/generators/nodes/shared/Expression.ts @@ -15,7 +15,13 @@ export default class Expression { indexes: Set; constructor(compiler, parent, scope, info) { - this.compiler = compiler; + // TODO revert to direct property access in prod? + Object.defineProperties(this, { + compiler: { + value: compiler + } + }); + this.node = info; this.snippet = `[✂${info.start}-${info.end}✂]`; diff --git a/src/generators/nodes/shared/Node.ts b/src/generators/nodes/shared/Node.ts index e0afb53409..b66220372d 100644 --- a/src/generators/nodes/shared/Node.ts +++ b/src/generators/nodes/shared/Node.ts @@ -17,11 +17,20 @@ export default class Node { var: string; constructor(compiler: Generator, parent, scope, info: any) { - this.compiler = compiler; - this.parent = parent; this.start = info.start; this.end = info.end; this.type = info.type; + + // this makes properties non-enumerable, which makes logging + // bearable. might have a performance cost. TODO remove in prod? + Object.defineProperties(this, { + compiler: { + value: compiler + }, + parent: { + value: parent + } + }); } cannotUseInnerHTML() { diff --git a/src/utils/flattenReference.ts b/src/utils/flattenReference.ts index a2303bca34..7e000875db 100644 --- a/src/utils/flattenReference.ts +++ b/src/utils/flattenReference.ts @@ -1,6 +1,7 @@ import { Node } from '../interfaces'; export default function flattenReference(node: Node) { + if (node.type === 'Expression') throw new Error('bad'); const parts = []; const propEnd = node.end;