fix(change_detector): ensure that locals are only used when implicit receiver
closes #1542
This commit is contained in:
parent
5b104936ae
commit
d4925b61ff
@ -169,7 +169,9 @@ class _ConvertAstIntoProtoRecords {
|
||||
|
||||
visitAccessMember(ast:AccessMember) {
|
||||
var receiver = ast.receiver.visit(this);
|
||||
if (isPresent(this.variableBindings) && ListWrapper.contains(this.variableBindings, ast.name)) {
|
||||
if (isPresent(this.variableBindings) &&
|
||||
ListWrapper.contains(this.variableBindings, ast.name) &&
|
||||
ast.receiver instanceof ImplicitReceiver) {
|
||||
return this._addRecord(RECORD_TYPE_LOCAL, ast.name, ast.name, [], null, receiver);
|
||||
} else {
|
||||
return this._addRecord(RECORD_TYPE_PROPERTY, ast.name, ast.getter, [], null, receiver);
|
||||
|
@ -469,6 +469,18 @@ export function main() {
|
||||
expect(executeWatch('name', 'name', new Person("Jim"), locals))
|
||||
.toEqual(['name=Jim']);
|
||||
});
|
||||
|
||||
it('should correctly handle nested properties', () => {
|
||||
var address = new Address('Grenoble');
|
||||
var person = new Person('Victor', address);
|
||||
var locals = new Locals(null,
|
||||
MapWrapper.createFromPairs([['city', 'MTV']]));
|
||||
expect(executeWatch('address.city', 'address.city', person, locals))
|
||||
.toEqual(['address.city=Grenoble']);
|
||||
expect(executeWatch('city', 'city', person, locals))
|
||||
.toEqual(['city=MTV']);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("handle children", () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user