Commit Graph

1185 Commits

Author SHA1 Message Date
Konstantin Shcheglov ac24bd115c Don't run 'pub list-package-dirs' if there is no pubpsec.lock file.
This should help on DAS startup - if we don't have to run Pub, this saves as much as 400ms for each pubspec.yaml file.
Without pubspec.yaml we won't get any results anyway.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1470793002 .
2015-11-23 09:19:10 -08:00
Konstantin Shcheglov 8c324a5b8d Propagate types of final/const top-level variables and fields.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/23001

Review URL: https://codereview.chromium.org/1460213005 .
2015-11-21 09:40:37 -08:00
Paul Berry 84c3cdb048 Add a unit index to prelinked type references in summaries.
In order to avoid having to reconstitute the entire element model when
deserializing a library summary, we'll need to be able to create element
handles for any elements referenced by the library.  Since element
handles operate using a "location", and the "location" records
information about the compilation unit containing the element, this
means that the library summary needs to track which unit each referenced
element lives in (even though this information would otherwise not be
semantically relevant).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1468583002 .
2015-11-20 14:10:42 -08:00
Brian Wilkerson 4ae8540383 Revert "Clean-up the registration of plugins"
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1465983004 .
2015-11-20 14:04:53 -08:00
Konstantin Shcheglov 0f477023a4 Don't update incrementally invalid results.
Invalid results don't have correct dependencies, so if we make them valid,
they will never get invalidated later.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1463833003 .
2015-11-20 12:29:20 -08:00
Brian Wilkerson 1367d2d47d Clean-up the registration of plugins
R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1460123002 .
2015-11-20 08:14:14 -08:00
Brian Wilkerson 1e140291c5 Add back a utility method needed by tests
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1457313003 .
2015-11-19 10:52:42 -08:00
pq 3a1a3ee094 Embedded options discovery (#24943).
Merges analysis options extracted from `_embedder.yaml` files (potentially) with local overrides.

Background: https://github.com/dart-lang/sdk/issues/24943

For test coverage of merging, see: `analyzer/test/src/util/yaml_test.dart`.

BUG=24943
R=brianwilkerson@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1445363002 .
2015-11-18 16:41:27 -08:00
Konstantin Shcheglov b46dd600d0 Remove unused declarations - skip summaries and completion.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1462463004 .
2015-11-18 15:21:01 -08:00
Paul Berry 0aebd7d6b2 Implement support for generic methods in summaries.
In theory generic top level functions are also supported, but they
aren't tested due to lack of parser support.

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

Review URL: https://codereview.chromium.org/1455863003 .
2015-11-18 10:26:28 -08:00
Brian Wilkerson 9d01b15fd2 Fix a bug parsing generic methods
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1459543002 .
2015-11-18 06:17:50 -08:00
Paul Berry 178cebb634 Modify summary Builder classes to avoid the use of Object.
Instead of passing around opaque Objects which are the result of
calling the Builder.finish() methods, we pass around the Builder
objects themselves, and we call finish() from within the generated
code.  This pushes the lack of type safety into the generated code,
leaving the handwritten code type safe.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1452363002 .
2015-11-17 15:50:26 -08:00
John Messerly 09625df4a9 re-land Use FunctionElementImpl for inline function type parameters
This reverts commit 2990a0933a.

And fixes the test failure. The one additional change is in error_verifier.dart

Previous reviews:
(initial) https://codereview.chromium.org/1435153007/
(revert) https://codereview.chromium.org/1445273002/

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1447373002 .
2015-11-17 14:13:14 -08:00
Brian Wilkerson 7537e1fea5 Fix the build by removing a not-yet needed method
Review URL: https://codereview.chromium.org/1450163003 .
2015-11-17 14:02:28 -08:00
Brian Wilkerson 8c3722e92a Add server utilities for the stress test
R=keertip@google.com

Review URL: https://codereview.chromium.org/1454813002 .
2015-11-17 13:18:04 -08:00
Konstantin Shcheglov 310514cc50 Log unresolved URIs using 'logInformation', so don't send to IDE.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1445283003 .
2015-11-17 10:25:13 -08:00
Konstantin Shcheglov 96b494665e Specialize Glob for the often case of suffix matching.
This makes it about 2.5 times faster in the micro-benchmark.
No noticable difference for DAS.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1448243002 .
2015-11-17 10:23:16 -08:00
Konstantin Shcheglov de6925a23e Add ApplyChangesStatus to AnalysisContext.applyChanges() and use it in DAS.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1448173002 .
2015-11-16 19:42:15 -08:00
John McCutchan bb4d547a5d Add _embedder.yaml support to analyzer and analysis_server
- If a package has an '_embedder.yaml'  file with an 'embedder_libs' key two things happen:
  1) We do not use the DartUriResolver to resolve dart: libraries.
  2) We use the EmbedderUriResolver to resolve all dart: libraries

- If multiple packages have an '_embedder.yaml' file we merge them.
  - This might not be the final behaviour that we want but I'm not sure how to surface errors to the end user.

- The '_embedder.yaml' file has a top level key 'embedder_libs' which is a map from dart: library uri to source path. Other keys are ignored by the EmbedderUriResolver.

- Unit tests for analyzer
- Integration test for analysis_server.

R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1437893003 .
2015-11-16 15:30:17 -08:00
John Messerly 2990a0933a Revert "Use FunctionElementImpl for inline function type parameters"
This reverts commit 79de8d8093.

Review URL: https://codereview.chromium.org/1445273002 .
2015-11-16 14:40:11 -08:00
John Messerly 79de8d8093 Use FunctionElementImpl for inline function type parameters
This lets it have the right enclosingElement, and thus typeParameters.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1435153007 .
2015-11-16 13:50:43 -08:00
John Messerly 591a2fdd91 Fixes pkg/analysis_server/test/analysis/get_hover_test
This was regressed by https://github.com/dart-lang/sdk/commit/af7359853f8f33b2febdcfa5beeb7a7dce115dce

Essentially, this restores the _functionTypesToFix tracking. Most function types are created later (in TypeResolverVisitor) but some are created earlier.

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

Review URL: https://codereview.chromium.org/1450073002 .
2015-11-16 13:46:33 -08:00
Konstantin Shcheglov 97088a2e90 Add debug output for issue 24939.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24939

Review URL: https://codereview.chromium.org/1444353004 .
2015-11-16 11:06:04 -08:00
Konstantin Shcheglov 9b7e011920 Optimize 'isWithin'.
Its "in stack" percent is down from 2.82% to 0.16% now.

This makes total MDL project analysis about 3% faster.

Also exchange the 'suffix' arguments to make them consistent with the parent/child order everywhere else.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1444983002 .
2015-11-16 08:45:27 -08:00
Konstantin Shcheglov 508b70bdab Replace Glob implementation.
This makes MDL analysis another 5% faster.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1452473002 .
2015-11-15 12:17:17 -08:00
Konstantin Shcheglov f464e2eddb Use AbsolutePathContext in Folder.contains().
This makes MDL analysis about 5% faster, from 5900 samples to 5600 samples.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1444943003 .
2015-11-15 09:33:16 -08:00
Konstantin Shcheglov b45f941d1e Optimize work with absolute paths.
This significantly improves MDL project analysis time.

Cold VM: 24600 ms -> 21586 ms, about 14% faster.
Hot  VM: 13100 ms -> 10080 ms, about 30% faster.

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

Review URL: https://codereview.chromium.org/1443173004 .
2015-11-14 14:40:47 -08:00
John Messerly af7359853f tweak FunctionTypeImpl to support generic methods
The big change here is to ensure FunctionTypeImpl.typeArguments is always initialized to match the parameters. This was previously the case, because we'd explicitly use the class's type parameters. With generic methods, we can no longer rely exclusively on that source of type parameters.

We take advantage of enclosingElement to compute typeParameters from all containing scopes that can have them. By tracking all of the typeParameters, this allows substitution to work later.

Adds a few very basic tests. Please note that generic methods are not ready to use yet.

In particular this doesn't yet do the correct substitutions in StaticTypeAnalyzer. It also doesn't include (mostly done) inference to infer type parameters from the argument types. Further, discovered a missing feature from the previous parser CL. And finally, it doesn't include the kind of ErrorVerifier checks we'll likely need.

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

Review URL: https://codereview.chromium.org/1434983006 .
2015-11-13 14:52:42 -08:00
pq c0257e1bf7 Strong Mode option value validation.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1441323003 .
2015-11-13 13:05:45 -08:00
Konstantin Shcheglov a21e3a5a7f Issue 24812. Fix for detached CompilationUnitElement(s) after package version switch.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24812

Review URL: https://codereview.chromium.org/1441013003 .
2015-11-12 13:22:04 -08:00
pq 60e04f734a Static warning fixes.
The good news is that I reproduced a server issue; the bad news is I landed a change with unnoticed static warnings! :/

(This fixes them.)

BUG=

Review URL: https://codereview.chromium.org/1441763002 .
2015-11-12 10:22:20 -08:00
pq b0a08827aa Improves options validation type safety (#24885).
Fixes #24885.

https://github.com/dart-lang/sdk/issues/24885

BUG=24885
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1437703003 .
2015-11-12 09:44:25 -08:00
Konstantin Shcheglov 5b61845221 Send any logError() information to the IDE.
I have not seen any errors sent so far after several minutes of playing with it.
Adding and removing files does not cause any errors.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1432423004 .
2015-11-12 08:16:24 -08:00
John Messerly 3cb4cdec03 initial generic method comment parsing
R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1434863003 .
2015-11-11 16:27:27 -08:00
Paul Berry 74f09b99f1 Introduce code to generate summaries from an element model.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1420053011 .
2015-11-11 13:17:59 -08:00
Konstantin Shcheglov 0e712ea00c Remove task inputs performance statistics.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1432293002 .
2015-11-11 10:04:17 -08:00
Vijay Menon 19ff4ca2f7 Check field overrides
Fixes https://github.com/dart-lang/dev_compiler/issues/52

This hits once in the SDK - naturally Devon hit it writing his version of hello world.  Fix coming in DDC.

R=leafp@google.com

Review URL: https://codereview.chromium.org/1430953004 .
2015-11-06 14:04:47 -08:00
pq 359ee92bea ErrorCode values "enum" update.
Updated to catch up with the new `ANNOTATION_WITH_NON_CLASS` error code.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1421773005 .
2015-11-06 13:18:36 -08:00
Konstantin Shcheglov 574cef9ee7 Issue 24751. Report a compile time error when @static_field is used with arguments.
@static_field(args) should be evaluated, but it cannot be, so it's a compile time error.

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

Review URL: https://codereview.chromium.org/1436433002 .
2015-11-06 13:03:57 -08:00
Konstantin Shcheglov 2d41202422 Issue 24765. Don't re-resolve already resolved variable references.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24765

Review URL: https://codereview.chromium.org/1416723011 .
2015-11-06 12:50:19 -08:00
pq 53d791d626 Option support for enableGenericMethods.
* Adds `enableGenericMethods` language configuration support to `.analysis_options`:

  analyzer:
    language:
      enableGenericMethods: true

  (with validation).

* Fixes `AnalysisOptionsImpl` to properly set (and copy) enableGenericMethods settings.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1412573012 .
2015-11-06 10:31:26 -08:00
Vijay Menon 2f1764eccd Record defensive dynamic invokes for unresolved field accesses
R=leafp@google.com

Review URL: https://codereview.chromium.org/1425593006 .
2015-11-06 06:26:41 -08:00
Brian Wilkerson 10eb0659c6 Better error message when missing new or const
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1407903011 .
2015-11-06 06:15:18 -08:00
pq 82e83bb34d Experimental getDiagnostics request (#24480).
* Adds `getDiagnostics` request with *very* provisional diagnostics payload (primary goal here is to plumb this fully through and iterate).
* Updates codegenerator to skip doc generation for experimental APIs.

Additional context here: https://github.com/dart-lang/sdk/issues/24480.

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

Review URL: https://codereview.chromium.org/1416093007 .
2015-11-05 15:05:21 -08:00
Paul Berry 9d550c4a0f Begin generating code for summary serialization/deserialization.
The generated code is not yet used.

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

Review URL: https://codereview.chromium.org/1414903005 .
2015-11-04 10:22:42 -08:00
Konstantin Shcheglov d49d0f7e06 Wait for InstrumentationService.shutdown() before exit(0).
Otherwise we don't get the last portion of instrumentation data in the
file at all.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1413403007 .
2015-11-04 10:08:20 -08:00
John Messerly 4c44096bf6 move TypeSystem classes to their own file
also sorted members per analyzer style (?)

figured it would be easier to work on as a 0.5k file vs ~15k resolver.dart :)

For now I left TypeProvider where it was. Not sure if it should move here or into its own file as well.

For backwards compat, all of the types are re-exported from resolver.dart.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1407923009 .
2015-11-03 11:38:34 -08:00
pq 67dc108f39 Map merging.
Basic YAML map merging suitable for merging a default map with an overriding one.

The semantics favor the overrider with a twist to support a short-hand for lists that stand-in for maps of scalars to booleans.  Specifically, lint rules can be enumerated as a list or as a map.  To make this work, lists can be "promoted" to maps.  In particular, if

linter:
  rules:
    - camel_case_types
    - one_member_abstracts

is merged with

linter:
  rules:
    one_member_abstracts: false
    always_specify_return_types: true

the right thing is done to get us to:

linter:
  rules:
    camel_case_types: true
    one_member_abstracts: false
    always_specify_return_types: true

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

Review URL: https://codereview.chromium.org/1425393002 .
2015-11-03 10:42:18 -08:00
Paul Berry cebb0dfb91 Refactor code for checking that generated files are up to date.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1430723002 .
2015-11-02 10:46:23 -08:00
Brian Wilkerson 323ce5d693 Fix null pointer (issue 24790)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1426943005 .
2015-11-02 08:05:07 -08:00