| OLD | NEW |
| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
| 7 import 'package:compiler/compiler_new.dart'; |
| 7 import 'memory_compiler.dart'; | 8 import 'memory_compiler.dart'; |
| 8 | 9 |
| 9 const MEMORY_SOURCE_FILES = const { | 10 const MEMORY_SOURCE_FILES = const { |
| 10 'main.dart': ''' | 11 'main.dart': ''' |
| 11 import 'package:expect/expect.dart'; | 12 import 'package:expect/expect.dart'; |
| 12 | 13 |
| 13 @NoInline() | 14 @NoInline() |
| 14 foo(y) => 49912344 + y; | 15 foo(y) => 49912344 + y; |
| 15 | 16 |
| 16 class A { | 17 class A { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 }''' | 35 }''' |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 void main() { | 38 void main() { |
| 38 asyncTest(() async { | 39 asyncTest(() async { |
| 39 OutputCollector collector = new OutputCollector(); | 40 OutputCollector collector = new OutputCollector(); |
| 40 CompilationResult result = await runCompiler( | 41 CompilationResult result = await runCompiler( |
| 41 memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector); | 42 memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector); |
| 42 // Simply check that the constants of the small functions are still in the | 43 // Simply check that the constants of the small functions are still in the |
| 43 // output, and that we don't see the result of constant folding. | 44 // output, and that we don't see the result of constant folding. |
| 44 String jsOutput = collector.getOutput('', 'js'); | 45 String jsOutput = collector.getOutput('', OutputType.js); |
| 45 | 46 |
| 46 Expect.isTrue(jsOutput.contains('49912344')); | 47 Expect.isTrue(jsOutput.contains('49912344')); |
| 47 Expect.isTrue(jsOutput.contains('123455')); | 48 Expect.isTrue(jsOutput.contains('123455')); |
| 48 Expect.isTrue(jsOutput.contains('81234512')); | 49 Expect.isTrue(jsOutput.contains('81234512')); |
| 49 Expect.isFalse(jsOutput.contains('49935756')); | 50 Expect.isFalse(jsOutput.contains('49935756')); |
| 50 Expect.isFalse(jsOutput.contains('211109')); | 51 Expect.isFalse(jsOutput.contains('211109')); |
| 51 Expect.isFalse(jsOutput.contains('82155031')); | 52 Expect.isFalse(jsOutput.contains('82155031')); |
| 52 Expect.isFalse(jsOutput.contains('4712')); | 53 Expect.isFalse(jsOutput.contains('4712')); |
| 53 }); | 54 }); |
| 54 } | 55 } |
| OLD | NEW |