Commit Graph

7128 Commits

Author SHA1 Message Date
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
John Messerly 2ce06f5325 sort type_system_test.dart
R=leafp@google.com

Review URL: https://codereview.chromium.org/1460853002 .
2015-11-18 13:26:17 -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 ec994696df skip new generic method test if task model is not on
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1456773002 .
2015-11-17 15:22:48 -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
Paul Berry 55983428b4 Add summary tests for cascaded show/hide combinators.
At the moment these tests are mostly redundant, since the semantics of
cascaded combinators are implemented elsewhere.  However, when we add
a relinking mechanism these tests will ensure that cascaded combinator
semantics are properly implemented by the relinker.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1455693002 .
2015-11-17 14:02:18 -08:00
John Messerly 9f938594bc skip task-model only tests if not running with task model
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1451243002 .
2015-11-17 12:37: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
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
Paul Berry 101883988b Fix summary_test.dart on Windows.
On Windows, absolute file URIs include a drive
letter (e.g. "file:///C:/foo.dart").  Added a helper function "absUri"
which generates the correct kind of absolute file URI for the platform.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1435153005 .
2015-11-13 10:54:22 -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 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
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
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
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
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
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
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
Konstantin Shcheglov 1bc7f93009 Adding a not explicit source makes it explicit.
When we add a new file in IDEA and open it in the editor, this causes
analysis.setSubscriptions to be send immediately, even before watcher
notices it. The server reacts by requesting the fully resolved unit, and
so causes creation of a not-explicit CacheEntry. So, when later we handle
applyChanges(), the entry already exists. In this case we still need to
mark it as explicit.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1411243010 .
2015-10-30 08:04:27 -07:00
pq af7017e585 Option support for enableSuperMixins (and more).
* Adds language configuration support to `.analysis_options`:

  analyzer:
    language:
      enableSuperMixins: true

  (with validation).

* Extracts context configuration out of `server` context_manager and into `analyzer` where it can be re-used by `analyzer_cli`.
* Some general cleanup of option validation (with more to come!)

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1423333002 .
2015-10-29 14:11:26 -07:00
Brian Wilkerson a7f2f5b4e1 Revert "Compute propagated type for final instance fields (partially addresses issue 23001)"
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1428803004 .
2015-10-29 14:02:38 -07:00
Brian Wilkerson 677d4b5bbc Compute documentation offsets for library, import, and export directive elements (issue 24756)
R=keertip@google.com

Review URL: https://codereview.chromium.org/1427513003 .
2015-10-29 14:00:02 -07:00
Konstantin Shcheglov 851dc4ea97 Quick Fix for CAN_BE_NULL_AFTER_NULL_AWARE.
Also fix for false positive :-(

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1423993005 .
2015-10-29 13:47:17 -07:00
Brian Wilkerson 8e80648c56 Compute propagated type for final instance fields (partially addresses issue 23001)
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1410493006 .
2015-10-29 11:36:11 -07:00
John Messerly 2503cb8eeb improve static type analysis for await for
This tries to do a full fix for https://github.com/dart-lang/sdk/issues/24191

The refactoring tries to unify how generic type substitutions are handled, so they always go through the (correct) mechanisms in the Element model.

This additionally should make it easier to add generic method type parameters in a future CL.

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

Review URL: https://codereview.chromium.org/1405143006 .
2015-10-29 11:17:18 -07:00
Konstantin Shcheglov 2529e684f0 Report hint when target of an invocation uses '?.', so can be null.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1423623005 .
2015-10-28 16:45:19 -07:00
pq 5accd7a72e Error code validation for error filters.
Screenshots and background can be found on the tracking bug: https://github.com/dart-lang/sdk/issues/24618

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

Review URL: https://codereview.chromium.org/1411053003 .
2015-10-28 16:37:34 -07:00
Konstantin Shcheglov 8f94e36a74 Check for potential null operand in Not expressions.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1427783003 .
2015-10-28 13:09:30 -07:00
pq ffeacec73d Improved YAML doc exception handling.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1415153004 .
2015-10-28 11:24:42 -07:00
pq 2f9c4af993 Error Suppression FTW.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1420363005 .
2015-10-28 09:59:05 -07:00
Brian Wilkerson c687f29555 Add hint for use of ?. in conditions (issue 24649)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1422813003 .
2015-10-28 08:28:42 -07:00
Konstantin Shcheglov c095ba1f91 Extract 'computeLineStarts' utility.
R=brianwilkerson@google.com, pquitslund@google.com
BUG=

Review URL: https://codereview.chromium.org/1411253007 .
2015-10-27 14:03:44 -07:00
Konstantin Shcheglov e2f905e11d Memory leak fix. Use correct analysis context for annotation constants.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1410573005 .
2015-10-27 11:04:27 -07:00