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

Unified Diff: pkg/analyzer/lib/src/generated/ast.dart

Issue 632203002: More string literals getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | pkg/analyzer/pubspec.yaml » ('j') | pkg/analyzer/test/generated/ast_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/ast.dart
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart
index dd0bcb03a71f5fb271e0e5e922ea116b645ef41c..c22a1fb080144902eb399a7795b3bab9481be78e 100644
--- a/pkg/analyzer/lib/src/generated/ast.dart
+++ b/pkg/analyzer/lib/src/generated/ast.dart
@@ -16045,11 +16045,7 @@ class SimpleStringLiteral extends SingleStringLiteral {
*/
String get value => _value;
- /**
- * Return `true` if this string literal is a multi-line string.
- *
- * @return `true` if this string literal is a multi-line string
- */
+ @override
bool get isMultiline {
String lexeme = literal.lexeme;
if (lexeme.length < 6) {
@@ -16058,9 +16054,16 @@ class SimpleStringLiteral extends SingleStringLiteral {
return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilities.endsWith3(lexeme, 0x27, 0x27, 0x27);
}
+ @override
bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72;
@override
+ bool get isSingleQuoted {
+ String lexeme = literal.lexeme;
+ return StringUtilities.endsWithChar(lexeme, 0x27);
Paul Berry 2014/10/07 13:18:04 Would it be better to check the beginning of the s
Brian Wilkerson 2014/10/07 14:12:04 isMultiline (on line 16049) has the same potential
scheglov 2014/10/07 15:37:56 Done.
scheglov 2014/10/07 15:37:56 Done.
+ }
+
+ @override
bool get isSynthetic => literal.isSynthetic;
/**
@@ -16181,7 +16184,26 @@ class StringInterpolation extends SingleStringLiteral {
}
@override
+ bool get isMultiline {
+ InterpolationString element = _elements.last;
+ String lexeme = element._contents.lexeme;
+ if (lexeme.length < 6) {
+ return false;
+ }
+ return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) ||
Paul Berry 2014/10/07 13:18:04 Similar concern here.
scheglov 2014/10/07 15:37:56 Done.
+ StringUtilities.endsWith3(lexeme, 0x27, 0x27, 0x27);
+ }
+
+ @override
bool get isRaw => false;
+
+
+ @override
+ bool get isSingleQuoted {
+ InterpolationString lastString = _elements.last;
+ String lexeme = lastString._contents.lexeme;
+ return StringUtilities.endsWithChar(lexeme, 0x27);
Paul Berry 2014/10/07 13:18:04 And here.
scheglov 2014/10/07 15:37:56 Done.
+ }
}
/**
@@ -16243,9 +16265,20 @@ abstract class SingleStringLiteral extends StringLiteral {
int get contentsEnd;
/**
+ * Return `true` if this string literal is a multi-line string.
+ */
+ bool get isMultiline;
+
+ /**
* Return `true` if this string literal is a raw string.
*/
bool get isRaw;
+
+ /**
+ * Return `true` if this string literal uses single qoutes (' or ''').
+ * Return `false` if this string literal uses double qoutes (" or """).
+ */
+ bool get isSingleQuoted;
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | pkg/analyzer/test/generated/ast_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698