Commit Graph

13 Commits

Author SHA1 Message Date
Mike Fairhurst 3095a082cd [analyzer] Add an API to get a language comment token off a unit.
Change-Id: I377fdc44d5e514d6d9a601b3947c3908e5a4497a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140768
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-03-26 03:47:57 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Brian Wilkerson d07e33e11f Convert more comments from block to line style
Change-Id: Ib1b2b1f6858c3c7503fd7a701b9badb9cfbfe8d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98050
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-28 17:54:00 +00:00
Paul Berry c79927fdd7 Change type of Expression.precedence to the Precedence class.
This is a breaking change, however clients that switched to using
`Expression.precedence2` (which was introduced in analyzer release
0.35.3) are unaffected.  After this change, clients may switch back to
using `Expression.precedence`.

Change-Id: Ia952c44001bdea91d32082add0be7e10c9936181
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-20 22:13:15 +00:00
Paul Berry 5aba7b7b85 Normalize expression precedence between analyzer and front_end.
Several places in the analyzer and the analysis server were using
hardcoded integers to represent precedence, rather than referring to
constants defined in the front_end.  This led to some subtle
off-by-one errors, because the old analyzer convention (prior to
integration with the front_end parser) used 0 to represent the lowest
precedence of an expression (and -1000 to represent the precedence of
non-expressions), whereas the front_end convention is for 1 to
represent the lowest precedence of an expression.  As far as I can
tell there was no user visible impact, but it made it very difficult
to reason about operator precedence.

This CL updates the analyzer and the analysis server so that they
don't hardcode any precedence values; instead they refer to named
constants in the front end.

In a follow-up CL I'll reduce some hardcoded precedence numbers in the
front end itself.

Change-Id: Id3869afeb83042cc7d6630a0a4a0533a07058736
Reviewed-on: https://dart-review.googlesource.com/c/93964
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-02-22 13:39:46 +00:00
Brian Wilkerson 469e1e2e64 Remove unnecessary library directives
Change-Id: I7a157080e4d7fd80d64489a13de4e996b5870930
Reviewed-on: https://dart-review.googlesource.com/c/79474
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-13 00:44:04 +00:00
Paul Berry 0a1fb8d248 Move scanner into pkg/front_end/lib/src/scanner.
Several support classes also had to move to front_end along with the
scanner.  Some of these support classes arguably don't belong to the
scanner itself, since they have other uses (e.g. SyntacticEntity,
ErrorCode, ErrorSeverity, ErrorType, and StringUtilities).  They will
be reorganized into a more appropriate location in future CLs, at the
time that they become needed by other components of the front end.

In order to avoid dragging in a lot of dependencies, the following
changes were made:

1. Scanner no longer reports errors through Source and
AnalysisErrorListener objects passed to the constructor.  Instead, it
provides an abstract reportError() method which clients may override
to perform error reporting in any way they wish.  Analyzer contains an
override of Scanner that mimics the old behavior in order to maintain
compatibility.

2. Static members of ErrorCode (`values` and `byUniqueName`) have been
moved to top level, and remain in analyzer.  To maintain
compatibility, these static members remain in ErrorCode (as deprecated
members that simply wrap the implementations in analyzer).  This means
we have a reverse dependency (front_end depends on analyzer), but this
dependency will go away as soon as we publish the next breaking change
release of analyzer.

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

Review URL: https://codereview.chromium.org/2486873003 .
2016-11-08 13:47:17 -08:00
Paul Berry dac96d0584 Add SyntacticEntity, an interface shared by AstNode and Token.
This allows types to be tightened up for AstNode.childEntities.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2357803002 .
2016-09-21 11:23:46 -07:00
Brian Wilkerson 4dcb9b6196 Initial implementation for lazy compound assignment operators
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2199323002 .
2016-08-02 09:16:17 -07:00
Brian Wilkerson 61818c95a1 Convert some for-in loops for performance
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1955373003 .
2016-05-09 11:01:16 -07:00
Konstantin Shcheglov 305f1f538c Pull the 'keyword' property into Token.
So, we can use it without casting to KeywordToken.
This gives small, but noticable performanace boost, about 4% on hot VM.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1909843002 .
2016-04-21 08:23:49 -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
Brian Wilkerson ec04f012f7 Move Token into the public API
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1690523002 .
2016-02-10 09:12:26 -08:00