The AST refactor for "UI as code" left behind a few things whose names
ended in "2". This CL deprecates those things and creates
replacements that don't end in "2", so that we keep the API clean. In
a future breaking change release of the analyzer we'll remove the
deprecated things.
The following methods and classes are added:
- ForStatement and ForStatementImpl
- ListLiteral.elements
- SetOrMapLiteral.elements
- AstVisitor.visitForStatement
- AstFactory.forStatement
- NodeLintRegistry.addForStatement
The following methods and classes are deprecated:
- ForStatement2 and ForStatement2Impl
- ListLiteral.elements2
- SetOrMapLiteral.elements2
- AstVisitor.visitForStatement2
- AstFactory.forStatement2
- NodeLintRegistry.addForStatement2
In a similar way to how we did the previous stage of AST migration,
the existing visitors have been modified so that the default
implementation of visitForStatement2 redirects to visitForStatement;
this allows clients to change their overrides of visitForStatement2 to
override visitForStatement instead. Once all clients have been
migrated we will be able to delete the visitForStatement2 method.
Change-Id: Ife5949071fe4cb50791cd4f2f4b99a1bfaad54c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97360
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This constitutes a breaking change, so the analyzer major version
number is bumped to 36. Clients that have stopped using the removed
data structures (and the methods associated with them) should be
unaffected.
Change-Id: Iab68ecf8d10a13013ebb6b1198c54755225d0eb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95704
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The following AST node types will be deprecated soon:
- ForEachStatement (use ForStatement2 instead)
- ForStatement (use ForStatement2 instead)
- MapLiteral (use SetOrMapLiteral instead)
- SetLiteral (use SetOrMapLiteral instead)
To allow clients to stop implementing visit methods that accept these
AST node types, we add a default implementation of each corresponding
visit method to each of the analyzer's visitor base classes; these
default implementations forwards to the new visit method.
This frees clients to begin migrating their visitors to the new AST
node types.
Future CLs will deprecate, and later remove, the old AST node types.
Change-Id: I8d86b64ef0b131012f0a9959aa8940e0d8561485
Reviewed-on: https://dart-review.googlesource.com/c/94301
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Adds a `TimedAstVisitor` that wraps and times base visitors. The perf hit for collecting timing was neglible so I opted to NOT surface a way to not collect the data. We can add that if needed.
Once this is published in a new analyzer, I can bake client support into (for example) the linter.
More context and a client mock here: https://github.com/dart-lang/sdk/issues/24548
BUG=
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1807723002 .