Commit Graph

6018 Commits

Author SHA1 Message Date
Sigmund Cherem d96b29378a Delete use of rasta and dartk from perf.dart scripts.
Change-Id: Id8cd7f01c68dbcb6f814ef51627a2f4b377f6819
Reviewed-on: https://dart-review.googlesource.com/9790
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2017-10-03 23:12:21 +00:00
Paul Berry 82623e49ee Mark forwarding stubs as abstract/concrete correctly.
Change-Id: I986f0bcd079a206e1d055762e5443e3b32ded295
Reviewed-on: https://dart-review.googlesource.com/10701
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-03 21:02:23 +00:00
Paul Berry 310c153eb6 Substitute generic function type parameters when making forwarding stubs.
When creating a forwarding stub for a method like this:

class C<T> {
  void foo<U>(T x, U y) {}
}
class D<V> extends C<V> {
  // Forwarding stub needed here
}

Two substitutions need to be done:

- We need to substitute V in place of T.

- We need to substitute the generic parameter for the forwarding stub
  in place of the generic parameter for the method being overridden.

So the generated method should look like this:

class D<V> extends C<V> {
  void foo<W>(V x, W y) => super.foo<W>(x, y);
}

Change-Id: Id846611c499b9aad4f042380862cbad08a6f1c17
Reviewed-on: https://dart-review.googlesource.com/10581
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-10-03 20:38:41 +00:00
Dan Rubel f0da9b68b5 fix skipUnexpectedToken
Change-Id: I6e75c00d035e561f8cd3e69b83fac264397e1fac
Reviewed-on: https://dart-review.googlesource.com/10720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-03 20:27:44 +00:00
Paul Berry eb7fc7d158 Tag forwarding stubs with a boolean flag in the kernel representation.
Change-Id: I5cdd05acd79f149b3702f982b1289930078d4e1b
Reviewed-on: https://dart-review.googlesource.com/10620
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-03 17:17:09 +00:00
Dan Rubel 9b14174556 fix import recovery
Update import recovery and extract skipUnexpectedTokenOpt
for use by class header out-of-order recovery.

Change-Id: I48fbadca34074b543cf8ca7f53ca3ab25a74f470
Reviewed-on: https://dart-review.googlesource.com/10440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2017-10-03 15:48:39 +00:00
Aske Simon Christensen 868f5d9fa6 Recover from error in for initializer
When a variable declaration in a for initializer has an error,
an error-throwing expression statement is produced by the general
variable declaration parser code. The body builder was not prepared
for this, but was trivially extended to handle it.

Closes https://github.com/dart-lang/sdk/issues/29984
Change-Id: Iace9a095cc150e26e62ed17716823e62e5d2ece3
Reviewed-on: https://dart-review.googlesource.com/8801
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-03 15:09:09 +00:00
Paul Berry c31a29aeb0 Remove the CovariancePropagator class.
The functionality of this class has been moved to InterfaceResolver.

Change-Id: Ieb887c5dd45f587985b08243d04e2bd02afeaff8
Reviewed-on: https://dart-review.googlesource.com/10204
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-03 15:01:31 +00:00
Brian Wilkerson b4d179e58a Recover from missing identifiers
Change-Id: I3c7a908449861eeed0915c4d74b10f4d1e46fde4
Reviewed-on: https://dart-review.googlesource.com/7558
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2017-10-03 13:41:02 +00:00
danrubel df97434c28 extract ForwardingListener from ForwardingTestListener
Change-Id: I6e073e97130cc78eb33d663b79f3b8e472c7d408
Reviewed-on: https://dart-review.googlesource.com/10220
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-03 12:54:38 +00:00
Paul Berry 99b757eb44 Move _recordInstrumentation from CovariancePropagator to InferenceResolver.
This will make it possible to delete CovariancePropagator without
regressing covariance instrumentation too badly.

Note that there are some small regressions due to the fact that
InferenceResolver doesn't yet correctly propagate covariance
annotations from a base class field to a subclass field/setter.  These
regressions can't be fixed until after InferenceResolver is integrated
with top level type inference.

Change-Id: I29352484e9f13bbfa9b34d463c6b27eab7f9698f
Reviewed-on: https://dart-review.googlesource.com/10200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-02 22:13:09 +00:00
Peter von der Ahé cefe4d5d65 Move compile_platform_test.dart to tool directory.
This also reverts "Move command_line.dart and most of compile_platform.dart into lib/"

This reverts commit 1916dc75e6.

Change-Id: I2598514c6bb62eec392bd00f20b15aac72b6fa42
Reviewed-on: https://dart-review.googlesource.com/9600
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-02 16:23:56 +00:00
Aske Simon Christensen accddd1d97 Use error message templates for error tokens
Also fixes unicode U+ notation in error messages to use uppercase
letters for the hex code, as per the Unicode Standard conventions.

Closes https://github.com/dart-lang/sdk/issues/29985
Change-Id: I6397e03cb3e0d5eca156621bb4b19dfa643d9437
Reviewed-on: https://dart-review.googlesource.com/9320
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-02 14:23:26 +00:00
Peter von der Ahé 9471634c64 Improve documentation.
Change-Id: I280e7a785aba441f80e5accf010037b7a1d2a078
Reviewed-on: https://dart-review.googlesource.com/9641
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-02 12:54:36 +00:00
Peter von der Ahé aff25fdef2 Restore compile.status.
Change-Id: I85a371fb9e4ff3003863b69ad62e90370619c8dd
Reviewed-on: https://dart-review.googlesource.com/9484
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-02 12:43:36 +00:00
Paul Berry 17a4f66126 Instrument the creation of forwarding stubs.
Change-Id: I98d15cdeaff72da4b6e4b8532689c24f42b6d501
Reviewed-on: https://dart-review.googlesource.com/9860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-30 18:27:25 +00:00
Paul Berry 3d2eba4d7f Start making use of the new InterfaceResolver class.
For the moment there is some duplicate functionality: both
InterfaceResolver and CovariancePropagator will try to propagate
covariance annotations.  This is ok for the short term, since
InterfaceResolver is still incomplete.  Once InterfaceResolver is
complete, I'll remove CovariancePropagater.

Note that forwarding stubs are now created, but they are not yet added
to classes, so they don't appear in the compiled kernel output.

Change-Id: I0a1814bd2abc5b63dbf7ceb6fc45f3da81728ee9
Reviewed-on: https://dart-review.googlesource.com/9788
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-30 14:47:26 +00:00
Paul Berry 46a8c79cf2 Add the ability to create forwarding stubs for operators.
Change-Id: Icc60faa9b6f706a0344a4ba3fdbe29ba61bcc078
Reviewed-on: https://dart-review.googlesource.com/9786
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-29 21:38:14 +00:00
Dan Rubel 5a67a64957 Refactor parseClass
Refactored the parseClass method in preparation for
adding recovery, updating error messages, and analyzer integration.

* Added several new parser events
    - handleClassExtends
    - handleClassImplements
    - handleClassHeader

* Revised the endClassDeclaration event

Change-Id: Ib58893097650eefb45051b462e9df7260b7776b2
Reviewed-on: https://dart-review.googlesource.com/9580
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 19:34:15 +00:00
Konstantin Shcheglov b5fc2de3bf Keep sources for libraries of the current cycle.
This should fix the issue 30917 flakiness.

The reason why the tests were failing is that the code in the tests
was not quite correct Dart code, so Fasta generated a synthetic
`#errors` top-level variable with fileUri == null. We should skip
this field because it is not a part of any unit, because its fileUri
is not the fileUri of any unit.

But we lose fileUri for a Node if Program.uriToSource does not
include this URI. So, if we clear uriToSource in KernelDriver, we
lose all the file URIs. So, now we keep sources for the cycle files.

The reason for flakiness is because of the same race condition
between analyzing AnalysisDriver.addFile() and getResult(). If
we process getResult() before, we don't have to read the library
kernel file, we just create in first time, and fileUri(s) are
valid.

R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/30917
Change-Id: Ie559cf2a8a778ebf4a9e297f5cb13d30a98b5a3c
Reviewed-on: https://dart-review.googlesource.com/9744
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-29 18:38:52 +00:00
Peter von der Ahé 0442a2bea0 Rename lookupSuperMember to lookupInstanceMember.
Change-Id: I14a17ce0b6a7569b2390dede9d1bfebdbb15be95
Reviewed-on: https://dart-review.googlesource.com/8541
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2017-09-29 16:40:22 +00:00
Peter von der Ahé 3473717fc5 Remove unused message template.
Change-Id: I193bc46074584584b9172badbe589668786ec99e
Reviewed-on: https://dart-review.googlesource.com/9681
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 16:19:42 +00:00
Brian Wilkerson dbb6c5a442 Associate more Fasta errors with analyzer errors
Change-Id: I235f748a267819abea739da3885ff9613034ebfe
Reviewed-on: https://dart-review.googlesource.com/9160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2017-09-29 15:14:23 +00:00
Dan Rubel 9527f37146 refactor parse import
* `as` clause and `deferred as` clause processing pushed
     into a new processImportPrefixOpt method.
* New handleImportPrefix event for communicating 
    `as` clause and `deferred as` clause to the listeners.
* Several new more detailed error messages for out of order
    clauses and keywords in the import directive.

Change-Id: I133842c7225403fa000ca1cf0e49af9f8a011386
Reviewed-on: https://dart-review.googlesource.com/8580
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 14:39:01 +00:00
Peter von der Ahé fe17656583 Remove toSuperMethodInvocation.
Change-Id: I2a600c58df11bae75e597747756680c9aa0caf03
Reviewed-on: https://dart-review.googlesource.com/8480
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2017-09-29 12:04:02 +00:00
Peter von der Ahé 132d707f6a Implement context for messages and use it for argument mismatches.
Change-Id: Iebf1a1fa0450ab900a9d220bf82bdf0f940c0399
Reviewed-on: https://dart-review.googlesource.com/7714
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2017-09-29 11:30:24 +00:00
Sigmund Cherem 655d60f2c5 Add incremental_perf: a script to measure performance of the incremental kernel
generator.

The script takes an input program Uri, and a file describing edits, and it mocks
applying the edits in multiple iterations.

incremental_perf_test illustrates how this can be used to do incremental
compiles of the dart2js source code.

Change-Id: I3518996a0faac34de8c6cef2f63468f4788b3c06
Reviewed-on: https://dart-review.googlesource.com/6026
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-29 05:17:41 +00:00
Kevin Moore b7a9f2ae7c Fix SDK constraints on analyzer, front_end, kernel, meta
Prepare to publish meta

Change-Id: I1bc564c68315fb2f27469deda76e75495e42c23b
Reviewed-on: https://dart-review.googlesource.com/9364
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2017-09-28 19:33:27 +00:00
Paul Berry 112eed2e55 Separate creation of forwarding stubs from creation of their implementations.
This is necessary for two reasons:

- Sometimes we need to create a forwading stub that is abstract.

- Sometimes a class has an existing abstract member that needs to be
  given an implementation.

Change-Id: I1fdb91ff421c1cd1234141db9c9b2190870164fa
Reviewed-on: https://dart-review.googlesource.com/9121
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-28 18:03:23 +00:00
Paul Berry c90e0b9cb3 Propagate covariance fixes to fields.
Change-Id: Iedd00f8d9acb6208cbdd127a1a39a48a1f10ddda
Reviewed-on: https://dart-review.googlesource.com/9120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-28 17:59:53 +00:00
Konstantin Shcheglov b756c80ac0 Store documentation comments directly into Kernel AST nodes.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug:
Change-Id: Ibe818653b8a4f92aad3aadc37da9d6fbacf35eb4
Reviewed-on: https://dart-review.googlesource.com/8721
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-28 17:06:01 +00:00
Peter von der Ahé f88bd6af3d Add testing target for dart2js with kernel.
Change-Id: I60c22a7df03e67e14b9328502b80aa697ced4d4c
Reviewed-on: https://dart-review.googlesource.com/8500
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-09-28 16:25:38 +00:00
Régis Crelier fc9b871d2f Mark vm-kernel compile/function_type_recovery as failing, but passes locally.
Change-Id: I6feb770f4cd8eefb2d13292de211978dce800b2f
Reviewed-on: https://dart-review.googlesource.com/9143
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 02:25:55 +00:00
Régis Crelier 2b56f3977e Fix vm-kernel shaker/empty_program test expectation.
Change-Id: Iaff69f49aaa7b908b43ec9cf1c0466030c971020
Reviewed-on: https://dart-review.googlesource.com/9142
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 02:07:45 +00:00
Régis Crelier db8b20107b Revert "Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError.""
This reverts commit 8cf9ef22c4.

The expectations in Dart2js and Kernel tests have now been updated.

Change-Id: I9d65ff207490cfc783849b1b726db81cf56ecfc2
Reviewed-on: https://dart-review.googlesource.com/9124
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 00:27:24 +00:00
Paul Berry f406efd265 In InterfaceResolver, favor inheriting the first member with the proper type.
We have to generate a forwarding stub whenever the inherited member
isn't the same as the one that ClassHierarchy would have chosen, and
ClassHierarchy favors inheriting the first member.  So this will avoid
creation of unnecessary forwarding stubs.

Change-Id: If2411c6ed0474da66544735b196f8042f98c2591
Reviewed-on: https://dart-review.googlesource.com/9063
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-27 22:38:47 +00:00
Paul Berry 46734c96f9 Create forwarding stubs properly for getters, setters, and fields.
Change-Id: Ife2be67a29d46957e56ff34faab83c15f9f8579b
Reviewed-on: https://dart-review.googlesource.com/9062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-27 22:29:02 +00:00
Paul Berry c0a2789b00 Clear class inference info after type inference is complete.
This should allow more memory to be reclaimed by GC.

Change-Id: I9fe8ad5ffb1b92910457630579bb0822fad9a3cc
Reviewed-on: https://dart-review.googlesource.com/9061
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-27 22:23:21 +00:00
Paul Berry c13eb60426 Implement logic for creating forwarding stubs and propagating covariance annotations.
This logic isn't hooked up yet; it's just unit tested.

Change-Id: Iacaf4fbc7c31be68c4c38cea60eca080c2aa1637
Reviewed-on: https://dart-review.googlesource.com/8734
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-27 17:57:34 +00:00
Dan Rubel f0caee1b24 Improve import directive recovery and report analyzer errors
- New handleRecoverImport event
    for clauses in import directive that are out of order
- New error codes for
    Duplicate prefix
    Prefix after combinator

Change-Id: I0fea7ad4b4014a0b8578d3982e0515fe85044854
Reviewed-on: https://dart-review.googlesource.com/7980
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-27 12:56:46 +00:00
Konstantin Shcheglov 7f33f78026 Issue 30875. Don't damage _redirecting# when adding kernels to DillLoader.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/30875
Change-Id: Iede037673458131a357050ab61eb9930b70d372b
Reviewed-on: https://dart-review.googlesource.com/8381
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-26 20:41:14 +00:00
Paul Berry 1916dc75e6 Move command_line.dart and most of compile_platform.dart into lib/
This should make it possible to run compile_platform_test.dart inside
google3, where package layout conventions are more strictly enforced
(files in test/ cannot import files in tool/).

Change-Id: I2299e0340b0edfc1a684a635de8cf87ecb9f241f
Reviewed-on: https://dart-review.googlesource.com/8701
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-26 17:34:01 +00:00
Paul Berry 9b45cc7e4d Implement ForwardingNodes.resolve().
This method figures out which method a given forwarding node resolves
to, accounting properly for the fact that when there is multiple
inheritance, the inherited method is the one with the most specific
type.

Change-Id: Ia412e2d195dd697e35c1c08480b51f2a6bd1cac5
Reviewed-on: https://dart-review.googlesource.com/8360
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-26 16:48:11 +00:00
Paul Berry 13d155cc9c Change messages_test to use package_root to find messages.yaml
This allows the test to pass in situations where it is not run from
the root of the SDK directory.

Change-Id: I855ec4529af6f18db41964f6976232358e94c920
Reviewed-on: https://dart-review.googlesource.com/8680
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-26 16:41:21 +00:00
Aske Simon Christensen 394f854fec Catch URI parse failure and report error
Closes https://github.com/dart-lang/sdk/issues/29977
Closes https://github.com/dart-lang/sdk/issues/29987
Change-Id: I448089036b20572d1cc8cb9d5e79cfd402caf273
Reviewed-on: https://dart-review.googlesource.com/8440
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-26 11:26:20 +00:00
Sigmund Cherem 4c893290e4 Reapply "Check whether type-arguments and type-parameters length match from the body builder."
This reverts commit 1ca12788c6.

Patchset 1 is the reverted CL, patchset 2 shows the changes.

Bug:
Change-Id: I4ffcb9ec20f2ac3c59d09adc3a6693f52c71601d
Reviewed-on: https://dart-review.googlesource.com/6360
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-26 04:09:37 +00:00
Paul Berry 95552a890e Verify consistency between InterfaceResolver and ClassHierarchy.
One of the roles of InterfaceResolver will be to determine when
ClassHierarchy's technique for finding an inherited member would
produce the wrong result, and adding a forwarding stub when that
happens.  Since ClassHierarchy's technique for finding an inherited
member is to just pick the first member it finds, we need to make sure
InterfaceResolver visits superclasses in the same order, so it will
know which member ClassHierarchy would pick.

This CL adds tests to make sure both classes visit members in the same
order, by testing that:

- methods in mixins take precedence over those from superclasses.

- methods in superclasses take precedence over those from interfaces.

- methods in interfaces are considered in the order in which the
  interfaces are named.

Also, I discovered that it was unnecessary for InterfaceResolver to
visit mixins, since ClassHierarchy has already merged methods from
mixins into the list of members it considers to be "declared in" the
class.

Change-Id: If0ca03824887c87e0ae2090532c75cf6c5ad3161
Reviewed-on: https://dart-review.googlesource.com/8322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-25 22:06:49 +00:00
Paul Berry d9ca760992 Start writing the infrastructure for creating forwarding stubs.
This CL adds the ability to create a list of "forwarding nodes" for a
source class.  A forwarding node is a data structure that will later
be resolved to either an explicitly declared member in the class or a
superclass, or to a forwarding stub.  The idea is that we will create
the forwarding nodes at the time of outline building, and later,
during type inference, we will resolve each forwarding node as it is
encountered.

The reason we need to defer resolution of the forwarding nodes until
inference is because we may need to use the results of type inference
to determine which member a given forwarding node resolves to.  For
example:

num f() => 1;
class A {
  final x = 1; // Inferred type: int
}
class B {
  final x = f(); // Inferred type: num
}
abstract class C implements A, B {}

We cannot determine at the time of building the outline for C whether
it inherits its x from A or B, because we need the results of type
inference to determine which of the two x's has a more specific type.

Note that some refactoring of ClassHierarchy was necessary in order to
allow the front end to maintain member lists in the same order used
internally by ClassHierarchy.  This will let us avoid unnecessary
redundant sorting of methods.

Change-Id: Iee754957e0ad3b16c4b60608e17a4a7b0006dfb4
Reviewed-on: https://dart-review.googlesource.com/7851
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-25 20:59:49 +00:00
Paul Berry ac57ed0a09 Visit classes in topo order when preparing inference.
This will be needed once we start adding the creation of forwarding
stubs to inference, since we'll need to create the forwarding stubs
for base classes before creating the forwarding stubs for derived
classes.

Also, change the nomenclature "prepareInitializerInference" to
"prepareTopLevelInference" since this inference stage already infers
more things than just initializers, and will soon start doing even
more.

This required creating a "ShadowClass" class to allow easy access to
the SourceClassBuilder from the Class object.  In future CLs I will
store other information related to inference and forwarding stubs in
ShadowClass.

Change-Id: Ie322c6c2230de2ffd2c042a707289992b1967f4f
Reviewed-on: https://dart-review.googlesource.com/7852
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-09-25 17:42:27 +00:00
Dan Rubel bc5531fd1c remove native clause processing from parser listeners
* Finish updating the fasta parser to handle native clauses
* Remove outdated native clause processing from listeners

Change-Id: I2797145d6aff07da2ee4e008d5e1f233f30813a2
Reviewed-on: https://dart-review.googlesource.com/7900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-25 15:48:49 +00:00