Commit Graph

4770 Commits

Author SHA1 Message Date
Konstantin Shcheglov 5139a1f85c Move the check for 'locals hides exports' to DillLibraryBuilder.buildAmbiguousBuilder().
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893383002 .
2017-05-22 13:07:43 -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
Konstantin Shcheglov 3859d2eb71 Let printProgramText() to use filter to print only some libraries.
As requested in https://codereview.chromium.org/2886233002/ comment.

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

Review-Url: https://codereview.chromium.org/2893233003 .
2017-05-22 11:10:56 -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é de7edcde74 Fix crash with generalized function types in type tests.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2899693003 .
2017-05-22 14:53:46 +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
Paul Berry d68f6ad603 Add statement hooks to TypeInferenceListener.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2894343002 .
2017-05-20 18:56:59 -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
Peter von der Ahé ef3d2c8ce2 Unsort methods from CL 2872903005.
Review-Url: https://codereview.chromium.org/2894583005 .
2017-05-19 11:17:52 +02:00
Peter von der Ahé 547b2cdcce Implement generalized function types.
Fixes https://github.com/dart-lang/sdk/issues/6972

Fixes https://github.com/dart-lang/sdk/issues/26581

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2876813002 .
2017-05-19 11:03:24 +02:00
Sigmund Cherem ebfd044456 Remove async modifier from outlines
In the future we might want to re-add this, but for now, no one needs to know
that a function was async/async*/sync*. This also allows the async/await
transformer to ignore external references without any special logic.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2888823004 .
2017-05-18 15:20:20 -07:00
Konstantin Shcheglov 510ce4d738 Mix salt into result signatures.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893453005 .
2017-05-17 21:00:07 -07: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
Konstantin Shcheglov 7bc9df585e Move writeOutline() and writeProgram() out of KernelTarget.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2885233003 .
2017-05-17 17:33:46 -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
Paul Berry caa67f9895 Rework TypeInferenceListener.
Parameters are added which point to the expressions being
inferred--this should help with debugging.  Also, printing debug
statements is now enabled by uncommenting a single "with" clause
rather than uncommenting two different print statements.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2888733005 .
2017-05-17 14:16:06 -07:00
Paul Berry f47347d967 Remove the closures used by TypeInferrerImpl.inferInvocation.
It's cleaner to just pass in the Arguments object directly.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2894453002 .
2017-05-17 14:08:39 -07:00
Konstantin Shcheglov bff1e003a8 Move the 'verify' flag to buildProgram().
Also make 'errors' typed.

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

Review-Url: https://codereview.chromium.org/2887163003 .
2017-05-17 13:57:44 -07:00
Konstantin Shcheglov be1f538bf0 Remove 'dumpIr' from writeProgram() and KernelTarget.
Debug output should be done where clients need it, not in shared code.

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

Review-Url: https://codereview.chromium.org/2886233002 .
2017-05-17 12:06: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
Sigmund Cherem cd2ebf70a2 Add dart:html and friends to patched_dart2js_sdk/platform.dill, also fix up
warnings on these libraries.

R=sra@google.com

Review-Url: https://codereview.chromium.org/2885103005 .
2017-05-17 10:58:30 -07:00
Paul Berry 28ed82075e Fix a type inference corner case: return expression where void expected.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2888073003 .
2017-05-17 10:01:18 -07:00
Paul Berry 58566c5488 Perform type inference directly within kernel shadow infer() methods.
Previously we deferred to methods in the TypeInferrerImpl object, on
the theory that we would want to share this code with analyzer AST
type inference.  But we are no longer planning to do that, so the
indirection is just cumbersome.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2890803002 .
2017-05-17 08:38:09 -07:00
Konstantin Shcheglov ae10e16d71 Fixes for review comments.
R=sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2889693004 .
2017-05-17 08:31:07 -07:00
Paul Berry 830be5727d Minor type inference fixes to do with null and bottom types.
This CL makes the following fixes:

- Updates analyzer's front_end_inference_test to represent the bottom
  type as "<BottomType>" (consistent with Kernel).

- Implements type inference of "throw" expressions.

- Does not coerce bottom to dynamic when inferring the return type of
  a closure.

- Does not coerce Null to dynamic when inferring the return type of a
  block closure.

- Ignores bare "return;" statements when inferring the return type of
  a block closure.

- Infers Null when a block closure lacks "return <expression>;"
  statements.

- Implements correct rules for LUB(Null, x), by treating Null as
  bottom.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2886873005 .
2017-05-17 05:36:11 -07:00
Konstantin Shcheglov 6c8733dcbd Fix for the compilation error.
Somehow was not displayed in my analysis view :-(

TBR

R=sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2886993003 .
2017-05-16 19:11:40 -07:00
Paul Berry 72d3fbc85f Implement type inference of static invocations.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2885963002 .
2017-05-16 18:33:24 -07:00
Konstantin Shcheglov 43cea08f6d Fixes for review comments.
R=sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2889463002 .
2017-05-16 17:27:37 -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
Paul Berry 798890256f Refactor common code between method and constructor inference.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2890633002 .
2017-05-16 14:09:04 -07:00
Konstantin Shcheglov 87680e5923 Fix computing export scopes for library cycles and after loading.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2885883002 .
2017-05-16 11:37:57 -07:00
Konstantin Shcheglov 97cf17c322 Compute export namespaces for DILL libraries.
R=ahe@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2886563002 .
2017-05-16 10:02:43 -07:00
Paul Berry 6a48f79ba3 Disable type erasure during strong mode tests.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2883343002 .
2017-05-16 09:47:21 -07:00
Paul Berry d99ba36b5e Remove generic parameters from type inference classes.
Previously, these classes were generic because we anticapted re-using
them with analyzer AST objects in order to do analyzer type inference.
But we've decided on a new technique for doing analyzer type
inference: infer at the kernel level and then transfer the inference
data to analyzer using the TypeInferenceListener.

So the generic parameters are no longer needed.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2885873002 .
2017-05-16 09:34:53 -07:00
Paul Berry 77f349880c Add a comment to refer to bug #29629.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2886783003 .
2017-05-16 08:55:14 -07:00
Dan Rubel 278c7bfbeb merge fasta.Token into analyzer.Token
This eliminates much of the duplication between the two token hierarchies
by merging much of the fasta.Token hierarchy into the analyzer.Token.

* merge token hierarchies
* cleanup fasta.Token.copy()
* set preceedingComments field via constructor
* replace isBuiltInIdentifier --> type.isBuiltIn
* change all fasta.Token references to analyzer.Token
* move fasta.Token.value() implementation into analyzer.SimpleToken

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2890523002 .
2017-05-16 11:50:14 -04:00
Konstantin Shcheglov e118615103 Include only changed or affected libraries into delta.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2885743002 .
2017-05-16 08:49:48 -07:00
Paul Berry 51eb5cef42 Minor type inference fixes.
- Add num::== and Iterable::where to analyzer mock SDK.

- Do not default parameter types to dynamic in BodyBuilder or
  KernelFormalParameterBuilder.  This is now handled by the
  KernelVariableDeclaration constructor.

- Only infer function expression parameter types in strong mode.

- Record inferred function expression parameter types to
  instrumentation.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2886443003 .
2017-05-16 08:42:25 -07:00
Dan Rubel d566906167 cleanup unused incremental resolution
* remove unused analyzer incremental resolution
* remove unused Token.applyDelta method

Patch Set 1 is the original CL that was landed and reverted
https://codereview.chromium.org/2876993005

Patsh Set 2 contains additional fixes and test changes

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2884853002 .
2017-05-16 07:53:17 -04:00