This is necessary because in certain circumstances the resolver needs
to consult the local elements. For example, when analyzing the type
behavior of a `return` statement, it examines the enclosing function's
element to see if it is asynchronous.
Change-Id: Id5b5922c9f000e62d3b6f3fa0a9cecf1b3a1b0c4
Reviewed-on: https://dart-review.googlesource.com/74491
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
There are some test failures introduced by this change. I believe
they are due to pre-existing bugs, so I'll address them in a follow-up
CL.
Change-Id: I4e00083e53f92d5c8ac53a7a597b89496402aec4
Reviewed-on: https://dart-review.googlesource.com/74487
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
There is no distinction between them from the langauge of view anymore.
This is a preparatory step before reporting super-invoked abstract
class members as errors, which we should do according to the issue.
Which, in turn, is for consistency between repoting corresponding
error for super-invoked, but not concrete members in mixin applications.
R=brianwilkerson@google.com
Bug: https://github.com/dart-lang/sdk/issues/33662
Change-Id: I00e8f185dbbdd1ffac88c500394a1e1497be6f9a
Reviewed-on: https://dart-review.googlesource.com/74481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This will be needed for summary logic, since summaries use a common
data structure to implement classes and mixins. It seems like it
should also be useful to clients. Note that it's a
backwards-compatible change in terms of the anaylzer API.
Change-Id: Id8e376f36a187578bd924bcf759c7384e5e96ce1
Reviewed-on: https://dart-review.googlesource.com/74326
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
With this change, analyzer error codes can be generated from messages.yaml
and those error codes easily translated from the corresponding fasta error.
Each fasta error code in messages.yaml that has an "index:" field
(see prior CL https://dart-review.googlesource.com/c/sdk/+/74040)
now has an Analyzer error code automatically generated
with the information in messages.yaml. In addition
a list of all indexed errors is generated so that a fasta error
code can be quickly translated into an Analyzer error code.
Change-Id: I2d534b7349590ddd54996f564db786c6ffe259b3
Reviewed-on: https://dart-review.googlesource.com/74240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In Fasta's outline builder, parse mixin declarations as if they were
the corresponding class declaration:
mixin M<T0,...,Ti> on S0,S1,...,Sj implement I0,...,Ik {...}
is parsed as if it were:
class M<T0,...,Ti> extends S0 with S1,...,Sj implements I0,...,Ik {
...
}
This supports the syntax and should automatically provide an
implementation of the runtime semantics on the VM. Not all of the
required static checks are implemented in the front end.
Change-Id: Ice65e93446222484272f8f7db0de2d18c352f56b
Reviewed-on: https://dart-review.googlesource.com/73760
Reviewed-by: Dan Rubel <danrubel@google.com>
These types were used long ago when we sometimes generated summaries
from an element model; they haven't been used in a long time.
Change-Id: I73d5e52cc3c35ce1d5ebb68bae59c8a795ce279f
Reviewed-on: https://dart-review.googlesource.com/74013
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This replaces the begin/endMixinApplication events which were used in both
```
class A = B with M;
```
and
```
class A extends B with M { }
``
with different events for each of the above situations.
This change facilitates properly handling class declarations of the form
```
class A with M { }
```
Removed event:
* beginMixinApplication
* endMixinApplication
Added events:
* handleNamedMixinApplicationWithClause
* handleClassWithClause
* handleClassNoWithClause
Change-Id: Ifa0ecfd7ff8c408087ad78036ad35ba4a00728c6
Reviewed-on: https://dart-review.googlesource.com/73940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
The only reason to include non-const expressions in an unlinked
summary is for type inference, but for one-phase summarization, we're
going to perform type inference directly based on the source AST. So
skip non-const expressions when doing one-phase summarization.
This requires modifying several summary tests so that they no longer
expect the non-const expressions to be present in the unlinked
summary. It also causes a few tests of one-phase summarization to
start failing, since the AST-based type inference logic hasn't been
implemented yet. This is ok because one-phase summarization isn't
exposed to customers yet; it will be fixed in follow-up CLs.
Change-Id: I7455fd82b64c59362439206a05a9eb3691c8e397
Reviewed-on: https://dart-review.googlesource.com/73688
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This removes the code the generates an error when a `with` clause
is used without an `extends` clause as in
```
class C with M { }
```
This is the first of several CLs to update the parser
as this CL only prevents the error from being generated.
Change-Id: I1d5c8577902e253a4c83cda2f6a1d4ab98319903
Reviewed-on: https://dart-review.googlesource.com/73687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Replace most methods with names containing CompileTimeError with corresponding
Problem methods.
Also make Severity.error the default severity.
Change-Id: I4f47bf71dec02347407f2ce4ccfdb04730daf51b
Reviewed-on: https://dart-review.googlesource.com/73221
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
Currently, analyzer summaries are generated in a two-step process,
translating compilation units into unlinked summaries and then linking
the unlinked summaries together to form linked summaries. In order to
support full unrestricted type inference, we'll need to build
summaries in one step, so that the full AST of initializers is
available for inference during linking.
This CL introduces a new API for one-step summarizing, along with test
cases to exercise it. For now, the one-step summary logic just
invokes the old two-step summary process. In future CLs I'll rework
it to be a true one-step summarizer so that the type inference
restrictions can be lifted.
Change-Id: Ic8d55850972f4697b5c6cc6fabe5d26dc7c1288c
Reviewed-on: https://dart-review.googlesource.com/73300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL addresses one of the issues in https://github.com/dart-lang/sdk/issues/34041
by fixing an AstBuilder crash and improving recovery of super constructor calls
in a constructor initializer list.
In addition, this adds a TestDescriptor adjustValidUnitBeforeComparison field
to support the new recovery tests.
Change-Id: I9e687aed34ea293700bd45d7c13ce36e83a00a05
Reviewed-on: https://dart-review.googlesource.com/73286
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This CL makes the following changes:
- Makes `linkerInputs` private to the strategy classes (the only thing
needed by tests is `testDartUri`).
- Changes the return type of addNamedSource to `void` (no caller was
using the return value).
- Generalizes _FilesToLink so that it can be re-used for one-phase
summary generation (where the inputs will be CompilationUnit objects
rather than UnlinkedUnitBuilder objects).
- Moves _parseText to top level so that it can be more easily reused.
Change-Id: I333b278b9a157b5013199d0c21cc4c8d3423dbe7
Reviewed-on: https://dart-review.googlesource.com/73281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>