mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:00:09 +00:00
Don't add empty leading/trailing strings in multiline strings.
Bug: Change-Id: Ia556ecb8bbffe94808de34340d60cfff74464476 Reviewed-on: https://dart-review.googlesource.com/32520 Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
d16eeb5eb8
commit
560fb2998d
|
@ -4210,6 +4210,17 @@ void main() {
|
|||
}
|
||||
}
|
||||
|
||||
test_stringInterpolation_multiLine_emptyBeforeAfter() async {
|
||||
addTestFile(r"""
|
||||
void main() {
|
||||
var v = 42;
|
||||
'''$v''';
|
||||
}
|
||||
""");
|
||||
AnalysisResult result = await driver.getResult(testFile);
|
||||
expect(result.errors, isEmpty);
|
||||
}
|
||||
|
||||
test_super() async {
|
||||
String content = r'''
|
||||
class A {
|
||||
|
|
|
@ -1363,8 +1363,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
|||
// Contains more than just \' or \".
|
||||
if (first.lexeme.length > 1) {
|
||||
String value = unescapeFirstStringPart(first.lexeme, quote);
|
||||
expressions.add(
|
||||
new ShadowStringLiteral(value)..fileOffset = offsetForToken(first));
|
||||
if (value.isNotEmpty) {
|
||||
expressions.add(new ShadowStringLiteral(value)
|
||||
..fileOffset = offsetForToken(first));
|
||||
}
|
||||
}
|
||||
for (int i = 1; i < parts.length - 1; i++) {
|
||||
var part = parts[i];
|
||||
|
@ -1381,8 +1383,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
|
|||
// Contains more than just \' or \".
|
||||
if (last.lexeme.length > 1) {
|
||||
String value = unescapeLastStringPart(last.lexeme, quote);
|
||||
expressions.add(
|
||||
new ShadowStringLiteral(value)..fileOffset = offsetForToken(last));
|
||||
if (value.isNotEmpty) {
|
||||
expressions.add(new ShadowStringLiteral(value)
|
||||
..fileOffset = offsetForToken(last));
|
||||
}
|
||||
}
|
||||
push(new ShadowStringConcatenation(expressions)
|
||||
..fileOffset = offsetForToken(endToken));
|
||||
|
|
|
@ -98,7 +98,6 @@ rasta/issue_000036: Crash
|
|||
rasta/issue_000039: VerificationError
|
||||
rasta/issue_000042: Crash
|
||||
rasta/issue_000044: Crash
|
||||
rasta/issue_000045: Crash
|
||||
rasta/issue_000067: Crash
|
||||
rasta/issue_000068: Crash
|
||||
rasta/issue_000069: Crash
|
||||
|
|
Loading…
Reference in a new issue