mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(compiler): produce binary expressions instead of dedicated write ones (#61682)
Currently our expression parser produces two different expressions for writes: `PropertyWrite` (e.g. `foo.bar = 123`) or `KeyedWrite` (e.g. `foo[0] = 123`). This is inconsistent with other ASTs, like TypeScript's, where writes are represented as binary expressions with a `=` operator and it makes it difficult to implement more write operators like `??=`, because we'd essentially have to duplicate them. These changes switch the expression parser over to produce binary expressions instead. PR Close #61682
This commit is contained in:
committed by
kirjs
parent
c663277df6
commit
08ee693995
@@ -532,13 +532,13 @@ describe('parser', () => {
|
||||
it('should record property write span', () => {
|
||||
const ast = parseAction('a = b');
|
||||
expect(unparseWithSpan(ast)).toContain(['a = b', 'a = b']);
|
||||
expect(unparseWithSpan(ast)).toContain(['a = b', '[nameSpan] a']);
|
||||
expect(unparseWithSpan(ast)).toContain(['a', '[nameSpan] a']);
|
||||
});
|
||||
|
||||
it('should record accessed property write span', () => {
|
||||
const ast = parseAction('a.b = c');
|
||||
expect(unparseWithSpan(ast)).toContain(['a.b = c', 'a.b = c']);
|
||||
expect(unparseWithSpan(ast)).toContain(['a.b = c', '[nameSpan] b']);
|
||||
expect(unparseWithSpan(ast)).toContain(['a.b', '[nameSpan] b']);
|
||||
});
|
||||
|
||||
it('should record spans for untagged template literals with no interpolations', () => {
|
||||
|
||||
Reference in New Issue
Block a user