Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart

Issue 1909843002: Pull the 'keyword' property into Token. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 6ab671d20899702db4f9336c143cc1adaba0fd1c..d80074b0c85444428fcd9ffa8cbc74c5a51ef965 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -484,18 +484,15 @@ class ReplacementRange {
}
if (token is StringToken) {
SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme);
- Token previous = token.previous;
- if (previous is KeywordToken) {
- Keyword keyword = previous.keyword;
- if (keyword == Keyword.IMPORT ||
- keyword == Keyword.EXPORT ||
- keyword == Keyword.PART) {
- int start = uri.contentsOffset;
- var end = uri.contentsEnd;
- if (start <= requestOffset && requestOffset <= end) {
- // Replacement range for import URI
- return new ReplacementRange(start, end - start);
- }
+ Keyword keyword = token.previous?.keyword;
+ if (keyword == Keyword.IMPORT ||
+ keyword == Keyword.EXPORT ||
+ keyword == Keyword.PART) {
+ int start = uri.contentsOffset;
+ var end = uri.contentsEnd;
+ if (start <= requestOffset && requestOffset <= end) {
+ // Replacement range for import URI
+ return new ReplacementRange(start, end - start);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698