| 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 // Test that parameters keep their names in the output. | 4 // Test that parameters keep their names in the output. | 
| 5 | 5 | 
| 6 import 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; | 
| 7 | 7 | 
| 8 const String FOO = r""" | 8 const String FOO = r""" | 
| 9 void foo(var a, var b) { | 9 void foo(var a, var b) { | 
| 10 } | 10 } | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 63   if (test) { | 63   if (test) { | 
| 64     result = 42; | 64     result = 42; | 
| 65   } | 65   } | 
| 66   return result; | 66   return result; | 
| 67 } | 67 } | 
| 68 """; | 68 """; | 
| 69 | 69 | 
| 70 main() { | 70 main() { | 
| 71   String generated = compile(FOO, entry: 'foo'); | 71   String generated = compile(FOO, entry: 'foo'); | 
| 72   // TODO(ngeoffray): Use 'contains' when frog supports it. | 72   // TODO(ngeoffray): Use 'contains' when frog supports it. | 
| 73   RegExp regexp = const RegExp(r"function\(a, b\) {"); | 73   RegExp regexp = new RegExp(r"function\(a, b\) {"); | 
| 74   Expect.isTrue(regexp.hasMatch(generated)); | 74   Expect.isTrue(regexp.hasMatch(generated)); | 
| 75 | 75 | 
| 76   generated = compile(BAR, entry: 'bar'); | 76   generated = compile(BAR, entry: 'bar'); | 
| 77   regexp = const RegExp(r"function\(eval\$, \$\$eval\) {"); | 77   regexp = new RegExp(r"function\(eval\$, \$\$eval\) {"); | 
| 78   Expect.isTrue(regexp.hasMatch(generated)); | 78   Expect.isTrue(regexp.hasMatch(generated)); | 
| 79 | 79 | 
| 80   generated = compile(PARAMETER_AND_TEMP, entry: 'bar'); | 80   generated = compile(PARAMETER_AND_TEMP, entry: 'bar'); | 
| 81   regexp = const RegExp(r"print\(t0\)"); | 81   regexp = new RegExp(r"print\(t0\)"); | 
| 82   Expect.isTrue(regexp.hasMatch(generated)); | 82   Expect.isTrue(regexp.hasMatch(generated)); | 
| 83   // Check that the second 't0' got another name. | 83   // Check that the second 't0' got another name. | 
| 84   regexp = const RegExp(r"print\(t0_0\)"); | 84   regexp = new RegExp(r"print\(t0_0\)"); | 
| 85   Expect.isTrue(regexp.hasMatch(generated)); | 85   Expect.isTrue(regexp.hasMatch(generated)); | 
| 86 | 86 | 
| 87   generated = compile(NO_LOCAL, entry: 'foo'); | 87   generated = compile(NO_LOCAL, entry: 'foo'); | 
| 88   regexp = const RegExp("return baz"); | 88   regexp = new RegExp("return baz"); | 
| 89   Expect.isTrue(regexp.hasMatch(generated)); | 89   Expect.isTrue(regexp.hasMatch(generated)); | 
| 90   regexp = const RegExp(r"baz = 2"); | 90   regexp = new RegExp(r"baz = 2"); | 
| 91   Expect.isTrue(regexp.hasMatch(generated)); | 91   Expect.isTrue(regexp.hasMatch(generated)); | 
| 92   regexp = const RegExp(r"baz = 3"); | 92   regexp = new RegExp(r"baz = 3"); | 
| 93   Expect.isTrue(regexp.hasMatch(generated)); | 93   Expect.isTrue(regexp.hasMatch(generated)); | 
| 94   regexp = const RegExp("bar === true"); | 94   regexp = new RegExp("bar === true"); | 
| 95   Expect.isTrue(regexp.hasMatch(generated)); | 95   Expect.isTrue(regexp.hasMatch(generated)); | 
| 96 | 96 | 
| 97   generated = compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo'); | 97   generated = compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo'); | 
| 98   regexp = const RegExp(r"var a = 2;"); | 98   regexp = new RegExp(r"var a = 2;"); | 
| 99   Expect.isTrue(regexp.hasMatch(generated)); | 99   Expect.isTrue(regexp.hasMatch(generated)); | 
| 100 | 100 | 
| 101   regexp = const RegExp(r"a = 2;"); | 101   regexp = new RegExp(r"a = 2;"); | 
| 102   Iterator matches = regexp.allMatches(generated).iterator(); | 102   Iterator matches = regexp.allMatches(generated).iterator(); | 
| 103   Expect.isTrue(matches.hasNext); | 103   Expect.isTrue(matches.hasNext); | 
| 104   matches.next(); | 104   matches.next(); | 
| 105   Expect.isFalse(matches.hasNext); | 105   Expect.isFalse(matches.hasNext); | 
| 106 | 106 | 
| 107   generated = compile(PARAMETER_INIT, entry: 'foo'); | 107   generated = compile(PARAMETER_INIT, entry: 'foo'); | 
| 108   regexp = const RegExp("var result = start;"); | 108   regexp = new RegExp("var result = start;"); | 
| 109   Expect.isTrue(regexp.hasMatch(generated)); | 109   Expect.isTrue(regexp.hasMatch(generated)); | 
| 110 } | 110 } | 
| OLD | NEW | 
|---|