Commit Graph

4276 Commits

Author SHA1 Message Date
Leaf Petersen 651221bb82 Resolve ordering issues.
This CL changes the way that the task model does strong mode inference to use the strongly connected components in the import/export graph.  Library cycles are computed and inference is staged by forcing each stage of inference to happen across an entire library cycle at once, and to force all external dependencies of a library cycle to have completed inference before inference for the library cycle can begin.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1386023002 .
2015-10-07 16:14:35 -07:00
John McCutchan 98638457ce Remove final users of dart:profiler library
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/1394533002 .
2015-10-07 09:27:22 -07:00
Paul Berry e40b231771 Make ResolveVariableReferencesTask depend on RESOLVED_UNIT3.
Technically, ResolveVariableReferencesTask only requires the
information guaranteed by RESOLVED_UNIT1 to do its job.  However,
later tasks, such as ResolveFunctionBodiesInUnitTask, require the
information computed by ResolveUnitTypeNamesTask (which produces
RESOLVED_UNIT3).  Normally this is not a problem, because
ResolveFunctionBodiesInUnitTask depends (via a rather complex
dependency chain) upon LIBRARY_ELEMENT5, which in turn depends on
ResolveLibraryTypeNamesTask, which depends on RESOLVED_UNIT3.  So
ResolvuUnitTypeNamesTask winds up getting run.

However, it's possible that due to analysis cache pressure, the
resolved unit will get thrown away, while the library element is
preserved.  If this happens, then when the resolved unit is being
recomputed, it won't be necessary to run ResolveLibraryTypeNamesTask
in order to recompute LIBRARY_ELEMENT5 (becase LIBRARY_ELEMENT5 is
still cached).  As a result, nothing is left that depends on
RESOLVED_UNIT3, so there is nothing to force ResolveUnitTypeNamesTask
to run.

The outward manifestation of this problem is that when trying to
resolve a library, a TypeName will be found whose ".type" property is
unexpectedly null, causing an exception in the ResolverVisitor.

The easy fix is to make ResolveVariableReferencesTask depend on
RESOLVED_UNIT3, so there is a complete dependency chain through all
the RESOLVED_UNIT[N] results that doesn't rely on any
LIBRARY_ELEMENT[N] intermediates.

This is not an ideal fix because it forces us to compute
RESOLVED_UNITs 2 and 3 even if they might not be needed.  Fortunately,
computing these RESOLVED_UNITs should be fast, so I don't expect a
significant performance penalty.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1386363002 .
2015-10-06 18:21:12 -07:00
pq fe76c6f3c4 Lint support for the new task model.
Related bug: https://github.com/dart-lang/analyzer_cli/issues/64

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1385293002 .
2015-10-06 16:45:45 -07:00
Konstantin Shcheglov 4e6195fdf5 Issue 24514. Set documentation range for LibraryElement.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24514

Review URL: https://codereview.chromium.org/1390003002 .
2015-10-06 16:13:57 -07:00
pq 90e975b656 Suppress scanner errors for non-existent URIs.
Fixes #23754.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1378503003 .
2015-10-06 10:25:50 -07:00
Konstantin Shcheglov ef434d6a9b Issue 24503. Disable type overrides for properties.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/24503

Review URL: https://codereview.chromium.org/1386033003 .
2015-10-06 08:40:02 -07:00
Konstantin Shcheglov c4427ca8f4 Fix for incremental resolver - changing field formal parameter name is sometimes a non-incremental change.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1374313007 .
2015-10-06 08:35:07 -07:00
Brian Wilkerson 04c5a5f199 Clean up hints
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1382403002 .
2015-10-05 09:20:44 -07:00
Konstantin Shcheglov 0ff03b00b8 Add the 'docRange' property and use it to compute documentation comment.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1376473007 .
2015-10-02 15:13:30 -07:00
Brian Wilkerson 66a122a9db Stop defensively copying AST structures before resolution
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1383043002 .
2015-10-02 12:38:18 -07:00
Konstantin Shcheglov 28e7dbf876 Don't make defensive copies of 'definedNames'.
This change reduces total analysis time by 13%.
For analyzer + analysis_server.
For the third full analysis, i.e. not cold VM.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1370993009 .
2015-10-02 10:15:24 -07:00
John Messerly a8570d9e7c fixes strong mode assignability
this fixes https://github.com/dart-lang/dev_compiler/issues/356

The issue here is that StrongTypeSystemImpl has toType and fromType backwards from how they are defined on the base class.
The way it works is to read it as "is the first type assignable to the second type"?

(I can see how this may have happened: the base class uses "leftType" and "rightType", which refers to the parameter order, not the order they would appear in an assignment expression.)

R=leafp@google.com

Review URL: https://codereview.chromium.org//1380963004 .
2015-10-01 15:40:50 -07:00
Brian Wilkerson 0f30af628a Fix computation of errors to not run extra tasks
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1370323003 .
2015-09-30 11:55:17 -07:00
Konstantin Shcheglov 1d28f99524 Fix for 'implemented' notification after an incremental change.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//1374943005 .
2015-09-30 11:08:41 -07:00
John Messerly 20e1f91fbb fix inference of hashCode with library prefix
fixes https://github.com/dart-lang/dev_compiler/issues/349

R=leafp@google.com

Review URL: https://codereview.chromium.org//1374813002 .
2015-09-28 16:02:10 -07:00
John Messerly 253fc292cb fix inference of object members on library prefix
See https://github.com/dart-lang/dev_compiler/issues/349 for context.

The prefix fix handled `toString()` but not `library_prefix.toString()`

R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org//1374773003 .
2015-09-28 14:40:20 -07:00
Konstantin Shcheglov ac282f8a1d Fix for the libraries to parts map.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1377613002 .
2015-09-28 13:21:41 -07:00
Leaf Petersen 9be2107f39 Improve the handling of inference for instance fields in the task model
strong mode inference.  This CL adds instance fields to the set of variables
for which dependencies are computed, and re-resolves each instance field
initializer using type information inferred for the static variables upon
which it depends.

This CL also stops static variables with existing type information from having
their types overwritten.

This CL ports over a number of the DDC inference tests, more remain to be ported.

There is still at least one outstanding issue with instance variable inference,
see #354 (and the two tests marked fail added in this CL).

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1370793002 .
2015-09-28 10:57:04 -07:00
John Messerly 9ac032d545 infer field formal parameter types
this fixes https://github.com/dart-lang/dev_compiler/issues/346

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1371813002 .
2015-09-28 09:20:20 -07:00
John Messerly 7bd3db6d74 analyzer strong mode: infer final field from initializer if super getters are dynamic
fixes https://github.com/dart-lang/dev_compiler/issues/348

R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org//1367183004 .
2015-09-25 17:49:55 -07:00
John Messerly c09b338e25 fix inference of object members when a method has no target
we incorrectly thought `toString()` was a call to `Object.toString()`

See https://github.com/dart-lang/dev_compiler/issues/349 for more context

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1368793004 .
2015-09-25 17:22:56 -07:00
Konstantin Shcheglov 6bab7d9cbc Use Element.nameLength where possible.
...or don't use it when there is a better alternative.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1372673003 .
2015-09-25 15:03:46 -07:00
Konstantin Shcheglov 3924b15d85 Remove ElementLocator.locateWithOffset altogether.
It was needed only for the old Angular implementation support, which
overlayed its own Element subclasses into normal Dart AST, for example
for string literals - names of components.

As we don't support this anymore, there is no need for the method.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1370833002 .
2015-09-25 14:57:15 -07:00
Konstantin Shcheglov 6c029f9cb1 Issue 24440. Fix for renaming libraries using 'part of' directives.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24440

Review URL: https://codereview.chromium.org//1364853007 .
2015-09-25 14:24:05 -07:00
Konstantin Shcheglov 4f8649f1b3 Issue 24442. Fix for renaming library names with spaces.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24442

Review URL: https://codereview.chromium.org//1370793003 .
2015-09-25 13:55:13 -07:00
Konstantin Shcheglov 327412cbad Add Element.nameLength getter and specialize it for LibraryElement.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24442

Review URL: https://codereview.chromium.org//1364583006 .
2015-09-25 13:35:49 -07:00
John Messerly 59eb287389 [analyzer] copy generic type args when inferring a new function type for an ExecutableElement
This matches what resolver.dart visitMethodDeclaration does when it creats the FunctionTypeImpl for the method. So we want to preserve these generic type args when we're building the new inferred function type, otherwise we'll fail to substitute them later on.

Context: https://github.com/dart-lang/dev_compiler/issues/342#issuecomment-142748853

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1364353003 .
2015-09-25 10:03:10 -07:00
Brian Wilkerson 2b84d9ada6 Merge pull request #24341 from srawlins/patch-1
Fix ConstantEvaluator's doc comment
2015-09-25 09:54:51 -07:00
Vijay Menon cac248765b Remove CompilationUnit name requirement
Some of our language tests have '.lib' extensions for dart files that are imported.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1372433003 .
2015-09-24 15:51:08 -07:00
pq 5dd6a543e7 Plugin manifest parsing.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1366023002 .
2015-09-24 14:53:15 -07:00
John Messerly 83a2449062 Infer setter parameter types in strong mode
This change also decouples setters and getters, which matches what DDC currently does. The benefit is they're inferred as independent methods, which allows code reuse between method/getter/setters. It also prevents ordering issues that might occur otherwise (i.e. if getter inference considers setter's type, and setter inference considers the getter's type).

More context: https://github.com/dart-lang/dev_compiler/issues/342#issuecomment-142713453

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1359243003 .
2015-09-24 13:21:04 -07:00
pq 72ee80467a ErrorHandler typedef fix.
Lo and behold this harkens back to lint request #1 (https://github.com/dart-lang/linter/issues/1). Could have saved me a headache!

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1367723003 .
2015-09-23 14:39:07 -07:00
pq 7ff04709e7 Plugin config cleanup.
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1366663002 .
2015-09-23 10:44:02 -07:00
pq e2ec118554 Plugin config format validation (and tests).
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1362033002 .
2015-09-23 09:51:29 -07:00
Leaf Petersen ff86501c85 This adds support for a DDC special case of inline JS. It also addresses an issue from an earlier CL, makes some readability improvements, and eliminates some now-redundant TODOs.
BUG=
R=scheglov@google.com, vsm@google.com

Review URL: https://codereview.chromium.org//1355393003 .
2015-09-23 08:58:04 -07:00
Konstantin Shcheglov 27a8bbd415 Reset Source modification stamp to -1 if it does not exist.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1361003002 .
2015-09-23 08:20:12 -07:00
Brian Wilkerson 45a81cbab4 Fix a repeated spelling error
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1361833003 .
2015-09-23 07:44:05 -07:00
pq f4c3b30d8a Basic plugin config parsing.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1364493004 .
2015-09-22 17:06:14 -07:00
Leaf Petersen 4fe661995d Add additional strong mode inference. This adds in all the remaining inference cases from the strong mode RestrictedStaticTypeAnalyzer.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1352763004 .
2015-09-22 14:03:08 -07:00
Brian Wilkerson 163ad75127 Fix status pages when running new task model
R=scheglov@google.com

Review URL: https://codereview.chromium.org//1351243003 .
2015-09-22 11:03:56 -07:00
Konstantin Shcheglov 3aabaa96e6 Fix for a stupid copy/paste bug in the incremental resolver.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1360583003 .
2015-09-21 09:17:35 -07:00
Konstantin Shcheglov a25cc8129a Limit cache invalidation by the updated source bounds.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1355853005 .
2015-09-18 18:11:54 -07:00
Konstantin Shcheglov fcb0c319da Fix for updating HINTS during incremental resolution with TM.
The key change is not updating LIBRARY_UNIT_ERRORS in IncrementalResolver.
Otherwise it becomes VALID and we don't recompute it, so don't recompute HINTS.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1355503004 .
2015-09-18 13:41:09 -07:00
Konstantin Shcheglov 14b726f3e6 Partially fix the cache invalidation problem during incremental resolution.
It still takes 90% of total incremental resolution time.
But at least it's not 10 seconds anymore, just 300ms in Analyzer + Server, or 80ms in pure Analyzer.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1350423002 .
2015-09-18 12:02:30 -07:00
Leaf Petersen f912eabcbf Make type system changes backwards compatible
This CL eliminates the additional typeSystem arguments added to the API by https://codereview.chromium.org/1329743005/  wherever possible, instead projecting out the typeSystem from the context as available.  Where not possible, the additional argument is made optional, defaulting to the standard TypeSystemImpl.  I believe that the result of this should be backwards compatible for clients (but not implementors) of the API.

BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org//1355773002 .
2015-09-18 09:59:12 -07:00
John Messerly d7cd11f86a allow dart:* libs to implement otherwise disallowed types (e.g. int)
all current and experimental Dart implementations (dart2js, vm, fletch, ddc) get an error in their SDK from this. The CL fixes it by allowing dart:* libraries to implement the disallowed types, like int/double/String/bool.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1346923007 .
2015-09-18 07:11:44 -07:00
Konstantin Shcheglov 594fe93422 Support for NAVIGATION/OCCURRENCES notifications for any source (such as HTML).
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1343283004 .
2015-09-17 12:37:36 -07:00
Harry Terkelsen f4426b109b Do not emit semicolons for await expressions in ToSourceVisitor
Closes #24364

BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org//1345403002 .
2015-09-17 11:20:45 -07:00
Konstantin Shcheglov ff95a65900 Reset AnalysisDriver on priority sources changes.
It turned out that our WorkManager(s) don't have the problem we discussed.
We remove targeted results from queues only when they are VALID or ERROR.
So, reset is safe to do.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1350993002 .
2015-09-17 07:57:51 -07:00