Replace index / search of `CompilationUnitElement` with special
`referencesLibraryFragment(LibraryFragment)`, because they are not
elements.
Change-Id: I4de4ce42270bdad92996bedbd06f108a7c71dffe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412681
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
For `InterfaceType` keep `element2` deprecated and define
`InterfaceElement get element2` instead. Most changes are because
of this.
Change-Id: I13b888610fc707438c3c97b676f1460e7fc2b040
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253564
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Cases where `null` was being passed as an argument to formatting a
message have all been fixed in previous CLs; all that remains to do is
change the type system to reflect that, and insert `!`s in a few
places.
This brings us one step closer to being able to make analyzer message
formatting type safe.
Change-Id: Id9e0d0b32f29cde0fdc5227417b7a2e3fc3b443d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216272
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Each of the *_Fasta test cases has a lot of test cases from the
corresponding *Mixin mixin. I started to combine _all_ of these
in parser_test.dart, but the file became too long; the formatter
was freezing IntelliJ.
So I've extracted out the non-test classes into parser_test_base.dart.
I'd like to extract each test class into its own file. For now, I
reduce half a dozen *_Fasta/*Mixin pairs into individual test classes.
Change-Id: I8dd7f28a6fe23e31f956cdb2f1d221669db376dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176064
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Fields initialized in `setUp` are late.
Variables initialized with implicit casts like:
ClassDeclaration clazz = unit.declarations[0];
would need a cast:
ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;
so they are updated to use var, which is more idiomatic:
var clazz = unit.declarations[0] as ClassDeclaration;
Change-Id: I4e4ae814a814d3a4200c5078a6904dbac0a8140c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170520
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
context: the package_root logic is not portable to how we run this test outside
the sdk in other build systems like bazel. To make it work in bazel, we
currently use const.fromEnvironment to override the location of the package
root. Due to upcoming changes to constant evaluation we can't continue using
const.fromEnvironment.
I considered 3 other options:
* using Platform.environment
* changing platform_root to be more sophisticated (e.g. look for a folder
containing `test`, instead of looking for `pkg`)
* directly defining the root at the beginning of main based on Platform.script
The latter works out of the box in bazel and is also pretty simple, so I felt it
was a good choice.
Note: there are several other tests depending on package_root that we can update
in a similar fashion. Today this is the only test that depends on package_root
that we are running internally in bazel.
Change-Id: Ie7b79a82c78605048b26b9676eac2fbd8b15aaa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98879
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
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>
Several tests need to access source files in the 'pkg' directory, and
they use various mechanisms for finding it. This CL changes
everything to use the same mechanism.
Change-Id: I146a6d72ec05a20cf07451a83eada9fb8e71a966
Reviewed-on: https://dart-review.googlesource.com/5484
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>