Konstantin Shcheglov
02c1a3bc54
[TBR] Restore try/catch for FileSystemException in TranslateUri.
...
I need to add exceptions to FileSystem and switch everything to FS.
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2864913002 .
2017-05-06 19:55:29 -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
Paul Berry
893a08c8dc
Implement type inference of constructor invocations in Fasta.
...
Fixes 68 inference tests.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2865623003 .
2017-05-05 11:58:56 -07:00
Paul Berry
350e93b1a8
Fix handling of null/bottom in front_end type inference.
...
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2863603004 .
2017-05-05 07:02:17 -07:00
Paul Berry
de32b9a32a
Hook up full list literal type inference logic.
...
AFAIK this is the full algorithm for list literal inference. But some
list literal tests still don't pass. I will investigate and fix in
future CLs.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2863733003 .
2017-05-05 04:23:39 -07:00
Paul Berry
a59bff3423
Implement inferGenericFunctionOrType in front_end.
...
R=jmesserly@google.com , scheglov@google.com
Review-Url: https://codereview.chromium.org/2863833002 .
2017-05-04 18:21:53 -07:00
Paul Berry
28f277a7e2
Implement inferTypeFromConstraints in front_end.
...
This is an intermediate algorithm used in type inference. It
corresponds to the method _GenericInferrer.infer() in analyzer.
R=jmesserly@google.com , scheglov@google.com
Note: error reporting will be added in a follow-up CL.
Review-Url: https://codereview.chromium.org/2863823002 .
2017-05-04 16:32:32 -07:00
Paul Berry
c376a45f91
Implement instantiateToBounds in front_end.
...
R=scheglov@google.com
Note: error reporting will be added in a follow-up CL.
Review-Url: https://codereview.chromium.org/2866543002 .
2017-05-04 15:23:20 -07:00
Paul Berry
3c04fa0007
Get astBuilder and typeInferenceEngine from SourceLoader.
...
This avoids some unnecessary plumbing.
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2850683004 .
2017-05-04 13:46:10 -07:00
Konstantin Shcheglov
a3db98c5de
Infer VariableSet types.
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2855323004 .
2017-05-04 13:37:02 -07:00
Konstantin Shcheglov
888097781b
Create KernelVariableDeclaration for formal parameters.
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2860173002 .
2017-05-04 13:32:35 -07:00
Konstantin Shcheglov
f7c8c7e3ef
Infer AsExpression types.
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2862043002 .
2017-05-04 13:27:47 -07:00
Paul Berry
3bfa3a21f7
Minor tweaks to type_constraint_gatherer.dart.
...
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2862063002 .
2017-05-04 13:22:49 -07:00
Sigmund Cherem
938d1ba524
Implement the kernel_generator API using fasta
...
BUG=
R=paulberry@google.com
Review-Url: https://codereview.chromium.org/2856223003 .
2017-05-04 12:02:05 -07:00
Kevin Millikin
04f7ba272a
Remove the Kernel setup_builtin_library transformation
...
This transformation replaces the body of _getMainClosure in
dart:_builtin with `return main` for the script's main if there is one
and removes the body if there is no main.
Without this transformation fasta will compile `return null` and dartk
will compile `return throw new NoSuchMethodError...`. Both of these
patterns will be patched in the VM when dart:_builtin is compiled from
Kernel.
BUG=
R=sigmund@google.com
Review-Url: https://codereview.chromium.org/2861023002 .
2017-05-04 20:29:44 +02:00
Konstantin Shcheglov
fe21d9fa62
Inference for typed ListLiteral(s).
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2856363002 .
2017-05-04 08:56:27 -07:00
Konstantin Shcheglov
9a34ac9f27
Type inference for StringConcatenation.
...
The test simple_literal_string was replaced with string_literal.
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2855403002 .
2017-05-04 08:47:12 -07:00
Paul Berry
932a749bbc
Begin implementing subtype matching for type inference.
...
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2856383003 .
2017-05-04 08:40:45 -07:00
Konstantin Shcheglov
b567aeaeef
Change Accessor(s) to use AstFactory to create MethodInvocation, PropertyGet/Set.
...
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2857133004 .
2017-05-03 14:10:54 -07:00
Paul Berry
45d06d718c
Fix prepareTopLevel's initialization of classHierarchy.
...
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2854333003 .
2017-05-03 10:50:44 -07:00
Paul Berry
d842f35bb2
Add a strong mode implementation of LUB to fasta; use it to infer ?:
...
R=ahe@google.com , leafp@google.com
Review-Url: https://codereview.chromium.org/2849213002 .
2017-05-03 10:36:47 -07:00
Konstantin Shcheglov
ec4c247efb
Add KernelXyzExpression stubs and factory methods.
...
Some of the factories methods don't accept yet enough tokens, and fileOffset(s) for them are set externally.
Also PropertyGet, SuperPropertySet, MethodInvocation which are used in accessors, are not converted yet.
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2861523003 .
2017-05-03 08:50:42 -07:00
Konstantin Shcheglov
3820e630ca
Create NullLiteral using AstFactory in BodyBuilder.
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2856893002 .
2017-05-03 08:38:19 -07:00
Konstantin Shcheglov
6885aea0db
Infer types of bool/null/string literals.
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2849293002 .
2017-05-01 19:33:31 -07:00
Sigmund Cherem
de36d11817
Add support for building patched_sdk and platform.dill for dart2js:
...
- defines a .gn target for patched_dart2js_sdk
- changes patch_sdk.dart to handle a dart2js target
- adds support in fasta to understand the `native` clause still used by dart2js
- add option to fasta to know whether it is generating kernel for the vm or dart2js
I'm not excited about how I added the target distinction in fasta, the reason I
did so is that it affects the behavior in several ways: in how we handle
`native`, in the libraries that are included by default in the platform.dill file,
and in the transformations that need to be done. I'm happy to change the
approach.
BUG=
R=ahe@google.com , vegorov@google.com , zra@google.com
Committed: https://github.com/dart-lang/sdk/commit/714523b103598d49295fa06b4ad13c6917c50399
Review-Url: https://codereview.chromium.org/2832353002 .
2017-05-01 17:23:02 -07:00
Konstantin Shcheglov
3604e69951
Infer types of double literals.
...
I'm also adding simple_* tests for integer and double literals, because
as it is now, existing tests are more complex, and we don't see whether
these basic features work.
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2853113002 .
2017-05-01 14:16:25 -07:00
Konstantin Shcheglov
37092ed677
New tests and improvements for generics in comments parsing.
...
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2856463004 .
2017-05-01 12:52:09 -07:00
Sigmund Cherem
e9cd0b0fa5
Revert "Add support for building patched_sdk and platform.dill for dart2js:"
...
This reverts commit 714523b103 .
TBR=ahe@google.com ,vegorov@google.com
Review-Url: https://codereview.chromium.org/2849183002 .
2017-05-01 10:29:26 -07:00
Sigmund Cherem
714523b103
Add support for building patched_sdk and platform.dill for dart2js:
...
- defines a .gn target for patched_dart2js_sdk
- changes patch_sdk.dart to handle a dart2js target
- adds support in fasta to understand the `native` clause still used by dart2js
- add option to fasta to know whether it is generating kernel for the vm or dart2js
I'm not excited about how I added the target distinction in fasta, the reason I
did so is that it affects the behavior in several ways: in how we handle
`native`, in the libraries that are included by default in the platform.dill file,
and in the transformations that need to be done. I'm happy to change the
approach.
BUG=
R=ahe@google.com , vegorov@google.com
Review-Url: https://codereview.chromium.org/2832353002 .
2017-05-01 10:11:42 -07:00
Erik Corry
aa6353b6da
Dart SDK Spelling b, c, and d.
...
R=kmillikin@google.com
BUG=
Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +02:00
Sigmund Cherem
f8fbff7322
Extend file-system abstraction with a couple methods, remove context.
...
New methods:
- exists: I'll be using it for input validation among other things
- lastModified: I'll be using this on some utilities to support the incremental
API.
BUG=
R=paulberry@google.com
Committed: https://github.com/dart-lang/sdk/commit/99ab24f628b23f248582874a6987883ab76c3195
Committed: https://github.com/dart-lang/sdk/commit/102de9e476bcd2b17f35604a7a3e442b28e14194
Review-Url: https://codereview.chromium.org/2844903002 .
2017-04-28 15:57:06 -07:00
Konstantin Shcheglov
f2f1c60904
Add 'scanGenericMethodComments' parameter to constructors and scan() functions.
...
R=ahe@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2850853004 .
2017-04-28 14:47:29 -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
Dmitry Stefantsov
95f15308c8
Revert "Extend file-system abstraction with a couple methods, remove context."
...
This reverts commit 102de9e476 .
TBR=sigmund@google.com
Review-Url: https://codereview.chromium.org/2850533004 .
2017-04-28 12:50:41 +02:00
Sigmund Cherem
102de9e476
Extend file-system abstraction with a couple methods, remove context.
...
New methods:
- exists: I'll be using it for input validation among other things
- lastModified: I'll be using this on some utilities to support the incremental
API.
BUG=
R=paulberry@google.com
Committed: https://github.com/dart-lang/sdk/commit/99ab24f628b23f248582874a6987883ab76c3195
Review-Url: https://codereview.chromium.org/2844903002 .
2017-04-27 15:05:10 -07:00
Sigmund Cherem
6ce9d4e1fb
Revert "Extend file-system abstraction with a couple methods, remove context."
...
This reverts commit 99ab24f628 .
Tests failed under `--use-sdk`. Fix is simple, but the affected tests seem to
be failing because of another CL as well.
TBR=brianwilkerson@google.com ,paulberry@google.com
Review-Url: https://codereview.chromium.org/2852463004 .
2017-04-27 14:46:40 -07:00
Dan Rubel
dc19d42c54
change fasta.Token.isIdentifier() from method to getter
...
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2839403004 .
2017-04-27 17:38:54 -04:00
Sigmund Cherem
99ab24f628
Extend file-system abstraction with a couple methods, remove context.
...
New methods:
- exists: I'll be using it for input validation among other things
- lastModified: I'll be using this on some utilities to support the incremental
API.
BUG=
R=paulberry@google.com
Review-Url: https://codereview.chromium.org/2844903002 .
2017-04-27 14:01:10 -07:00
Konstantin Shcheglov
0fe8546217
Rollback instrumentation during analysis and validate resolved ASTs instead.
...
R=brianwilkerson@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2846883005 .
2017-04-27 10:30:19 -07:00
Paul Berry
748e7c8ded
Extend pkg/front_end/lib/src/fasta/kernel/verifier.dart to check for UnknownType.
...
UnknownType should only ever appear in the type schemas used by type
inference; it should not show up in a completed program.
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2843333005 .
2017-04-27 09:58:22 -07:00
Paul Berry
2d508dcc9c
Add a clarifying comment explaining why UnknownType.accept() doesn't throw.
...
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2842283002 .
2017-04-27 08:36:21 -07:00
Paul Berry
046a62a54f
Remove AstFactory.field()
...
This method doesn't really belong in AstFactory, because it's not used
by BodyBuilder; it's used by KernelFieldBuilder, which always builds
kernel objects. We only need to abstract the objects that are created
by BodyBuilder, since only BodyBuilder is going to have to be capable
of building analyzer ASTs.
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2842273002 .
2017-04-26 13:47:59 -07:00
Konstantin Shcheglov
cf013c6469
Instrument analyzer's type analysis and run front_end inference tests.
...
R=brianwilkerson@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2846463003 .
2017-04-26 13:31:10 -07:00
Paul Berry
d7031ce9bf
Change accessors and AstFactory to use tokens rather than file offsets.
...
This is a necessary prerequisite for re-using BodyBuilder to make
analyzer ASTs, since analyzer ASTs use tokens rather than offsets to
keep track of file positions.
R=ahe@google.com
Review-Url: https://codereview.chromium.org/2841863002 .
2017-04-26 13:29:42 -07:00
Konstantin Shcheglov
27b4b36b86
A couple of tweaks in ValidatingInstrumentation.
...
R=brianwilkerson@google.com , paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2843103002 .
2017-04-26 13:09:34 -07:00
Paul Berry
324d60d764
Add type schema elimination logic.
...
As defined in https://github.com/dart-lang/sdk/pull/29371/files
R=leafp@google.com
Review-Url: https://codereview.chromium.org/2837093002 .
2017-04-26 12:56:13 -07:00
Dan Rubel
3b790e5311
new TokenType and Keyword API
...
This adds two new methods and adapts most of the old references
to use these new API. Once all call sites have been updated,
the old API can be removed.
This is part one of https://codereview.chromium.org/2842643004/
* replace type == TokenType.KEYWORD with type.isKeyword
* change Keyword.syntax --> Keyword.lexeme
R=paulberry@google.com , scheglov@google.com
Review-Url: https://codereview.chromium.org/2842213003 .
2017-04-26 15:53:58 -04:00
Paul Berry
78c1cad702
Simplify BodyBuilder's Identifier class.
...
This class doesn't need to extend InvalidExpression as long as we make
sure that it is never seen by toValue().
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2845723002 .
2017-04-26 12:50:44 -07:00
Paul Berry
d30c7e7650
Rename TypeInferrerImpl._context to _closureContext; make null outside of closures.
...
R=scheglov@google.com
Review-Url: https://codereview.chromium.org/2839193003 .
2017-04-26 11:40:07 -07:00
Konstantin Shcheglov
7343bfacbd
Reorder parameters in Instrumentation.record().
...
R=paulberry@google.com
BUG=
Review-Url: https://codereview.chromium.org/2839003002 .
2017-04-25 15:06:41 -07:00