Paul Berry
be01632bc0
Fix type inference of getters that "override" setters and vice versa.
...
Normally getters and setters are considered distinct and unrelated by
the type inference algorithm. However, if a getter has no declared
type and doesn't override anything, then we fall back on inferring its
type from an inherited setter, and vice versa.
R=sigmund@google.com
Review-Url: https://codereview.chromium.org/2946733003 .
2017-06-20 05:34:31 -07:00
Konstantin Shcheglov
bcf179c9fa
Add the 'crossGettersSetters' flag to ClassHierarchy.forEachOverridePair().
...
We need to be able to get 'overrides' of setters with getters and vise
versa to support top-level inference.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2941363002 .
2017-06-17 18:32:44 -07:00
Dmitry Stefantsov
5982ace801
Add transformLibraries for closure conversion
...
Closure conversion can now be run on a part of a program. It allows
using closure conversion in kernel-isolate. It comes at a cost of
temporarily sacrificing implementation of tear-offs via closures; VM
mechanism for tear-offs is used for now.
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2938773003 .
2017-06-15 14:18:10 +02:00
Dmitry Stefantsov
32eed0892d
Update expectations for closure conversion tests
...
R=karlklose@google.com
Review-Url: https://codereview.chromium.org/2935223003 .
2017-06-14 11:03:46 +02:00
Konstantin Shcheglov
cf59b1a0f9
Remove ClassHierarchy factory constructor.
...
KernelTarget already uses IncrementalClassHierarchy, and other clients
either need ClosedWorldClassHierarchy, so should explicitly create it,
or don't care, and can be switched to IncrementalClassHierarchy.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2930973002 .
2017-06-08 18:42:22 -07:00
Konstantin Shcheglov
5fe793ec4e
Use ClassHierarchy.applyChanges() in MixinFullResolution.
...
So, we let the hierarchy to decide how to react to the changes, and
instance of which class hierarchy to create.
This makes initial compilation with Kernel Driver about 5% faster.
R=ahe@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2924333002 .
2017-06-08 14:00:51 -07:00
Dmitry Stefantsov
09e755196a
Pass a Target instance to DillTarget instead of its name
...
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2924833002 .
2017-06-06 16:03:49 +02:00
Konstantin Shcheglov
8ec1f95af6
Replace ClassHierarchy.classes with getOrderedClasses().
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2924713002 .
2017-06-05 20:23:13 -07:00
Konstantin Shcheglov
64ce51ce4b
Fix the test and implement forEachOverridePair() for IncrementalClassHierarchy.
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2920323002 .
2017-06-05 13:11:29 -07:00
Konstantin Shcheglov
71b1905265
Fix the test for ClassHierarchy.getDispatchTarget().
...
The blame was placed incorrectly - it was a bug in the test itself.
We need both empty FunctionBody and isAbstract flag for Procedure.
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2925573002 .
2017-06-05 10:42:21 -07:00
Konstantin Shcheglov
5cf61cb0dc
Implement getInterfaceMember() for IncrementalClassHierarchy.
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2916383003 .
2017-06-03 18:52:00 -07:00
Konstantin Shcheglov
952687a64f
Implement getDispatchTarget() in IncrementalClassHierarchy.
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2916403002 .
2017-06-02 13:58:26 -07:00
Konstantin Shcheglov
99363d42d0
Implement getClassicLeastUpperBound() in IncrementalClassHierarchy.
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2921083002 .
2017-06-02 13:46:58 -07:00
Konstantin Shcheglov
c2b5ae00ce
Implement getClassAsInstanceOf() and getTypeAsInstanceOf() for IncrementalClassHierarchy.
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2915263003 .
2017-06-02 11:54:47 -07:00
Konstantin Shcheglov
4301ce842a
Implement IncrementalClassHierarchy.getRankedSuperclasses().
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2916323002 .
2017-06-02 09:15:44 -07:00
Dmitry Stefantsov
1e2f06f8da
Reapply "Use backend targets to run Kernel transformations in Fasta"
...
This reverts commit 0b424ca5d2
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2919003003 .
2017-06-02 16:10:28 +02:00
Dmitry Stefantsov
0b424ca5d2
Revert "Use backend targets to run Kernel transformations in Fasta"
...
This reverts commit 8ff762067a .
TBR=ahe@google.com
Review-Url: https://codereview.chromium.org/2918923003 .
2017-06-02 12:45:34 +02:00
Dmitry Stefantsov
8ff762067a
Use backend targets to run Kernel transformations in Fasta
...
R=ahe@google.com , scheglov@google.com
Review-Url: https://codereview.chromium.org/2918623004 .
2017-06-02 10:40:13 +02:00
Konstantin Shcheglov
65c1f5f8ab
Start implementing IncrementalClassHierarchy.
...
Only getClassDepth() for now.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2922533002 .
2017-06-01 15:01:51 -07:00
Konstantin Shcheglov
d91ba05859
Additional tests for ClassHierarchy.forEachOverridePair().
...
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2918663006 .
2017-06-01 14:51:14 -07:00
Konstantin Shcheglov
717937a180
Add the more complex LUB test.
...
Peter asked to a more complex test.
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2916093003 .
2017-06-01 14:46:20 -07:00
Konstantin Shcheglov
00f97489cf
Remove the ClassHierarchy.rootClass getter.
...
According to the language specification the root class is always
equivalent to the Object class.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2919833002 .
2017-06-01 11:56:46 -07:00
Konstantin Shcheglov
5bdfd1e69b
Pass ClassHierarchy instead of creating it.
...
MixinFullResolution is also updated to create new ClassHierarchy
instance only if there are transformed classes. This improves
incremental kernel generator initial time from 22 to 16 seconds.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2918593003 .
2017-06-01 07:20:13 -07:00
Konstantin Shcheglov
463275881d
Replace modelled Dart code comments with Kernel text validation.
...
Paul, do you want to keep ASCII hierarchies, or the text provides
enough information / easy to read?
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2920563002 .
2017-05-31 13:09:36 -07:00
Konstantin Shcheglov
e94a8e1367
Start adding unit tests for ClassHierarchy.
...
I need these tests in order to be sure that I understand expectations
of the ClassHierarchy interface, and to be able to test a lazy
implementation I'm going to create for incremental kernel generator.
I moved lub_test tests into this wider test suite.
Tests for forEachOverridePair() are not complete yet, just one path
is tested.
If there are any additional cases that you think should be covered,
please let me know.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2912173002 .
2017-05-31 11:31:36 -07:00
Konstantin Shcheglov
3803374d32
Don't recreate CoreTypes in transformers. Pass it in.
...
The same will be done later for ClassHierarchy. So, it would be up to
the client to decide which flavour to create, and whether the same
instance can be reused.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2904203003 .
2017-05-31 09:54:27 -07:00
Konstantin Shcheglov
f9af7bf5bc
Extract ClassHierarchyImpl implementation from ClassHierarchy.
...
As a preparation step for using different implementation during
incremental kernel generation.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2904203002 .
2017-05-30 09:45:06 -07:00
Peter von der Ahé
8f1a69826a
Fix problems with closures_test.
...
R=dmitryas@google.com
Review-Url: https://codereview.chromium.org/2898173005 .
2017-05-30 12:10:01 +02:00
Peter von der Ahé
27761fd369
Read SDK and patches from a JSON file.
...
R=sigmund@google.com
Review-Url: https://codereview.chromium.org/2895983002 .
2017-05-25 15:57:57 +02:00
Paul Berry
e642722f42
Implement subtyping rules for FutureOr in kernel.
...
These rules are only enabled when in strong mode, so existing Dart 1.0
functionality should be unaffected.
R=kmillikin@google.com , scheglov@google.com
Review-Url: https://codereview.chromium.org/2900113002 .
2017-05-24 06:14:22 -07:00
Peter von der Ahé
425626363a
Fix closure and interpreter suites.
...
Review-Url: https://codereview.chromium.org/2897933004 .
2017-05-22 18:19:37 +02:00
Konstantin Shcheglov
00525a056c
Update cli description for a couple of benchmarks.
...
R=ahe@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2896613003 .
2017-05-19 15:11:17 -07:00
Konstantin Shcheglov
06e9b4b503
Rename buildOutline() and separate 'build' and 'writeProgram()'.
...
Also rename KernelTarget.program to _program to prevent clients from
reaching into internals. I think eventually we want to make more
stuff private. And rationalize errors handling. And... many things :-)
R=ahe@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2893563003 .
2017-05-17 11:10:06 -07:00
Konstantin Shcheglov
e3f4ed94b1
Rename Target.writeOutline() into computeOutline(), add separate KernelTarget.writeOutline().
...
For DillTarget write does not make sense, and even for KernelTarget
we usually don't want to write anything.
R=ahe@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2885923002 .
2017-05-16 14:38:24 -07:00
Konstantin Shcheglov
bdedd6768b
Add a way to use shared CanonicalName root to deserialize Program.
...
This allows for example to add SDK into a Program, then load the
"incomplete" Program A that has only the library A, and name sequences
that references SDK classes. Because we look into the nameRoot which
aleady has SDK CanonicalName(s), we can find these names while filling
the link table and use references which point to the existing SDK
AST nodes. Then we can load another set of library cycles, etc.
At the end we have a set of self-consistent libraries that we can
feed into DillTarget/DillLoader and resolve anothersource target
against it.
This CL is based on https://codereview.chromium.org/2872903005/
which has not been reviewed yet.
R=kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2874723002 .
2017-05-12 10:42:08 -07:00
Konstantin Shcheglov
8751b91062
Rework DillLoader to allow adding multiple dills.
...
This allows us to compose a consistent bundle with SDK and the transitive
closure of required libraries for a libarary, and then compile it
separately (or as a part of its own library cycle).
There is still more data public than I'd like, but I will leave this
clean up fo later.
R=ahe@google.com , kmillikin@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2872903005 .
2017-05-11 08:56:36 -07:00
Konstantin Shcheglov
cc91d04514
Use FileSystem to read files in SourceLoader and TranslateUri.
...
This is a prerequisite for writing fast unit tests, as I would like
to do while working on the incremental kernel driver.
R=ahe@google.com , paulberry@google.com , sigmund@google.com
BUG=
Review-Url: https://codereview.chromium.org/2865843002 .
2017-05-06 13:09:28 -07:00
Zhivka Gucevska
13cb938bc7
Fix issues in interpreter tests
...
BUG=
R=asgerf@google.com
Review-Url: https://codereview.chromium.org/2850413002 .
2017-05-02 11:43:26 +02:00
Paul Berry
29570728a3
Implement Dart 1.0 LUB algorithm (for interface types) in kernel.
...
Note: I intend to implement the full LUB algorithm (including strong
mode behaviors) in front_end, however this piece of the algorithm
makes sense to be in kernel so that it can take advantage of
_ClassInfo.
R=ahe@google.com , johnniwinther@google.com
Review-Url: https://codereview.chromium.org/2848083002 .
2017-05-01 11:25:47 -07:00
Zhivka Gucevska
184cc25766
Add initial tests for Kernel interpreter
...
Add logging in the Interpreter for:
- StaticInvocationExpression, including calls to print
- ReturnStatement
- IfStatement
BUG=
R=dmitryas@google.com
Review-Url: https://codereview.chromium.org/2841803002 .
2017-05-01 16:12:27 +02:00
Sigmund Cherem
26c2f3e17f
Move dartk to the tool folder
...
"bin" is part of the public API of a package, private tools can go under the
`tool` folder. This allows us to use a dev_dependency on analyzer without
exposing a broken import publicly.
I've only moved `dartk` so far (which I expect will be removed once we have a
better API for front_end.
R=asgerf@google.com , kmillikin@google.com
Review-Url: https://codereview.chromium.org/2842643002 .
2017-04-28 15:39:17 -07:00
Asger Feldthaus
ac40d0bb8e
Add typedef AST node boilerplate.
...
This adds the Typedef and TypedefType to the kernel AST,
with the relevant boilerplate.
Typedefs are not implemented in frontend or backend.
R=ahe@google.com , kmillikin@google.com
Committed: https://github.com/dart-lang/sdk/commit/d1c3ee4b35227cb6926f03479a34f82774523773
Review-Url: https://codereview.chromium.org/2825053002 .
2017-04-28 13:26:47 +02:00
Asger Feldthaus
3f1aa32183
Revert "Add typedef AST node boilerplate."
...
This reverts commit d1c3ee4b35 .
TBR
BUG=
Review-Url: https://codereview.chromium.org/2849803002 .
2017-04-28 12:54:19 +02:00
Asger Feldthaus
d1c3ee4b35
Add typedef AST node boilerplate.
...
This adds the Typedef and TypedefType to the kernel AST,
with the relevant boilerplate.
Typedefs are not implemented in frontend or backend.
R=ahe@google.com , kmillikin@google.com
Review-Url: https://codereview.chromium.org/2825053002 .
2017-04-28 12:39:21 +02:00
Sigmund Cherem
06189b271a
loader, target, diet_listener moved
...
from front_end/lib/src/fasta/analyzer/
to analyzer/lib/src/fasta/
analyzer_compile and compile_platform_dartk moved
from front_end/lib/src/fasta/analyzer/
to front_end/tool/_fasta/
front_end/src/fasta/testing/* continues to have some shared testing logic,
- logic to compute the patched sdk is moved up one level
- TestContext, Run, and suite.dart (which depend on analyzer) moved to pkg/front_end/test/fasta/testing/
- only a copy of TestContext is duplicated under pkg/kernel/test/closure/.
R=ahe@google.com , paulberry@google.com
Review-Url: https://codereview.chromium.org/2828583003 .
2017-04-25 13:16:14 -07:00
Paul Berry
e8e8359cdf
Add local type inference logic for integer literals.
...
This CL introduces Fasta's first type inference rule, and hooks it up
to all the necessary testing infrastructure. The rule is that a local
variable whose initializer is an integer literal should have an
inferred type of int.
Only variables occurring at top level within a method are inferred (we
don't yet recurse inside sub-blocks).
Additional type inference rules will be added in follow-up CLs.
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2828693003 .
2017-04-20 03:36:19 -07:00
Peter von der Ahé
433575f618
Remove kernel baseline tests.
...
In CL 2824203002 the associated test cases are moved to pkg/front_end which uses pkg/testing to replace what's implemented in these tests.
R=asgerf@google.com
Review-Url: https://codereview.chromium.org/2824203002 .
2017-04-19 10:22:25 +02:00
Dmitry Stefantsov
cd501b2db3
Switch to Fasta in "golden" tests of closure conversion
...
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2808443002 .
2017-04-07 14:21:04 +02:00
Asger Feldthaus
a3402df15c
[Kernel] Remove code from the old type propagation.
...
BUG=
R=kmillikin@google.com
Review-Url: https://codereview.chromium.org/2780513004 .
2017-03-28 12:43:22 +02:00
Dmitry Stefantsov
9ab86da19c
Add Vector type to Kernel
...
There are four operations that work on Vectors: Vector creation, looking
up an item in a Vector, assigning a value to an item in a Vector, and
copying a Vector. The first three operations are allowed to only use
integer literals as number operands (length for Vector creation, index
for item lookup and assignment). Corresponding AST nodes are created for
these operations.
Vectors are used to represent contexts in Closure Conversion. The parent
context is stored as item 0 in its children contexts. The "golden" tests
for this transformation are adjusted accordingly.
The support for Vectors is added to ast-to-text, ast-to-binary, and
binary-to-ast transformations.
R=asgerf@google.com , kmillikin@google.com
Review-Url: https://codereview.chromium.org/2767773004 .
2017-03-27 15:52:32 +02:00