| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #import("compiler_helper.dart"); | 5 #import("compiler_helper.dart"); |
| 6 | 6 |
| 7 final String TEST_ONE = @""" | 7 final String TEST_ONE = @""" |
| 8 foo(a) { | 8 foo(a) { |
| 9 int c = foo(1); | 9 int c = foo(1); |
| 10 if (a) c = foo(2); | 10 if (a) c = foo(2); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 main() { | 33 main() { |
| 34 String generated = compile(TEST_ONE, 'foo'); | 34 String generated = compile(TEST_ONE, 'foo'); |
| 35 RegExp regexp = new RegExp(getIntTypeCheck(anyIdentifier)); | 35 RegExp regexp = new RegExp(getIntTypeCheck(anyIdentifier)); |
| 36 Iterator<Match> matches = regexp.allMatches(generated).iterator(); | 36 Iterator<Match> matches = regexp.allMatches(generated).iterator(); |
| 37 checkNumberOfMatches(matches, 0); | 37 checkNumberOfMatches(matches, 0); |
| 38 | 38 |
| 39 regexp = const RegExp("return c;"); | 39 regexp = const RegExp("return c;"); |
| 40 Expect.isTrue(regexp.hasMatch(generated)); | 40 Expect.isTrue(regexp.hasMatch(generated)); |
| 41 | 41 |
| 42 generated = compile(TEST_TWO, 'foo'); | 42 generated = compile(TEST_TWO, 'foo'); |
| 43 regexp = const RegExp("foo\\\$1\\(1\\)"); | 43 regexp = const RegExp("foo\\\$1\\(\\(1\\)\\)"); |
| 44 matches = regexp.allMatches(generated).iterator(); | 44 matches = regexp.allMatches(generated).iterator(); |
| 45 checkNumberOfMatches(matches, 1); | 45 checkNumberOfMatches(matches, 1); |
| 46 | 46 |
| 47 generated = compile(TEST_THREE, 'foo'); | 47 generated = compile(TEST_THREE, 'foo'); |
| 48 regexp = new RegExp(getIntTypeCheck('param1')); | 48 regexp = new RegExp(getIntTypeCheck('param1')); |
| 49 Expect.isTrue(regexp.hasMatch(generated)); | 49 Expect.isTrue(regexp.hasMatch(generated)); |
| 50 regexp = new RegExp(getIntTypeCheck('param2')); | 50 regexp = new RegExp(getIntTypeCheck('param2')); |
| 51 Expect.isTrue(regexp.hasMatch(generated)); | 51 Expect.isTrue(regexp.hasMatch(generated)); |
| 52 } | 52 } |
| OLD | NEW |