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>
- ForStatement and ForEachStatement will be replaced by ForStatement2.
- MapLiteral and SetLiteral will be replaced by SetOrMapLiteral.
To ease the transition, the old classes are subtypes of the new
classes, so even though the analyzer still creates instances of the
old classes, clients should be able to start referring to the new
classes in their code. The analyzer will stop creating instances of
MapLiteral and SetLiteral when the experimental flags for the "UI as
code" feature are turned on, and will stop creating instances of all 4
classes when we bump the major version number (which should happen
sometime in March).
For visitors, we've updated the base classes with the following default methods:
visitForStatement(node) => visitForStatement2(node);
visitForEachStatement(node) => visitForStatement2(node);
visitMapLiteral(node) => visitSetOrMapLiteral(node);
visitSetLiteral(node) => visitSetOrMapLiteral(node);
So clients should be able to start revising their visitors to override
the new visit methods rather than the old ones, and the visit methods
in the base classes will automatically forward to the new visit
methods.
Change-Id: Ifde3a2aa3c8c49ce4e65dfaabf086db4dabb73f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
We used to set the code range of the whole FieldDeclaration for each
individual VariableDeclaration even when there are multiple of them.
Now the first VariableDeclaration will use code range that starts at
the beginning of the FieldDeclaration, and ends at the end of its
initializer. The subsequent variables (if any) will start of the
start of their names. So, each variable will get unique code range.
R=brianwilkerson@google.com
Change-Id: I0a93bdad2a17454fd5b343b395c72440c86b421d
Reviewed-on: https://dart-review.googlesource.com/70981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Some pain points are:
1. It is a breaking change. I think I will break it even more by removing
FunctionTypeAliasElement altogether.
2. We lose ability to keep track that this FunctionType is instantiation
of a typedef. Just like in Kernel.
3. We sometimes have to look up to see if the GenericFunctionTypeElement
is a function in a named GenericTypeAliasElement.
R=brianwilkerson@google.com, paulberry@google.com
Bug:
Change-Id: Ib250cc446a0ed5b8969f16f7cc6293ef4acf01a8
Reviewed-on: https://dart-review.googlesource.com/9421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is the same as 1d028eed8d (which
was reverted) except that it doesn't remove the old AST factory
constructors (which broke dev_compiler). The removal of old AST
factory constructors will be done in a follow-up CL so that if it
unexpectedly breaks any other clients we will be able to revert it
without reverting this CL.
R=scheglov@google.com
Review URL: https://codereview.chromium.org/2536373008 .
There are following changes:
1. DEPS to pull in test_reflective_loader 0.0.4
2. Rename runReflectiveTests() to defineReflectiveTests().
3. Remove analyzer's pkg/analyzer/test/reflective_tests.dart
4. Replace reflective_tests.dart imports with package:test_reflective_loader/test_reflective_loader.dart imports.
5. Sort/format and organize imports in the files with imports changes.
6. Fix for a couple of bugs in analysis_server exposed by the new loader.
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/2298913003 .