Commit Graph

2004 Commits

Author SHA1 Message Date
Dan Rubel 6907345fb9 improve fasta unterminated string recovery
* enhance handling of unterminated strings
* update ast builder and string validator to handle unterminated strings

Review-Url: https://codereview.chromium.org/2906193004 .
2017-05-28 23:35:32 -04:00
Paul Berry e4042e5de2 Implement type inference for await expressions in front_end.
This required implementing FutureOr rules in
type_constraint_gatherer.dart.  It also required fixing an incorrect
type in analyzer's mock SDK, which had some follow on effects on
analyzer unit tests.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2904263003 .
2017-05-27 07:30:46 -07:00
Paul Berry 5d69e056d3 Add type inference support for "call" invocations of function expressions.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2911683003 .
2017-05-26 13:34:42 -07:00
Paul Berry d859cc6e4e Add type inference logic for map literals
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2905353002 .
2017-05-26 13:09:53 -07:00
Paul Berry 3c730528fc Treat type inference context dynamic as equivalent to an empty context.
This replicates analyzer behavior.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2903153006 .
2017-05-26 11:26:35 -07:00
Dan Rubel 8928329339 improve fasta interpolation recovery
* improve fasta interpolation recovery by adding closing brace
    for unterminated string
* update analyzer scanner test because fasta does not support
    does not support \r line endings

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2910583002 .
2017-05-26 08:43:48 -04:00
Paul Berry f60bad7fbc Fix type inference of redirecting factory constructor invocations.
Their types should be inferred based on the initial target of the
invocation, not the redirected target.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2904133002 .
2017-05-25 17:19:20 -07:00
Paul Berry ee6fd5e1a3 Perform type inference on redirecting initializers (C() : this(...);).
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2905163002 .
2017-05-25 14:47:53 -07:00
Paul Berry 069e1bda1c Correctly infer the return context while compiling a factory constructor.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2907643003 .
2017-05-25 14:17:59 -07:00
Konstantin Shcheglov 30b51f7403 Files are added with absolute URIs, but invalidated with file URIs.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2907673002 .
2017-05-25 13:42:18 -07:00
Paul Berry cefc4cc768 Perform type inference on explicitly typed fields.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2905123002 .
2017-05-25 13:22:26 -07:00
Paul Berry 1e45167514 Update strong mode expectations to reflect kernel type parameter conventions.
When outputting the name of a type parameter, Kernel follows two
special conventions:

- It fully qualifies the name of the type parameter with respect to
  the scope of its declaration; so for example a type parameter `T` of
  a class `C` in a library `lib` might be annotated as `lib::C::T`.

- Within a factory constructor, type parameters of the class are
  annotated as though they are type parameters of the factory
  constructor (this is because factory constructors are represented in
  kernel as static methods).

This CL adjusts the strong mode type inference tests to reflect this
behavior (and modifies analyzer's front_end_inference_test so that
follows the kernel conventions).

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2909503004 .
2017-05-25 11:11:14 -07:00
Paul Berry 560cf61b3b Add type inference logic for cascade expressions.
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2903243002 .
2017-05-25 09:30:26 -07: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 8a92a2a79c Infer the types of initializing formals from the corresponding fields.
This inference is enabled for both strong and non-strong mode, since
it is mandated by the Dart 1.0 spec.

R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2908453002 .
2017-05-25 04:47:44 -07:00
Dan Rubel 54d6e3a1c5 cleanup fasta token classes
* replace fasta.SymbolToken --> analyzer.Token
* replace fasta.BeginGroupToken --> analyzer.BeginToken
* replace fasta.SymbolToken.eof --> analyzer.Token.eof

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2899043006 .
2017-05-25 07:26:50 -04:00
danrubel 498a39ed61 delete obsolete scanner roundtrip test
Review-Url: https://codereview.chromium.org/2900303003 .
2017-05-24 21:07:25 -04:00
Konstantin Shcheglov 97d587520c Add LimitedBinaryPrinter, tests and switch incremental generator to it.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2896493002 .
2017-05-24 16:17:28 -07:00
Dan Rubel 136698a734 remove fasta <--> analyzer token translation
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2902813005 .
2017-05-24 17:34:08 -04:00
Dan Rubel dff793d05f update lazy assignment operators
and remove scanLazyAssignmentOperators flag

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2903063003 .
2017-05-24 17:05:02 -04:00
Paul Berry a21b9e5638 Remove AstFactory from the front end.
R=ahe@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2904673003 .
2017-05-24 11:28:12 -07:00
Dan Rubel 6e981d0cbf enable analyzer scanner adapter generic method support
This turns on generic method support in the scanner adapter layer
and updates the token.offset when the analyzer scanner
is being used to parse generic method comments.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2900963009 .
2017-05-24 13:37:52 -04:00
Paul Berry 6b100c007b Use declared return type for inference of return and yield statements.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2899073004 .
2017-05-24 09:28:26 -07:00
Peter von der Ahé ddf5fc23f1 Improve analysis coverage.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2904483002 .
2017-05-24 15:52:42 +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é b6a78795e4 Fix various semantic nits that Fasta will detect.
R=johnniwinther@google.com, paulberry@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2897003003 .
2017-05-24 11:43:18 +02:00
Paul Berry 54bd8a79c4 Fix top level type inference in the event that there are circularities.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2900193002 .
2017-05-23 14:01:46 -07:00
Paul Berry b16b0e8edb Fix type inference of yield* statements
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2898313002 .
2017-05-23 13:10:40 -07:00
Konstantin Shcheglov 77d4eb609b Use LibraryIndex in CoreTypes instead of extending it.
A smaller step this time - change only clients, but keep implementation
the same for now.

Not all patched SDKs have all classes and procedures, so I have to make
some them lazy. All of them could be done for consistency, but this
might slightly affect performance for often used dart:core classes.

Also it's a bit of mess now.
Maybe group these classes into logical structures, coreTypes.core.list,
coreTypes.async.future, coreTypes.async.futureMicrotask, etc. Something
like it was before this change, but fixed types and names instead of
more flexible (but in general slower) strings.

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

Review-Url: https://codereview.chromium.org/2890933002 .
2017-05-23 09:30:37 -07:00
Konstantin Shcheglov 0cfdae6182 Beef up front-end mock SDK libraries, mostly dart:core.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893423002 .
2017-05-22 14:49:55 -07:00
Konstantin Shcheglov b14be9d1ce Add a test for including all libraries from changed to the entry point.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2899883002 .
2017-05-22 14:44:47 -07:00
Paul Berry 79b4382784 Fix type inference of assignments to local variables.
If the variable's type was inferred, the inferred type should be used
as the inference context for the RHS expression.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2900873002 .
2017-05-22 12:54:29 -07:00
Paul Berry 37db02a355 Add some type inference for "yield" statements.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2899833002 .
2017-05-22 11:38:20 -07:00
Paul Berry 4b9485db73 Fix type inference of factory constructor invocations.
Factory constructors are represented as static methods with dynamic
return type; in order to type infer them properly we must use the type
of the enclosing class as the return type (with type parameters
substituted appropriately).

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2900553003 .
2017-05-22 11:18:33 -07:00
Peter von der Ahé 6715900e09 Fix incremental kernel generator.
Review-Url: https://codereview.chromium.org/2896003002 .
2017-05-22 18:01:50 +02:00
Peter von der Ahé 4fddc2e4d5 Move code for instantiating Invocation to Target.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2897683002 .
2017-05-22 15:59:06 +02:00
Peter von der Ahé 8f17ae7709 Update status and expectations.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2900753002 .
2017-05-22 15:22:38 +02:00
Paul Berry bf15116d0f Handle FutureOr type when inferring async closures.
R=asgerf@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2892593005 .
2017-05-20 20:16:59 -07:00
Dan Rubel 3c447ab35d add fasta.scanner support for lazy assignment operators
R=paulberry@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2895803002 .
2017-05-20 23:02:47 -04:00
Paul Berry 4e3f10669d Flatten futures when inferring the type of an async function expression.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2895063003 .
2017-05-20 20:00:18 -07:00
Konstantin Shcheglov d7be9e36e8 Local declarations take precedence over exports.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2894183002 .
2017-05-20 18:35:52 -07:00
Sigmund Cherem 011f8c5873 Reapply CL: first step for modular support in fasta
BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2894283002 .
2017-05-19 19:47:37 -07:00
Konstantin Shcheglov 658ff7ba99 Remove IncrementalResolvedAstGenerator.
It is not used anymore, and there is a compilation errors accidentally
introduced. So, I guess it is easier to remove it than to fix it.

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

Review-Url: https://codereview.chromium.org/2892203003 .
2017-05-19 15:07:27 -07:00
Sigmund Cherem 54dcc29835 Revert "First step for modular output in fasta."
This reverts commit d9e9382373.

There were bot failures on incremental_kernel_generator test and in
incremental_resolved_ast_test, I'm not sure yet why tests passed locally though.

BUG=

Review-Url: https://codereview.chromium.org/2894273002 .
2017-05-19 15:02:48 -07:00
Sigmund Cherem d9e9382373 First step for modular output in fasta.
Some details:
 - Adds the tree-shaker logic and unit tests for it,

   Note: I'm still not clear on what degree of tree-shaking we can get away
   with. For now I have a mode to delete anything that is not seen explicitly.
   This passes verification for all of our tests so far, but breaks both the
   mixin and the async/await transformer in some scenarios.

 - Writes a prototype of kernelForBuildUnit (although no automated tests for it
   yet).

 - Moves a few more pieces to ProcessedOptions

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2893493004 .
2017-05-19 13:59:15 -07:00
Peter von der Ahé f19e46e946 Update Listener implementations.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2892173002 .
2017-05-19 13:32:23 +02:00
Paul Berry 8c04f1a7f9 Revert "Flatten futures when inferring the type of an async function expression."
This reverts commit a0d98fe474.

This should address failures in the buildbot "vm-kernel-linux-release-x64-be".

TBR=scheglov@google.com

Review-Url: https://codereview.chromium.org/2893813002 .
2017-05-17 20:24:37 -07:00
Paul Berry a0d98fe474 Flatten futures when inferring the type of an async function expression.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2890083002 .
2017-05-17 14:56:03 -07:00
Konstantin Shcheglov abc656f3c3 Fix for resolving 'bar.dart' against 'dart:foo'. Test for TranslateUri.
This allows us to compile more libraries, although we still cannot
compile pkg/analyzer. We use too much memory, and there might be another
bug - it got into infinite loop.

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

Review-Url: https://codereview.chromium.org/2890883002 .
2017-05-17 11:33:55 -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