Sanity checks now run in a single pass rather than two, and
instead of building a set consisting of all members, it uses
a bit from the transformer flags to remember which members are
not orphaned.
As an additional check, it now checks that members are not
declared more than once.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2529973002 .
This was originally done to be consistent with FunctionType,
where the named parameters are sorted, but for FunctionNode
it is not necessary.
It causes issues for natives that expect parameters to be
declared in a certain order. It is also an issue if we
ever want to reuse the kernel format for summaries, where
it is also preferable to present the named parameters in
their original order.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2527933002 .
This file is not strong-mode clean, but since a more recent version
of closure conversion still exists in a branch on the kernel github
repo, there is not much point in fixing this version of it.
BUG=
R=ahe@google.com
Review URL: https://codereview.chromium.org/2526793002 .
FunctionType now has a List<NamedType> which must be sorted by name.
Previously, named parameters were stored in a Map<String, DartType>.
FunctionNode still has a List<VariableDeclaration>, but this list must
now be sorted by name.
BUG=
R=ahe@google.com
Review URL: https://codereview.chromium.org/2502343002 .
Since offsets and uris was added to the dill file, compiling to dill
without linking hasn't worked because of external libraries.
The external libraries doesn't add to the line starts table and thus
the uris from libraries, classes and so on isn't recorded.
When trying to write an unrecorded uri to the dill file it fails.
The simple solution applied here is to fall-back to the empty
string when the uri hasn't been recorded.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org/2483243002 .
If the body of a let expression contains an await, the translation could
hoist statements that contain references to the let-bound variable out
of its scope.
Instead split by cases on whether the body contains an await. If so, we
hoist let-bound variables to the statement level. If not, we produce a
let expression.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org/2480743002 .
The translation for async and async* functions translates returns into
two statements, where the second one is a return. The VM's compilation
strategy is to inline the code for all finally blocks immediately before
a return statement.
This causes future completion/stream cancellation to occur before
finally blocks, instead of after as intended.
The solution here is to translate returns into a break from a labeled
block and put a single async/async* return sequence, outside any finally
blocks, after the labeled block.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org/2476513003 .
The VM target's continuation transformer uses a class that was originally
named _StreamIteratorImpl and then renamed to _StreamIterator. If looking
up the old name fails, try the new name.
BUG=
R=jensj@google.com
Review URL: https://codereview.chromium.org/2465163004 .
Previously, the type of a conditional expression could be omitted if
one of the arms was just a null literal. This was meant to simplify
translation into kernel, but wasn't really worth it in terms of
complexity, and it does not work well for types that carry nullability
information.
BUG=
R=ahe@google.com
Review URL: https://codereview.chromium.org/2465263002 .
This is a piece of the upcoming strong mode-based type propagation.
The new type propagator will build its inference graph based on the
subtyping constraints found during type checking.
This type checker is not intended to report type errors to end-users.
In its current form, it is quite redundant with the front end's type
checker, but this will not be the case once we augment kernel's type
system.
The internals of "dart:" libraries are not type checked -- they are
simply assumed to satisfy the type annotations on their interfaces.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2465893002 .
BlockExpression allowed statements to appear in an expression context.
It is unsafe for its original use case, allowing 'yield' to appear as an
expression, because the VM's yield implementation does not work when
there are live expression intermediate values.
Eliminate it by changing the async ExpressionLifter to return a
transformed expression and emit statements into a given list as a side
effect. This requires implementing the transformation for all
statements to account for how they may contain a nested expression.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org/2460373002 .
TreeNode.location is a getter for use in diagnostics and debugging.
It uses parent pointers to find the enclosing file URI and line ending
table of the node. If the node has no offset stored, it will use that
of the first enclosing parent that has an offset.
BUG=
R=ahe@google.com, jensj@google.com
Review URL: https://codereview.chromium.org/2448873004 .
Type annotations in the supertype clauses of a class are now Supertypes
instead of InterfaceTypes. In the current version, the two classes
contain the same information, but they are about to diverge in the
following ways:
- An InterfaceType may be nullable, whereas a supertype cannot.
- An InterfaceType may represent the exact class, a subclass, or
a subtype of the given class.
- The type arguments to an interface type represent bounds, whereas
the arguments to a supertype are always exact.
We also introduce a class Substitution that represents an operator
that replaces type parameters with types, depending on the variance
of their use site.
A substitution can be applied to a DartType or a Supertype, and can
be generated independently of how it will be applied.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/2439043002 .
That is, if a field has no declaration-site initializer and at least
one constructor in the class does not initialize it, then we add an
explicit null initializer for it.
BUG=
R=ahe@google.com
Review URL: https://chromereviews.googleplex.com/527827014 .
When visiting a generic function type in contravariant context, the
current variance bit would not be propagated to the inner visitor.
For example,
(<F>(T,F) => F) => int [bottom <: T <: String]
would erroneously map to:
(<F>(bottom,F) => F) => int
instead of:
(<F>(String,F) => F) => int
Generic function types cannot occur in contravariant position
using current Dart syntax, but it could possibly occur as an
intermediate type.
BUG=
R=ahe@google.com
Review URL: https://chromereviews.googleplex.com/521207013 .
When a class inherits two abstract members with the same name from
different supertypes, both members are now present the list returned
by ClassHierarchy.getInterfaceMembers. Previously, only one of the
member would be present.
This ensures that all override pairs can be detected, which in turn
is necessary for inserting covariance checks in strong mode.
Another change in this CL is that interface members are built
eagerly instead of on-demand. This makes the ClassHierarchy more
reliable when used for transformation, and easier to benchmark.
BUG=
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/520907013 .
Previously, we would generate a stub for a redirecting factory, but
the default parameter values were not correctly forwarded.
This could have been fixed by copying the default parameter values into
the stub, but this conflicts with modular compilation, since the
element model does not expose default parameter values, and we should
not rely on the AST of libraries not part of the current build unit.
Apart from fixing this bug, this is also more aligned with how all the
backends actually work.
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/513577013 .
Strong mode allows constant expressions to reference type parameters.
This requires constants to be canonicalized at runtime, but it is not
yet determined exactly how this feature will work in future versions
of the language.
For now, we work around it by replacing such types with 'dynamic'.
BUG=
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/516477013 .
Block expressions are expressions and so can be arbitrarily nested.
They can contain statements, including yield statements. The VM's
implementation of yield assumes that it can only occur when there are no
live intermediate values. It is not generally safe to allow
yield-containing block expressions to appear as arbitrary
subexpressions.
As a first step toward eliminating block expressions, this change
flattens the ones produced by the async transformation so that they can
only occur as the children of statements.
BUG=
R=asgerf@google.com
Review URL: https://chromereviews.googleplex.com/517457014 .
A mixin application C<T1 ... Tm> with D<T1 ... Tn> is canonicalized if
the Ts are distinct, unbound type variables. In all other cases, a new
class is created per mixin application.
Previously, all mixin applications were canonicalized in an overly
general way, causing type checking issues, and excessive duplication of
type parameters.
BUG=
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/511567015 .