| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 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 | 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 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'package:compiler/src/closure.dart'; | 7 import 'package:compiler/src/closure.dart'; |
| 8 import 'package:compiler/src/compiler.dart'; | 8 import 'package:compiler/src/compiler.dart'; |
| 9 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 9 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 10 import 'package:compiler/src/elements/elements.dart'; | 10 import 'package:compiler/src/elements/elements.dart'; |
| 11 import 'package:compiler/src/tree/nodes.dart'; | 11 import 'package:compiler/src/tree/nodes.dart'; |
| 12 import '../equivalence/id_equivalence.dart'; | 12 import '../equivalence/id_equivalence.dart'; |
| 13 import '../equivalence/id_equivalence_helper.dart'; | 13 import '../equivalence/id_equivalence_helper.dart'; |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 asyncTest(() async { | 16 asyncTest(() async { |
| 17 Directory dataDir = new Directory.fromUri(Platform.script.resolve('data')); | 17 Directory dataDir = new Directory.fromUri(Platform.script.resolve('data')); |
| 18 await for (FileSystemEntity entity in dataDir.list()) { | 18 await for (FileSystemEntity entity in dataDir.list()) { |
| 19 print('Checking ${entity.uri}'); | 19 print('Checking ${entity.uri}'); |
| 20 String annotatedCode = await new File.fromUri(entity.uri).readAsString(); | 20 String annotatedCode = await new File.fromUri(entity.uri).readAsString(); |
| 21 await checkCode(annotatedCode, checkClosureData); | 21 await checkCode(annotatedCode, checkClosureData); |
| 22 } | 22 } |
| 23 }); | 23 }); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void checkClosureData( | 26 void checkClosureData( |
| 27 Compiler compiler, Map<Id, String> expectedMap, MemberElement member) { | 27 Compiler compiler, Map<Id, String> expectedMap, MemberElement member) { |
| 28 new ClosureChecker(compiler.reporter, expectedMap, member.resolvedAst, | 28 new ClosureChecker(compiler.reporter, expectedMap, member.resolvedAst, |
| 29 compiler.closureDataLookup as ClosureDataLookup<Node>) | 29 compiler.backendStrategy.closureDataLookup as ClosureDataLookup<Node>) |
| 30 .check(); | 30 .check(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 class ClosureChecker extends AbstractResolvedAstChecker { | 33 class ClosureChecker extends AbstractResolvedAstChecker { |
| 34 final ClosureDataLookup<Node> closureDataLookup; | 34 final ClosureDataLookup<Node> closureDataLookup; |
| 35 final ClosureRepresentationInfo info; | 35 final ClosureRepresentationInfo info; |
| 36 | 36 |
| 37 ClosureChecker(DiagnosticReporter reporter, Map<Id, String> expectedMap, | 37 ClosureChecker(DiagnosticReporter reporter, Map<Id, String> expectedMap, |
| 38 ResolvedAst resolvedAst, this.closureDataLookup) | 38 ResolvedAst resolvedAst, this.closureDataLookup) |
| 39 : this.info = | 39 : this.info = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 return sb.toString(); | 51 return sb.toString(); |
| 52 } | 52 } |
| 53 return null; | 53 return null; |
| 54 } | 54 } |
| 55 | 55 |
| 56 @override | 56 @override |
| 57 String computeElementValue(AstElement element) { | 57 String computeElementValue(AstElement element) { |
| 58 return null; | 58 return null; |
| 59 } | 59 } |
| 60 } | 60 } |
| OLD | NEW |