fix(change detectors): Fix deduping of protos in transformed dart mode.
In non-transformed mode the funcOrValue check was enough, but once transformed these all use the same function for getters, so we need to also check the name.
This commit is contained in:
parent
dcdd73065a
commit
73a939e76c
|
@ -46,7 +46,7 @@ function _selfRecord(r: ProtoRecord, contextIndex: number, selfIndex: number): P
|
||||||
function _findMatching(r: ProtoRecord, rs: List<ProtoRecord>) {
|
function _findMatching(r: ProtoRecord, rs: List<ProtoRecord>) {
|
||||||
return ListWrapper.find(rs, (rr) => rr.mode !== RecordType.DIRECTIVE_LIFECYCLE &&
|
return ListWrapper.find(rs, (rr) => rr.mode !== RecordType.DIRECTIVE_LIFECYCLE &&
|
||||||
rr.mode === r.mode && rr.funcOrValue === r.funcOrValue &&
|
rr.mode === r.mode && rr.funcOrValue === r.funcOrValue &&
|
||||||
rr.contextIndex === r.contextIndex &&
|
rr.contextIndex === r.contextIndex && rr.name === r.name &&
|
||||||
ListWrapper.equals(rr.args, r.args));
|
ListWrapper.equals(rr.args, r.args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ import {RecordType, ProtoRecord} from 'angular2/src/change_detection/proto_recor
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function r(funcOrValue, args, contextIndex, selfIndex, lastInBinding = false,
|
function r(funcOrValue, args, contextIndex, selfIndex, lastInBinding = false,
|
||||||
mode = RecordType.PROPERTY) {
|
mode = RecordType.PROPERTY, name = "name") {
|
||||||
return new ProtoRecord(mode, "name", funcOrValue, args, null, contextIndex, null, selfIndex,
|
return new ProtoRecord(mode, name, funcOrValue, args, null, contextIndex, null, selfIndex, null,
|
||||||
null, null, lastInBinding, false);
|
null, lastInBinding, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("change detection - coalesce", () => {
|
describe("change detection - coalesce", () => {
|
||||||
|
@ -60,5 +60,14 @@ export function main() {
|
||||||
|
|
||||||
expect(rs.length).toEqual(2);
|
expect(rs.length).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should not coalesce protos with different names but same value", () => {
|
||||||
|
var nullFunc = () => {};
|
||||||
|
var rs = coalesce([
|
||||||
|
r(nullFunc, [], 0, 1, false, RecordType.PROPERTY, "foo"),
|
||||||
|
r(nullFunc, [], 0, 1, false, RecordType.PROPERTY, "bar"),
|
||||||
|
]);
|
||||||
|
expect(rs.length).toEqual(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue