When the result of getInterceptor is either null or a known constant,
it is compiled to `x && const` or `x == null ? x : const` depending
on whether there are any other falsy values for that type.
This required some changes to share_interceptors so it can share/hoist
the constant subexpression separately from the whole expression.
The Interceptor root class is removed from the intercepted classes of
getInterceptor when it is "shadowed" by all the other intercepted classes.
E.g. if the input is a number or a string, there is no need
to intercept for {JSNumber, JSString, Interceptor}, because JSNumber
and JSString collectively shadow Interceptor.
R=sra@google.com
Review URL: https://codereview.chromium.org/1409803003 .
If the JS ast contains an initializer list:
var x = foo(), y = await x;
It would be retained as a single statement and generate invalid output
that awaits 'x' before it has been defined.
CLOSES=23997
BUG=
R=sigurdm@google.com
Review URL: https://codereview.chromium.org/1427593003 .
Main changes:
Moved native/jsinterop members from
elements/elements.dart, (interface)
elements/modelx.dart, (implementation)
native/native.dart (implementation)
to
common/backend_api.dart (interface)
js_backend/backend.dart (implementation)
Removed LibraryElement.canUseNative and added BackendApi.canUseNative to
common/backend_api.dart
to encapsulate the maybeEnableNative function in
native/native.dart
Added ScannerOptions to
parser/element_listener.dart
as a required argument of ElementListener
and added Parsing.getScannerOptionsFor to
common/resolution.dart (interface)
compiler.dart (implementation)
to allow the `native` pseudo keyword in
native/scanner.dart
The remaining changes are side-effects of the changes above.
R=jacobr@google.com, sigurdm@google.com
Review URL: https://codereview.chromium.org/1408043002.
Strings were not sometimes not considered indexables because
[subtype=String] is not reduced to [exact=JSString].
We now rewrite the index-set operator to direct access even when the
receiver object is potentially null (but is otherwise a mutable
indexable).
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1420563002 .
this is necessary because the type of elements will not be
set unless the typechecker runs on the element. You need
the type to be set even when suppressWarnings is on because
in checked mode it is an error to declare a compiled constant
with inconsistent field types
Fixes#24653
BUG=
R=sigmund@google.com
Review URL: https://codereview.chromium.org/1411153005 .
The analysis uses a watered-down octagon domain which reduces range
analysis to a graph problem.
There are more ideas to try out to improve on this, but I think this is
a nice baseline to work from.
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org//1353443002 .
All passes must now preserve valid parent pointers. Several passes
already did this (or tried to do it).
The IR integrity checker can now check that parent pointers are valid.
This has caught a number of missing parent pointers assignments in
passes that otherwise tried to preserve them.
All node constructors now set parent pointers. This is very convenient
for simple transformations, but also a bit of a trap since updating a
field on an existing node does not update the parent pointer.
This is a pretty heavy-handed change. The main rationale for it are:
- The helpers methods require parent pointers, so they are more useful
when parent pointers are always set.
- The integrity checker can catch bogus parent pointers after passes
that have to maintain them anyway.
- The integrity checker is super slow, but this can finally be fixed
if it can assume parent pointers are valid (not part of this CL).
The IR visitors have been changed a bit to support a generic parent
visitor that does not have to implement every visit method.
The 'parent index' fields have been removed.
BUG=
R=kmillikin@google.com
Committed: https://github.com/dart-lang/sdk/commit/6cc9b435354ea4fe3796437e3cc7091f6a11de19
Review URL: https://codereview.chromium.org/1375213003 .