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

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

Issue 11419118: Change === to identical in the dart2js source. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "dart2jslib.dart"; 9 import "dart2jslib.dart";
10 import "tree/tree.dart"; 10 import "tree/tree.dart";
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 token.charOffset + leftQuote, 42 token.charOffset + leftQuote,
43 content, 43 content,
44 quoting); 44 quoting);
45 } 45 }
46 46
47 static StringQuoting quotingFromString(SourceString sourceString) { 47 static StringQuoting quotingFromString(SourceString sourceString) {
48 Iterator<int> source = sourceString.iterator(); 48 Iterator<int> source = sourceString.iterator();
49 bool raw = false; 49 bool raw = false;
50 int quoteLength = 1; 50 int quoteLength = 1;
51 int quoteChar = source.next(); 51 int quoteChar = source.next();
52 if (quoteChar === $r) { 52 if (identical(quoteChar, $r)) {
53 raw = true; 53 raw = true;
54 quoteChar = source.next(); 54 quoteChar = source.next();
55 } 55 }
56 assert(quoteChar == $SQ || quoteChar == $DQ); 56 assert(quoteChar == $SQ || quoteChar == $DQ);
57 // String has at least one quote. Check it if has three. 57 // String has at least one quote. Check it if has three.
58 // If it only have two, the string must be an empty string literal, 58 // If it only have two, the string must be an empty string literal,
59 // and end after the second quote. 59 // and end after the second quote.
60 bool multiline = false; 60 bool multiline = false;
61 if (source.hasNext && source.next() == quoteChar && source.hasNext) { 61 if (source.hasNext && source.next() == quoteChar && source.hasNext) {
62 int code = source.next(); 62 int code = source.next();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 } 179 }
180 // String literal successfully validated. 180 // String literal successfully validated.
181 if (quoting.raw || !containsEscape) { 181 if (quoting.raw || !containsEscape) {
182 // A string without escapes could just as well have been raw. 182 // A string without escapes could just as well have been raw.
183 return new DartString.rawString(string, length); 183 return new DartString.rawString(string, length);
184 } 184 }
185 return new DartString.escapedString(string, length); 185 return new DartString.escapedString(string, length);
186 } 186 }
187 } 187 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698