These can be represented as an unevaluated static invocation.
Change-Id: Ib827345f1f65a09f1a856eae33366722a2e613d2
Reviewed-on: https://dart-review.googlesource.com/c/90008
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Change-Id: I2bfe8ad8d86806e0f5ffa026566cfa234b82154b
Reviewed-on: https://dart-review.googlesource.com/c/90005
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Calls to the factory constructor 'new List' can turn into static
invocations of a backend-specific factory function. Signal an error
instead of crashing.
Change-Id: Id0a8a7f0f847c03225b7fa9da2351032d15522e0
Reviewed-on: https://dart-review.googlesource.com/c/90006
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Handles the situations described in #34204 and #34189 when front-end
constant folding is enabled.
Change-Id: I64fd8449ac1661f6fe67411113c6f99d8009547c
Reviewed-on: https://dart-review.googlesource.com/c/90007
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Change-Id: Id38f5e7495c245e5a7b161b55c58b8826c146a80
Reviewed-on: https://dart-review.googlesource.com/c/90000
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Change-Id: I978c90762ee85a6d7936d6a55e11d5d95d509b4f
Reviewed-on: https://dart-review.googlesource.com/c/89507
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
An invalid constant is (currently) represented by an unevaluated
invalid expression. Using this instead of null fixes 63 out of 125
CFE constant-evaluation crashes with constant-update-2018 and
correctly signals 26 more previously-missed compile-time errors.
Change-Id: I5b4de3995b3a59978dfa08fc542ef0f027572eb6
Reviewed-on: https://dart-review.googlesource.com/c/89506
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Fasta allows some non-const static field access in constant contexts
which leads to the constant evaluator trying to evaluate them. Signal
an error instead of crashing. This will double-report errors for the
cases that Fasta already catches, and we should fix that
double-reporting.
Fix unbounded recursion in printing unevaluated constants (writeNode
called visitUnevaluatedConstant which called defaultConstant which
called writeNode...).
Fix a spurious trailing comma in printing of instance constants.
Change-Id: Idff3169a3a56432ad67c27ff9c267ef355c4c1dc
Reviewed-on: https://dart-review.googlesource.com/c/89514
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Instead of simply printing a message, properly signal a Fasta problem for
constant errors. This causes 68 tests (presumably missing compile-time
errors) to start passing with --enable-experiment=constant-update-2018.
Change-Id: Ia9f1809305bbef7b4652ce49acf6fb9c18408207
Reviewed-on: https://dart-review.googlesource.com/c/89580
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Make the constant evaluator take an explicit error reporter so we have
to opt in to using the "simple" one that reports errors in an ad hoc
way. This is the start of a change to use Fasta-controlled error
messages throughout and eventually get rid of the simple error
handler, and to continue constant evaluation after the first constant
error.
Change-Id: If6b1801edab6063754b642cf4a603abf9d63103a
Reviewed-on: https://dart-review.googlesource.com/c/89501
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
A simple solution is to leave them unevaluated.
Change-Id: Ic7d1237452a387180ec12f23b3a4030ff64f061d
Reviewed-on: https://dart-review.googlesource.com/c/89282
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
These can arise in erroneous cases which have already been reported,
e.g., in a for-in loop with a const declaration. The constant
evaluator should not assume a non-null initializer in this case.
Change-Id: I2540cb9c659d33e23b6c00d4a8bbf56c404d8c1d
Reviewed-on: https://dart-review.googlesource.com/c/89280
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Instead of evaluating them to their default value, leave them
unevaluated.
Change-Id: Iefc7701b9993cae8f7f1eee37d904d21a89a1cd8
Reviewed-on: https://dart-review.googlesource.com/c/89002
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Add Kernel syntactic support for constants constructed by
bool.fromEnvironment, int.fromEnvironment, and String.fromEnvironment.
These values are not necessarily available at compile time. Because
constants can depend on these values, there is also an unevaluated constant
that represents an expression depending on environment values.
This syntax is not yet produced by the Fasta compiler.
Change-Id: Ie96ea7f60a7efcd35ac802b320a00f398d41232e
Reviewed-on: https://dart-review.googlesource.com/c/88827
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Change-Id: Ia32e2c0beb504e38f8dcb9bae33f4ee9f0e7daca
Reviewed-on: https://dart-review.googlesource.com/c/88825
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
Change-Id: I1682baeb336b8be3cb6c5874715ef8ba730561e0
Reviewed-on: https://dart-review.googlesource.com/c/88803
Commit-Queue: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Add serializers for instance getters, setters, and methods and for
super getters, setters, and methods. This requires also serializing
Arguments.
Change-Id: I36d36892bf896cd12b48f9e77395c0584daf47f1
Reviewed-on: https://dart-review.googlesource.com/c/88710
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Change-Id: I782700f972b846ec0d86b671c0c9b097ca73495d
Reviewed-on: https://dart-review.googlesource.com/c/88800
Commit-Queue: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Change-Id: I753153a9c8f5adeb9be516f60590bd3f33bc4923
Reviewed-on: https://dart-review.googlesource.com/c/88680
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Change-Id: I8d945fc9d75aad1c4275b6d3dd3f9e2ea884ea9f
Reviewed-on: https://dart-review.googlesource.com/c/88451
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This will enable serialization of expressions blocked on names.
Supporting private names requires a map from from serialized library
ID to library. More generally, we need to support something like the
dill file's canonical names.
Change-Id: I7d470e6a49b167f7755d130ea6c3e543e188da65
Reviewed-on: https://dart-review.googlesource.com/c/88703
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
References can be null --- it's written as the byte [0].
Thus in the null case it would before be [0] and now be [0].
In the non-null case it would before be [1, xyz] (1 for Tag.Something
and xyz for the actual, now positive, uint30). Now it would be [xyz].
Change-Id: Ibc08d3afb7275b0429a4d6c5e667fbd381121489
Reviewed-on: https://dart-review.googlesource.com/c/85394
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Before this change we allowed to serialize some references as null,
and would only complain when trying to read the dill back in.
This CL changes that so it complains up front.
It is unknown if any of this would ever occur in practise.
Change-Id: Id5e1af89abfb88a2d4249bd439b53b062d7aeffa
Reviewed-on: https://dart-review.googlesource.com/c/85392
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
The length is redundant if the list is delimited. Serializing the
length had the slight advantage of preallocating a list of the correct
size and the disadvantages of being harder to maintain by hand and
ugly to read.
Instead, delimit lists. The empty list is naturally ().
Change-Id: I17c14f4e0ca4934cfd3dcdf2a0047f87df80bb79
Reviewed-on: https://dart-review.googlesource.com/c/88320
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Serializing Let requires us to serialize variable declarations which are
complicated. They require us to support optional values because they
have an optional initializer. This is done by using a _ for none.
Having support for Let will allow us to support variable get and set.
Change-Id: I207183730389de70409ae6ca5017510420e36830
Reviewed-on: https://dart-review.googlesource.com/c/88182
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Use separate tags for the non-const and const versions of these
literals, just like the binary serializer does.
Change-Id: I3fabf02ce758a46ce55ff258723dd3ae11e6d497
Reviewed-on: https://dart-review.googlesource.com/c/88181
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Add serializers for some simple DartTypes and some expressions that
were blocked on being able to serializer DartTypes.
Change-Id: Ib16aa59e5782bddc820ea88e0885f258fc17bbd0
Reviewed-on: https://dart-review.googlesource.com/c/88180
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Support the rest of the expressions that do not require serializing
DartType, Name, Arguments, or references to other parts of the AST.
Change-Id: Icef3c2824354add1b13fa8c34fa7ff7c48bd2148
Reviewed-on: https://dart-review.googlesource.com/c/87963
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>