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

Side by Side Diff: tests/language/static_inline_test.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 9 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 // Test inlining of assignments in parameter passing. If [StringScanner.charAt] 5 // Test inlining of assignments in parameter passing. If [StringScanner.charAt]
6 // is inlined, the argument expresion [: ++byteOffset :] should not be 6 // is inlined, the argument expresion [: ++byteOffset :] should not be
7 // duplicated. 7 // duplicated.
8 8
9 class StringScanner { 9 class StringScanner {
10 static String string; 10 static String string;
11 int byteOffset = -1; 11 int byteOffset = -1;
12 12
13 int nextByte(foo) { 13 int nextByte(foo) {
14 if (foo) return -2; 14 if (foo) return -2;
15 return charAt(++byteOffset); 15 return charAt(++byteOffset);
16 } 16 }
17 17
18 static int charAt(index) 18 static int charAt(index)
19 => (string.length > index) ? string.charCodeAt(index) : -1; 19 => (string.length > index) ? string.codeUnitAt(index) : -1;
20 } 20 }
21 21
22 void main() { 22 void main() {
23 var scanner = new StringScanner(); 23 var scanner = new StringScanner();
24 StringScanner.string = 'az9'; 24 StringScanner.string = 'az9';
25 Expect.equals(0x61, scanner.nextByte(false)); // Expect a. 25 Expect.equals(0x61, scanner.nextByte(false)); // Expect a.
26 Expect.equals(0x7A, scanner.nextByte(false)); // Expect z. 26 Expect.equals(0x7A, scanner.nextByte(false)); // Expect z.
27 Expect.equals(0x39, scanner.nextByte(false)); // Expect 9. 27 Expect.equals(0x39, scanner.nextByte(false)); // Expect 9.
28 Expect.equals(-1, scanner.nextByte(false)); 28 Expect.equals(-1, scanner.nextByte(false));
29 } 29 }
OLDNEW
« no previous file with comments | « tests/language/optimized_string_charcodeat_test.dart ('k') | tests/language/string_escapes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698