fix(ChangeDetection): chain expressions evaluate to the last expression (codegen)
fixes #4782 Closes #5892
This commit is contained in:
parent
8c37b7e8f2
commit
933a9112da
|
@ -103,7 +103,7 @@ export class CodegenLogicUtil {
|
|||
break;
|
||||
|
||||
case RecordType.Chain:
|
||||
rhs = 'null';
|
||||
rhs = `${getLocalName(protoRec.args[protoRec.args.length - 1])}`;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -438,6 +438,7 @@ var _availableEventDefinitions = [
|
|||
'(event)="a[0]=\$event"',
|
||||
// '(event)="\$event=1"',
|
||||
'(event)="a=a+1; a=a+1;"',
|
||||
'(event)="true; false"',
|
||||
'(event)="false"',
|
||||
'(event)="true"',
|
||||
'(event)="true ? a = a + 1 : a = a + 1"',
|
||||
|
|
|
@ -1358,6 +1358,10 @@ export function main() {
|
|||
val = _createChangeDetector('(event)="true"', d, null);
|
||||
res = val.changeDetector.handleEvent("event", 0, event);
|
||||
expect(res).toBe(true);
|
||||
|
||||
val = _createChangeDetector('(event)="true; false"', d, null);
|
||||
res = val.changeDetector.handleEvent("event", 0, event);
|
||||
expect(res).toBe(false);
|
||||
});
|
||||
|
||||
it('should support short-circuiting', () => {
|
||||
|
|
Loading…
Reference in New Issue