Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart

Issue 2990983002: Handle NativeTypedArray in closed_world_from_dill_test (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Partial test that the closed world computed from [WorldImpact]s derived from 5 // Partial test that the closed world computed from [WorldImpact]s derived from
6 // kernel is equivalent to the original computed from resolution. 6 // kernel is equivalent to the original computed from resolution.
7 library dart2js.kernel.closed_world_from_dill_test; 7 library dart2js.kernel.closed_world_from_dill_test;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:io'; 10 import 'dart:io';
11 11
12 import 'package:async_helper/async_helper.dart'; 12 import 'package:async_helper/async_helper.dart';
13 import 'package:compiler/src/commandline_options.dart'; 13 import 'package:compiler/src/commandline_options.dart';
14 import 'package:compiler/src/common.dart'; 14 import 'package:compiler/src/common.dart';
15 import 'package:compiler/src/compiler.dart'; 15 import 'package:compiler/src/compiler.dart';
16 import 'package:compiler/src/elements/types.dart'; 16 import 'package:compiler/src/elements/types.dart';
17 import 'package:compiler/src/enqueue.dart'; 17 import 'package:compiler/src/enqueue.dart';
18 import 'package:compiler/src/kernel/element_map.dart'; 18 import 'package:compiler/src/kernel/element_map.dart';
19 import 'package:compiler/src/kernel/kernel_strategy.dart'; 19 import 'package:compiler/src/kernel/kernel_strategy.dart';
20 import 'package:compiler/src/resolution/class_hierarchy.dart';
20 import 'package:compiler/src/resolution/enum_creator.dart'; 21 import 'package:compiler/src/resolution/enum_creator.dart';
21 import 'package:compiler/src/universe/world_builder.dart'; 22 import 'package:compiler/src/universe/world_builder.dart';
22 import 'package:compiler/src/world.dart'; 23 import 'package:compiler/src/world.dart';
23 import 'package:expect/expect.dart'; 24 import 'package:expect/expect.dart';
24 import '../memory_compiler.dart'; 25 import '../memory_compiler.dart';
25 import '../equivalence/check_functions.dart'; 26 import '../equivalence/check_functions.dart';
26 import '../serialization/helper.dart'; 27 import '../serialization/helper.dart';
27 import 'test_helpers.dart'; 28 import 'test_helpers.dart';
28 29
29 import 'compiler_helper.dart'; 30 import 'compiler_helper.dart';
30 31
31 const SOURCE = const { 32 const SOURCE = const {
32 'main.dart': ''' 33 'main.dart': '''
33 import 'dart:html'; 34 import 'dart:html';
35 import 'dart:typed_data';
34 import 'package:expect/expect.dart'; 36 import 'package:expect/expect.dart';
35 37
36 class ClassWithSetter { 38 class ClassWithSetter {
37 void set setter(_) {} 39 void set setter(_) {}
38 } 40 }
39 41
40 class Mixin { 42 class Mixin {
41 method1() {} 43 method1() {}
42 method2() {} 44 method2() {}
43 method3() {} 45 method3() {}
(...skipping 23 matching lines...) Expand all
67 new ClassWithSetter().setter = null; 69 new ClassWithSetter().setter = null;
68 new Class1().method1(); 70 new Class1().method1();
69 new Class2().method2(); 71 new Class2().method2();
70 new Class2().method3(); 72 new Class2().method3();
71 new Class2().method5(); 73 new Class2().method5();
72 new Element.div(); 74 new Element.div();
73 null is List<int>; // Use generic test 75 null is List<int>; // Use generic test
74 method1(); // Both top level and instance method named 'method1' are live. 76 method1(); // Both top level and instance method named 'method1' are live.
75 #main; // Use a const symbol. 77 #main; // Use a const symbol.
76 const Symbol('foo'); // Use the const Symbol constructor directly 78 const Symbol('foo'); // Use the const Symbol constructor directly
79 new Int8List(0); // Use redirect factory to abstract native class
77 } 80 }
78 ''' 81 '''
79 }; 82 };
80 83
81 main(List<String> args) { 84 main(List<String> args) {
82 asyncTest(() async { 85 asyncTest(() async {
83 await mainInternal(args); 86 await mainInternal(args);
84 }); 87 });
85 } 88 }
86 89
87 enum ResultKind { crashes, errors, warnings, success, failure } 90 enum ResultKind { crashes, errors, warnings, success, failure }
88 91
89 Future<ResultKind> mainInternal(List<String> args, 92 Future<ResultKind> mainInternal(List<String> args,
90 {bool skipWarnings: false, bool skipErrors: false}) async { 93 {bool skipWarnings: false, bool skipErrors: false}) async {
91 Arguments arguments = new Arguments.from(args); 94 Arguments arguments = new Arguments.from(args);
92 Uri entryPoint; 95 Uri entryPoint;
93 Map<String, String> memorySourceFiles; 96 Map<String, String> memorySourceFiles;
94 if (arguments.uri != null) { 97 if (arguments.uri != null) {
95 entryPoint = arguments.uri; 98 entryPoint = arguments.uri;
96 memorySourceFiles = const <String, String>{}; 99 memorySourceFiles = const <String, String>{};
97 } else { 100 } else {
98 entryPoint = Uri.parse('memory:main.dart'); 101 entryPoint = Uri.parse('memory:main.dart');
99 memorySourceFiles = SOURCE; 102 memorySourceFiles = SOURCE;
100 } 103 }
101 104
102 enableDebugMode(); 105 enableDebugMode();
103 EnumCreator.matchKernelRepresentationForTesting = true; 106 EnumCreator.matchKernelRepresentationForTesting = true;
107 useOptimizedMixins = true;
104 108
105 Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill'); 109 Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
106 print('--- create temp directory $dir -------------------------------'); 110 print('--- create temp directory $dir -------------------------------');
107 memorySourceFiles.forEach((String name, String source) { 111 memorySourceFiles.forEach((String name, String source) {
108 new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source); 112 new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
109 }); 113 });
110 entryPoint = dir.uri.resolve(entryPoint.path); 114 entryPoint = dir.uri.resolve(entryPoint.path);
111 115
112 print('---- analyze-only ------------------------------------------------'); 116 print('---- analyze-only ------------------------------------------------');
113 DiagnosticCollector collector = new DiagnosticCollector(); 117 DiagnosticCollector collector = new DiagnosticCollector();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return equivalence.typeEquivalence(unalias(a), b); 162 return equivalence.typeEquivalence(unalias(a), b);
159 }, 163 },
160 elementFilter: elementFilter, 164 elementFilter: elementFilter,
161 verbose: arguments.verbose); 165 verbose: arguments.verbose);
162 166
163 checkClosedWorlds(closedWorld1, closedWorld2, 167 checkClosedWorlds(closedWorld1, closedWorld2,
164 strategy: equivalence.defaultStrategy, verbose: arguments.verbose); 168 strategy: equivalence.defaultStrategy, verbose: arguments.verbose);
165 169
166 return ResultKind.success; 170 return ResultKind.success;
167 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698