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

Issue 1056103002: Fix interpretation of string contents after interpolation expressions. (Closed)

Created:
5 years, 8 months ago by Paul Berry
Modified:
5 years, 8 months ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

Fix interpretation of string contents after interpolation expressions. Previously, the logic for skipping the opening quote(s) (and optional 'r') of a string were erroneously being invoked after string interpolations. As a result, a string like '${x}"y' was being interpreted as '${x}y'. Usually, this had no visible user effect, because analyzer's interpretation of strings is currently only used for constant evaluation, and string interpolation is rare in constant expressions. However, it was triggering an internal error in the case where the interpolation is at the end of a multiline string, since it caused analyzer to compute that the number of characters following the interpolation was negative. In addition to fixing the bug, I've modified the logic for logging the internal error so that it also asserts; this allows the error to be detected by unit tests. I've also fixed an off-by-one error in the internal error logic which had prevented the bug from being noticed on single-line strings. BUG=dartbug.com/23046 R=brianwilkerson@google.com Committed: https://code.google.com/p/dart/source/detail?r=44880

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -47 lines) Patch
M pkg/analyzer/lib/src/generated/ast.dart View 1 chunk +24 lines, -22 lines 0 comments Download
M pkg/analyzer/lib/src/generated/parser.dart View 3 chunks +7 lines, -4 lines 0 comments Download
M pkg/analyzer/test/generated/parser_test.dart View 6 chunks +105 lines, -5 lines 0 comments Download
A + tests/language/regress_23046_test.dart View 1 chunk +7 lines, -16 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
Paul Berry
5 years, 8 months ago (2015-04-03 14:39:52 UTC) #2
Brian Wilkerson
LGTM
5 years, 8 months ago (2015-04-03 15:13:32 UTC) #3
Paul Berry
5 years, 8 months ago (2015-04-03 15:52:21 UTC) #4
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as 44880 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698