Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
fix(Compiler): handle exception thrown by parsing an invalid micro ex…
Browse files Browse the repository at this point in the history
…pression

While the error reported in #1502 was
fixed, the fix introduced a new, unhandled exception that would be reported as a
bug in the compiler given the same inputs.

PiperOrigin-RevId: 228791959
  • Loading branch information
leonsenft authored and matanlurey committed Jan 18, 2019
1 parent d16194e commit d02cbc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 3 additions & 0 deletions angular_ast/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Errors caused by parsing an invalid micro expression (i.e. `*ngFor`) are now
reported to the registered `ExceptionHandler` rather than thrown.

## 0.5.8

* Fixed a type error that occurred when recovering from a missing closing
Expand Down
11 changes: 2 additions & 9 deletions angular_ast/lib/src/visitors/desugar_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ class DesugarVisitor implements TemplateAstVisitor<TemplateAst, void> {
astNode.bananas.clear();
}

EmbeddedTemplateAst _desugarStar(
StandaloneTemplateAst astNode,
List<StarAst> stars,
) {
TemplateAst _desugarStar(StandaloneTemplateAst astNode, List<StarAst> stars) {
var starAst = stars[0];
var origin = _toolFriendlyAstOrigin ? starAst : null;
var starExpression = starAst.value?.trim();
Expand All @@ -201,11 +198,7 @@ class DesugarVisitor implements TemplateAstVisitor<TemplateAst, void> {
);
} catch (e) {
exceptionHandler.handle(e);
if (astNode is EmbeddedTemplateAst) {
return astNode;
}
// We parsed this as something unexpected, and should not continue.
rethrow;
return astNode;
}
if (micro != null) {
propertiesToAdd.addAll(micro.properties);
Expand Down

0 comments on commit d02cbc2

Please sign in to comment.