This CL also adds fileUri/charOffset to all TypeBuilder's and renames
Void/FutureOr/Never/Dynamic/BuiltInTypeBuilder to *TypeDeclarationBuilder
so match their relation to TypeBuilder/TypeDeclarationBuilder.
Closes#42962
Change-Id: Iee5102134574d24f748103282a37bb9a85a0ac2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161165
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
I think currently it's marked in the test system (which is why it is not
sad on the bots), but that doesn't help us when running the
incremental_load_from_dill_suite.dart locally.
Change-Id: I0b92b2b30ddb606a96632d6f34ee4c2767cfbeb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161173
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This CL enables textual outline modelling in the incremental compiler,
meaning that the textual outlines created (and compared) to figure out
if we can do a "minimal invalidation" (with the experiment enabled)
is "modelled", i.e. have members, classes etc sorted so that re-ordering
things in a file generally doesn't cause a "transitive invalidation".
Change-Id: I9daddf2bd34e4c2e17b42a5e356033816d05b359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161172
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This adds support lowering the encoding of top-level/static fields
with initializers as if they were marked as late fields. This ensures
that LateInitialization is thrown if final fields are written to during
initialization.
Closes#42956
Change-Id: I488fdddd87ebd935a0cdaf82a724e9b87d5f91ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160724
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
The main reason is that this adds better help text when run from
`dart format`. But it includes a couple of other changes and fixes:
* Don't crash when non-ASCII whitespace is trimmed.
* Split all conditional expressions (`?:`) when they are nested.
* Handle `external` and `abstract` fields and variables.
Change-Id: I59326e693bfe538013cd23b58924461f60e8e908
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160981
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Rename test.options files and TestOptions to folder.options and FolderOptions,
respectively. Rename link.options files and LinkDependencyOptions to
test.options and TestOptions.
This is to better reflect the current usage of these options.
Change-Id: Ibd3c49fa5bd1c9ce8a9eb5910417c12cd45845d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160723
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.
Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This CL basically change two things about the sorting:
* Entities are not sorted according to metadata. Metadata just follows
along. Before "@a class B {}" would come before "class A {}" because
"@" comes before "c". Now "class A {}" comes first because "A" < "B".
* Sorting happens on a token level, i.e. "F<int>" will now come before
"F2<int>" because "F" < "F2" whereas before it was the other way
around because "F2" < "F<" (because "2" < "<").
None of it really matters as long as sorting is done the same way when
comparing the outlines.
Doing it this way makes it faster and actually brings the runtime
(in benchmarks) less than the old (now deleted) textual outline.
Change-Id: Ib1d887ab0c14519316c8e9a3da38f0dd49b4104f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Before this CL the textual outline didn't know about imports and exports
and thus couldn't sort them.
This CL makes it know about them and allows imports and exports to be
sorted internally, but not mix with other stuff (e.g. imports should be
placed after "foo() {}" just because "f" comes before "i", but putting
"import 'a.dart'" before "import 'b.dart'" is OK.
This CL does not sort the hide and show entries.
Change-Id: Ic640cdaa98ac3562f8b36b21180a26584cb6d205
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158551
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Before this CL the textual outline didn't know about named mixin
applications which caused it to insert "fences", i.e. splaces it
wouldn't sort across.
So for instance
class E {}
class D {}
class C<T> = Object with A<Function(T)>;
class B {}
class A {}
would not be sorted fully because class C is a named mixin application,
something it didn't know about, and it would only allow stuff on either
side to be sorted. So the sorted output would have been
class D {}
class E {}
class C<T> = Object with A<Function(T)>;
class A {}
class B {}
With this change it knows about it and the output would now thus be
class A {}
class B {}
class C<T> = Object with A<Function(T)>;
class D {}
class E {}
Change-Id: I97b28706732582d0c37f1b2c052b9f6eaf862a5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158550
Reviewed-by: Johnni Winther <johnniwinther@google.com>
E.g. before this change an empty class output would have been
class Foo {
}
now instead it becomes
class Foo {}
this matches what the formatter does.
Change-Id: Id08edc5259bae00deff9a66b4ae745f21c192358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158549
Reviewed-by: Johnni Winther <johnniwinther@google.com>
E.g. before this change a procedure output would have been
foo() { }
now instead it becomes
foo() {}
this matches what the formatter does.
Change-Id: Ieb538d61e527cbec26d1d65ed6de349311dd0163
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158548
Reviewed-by: Johnni Winther <johnniwinther@google.com>
The widget transformer would try to pass on the location injected
parameter in the factory constructor when calling constructors of its
own kind in constructor body. For instance
class Foo extends Widget {
factory Foo() => new Foo.internal();
Foo.internal();
}
would be transformed into
class Foo extends Widget {
factory Foo({Location loc}) => new Foo.internal(loc: loc);
Foo.internal({Location loc}) : super(loc);
}
This doesn't work if the constructor invocation is constant. For
instance:
class Foo extends Widget {
factory Foo() => const Foo.internal();
const Foo.internal();
}
which would be transformed into
class Foo extends Widget {
factory Foo({Location loc}) => const Foo.internal(loc: loc);
const Foo.internal({Location loc}) : super(loc);
}
Here the reading of the injected factory parameter [loc] is not a
valid constant, leading to a compile-time error during constant
evaluation.
To handle this, const constructor invocations within factories do
not pass on the location from the surrounding constructor but
uses their own. For instance:
class Foo extends Widget {
factory Foo() => const Foo.internal();
Foo.internal();
}
will be transformed into
class Foo extends Widget {
factory Foo({Location loc})
=> const Foo.internal(loc: const Location());
Foo.internal({Location loc}) : super(loc);
}
This does mean that these constant widgets will all have a
location based on the factory constructor declaration and _not_
one per invocation of the factory constructor.
Related to https://github.com/flutter/flutter/issues/63335
Change-Id: Ie3300d3ba81324d5fbd7fb6ab72b9d83d7afcf22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158395
Reviewed-by: Jens Johansen <jensj@google.com>
This CL:
* Adds the textual outline suite to the suite runner run by the bots,
hopefully ensuring that we won't forget about them in the future;
* Adds the missing textual outlines and status entries to make the
textual_outline suite pass.
Change-Id: I0434b6a8e19019bbae7457ea738a13f2623f0c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158542
Reviewed-by: Johnni Winther <johnniwinther@google.com>
E.g. class Foo extends Bar, Baz {} would before have parsed weirdly,
but it will parse as you'd (probably) expect with an error saying
you cannot do that. For now at least both CFE and Analyzer will
pretend like you just specified the first one but I suppose Analyzer
could for instance use the extra information to propose converting
other ones to implements clauses or similar.
Fixes https://github.com/dart-lang/sdk/issues/22313
Change-Id: I180cdd8ab07143dd74fd21c9976ec2a46c428d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158261
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This avoids adding forwarding stubs on all subsequent subclasses by
using the result of the superclass member computation in subclass
member computation.
Change-Id: Id9ae4a8e7b0fbfe90c863580f056bf9d6266220f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157322
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This CL does three things:
* It adds a test that shows how a stub is added if it compiles all
"user libraries" from source, but not when it loads some libraries
from a dill. This is bad and can lead to leaks (and possibly other
things).
* It adds the transformation phase to the tests using the link option
for the linked component. This is needed to avoid a potential crash
(assert error) in the mixin transformation triggered by the new test
added above.
* It adds the possibility to create a non-linked compilation in a
testcase directory with a link.options file by naming the file
"<whatever>.no_link.dart". This way one can have two expect files
close together that shows differences between using linked
dependencies and not without too much duplicated test code.
Change-Id: I170c66fb3e0d4d1263217d64234dc0e88388747d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156912
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>