angular-cn/packages/compiler/test/render3
Keen Yee Liau 208ef7bd62 refactor(compiler): Remove NullAstVisitor and visitAstChildren (#35619)
This commit removes the `NullAstVisitor` and `visitAstChildren` exported
from `packages/compiler/src/expression_parser/ast.ts` because they
contain duplicate and buggy implementation, and their use cases could be
sufficiently covered by `RecursiveAstVisitor` if the latter implements the
`visit` method. This use case is only needed in the language service.

With this change, any visitor that extends `RecursiveAstVisitor` could
just define their own `visit` function and the parent class will behave
correctly.

A bit of historical context:
In language service, we need a way to tranverse the expression AST in a
selective manner based on where the user's cursor is. This means we need a
"filtering" function to decide which node to visit and which node to not
visit. Instead of refactoring `RecursiveAstVisitor` to support this,
`visitAstChildren` was created. `visitAstChildren` duplicates the
implementation of `RecursiveAstVisitor`, but introduced some bugs along
the way. For example, in `visitKeyedWrite`, it visits
```
obj -> key -> obj
```
instead of
```
obj -> key -> value
```

Moreover, because of the following line
```
visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context);
```
`visitAstChildren` visits every node *twice*.

PR Close #35619
2020-02-28 07:13:17 -08:00
..
util refactor(compiler): Remove NullAstVisitor and visitAstChildren (#35619) 2020-02-28 07:13:17 -08:00
view fix(ivy): correctly associate output bound events with directives (#31938) 2019-12-17 14:39:33 -08:00
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
README.md feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
r3_ast_absolute_span_spec.ts fix(ivy): record correct absolute source span for ngForOf expressions (#31813) 2019-12-16 08:11:48 -08:00
r3_ast_spans_spec.ts test(compiler): add correct use case of ngFor in r3 ast (#35671) 2020-02-25 13:09:08 -08:00
r3_template_transform_spec.ts test(compiler): add correct use case of ngFor in r3 ast (#35671) 2020-02-25 13:09:08 -08:00
style_parser_spec.ts refactor(ivy): Switch styling to new reconcile algorithm (#34616) 2020-01-24 12:23:00 -08:00

README.md

Tests in this directory are excluded from running in the browser and only run in node.