Commit Graph

38 Commits

Author SHA1 Message Date
Brian Wilkerson 98671b2659 Make DeclaredVariables immutable
Change-Id: I3d0233cfb4002140af7cf0166cd98466d73d630c
Reviewed-on: https://dart-review.googlesource.com/50580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-11 01:58:51 +00:00
danrubel b82e5b4704 Replace code completion usage of token.previous with findPrevious
This CL is the first in a multi-part effort to remove the `previous`
field from the Token class. This first step introduces a new findPrevious
utility method that finds the the token before a given token in a token stream,
and then replaces usages of token.previous with calls to this
new findPrevious utility.

Change-Id: I57de4e542adb5950f1bddd951ff555dd98b19b3b
Reviewed-on: https://dart-review.googlesource.com/48461
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-28 02:27:54 +00:00
Brian Wilkerson 1d159e7c23 Rename annotation testing methods in Element
Change-Id: I0f60b9abd3de350e62d89eac0d690a1db40316b7
Reviewed-on: https://dart-review.googlesource.com/45080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 17:23:48 +00:00
Brian Wilkerson 5fd560f96b Add getters to replace ParameterKind
Change-Id: I0886c8d032e963857b8054e894ed3343a235b5c2
Reviewed-on: https://dart-review.googlesource.com/44921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 14:22:52 +00:00
Brian Wilkerson b8f870c524 Add support for testing the highlight range of errors
Change-Id: I077ee8318756450271b68c70ed304807a1dfb240
Reviewed-on: https://dart-review.googlesource.com/16640
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-25 20:00:26 +00:00
Konstantin Shcheglov d4dec4e1a4 Create GenericTypeAliasElement for both FunctionTypeAlias and GenericTypeAlias nodes.
Some pain points are:

1. It is a breaking change. I think I will break it even more by removing
   FunctionTypeAliasElement altogether.

2. We lose ability to keep track that this FunctionType is instantiation
   of a typedef. Just like in Kernel.

3. We sometimes have to look up to see if the GenericFunctionTypeElement
   is a function in a named GenericTypeAliasElement.

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

Bug:
Change-Id: Ib250cc446a0ed5b8969f16f7cc6293ef4acf01a8
Reviewed-on: https://dart-review.googlesource.com/9421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 00:39:05 +00:00
Konstantin Shcheglov f7eba2359b Create new style GenericFunctionTypeElementImpl for function typed parameters.
ParameterElement.parameters/typeParameters always return empty lists.

This was initially landed as https://dart-review.googlesource.com/c/sdk/+/3401,
but was rolled back because of dartdoc breakage.

R=brianwilkerson@google.com

Bug:
Change-Id: I328355fa4520536dfd0029966ad9f9af2e63a7d2
Reviewed-on: https://dart-review.googlesource.com/5000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-11 19:15:11 +00:00
Lasse Reichstein Holst Nielsen 76a3b431bb Revert "Create new style GenericFunctionTypeElementImpl for function typed parameters."
This CL broke the SDK API-doc generation.
See https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fclient.dart%2Fdart-sdk-linux-be%2F15242%2F%2B%2Frecipes%2Fsteps%2Fgenerate_API_docs%2F0%2Fstdout

Change-Id: I2b4acd766fb65e82a29b73412833e04112ba9dc4
Reviewed-on: https://dart-review.googlesource.com/3460
Reviewed-by: Jonas Termansen <sortie@google.com>
2017-09-06 10:43:11 +00:00
Konstantin Shcheglov a3f8740bbd Create new style GenericFunctionTypeElementImpl for function typed parameters.
ParameterElement.parameters/typeParameters always return empty lists.

R=brianwilkerson@google.com

Bug:
Change-Id: I5200df9e891031437d6e597f30fa54399b7d00e1
Reviewed-on: https://dart-review.googlesource.com/3401
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-06 02:31:11 +00:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

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

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Konstantin Shcheglov 4323722416 Stop using ExecutableElement.functions in tests.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2965423002 .
2017-07-07 13:05:38 -07:00
Konstantin Shcheglov 4f7a4f443d Remove ExecutableElement.labels usages in tests.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2974513002 .
2017-07-06 11:44:32 -07:00
Konstantin Shcheglov 7ed5e1c433 Remove ExecutableElement.localVariables altogether.
It is not used in analyzer or analysis_server, and in packages in
internal codebase.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2966313002 .
2017-07-05 16:59:41 -07:00
Konstantin Shcheglov ee177cb51e Remove other usages of ExecutableElement.localVariables.
Use AST to find LocalVariableElement(s), don't test for empty.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2971893002 .
2017-07-05 14:33:09 -07:00
Brian Wilkerson 4fab4a1f52 Clean up type parameters in comments
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2948393002 .
2017-06-23 12:53:11 -07:00
Konstantin Shcheglov 8c391c1f14 Tests for SimpleIdentifier.inGetterContext() updated in other CL.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2844343002 .
2017-04-27 10:54:39 -07:00
Konstantin Shcheglov 2143087734 Build GenericFunctionTypeElementImpl in both ApiElementBuilder and LocalElementBuilder.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2809423003 .
2017-04-12 09:39:31 -07:00
Konstantin Shcheglov 16e9641583 Build elements for FieldFormalParameter(s) even for local functions.
This is invalid code, we report an error, but we cannot leave it as
null, because this causes exceptions down the stream.

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

Review-Url: https://codereview.chromium.org/2800443002 .
2017-04-04 12:45:11 -07:00
Paul Berry 67463b0f7d Make some parser test helper methods non-static.
This paves the way for allowing more of analyzer's parser tests to be
run on both Fasta's parser and the analyzer parser.

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

Review-Url: https://codereview.chromium.org/2683543006 .
2017-02-08 08:24:55 -08:00
Brian Wilkerson abeac7ea44 Element model support for covariant
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2644543005 .
2017-01-20 07:59:24 -08:00
Paul Berry 0c31815f1c Transition analyzer and analysis_server to new astFactory.
This is the same as 1d028eed8d (which
was reverted) except that it doesn't remove the old AST factory
constructors (which broke dev_compiler).  The removal of old AST
factory constructors will be done in a follow-up CL so that if it
unexpectedly breaks any other clients we will be able to revert it
without reverting this CL.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2536373008 .
2016-12-01 10:56:21 -08:00
Vijay Menon b8d3758dcd Revert "Transition analyzer and analysis_server to new astFactory; remove old AST factory methods."
This reverts commit 1d028eed8d.

This was breaking DDC.

TBR=paulberry@google.com

Review URL: https://codereview.chromium.org/2542753002 .
2016-11-30 14:57:49 -08:00
Paul Berry 1d028eed8d Transition analyzer and analysis_server to new astFactory; remove old AST factory methods.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2539243002 .
2016-11-30 12:28:51 -08:00
Paul Berry 05a6045674 Rename AstFactory -> AstTestFactory.
This paves the way for introducing a new AstFactory class that will be
part of the analyzer public API.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2524903002 .
2016-11-22 16:09:51 -08:00
Paul Berry 4054d93fc9 Handle default formal parameters in LocalElementBuilder
Fixes #27615.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2437793002 .
2016-10-19 11:17:43 -07:00
Konstantin Shcheglov 412cceb7d0 Add tests showing using LocalElementBuilder separately, for variable or body.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2428773004 .
2016-10-18 14:38:06 -07:00
Konstantin Shcheglov 529ebf7be2 Add (shared) tests for ApiElementBuilder and ElementBuilder.
Also copy API-only tests from the old CL.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2431783002 .
2016-10-18 12:28:09 -07:00
Konstantin Shcheglov 13d2420a3d Extract ElementBuilder tests into a separate file.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2430723002 .
2016-10-18 10:22:45 -07:00
Konstantin Shcheglov 5455fd0118 Remove 'initializeTestEnvironment' from 'analyzer'.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2399913002 .
2016-10-06 10:18:54 -07:00
Konstantin Shcheglov 175dad4f15 Switch 'analyzer' to 'package:test' and test_reflective_loader ^0.1.0.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2391423003 .
2016-10-06 08:46:35 -07:00
Konstantin Shcheglov cc6beaf56d Pull in test_reflective_loader 0.0.4 and switch analyzer to it.
There are following changes:

1. DEPS to pull in test_reflective_loader 0.0.4
2. Rename runReflectiveTests() to defineReflectiveTests().
3. Remove analyzer's pkg/analyzer/test/reflective_tests.dart
4. Replace reflective_tests.dart imports with package:test_reflective_loader/test_reflective_loader.dart imports.
5. Sort/format and organize imports in the files with imports changes.
6. Fix for a couple of bugs in analysis_server exposed by the new loader.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2298913003 .
2016-08-31 13:46:39 -07:00
Konstantin Shcheglov f1bc40923a Report HintCode.UNUSED_FIELD for fields which are referenced in constructor field initializers.
This adds two not false positives in dart2js, and zero to DDC.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2029193003 .
2016-06-02 08:00:22 -07:00
Bob Nystrom 31aa8e26df Distinguish SimpleIdentifier uses and declarations at parse time.
Instead of a very slow .inDeclarationContext() method which determines
whether a given identifier is in a use position or not, we just create
a different subclass at parse time that encodes that fact directly.

Also, remove an unnecessary _validateElement() method.

On my Mac laptop, this takes benchmark/errors_in_all_libraries.dart

From: 0:00:05.673849
To:   0:00:05.193563 (91.53%)

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1833573006 .
2016-03-25 10:38:22 -07:00
Konstantin Shcheglov 0f64fcdd6f Issue 26051. Fix for MethodDeclartion.beginToken for external.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/26051

Review URL: https://codereview.chromium.org/1820743002 .
2016-03-20 15:21:03 -07:00
Brian Wilkerson 71e7ed86c0 Move scanner out of generated and clean up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1693083004 .
2016-02-14 07:48:44 -08:00
Bob Nystrom b0719aa402 Remove unused or unneeded stuff from java_core.dart.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1688113004 .
2016-02-12 11:10:48 -08:00
Brian Wilkerson dd0c42cb72 Moved the AST related tests to their new locations
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1612933006 .
2016-01-23 09:45:01 -08:00
Brian Wilkerson 66e07636f4 Moved the tests for the element model into locations corresponding to the implementation
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1529923003 .
2015-12-16 07:49:15 -08:00