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

Side by Side Diff: tests/compiler/dart2js/mirror_helper_test.dart

Issue 263103003: Remove warnings from dart2js test-suite. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove debug code. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 'dart:async'; 6 import 'dart:async';
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import 'memory_compiler.dart' show compilerFor; 8 import 'memory_compiler.dart' show compilerFor;
9 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show 9 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
10 Compiler; 10 Compiler;
11 import 11 import
12 '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart' 12 '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
13 show 13 show
14 Element, LibraryElement, ClassElement; 14 Element, LibraryElement, ClassElement;
15 import 15 import
16 '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' 16 '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'
17 show 17 show
18 Node; 18 Block, ExpressionStatement, FunctionExpression, Node, Send;
19 import 19 import
20 '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_backen d.dart' 20 '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_backen d.dart'
21 show 21 show
22 DartBackend, ElementAst; 22 DartBackend, ElementAst;
23 import 23 import
24 '../../../sdk/lib/_internal/compiler/implementation/mirror_renamer/mirror_re namer.dart' 24 '../../../sdk/lib/_internal/compiler/implementation/mirror_renamer/mirror_re namer.dart'
25 show 25 show
26 MirrorRenamer; 26 MirrorRenamer;
27 27
28 28
(...skipping 18 matching lines...) Expand all
47 47
48 void testWithMirrorRenaming({bool minify}) { 48 void testWithMirrorRenaming({bool minify}) {
49 asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify). 49 asyncTest(() => runCompiler(useMirrorHelperLibrary: true, minify: minify).
50 then((Compiler compiler) { 50 then((Compiler compiler) {
51 51
52 DartBackend backend = compiler.backend; 52 DartBackend backend = compiler.backend;
53 MirrorRenamer mirrorRenamer = backend.mirrorRenamer; 53 MirrorRenamer mirrorRenamer = backend.mirrorRenamer;
54 Map<Node, String> renames = backend.renames; 54 Map<Node, String> renames = backend.renames;
55 Map<LibraryElement, String> imports = backend.imports; 55 Map<LibraryElement, String> imports = backend.imports;
56 56
57 Node getNameFunctionNode = 57 FunctionExpression node = backend.memberNodes.values.first.first;
58 backend.memberNodes.values.first.first.body.statements.nodes.head; 58 Block block = node.body;
59 ExpressionStatement getNameFunctionNode = block.statements.nodes.head;
60 Send send = getNameFunctionNode.expression;
59 61
60 Expect.equals(renames[mirrorRenamer.mirrorHelperGetNameFunctionNode.name], 62 Expect.equals(renames[mirrorRenamer.mirrorHelperGetNameFunctionNode.name],
61 renames[getNameFunctionNode.expression.selector]); 63 renames[send.selector]);
62 Expect.equals("", 64 Expect.equals("",
63 renames[getNameFunctionNode.expression.receiver]); 65 renames[send.receiver]);
64 Expect.equals(1, imports.keys.length); 66 Expect.equals(1, imports.keys.length);
65 })); 67 }));
66 } 68 }
67 69
68 void testWithoutMirrorRenaming({bool minify}) { 70 void testWithoutMirrorRenaming({bool minify}) {
69 asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify). 71 asyncTest(() => runCompiler(useMirrorHelperLibrary: false, minify: minify).
70 then((Compiler compiler) { 72 then((Compiler compiler) {
71 73
72 DartBackend backend = compiler.backend; 74 DartBackend backend = compiler.backend;
73 Map<Node, String> renames = backend.renames; 75 Map<Node, String> renames = backend.renames;
74 Map<LibraryElement, String> imports = backend.imports; 76 Map<LibraryElement, String> imports = backend.imports;
75 77
76 Node getNameFunctionNode = 78 FunctionExpression node = backend.memberNodes.values.first.first;
77 backend.memberNodes.values.first.first.body.statements.nodes.head; 79 Block block = node.body;
80 ExpressionStatement getNameFunctionNode = block.statements.nodes.head;
81 Send send = getNameFunctionNode.expression;
78 82
79 Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector)) ; 83 Expect.isFalse(renames.containsKey(send.selector));
80 Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver)) ; 84 Expect.isFalse(renames.containsKey(send.receiver));
81 Expect.equals(1, imports.keys.length); 85 Expect.equals(1, imports.keys.length);
82 })); 86 }));
83 } 87 }
84 88
85 const MEMORY_SOURCE_FILES = const <String, String> { 89 const MEMORY_SOURCE_FILES = const <String, String> {
86 'main.dart': """ 90 'main.dart': """
87 import 'dart:mirrors'; 91 import 'dart:mirrors';
88 92
89 class Foo { 93 class Foo {
90 noSuchMethod(Invocation invocation) { 94 noSuchMethod(Invocation invocation) {
91 MirrorSystem.getName(invocation.memberName); 95 MirrorSystem.getName(invocation.memberName);
92 } 96 }
93 } 97 }
94 98
95 void main() { 99 void main() {
96 new Foo().fisk(); 100 new Foo().fisk();
97 } 101 }
98 """}; 102 """};
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/mirror_helper_unique_minification_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698