Fixing issue #276 -- unsoaked cached indexes.
This commit is contained in:
parent
dc0b03e54e
commit
2e3f575f9c
|
@ -353,7 +353,7 @@
|
||||||
return this.base instanceof LiteralNode && this.base.value.match(NUMBER);
|
return this.base instanceof LiteralNode && this.base.value.match(NUMBER);
|
||||||
};
|
};
|
||||||
ValueNode.prototype.cacheIndexes = function(o) {
|
ValueNode.prototype.cacheIndexes = function(o) {
|
||||||
var _len, _ref2, _ref3, copy, i, index, indexVar, prop;
|
var _len, _ref2, _ref3, copy, first, i, index, indexVar, prop;
|
||||||
copy = new ValueNode(this.base, this.properties.slice(0));
|
copy = new ValueNode(this.base, this.properties.slice(0));
|
||||||
if (this.base.isComplex()) {
|
if (this.base.isComplex()) {
|
||||||
_ref2 = this.base.compileReference(o);
|
_ref2 = this.base.compileReference(o);
|
||||||
|
@ -367,8 +367,11 @@
|
||||||
_ref3 = prop.index.compileReference(o);
|
_ref3 = prop.index.compileReference(o);
|
||||||
index = _ref3[0];
|
index = _ref3[0];
|
||||||
indexVar = _ref3[1];
|
indexVar = _ref3[1];
|
||||||
this.properties[i] = new IndexNode(index);
|
this.properties[i] = (first = new IndexNode(index));
|
||||||
copy.properties[i] = new IndexNode(indexVar);
|
copy.properties[i] = new IndexNode(indexVar);
|
||||||
|
if (prop.soakNode) {
|
||||||
|
first.soakNode = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this, copy];
|
return [this, copy];
|
||||||
|
|
|
@ -346,9 +346,10 @@ exports.ValueNode = class ValueNode extends BaseNode
|
||||||
[@base, copy.base] = @base.compileReference o
|
[@base, copy.base] = @base.compileReference o
|
||||||
for prop, i in copy.properties
|
for prop, i in copy.properties
|
||||||
if prop instanceof IndexNode and prop.index.isComplex()
|
if prop instanceof IndexNode and prop.index.isComplex()
|
||||||
[index, indexVar] = prop.index.compileReference o
|
[index, indexVar] = prop.index.compileReference o
|
||||||
this.properties[i] = new IndexNode index
|
this.properties[i] = first = new IndexNode index
|
||||||
copy.properties[i] = new IndexNode indexVar
|
copy.properties[i] = new IndexNode indexVar
|
||||||
|
first.soakNode = yes if prop.soakNode
|
||||||
[this, copy]
|
[this, copy]
|
||||||
|
|
||||||
# Override compile to unwrap the value when possible.
|
# Override compile to unwrap the value when possible.
|
||||||
|
|
|
@ -147,3 +147,5 @@ ok (maybe_close plus1, 41)?() is 42
|
||||||
ok (maybe_close 'string', 41)?() is undefined
|
ok (maybe_close 'string', 41)?() is undefined
|
||||||
|
|
||||||
ok 2?(3) is undefined
|
ok 2?(3) is undefined
|
||||||
|
|
||||||
|
ok calendar?[Date()] is undefined
|
||||||
|
|
Loading…
Reference in New Issue