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

Unified Diff: pkg/front_end/test/scanner_test.dart

Issue 2674383002: Use token.value to distinguish comment types. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/scanner_test.dart
diff --git a/pkg/front_end/test/scanner_test.dart b/pkg/front_end/test/scanner_test.dart
index 2a7b8d7fb1f52fb2de05c065ada5b54c23593445..83fdc332fe1c8c78684bc827b835f02bf31fab13 100644
--- a/pkg/front_end/test/scanner_test.dart
+++ b/pkg/front_end/test/scanner_test.dart
@@ -225,13 +225,6 @@ class ScannerTest_Fasta extends ScannerTestBase {
@override
@failingTest
- void test_comment_single() {
- // TODO(paulberry,ahe): See TODO comment below in _translateTokenInfoKind().
- super.test_comment_single();
- }
-
- @override
- @failingTest
void test_double_missingDigitInExponent() {
// TODO(paulberry,ahe): see UnimplementedError("distinguish unterminated
// errors")
@@ -398,7 +391,13 @@ class ScannerTest_Fasta extends ScannerTestBase {
}
} else if (token is fasta.StringToken &&
token.info.kind == fasta.COMMENT_TOKEN) {
- var translatedToken = _translateToken(token, null) as CommentToken;
+ // TODO(paulberry,ahe): It would be nice if the scanner gave us an
+ // easier way to distinguish between the two types of comment.
+ var type = token.value.startsWith('/*')
+ ? TokenType.MULTI_LINE_COMMENT
+ : TokenType.SINGLE_LINE_COMMENT;
+ var translatedToken =
+ new CommentToken(type, token.value, token.charOffset);
if (currentCommentHead == null) {
currentCommentHead = currentCommentTail = translatedToken;
} else {
@@ -491,16 +490,8 @@ class ScannerTest_Fasta extends ScannerTestBase {
}
}
- Token makeCommentToken() {
- return new CommentToken(type, token.value, offset);
- }
-
if (token is fasta.StringToken) {
- if (token.info.kind == fasta.COMMENT_TOKEN) {
- return makeCommentToken();
- } else {
- return makeStringToken(token.value);
- }
+ return makeStringToken(token.value);
} else if (token is fasta.KeywordToken) {
return makeKeywordToken(_translateKeyword(token.keyword.syntax));
} else if (token is fasta.SymbolToken) {
@@ -653,10 +644,6 @@ class ScannerTest_Fasta extends ScannerTestBase {
return TokenType.GT_GT;
case fasta.CARET_EQ_TOKEN:
return TokenType.CARET_EQ;
- case fasta.COMMENT_TOKEN:
- // TODO(paulberry,ahe): how to distinguish multi-line from
- // single-line comments? Causes a failure in test_comment_single().
- return TokenType.MULTI_LINE_COMMENT;
case fasta.STRING_INTERPOLATION_IDENTIFIER_TOKEN:
return TokenType.STRING_INTERPOLATION_IDENTIFIER;
case fasta.QUESTION_PERIOD_TOKEN:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698