pull/1367/head
Rich Harris 7 years ago
parent be3556ee56
commit d960827f96

@ -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(
// <input type='checkbox' bind:group='foo'>
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}])`;
}

@ -15,7 +15,13 @@ export default class Expression {
indexes: Set<string>;
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}✂]`;

@ -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() {

@ -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;

Loading…
Cancel
Save