Commit Graph

7128 Commits

Author SHA1 Message Date
pq c4ccdb462a LineInfo line-end detection fixes.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1413783005 .
2015-10-27 09:39:30 -07:00
pq 808f32d61d Fix to give LineInfo to options error spans.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1417363007 .
2015-10-26 21:09:48 -07:00
pq 68dc36a3e7 OptionsValidator plugin extension and linter service.
* Adds a new extension point to allow for contributing OptionsValidators.
* Adds a new linter 'service' to server that contributes a lint-aware validator.

You'll notice that the warning code I added is NOT in `errors.dart`.  I did that in anticipation of plugin-specifc warnings living elsewhere.  If that's not the right angle, happy to un-do!

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1418333002 .
2015-10-26 08:50:55 -07:00
John Messerly 396ed51cf0 fixes #24713, remove old generic substitution code in _getTypeOfProperty
it looks like some old code was hanging around that tried to substitute generic type parameters by name. This is unnecessary because we already have a substituted type at this point, and the type variable we were substituting had no relationship at all with the parameter. After removing the code, all tests seem to be passing.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1409143009 .
2015-10-24 12:48:53 -07:00
Konstantin Shcheglov c43f292dd9 Remove IMPORT_EXPORT_SOURCE_CLOSURE and IS_CLIENT results.
This improves warm VM analysis time (i.e. 99% of all analyzis that happens in IDEs) from 7200 ms to 6600 ms.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1417143003 .
2015-10-24 08:35:26 -07:00
Konstantin Shcheglov 041e61a0f6 Ensure that RESOLVED_UNITx ready once for every library.
...instead of ensuring this separately for complete closures of every library.

This improves initial analysis performance from about 44 seconds to 39.
This also makes WorkOrder.moveNext less expensive - to about 5.6% during initial analysis.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1412273004 .
2015-10-23 13:25:56 -07:00
Konstantin Shcheglov f09778528a Use LIBRARY_SPECIFIC_UNITS instead of UNITS.
This reduces number of LibrarySpecificUnit instances from 10,000,000 to about 6,000.
Also this slightly improves the code of corresponding 'buildInputs' methods.

This saves some memory, but unfortunately does not win any performance.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1422793002 .
2015-10-23 08:31:59 -07:00
Konstantin Shcheglov fe4644e35b Reset AnalysisDriver after changes.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1410813003 .
2015-10-22 13:28:05 -07:00
pq b1215d7718 More options file validation (and API iteration).
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1419673006 .
2015-10-22 13:20:13 -07:00
pq 0881b53a3b Error reporting for spans.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1418973002 .
2015-10-22 08:37:25 -07:00
Konstantin Shcheglov 2586267dbb Keep cache entries for explicitly added sources.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1420613003 .
2015-10-21 20:15:31 -07:00
pq fb8cc0aa39 Unsupported analysis option validation.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1418533004 .
2015-10-21 14:13:59 -07:00
pq 6c85fe785a Analysis Options error notifications.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1411013003 .
2015-10-21 09:59:19 -07:00
Vijay Menon ba6078197b Fix warnings on implicit casts
R=leafp@google.com

Review URL: https://codereview.chromium.org/1418653003 .
2015-10-20 16:00:21 -07:00
pq bf0ba96027 Analysis Options processing task and manager.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1413973003 .
2015-10-20 15:38:55 -07:00
Paul Berry 1a75281742 Rework handling of potentially-constant variables.
Previously, we had a mixin class PotentiallyConstVariableElement to
represent variables which might be constant.  This left some holes in
the type hierarchy which didn't implement
PotentiallyConstVariableElement but nonetheless could be reached by
constant evaluation code in the event of errors in the code being
analyzed, resulting in an invalid cast exception.

This CL drops PotentiallyConstVariableElement and moves its one getter
to VariableElementImpl so that it will be available to all variable
elements.  This allows us to avoid a lot of casts, including the one
that previously caused the exception.

Fixes #24645.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1416873003 .
2015-10-20 12:37:10 -07:00
Brian Wilkerson cc8f64b824 Do not generate warnings when noSuchMethod is inherited (issue 24337)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1414003003 .
2015-10-20 10:35:53 -07:00
Konstantin Shcheglov 29f3baf646 Issue 24552. Disable reporting HTML parsing errors.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24552

Review URL: https://codereview.chromium.org/1418663002 .
2015-10-20 10:34:40 -07:00
Leaf Petersen 10915a849b Library Cycle invalidation. Library cycle information on the element model was not being correctly invalidated on incremental updates to source files, since the appropriate dependencies cannot be surfaced in the task model directly. This CL adds logic to conservatively invalidate the element model information as needed.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1413273002 .
2015-10-19 17:08:07 -07:00
Paul Berry f145f89ccb Create loadLibrary function element eagerly.
Previously we created this element lazily (when requested) but this
didn't work well with the new task model, because creating the element
required calling back into the context and requesting full analysis of
`dart:async` (in order to get access to the Future type), and this
could lead to reentrant task execution.

Now we explicitly create the element in ResolveLibraryTypeNamesTask,
which allows us to get the Future type from the TypeProvider, avoiding
reentrancy.

Fixes #24627.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1405963005 .
2015-10-19 13:34:20 -07:00
Konstantin Shcheglov 4249335a0e Improve incomplete for-each parsing.
Othewise a bizzare structure is returned with identifier in place of a semicolon.
It is easier for client to work with a more correct AST.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1413953003 .
2015-10-19 12:16:26 -07:00
Konstantin Shcheglov 78c7cde132 Improve recovery for local variable declarations.
We need this to improve code completion, and to *not* suggest method/keywords/etc
in cases like "main() {String s^}". Currently it is parsed as "main() {String; s^;}",
so completion cannot distinguish the variable name "s" from a of start a new expression.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1413773003 .
2015-10-19 10:24:21 -07:00
Paul Berry 6da5bb4ee4 Fix test_hasKnownValue_list_invalid
This test wasn't actually testing anything about lists, and was
redundant with test_hasKnownValue_dynamic.  Correcting the test to match
the probable intention.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1413123002 .
2015-10-19 09:40:24 -07:00
Paul Berry 2d3fe73b36 Fix tests of DartObject.hasKnownValue.
The tests were exercising the semantics of the old (deprecated) method
hasExactValue, and thus they were failing.

TBR=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1411083004 .
2015-10-19 07:32:54 -07:00
Brian Wilkerson 204ee60bd0 Add a public API for the results of constant evaluation
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1410643003 .
2015-10-17 07:51:10 -07:00
Brian Wilkerson 40b38e988b Include parameter annotations in toSource (issue 24578)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1408923002 .
2015-10-16 07:41:05 -07:00
pq 91e5facc0f Registry memory leak fixes.
Fixes #24549.

A few notes:
  * does away with registry in favor of context-associated configurations
  * pulls in linter rev that does the context association
  * bumps analyzer version before publishing (needed to update analyzer_cli)

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1406043002 .
2015-10-15 14:24:20 -07:00
Brian Wilkerson d2b1edb695 Fix another place where identifiers were not being re-resolved correctly
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1409813002 .
2015-10-15 13:59:48 -07:00
Vijay Menon 5ec298794b Fix loop var inference when iterating on a type-param type.
Fixes https://github.com/dart-lang/dev_compiler/issues/336

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

Review URL: https://codereview.chromium.org/1405803003 .
2015-10-14 20:05:21 -07:00
pq 888c4c526f State-carrying context API.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1403033002 .
2015-10-14 15:33:09 -07:00
John Messerly f092c247fd move strong mode hints behind flag
these test features were not supposed to be leaking into the UI

R=leafp@google.com

Review URL: https://codereview.chromium.org/1402813005 .
2015-10-13 16:46:24 -07:00
Konstantin Shcheglov a41819650e Issue 24566. Main AnalysisContext.getLibrariesContaining() should work also for SDK sources.
This also fixes IDEA's Iterable hierarchy problem.

R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24566

Review URL: https://codereview.chromium.org/1405643002 .
2015-10-13 14:25:07 -07:00
Leaf Petersen 4ca8a3f19b Strong mode checker integration. This integrates jmesserly's CL, and adds a task for computing strong mode errors and an annotated unit.
BUG=
R=brianwilkerson@google.com, jmesserly@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1396273004 .
2015-10-13 10:16:35 -07:00
John Messerly 8ae0534c1c port DDC checker code to analyzer
It's not used yet, except by its own test.

Naturally there's a *lot* to clean up here in follow ups. I tried to keep the ported code in its own directory so it's obvious. Ideally we can remove this directory once the code has been moved out.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1402783004 .
2015-10-12 12:31:00 -07:00
Sigurd Meldgaard a763c71d92 Introduce the "Embedded" category.
It is not visible from the dart2js command line.

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

Committed: https://github.com/dart-lang/sdk/commit/0aef0efb6a38a65fa676fa9e8daa85a972521745
Reverted: https://codereview.chromium.org/1401513002

Review URL: https://codereview.chromium.org/1395863002 .
2015-10-12 12:15:48 +02:00
Konstantin Shcheglov ebdfa991d4 Issue 24538. Route SDK results into SDK context DartWorkManager.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24538

Review URL: https://codereview.chromium.org/1399873002 .
2015-10-09 21:45:35 -07:00
Paul Berry 9af099fcdf Access types safely in TypeResolverVisior.visitMethodDeclaration()
Previously, when attempting to figure out the type of the synthetic
field associated with a getter (or setter),
TypeResolverVisitor.visitMethodDeclaration() used the getters
FunctionTypeImpl.returnType (or FunctionTypeImpl.normalParameterTypes)
to extract the appropriate type.  But those getters are only safe to
use after types have been fully constructed (because they may try to
perform type substitution).  Fortunately, type substitution isn't
needed here, so we can simply use FunctionTypeImpl.baseReturnType (or
FunctionTypeImpl.baseParameters) instead.

Fixes #24539.

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

Review URL: https://codereview.chromium.org/1397193002 .
2015-10-09 14:21:12 -07:00
pq 695256d586 Linter hookup into AS.
Note the TODO to fix the extension manager interaction hijinx.  Really we should ensure that we are only using the one in engine.  At the moment, it's easy to get this wrong (as the initialization heroics herein testify).

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1392683003 .
2015-10-09 13:40:07 -07:00
Konstantin Shcheglov e1083af258 Ignore absence of DOCTYPE in HTML files.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1395033003 .
2015-10-09 10:44:03 -07:00
Konstantin Shcheglov 14ab3cae4d Fix for top level variable documention ranges.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1396693004 .
2015-10-09 10:39:46 -07:00
Konstantin Shcheglov 9f8da95217 The (failing) test for the invalid hint / used elements problem.
The problem is that during computing RESOLVED_UNIT3 we reuse RESOLVED_UNIT2
with the previously resolved bodies. And resolver ignores already resolved
identifiers. So, this causes pointing to the stale element model, etc.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1398433004 .
2015-10-07 21:46:03 -07:00
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
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
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
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