Commit Graph

4770 Commits

Author SHA1 Message Date
Peter von der Ahé 4b47b10a77 Move buildMethodInvocation to BodyBuilder.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2906333002 .
2017-05-31 15:30:54 +02:00
Peter von der Ahé cdfd07b9d3 Don't read platform files during testing, and avoid trimming broken programs.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2912353002 .
2017-05-31 15:03:30 +02:00
Peter von der Ahé 8ea78cbc3f Avoid using Invalid{Statement,Expression,Initializer}.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2906253004 .
2017-05-31 14:53:44 +02:00
Peter von der Ahé 29dac16eba Clean up shared names.
R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2909013002 .
2017-05-31 11:08:30 +02:00
Paul Berry b89e8cd1a1 Fix inferInvocation for top level inference.
When inferring the type of an invocation for top level inference, if
type parameters are not specified, then it is an error.  So we should
not recurse into subexpressions (even if inferenceNeeded is `true`).
This avoids confusion by making it clear to the user that we don't
take subexpressions into account when doing top level type inference,
even when recovering from type inference errors.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2911323002 .
2017-05-30 14:43:06 -07:00
danrubel f3a79c4e4e update fasta StringToken.toString to make formatter happy
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2915593004 .
2017-05-30 16:55:08 -04:00
Paul Berry 0017ffd872 Change the approach of front_end top level inference to match the spec.
Specifically, we can't walk all the subexpressions when doing top
level inference, or we will pick up bogus dependencies.  This means
that we can't determine the dependencies during BodyBuilder execution;
we have to do it in a follow-up pass once we have the AST.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2913743003 .
2017-05-30 13:42:12 -07:00
Konstantin Shcheglov 0dd81884bf Perform MixinFullResolution only for source libraries.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2912503003 .
2017-05-30 09:33:26 -07:00
Peter von der Ahé 9497f5d3f8 Remove accessor properties not used by Fasta.
R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2908123002 .
2017-05-30 13:08:31 +02:00
Peter von der Ahé 4cd8e437f6 Various constant checks.
R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2908113002 .
2017-05-30 12:44:57 +02:00
Paul Berry 6a809aa432 Add type inference logic for "for-in" loops.
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2908973002 .
2017-05-29 07:35:46 -07:00
Peter von der Ahé 0eae9218f4 Complain about duplicated names.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2902113005 .
2017-05-29 09:45:05 +02:00
Dan Rubel 767d5ecbfd Revert "improve fasta unterminated string recovery"
This reverts commit 6907345fb9.

Review-Url: https://codereview.chromium.org/2907093002 .
2017-05-28 23:40:08 -04:00
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 9a64339646 Change dependency walker's Node.dependencies to a static getter.
This prevents it from being accidentally overridden in a derived class.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2907023003 .
2017-05-27 21:27:21 -07: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 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é 9b4bc8b0ff Read file names from libraries.json, not URIs.
R=danrubel@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2906673002 .
2017-05-25 16:20:05 +02:00
Peter von der Ahé bcb2ea962b Complain about function literals not being constant expressions.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2899343002 .
2017-05-25 16:02:30 +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 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
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
Konstantin Shcheglov 2b8fd9dee8 Transform async code only for source libraries.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2905463002 .
2017-05-24 15:51:18 -07: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
Sigmund Cherem 9fd47a08d1 Address follow up comments
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2902643002 .
2017-05-24 11:20:40 -07:00
Sigmund Cherem 5f8bc4feb2 fasta: revert check for null fileUri in the error reporting of the verifier.
(as discussed in https://codereview.chromium.org/2894283002, we are reverting
this because we don't know how to reproduce this issue anymore. When it comes up
again we can either fix the issue or re-revert and include an explanation).

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2902153003 .
2017-05-24 11:17:15 -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
Paul Berry b9b949f436 Use FutureOr as the return context in async closures.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2898373004 .
2017-05-24 08:24:13 -07: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é 61d855bb47 Prepare for development branch by updating externally-used API.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2898183002 .
2017-05-24 14:32:45 +02:00
Peter von der Ahé 9ed1ba2c12 Temporarily uncomment logEvent to make build bot green.
Review-Url: https://codereview.chromium.org/2901273002 .
2017-05-24 12:04:19 +02:00
Peter von der Ahé f5012090f9 New parser event needed to check case expressions.
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2900993002 .
2017-05-24 11:48:42 +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
Paul Berry a3e11d2e6e Always record inference of implicit function expression params, even if dynamic.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2904653002 .
2017-05-23 12:32:49 -07:00
Paul Berry 0d31c8c524 Populate TypeInferrerImpl.closureContext more frequently.
Previously, we only used a ClosureContext in the case where the
innermost function being inferred was a function expression.  This
meant that we couldn't use the declared return type as the context for
`return` or `yield` statements in any other sort of function.  As a
first step towards fixing that, this CL makes the following changes:

- The entry point to type inference is now a separate
  TypeInferrer.inferFunctionBody method rather than re-using
  TypeInferrer.inferStatement; this gives us an opportunity to set up
  the context.

- Some of the logic from KernelFunctionExpression._inferExpression
  (particularly to do with asynchronous and generator functions) is
  moved to ClosureContext so that it can be used for other sorts of
  functions.

- The only time TypeInferrerImpl.closureContext is ever `null` is now
  when inferring a top level or field initializer expression, so we
  can eliminate some null checks from
  KernelReturnStatement._inferStatement and
  KernelYieldStatement._inferStatement.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2902683004 .
2017-05-23 11:21:45 -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 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