OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 /// Test that checks that we are not added $isFunction properties on closure |
| 6 /// classes. |
| 7 |
| 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:compiler/src/commandline_options.dart'; |
| 10 import 'package:compiler/src/compiler.dart'; |
| 11 import 'package:compiler/src/js_emitter/model.dart'; |
| 12 import 'package:expect/expect.dart'; |
| 13 import 'memory_compiler.dart'; |
| 14 |
| 15 const String SOURCE = ''' |
| 16 import 'dart:isolate'; |
| 17 main(arg) {} |
| 18 '''; |
| 19 |
| 20 main() { |
| 21 asyncTest(() async { |
| 22 var result = await runCompiler( |
| 23 memorySourceFiles: {'main.dart': SOURCE}, |
| 24 options: [Flags.enableCheckedMode]); |
| 25 Expect.isTrue(result.isSuccess); |
| 26 Compiler compiler = result.compiler; |
| 27 Program program = compiler.backend.emitter.emitter.programForTesting; |
| 28 var name = compiler.backend.namer |
| 29 .operatorIs(compiler.frontendStrategy.commonElements.functionClass); |
| 30 for (Fragment fragment in program.fragments) { |
| 31 for (Library library in fragment.libraries) { |
| 32 for (Class cls in library.classes) { |
| 33 if (!cls.element.isClosure) continue; |
| 34 for (StubMethod stub in cls.isChecks) { |
| 35 Expect.notEquals( |
| 36 stub.name.key, name.key, "Unexpected ${name.key} stub on $cls"); |
| 37 } |
| 38 } |
| 39 } |
| 40 } |
| 41 }); |
| 42 } |
OLD | NEW |