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

Side by Side Diff: lib/compiler/implementation/string_validator.dart

Issue 11090016: Change core lib, dart2js, and more for new optional parameters syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Check the validity of string literals. 5 // Check the validity of string literals.
6 6
7 #library("stringvalidator"); 7 #library("stringvalidator");
8 8
9 #import("leg.dart"); 9 #import("leg.dart");
10 #import("scanner/scannerlib.dart"); 10 #import("scanner/scannerlib.dart");
(...skipping 12 matching lines...) Expand all
23 int leftQuote = quoting.leftQuoteLength; 23 int leftQuote = quoting.leftQuoteLength;
24 int rightQuote = quoting.rightQuoteLength; 24 int rightQuote = quoting.rightQuoteLength;
25 SourceString content = source.copyWithoutQuotes(leftQuote, rightQuote); 25 SourceString content = source.copyWithoutQuotes(leftQuote, rightQuote);
26 return validateString(token, 26 return validateString(token,
27 token.charOffset + leftQuote, 27 token.charOffset + leftQuote,
28 content, 28 content,
29 quoting); 29 quoting);
30 } 30 }
31 31
32 DartString validateInterpolationPart(Token token, StringQuoting quoting, 32 DartString validateInterpolationPart(Token token, StringQuoting quoting,
33 [bool isFirst = false, 33 {bool isFirst: false,
34 bool isLast = false]) { 34 bool isLast: false}) {
35 SourceString source = token.value; 35 SourceString source = token.value;
36 int leftQuote = 0; 36 int leftQuote = 0;
37 int rightQuote = 0; 37 int rightQuote = 0;
38 if (isFirst) leftQuote = quoting.leftQuoteLength; 38 if (isFirst) leftQuote = quoting.leftQuoteLength;
39 if (isLast) rightQuote = quoting.rightQuoteLength; 39 if (isLast) rightQuote = quoting.rightQuoteLength;
40 SourceString content = source.copyWithoutQuotes(leftQuote, rightQuote); 40 SourceString content = source.copyWithoutQuotes(leftQuote, rightQuote);
41 return validateString(token, 41 return validateString(token,
42 token.charOffset + leftQuote, 42 token.charOffset + leftQuote,
43 content, 43 content,
44 quoting); 44 quoting);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 } 180 }
181 // String literal successfully validated. 181 // String literal successfully validated.
182 if (quoting.raw || !containsEscape) { 182 if (quoting.raw || !containsEscape) {
183 // A string without escapes could just as well have been raw. 183 // A string without escapes could just as well have been raw.
184 return new DartString.rawString(string, length); 184 return new DartString.rawString(string, length);
185 } 185 }
186 return new DartString.escapedString(string, length); 186 return new DartString.escapedString(string, length);
187 } 187 }
188 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698