apply nested `assign` usage

pull/1282/head
Luke Edwards 8 years ago
parent c753396cab
commit aa8f57d001

@ -335,7 +335,7 @@ export default function dom(
} }
customElements.define("${generator.tag}", ${name}); customElements.define("${generator.tag}", ${name});
@assign(${prototypeBase}, ${proto}, { @assign(@assign(${prototypeBase}, ${proto}), {
_mount(target, anchor) { _mount(target, anchor) {
target.insertBefore(this, anchor); target.insertBefore(this, anchor);
}, },

@ -125,7 +125,7 @@ export default class AwaitBlock extends Node {
${this.then.block.context ? deindent` ${this.then.block.context ? deindent`
var state = #component.get(); var state = #component.get();
${resolved} = { ${this.then.block.context}: ${value} }; ${resolved} = { ${this.then.block.context}: ${value} };
${replace_await_block}(${token}, ${create_then_block}, @assign({}, state, ${resolved})); ${replace_await_block}(${token}, ${create_then_block}, @assign(@assign({}, state), ${resolved}));
` : deindent` ` : deindent`
${replace_await_block}(${token}, null, null); ${replace_await_block}(${token}, null, null);
`} `}
@ -133,7 +133,7 @@ export default class AwaitBlock extends Node {
${this.catch.block.context ? deindent` ${this.catch.block.context ? deindent`
var state = #component.get(); var state = #component.get();
${resolved} = { ${this.catch.block.context}: ${error} }; ${resolved} = { ${this.catch.block.context}: ${error} };
${replace_await_block}(${token}, ${create_catch_block}, @assign({}, state, ${resolved})); ${replace_await_block}(${token}, ${create_catch_block}, @assign(@assign({}, state), ${resolved}));
` : deindent` ` : deindent`
${replace_await_block}(${token}, null, null); ${replace_await_block}(${token}, null, null);
`} `}
@ -147,7 +147,7 @@ export default class AwaitBlock extends Node {
} else { } else {
${resolved} = { ${this.then.block.context}: ${promise} }; ${resolved} = { ${this.then.block.context}: ${promise} };
if (${await_block_type} !== ${create_then_block}) { if (${await_block_type} !== ${create_then_block}) {
${replace_await_block}(${token}, ${create_then_block}, @assign({}, state, ${resolved})); ${replace_await_block}(${token}, ${create_then_block}, @assign(@assign({}, state), ${resolved}));
return true; return true;
} }
} }
@ -190,7 +190,7 @@ export default class AwaitBlock extends Node {
if (${conditions.join(' && ')}) { if (${conditions.join(' && ')}) {
// nothing // nothing
} else { } else {
${await_block}.p(changed, @assign({}, state, ${resolved})); ${await_block}.p(changed, @assign(@assign({}, state), ${resolved}));
} }
`); `);
} else { } else {

@ -267,7 +267,7 @@ export default class EachBlock extends Node {
block.builders.init.addBlock(deindent` block.builders.init.addBlock(deindent`
for (var #i = 0; #i < ${each_block_value}.${length}; #i += 1) { for (var #i = 0; #i < ${each_block_value}.${length}; #i += 1) {
var ${key} = ${each_block_value}[#i].${this.key}; var ${key} = ${each_block_value}[#i].${this.key};
${blocks}[#i] = ${lookup}[${key}] = ${create_each_block}(#component, ${key}, @assign({}, state, { ${blocks}[#i] = ${lookup}[${key}] = ${create_each_block}(#component, ${key}, @assign(@assign({}, state), {
${this.contextProps.join(',\n')} ${this.contextProps.join(',\n')}
})); }));
} }
@ -297,7 +297,7 @@ export default class EachBlock extends Node {
var ${each_block_value} = ${snippet}; var ${each_block_value} = ${snippet};
${blocks} = @updateKeyedEach(${blocks}, #component, changed, "${this.key}", ${dynamic}, ${each_block_value}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, "${mountOrIntro}", function(#i) { ${blocks} = @updateKeyedEach(${blocks}, #component, changed, "${this.key}", ${dynamic}, ${each_block_value}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, "${mountOrIntro}", function(#i) {
return @assign({}, state, { return @assign(@assign({}, state), {
${this.contextProps.join(',\n')} ${this.contextProps.join(',\n')}
}); });
}); });
@ -332,7 +332,7 @@ export default class EachBlock extends Node {
var ${iterations} = []; var ${iterations} = [];
for (var #i = 0; #i < ${each_block_value}.${length}; #i += 1) { for (var #i = 0; #i < ${each_block_value}.${length}; #i += 1) {
${iterations}[#i] = ${create_each_block}(#component, @assign({}, state, { ${iterations}[#i] = ${create_each_block}(#component, @assign(@assign({}, state), {
${this.contextProps.join(',\n')} ${this.contextProps.join(',\n')}
})); }));
} }
@ -430,7 +430,7 @@ export default class EachBlock extends Node {
if (${condition}) { if (${condition}) {
for (var #i = ${start}; #i < ${each_block_value}.${length}; #i += 1) { for (var #i = ${start}; #i < ${each_block_value}.${length}; #i += 1) {
var ${this.each_context} = @assign({}, state, { var ${this.each_context} = @assign(@assign({}, state), {
${this.contextProps.join(',\n')} ${this.contextProps.join(',\n')}
}); });

@ -163,7 +163,7 @@ export function _set(newState) {
} }
if (!dirty) return; if (!dirty) return;
this._state = assign({}, oldState, newState); this._state = assign(assign({}, oldState), newState);
this._recompute(changed, this._state); this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state); if (this._bind) this._bind(changed, this._state);

Loading…
Cancel
Save