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

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

Issue 23956007: Fix bug in inferrer for the computation of callers: we need to keep track of what is the called nod… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that computation of callers of an element works when two
6 // elements of the same name are being invoked in the same method.
7
8 import 'package:expect/expect.dart';
9 import "package:async_helper/async_helper.dart";
10 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart';
11 import '../../../sdk/lib/_internal/compiler/implementation/types/simple_types_in ferrer.dart';
12
13 import 'compiler_helper.dart';
14 import 'parser_helper.dart';
15
16 const String TEST = """
17 class A {
18 var field;
19 }
20
21 class B {
22 var field;
23 }
24
25 main() {
26 new A().field;
27 new B().field;
28 }
29 """;
30
31 // Create our own type inferrer to avoid clearing out the internal
32 // data structures.
33 class MyInferrer extends SimpleTypesInferrer {
34 MyInferrer(compiler) : super(compiler);
35 clear() {}
36 }
37
38 void main() {
39 Uri uri = new Uri(scheme: 'source');
40 var compiler = compilerFor(TEST, uri);
41 var inferrer = new MyInferrer(compiler);
42 compiler.typesTask.typesInferrer = inferrer;
43 asyncTest(() => compiler.runCompiler(uri).then((_) {
44 var mainElement = findElement(compiler, 'main');
45 var classA = findElement(compiler, 'A');
46 var fieldA = classA.lookupLocalMember(buildSourceString('field'));
47 var classB = findElement(compiler, 'B');
48 var fieldB = classB.lookupLocalMember(buildSourceString('field'));;
49
50 Expect.isTrue(inferrer.getCallersOf(fieldA).contains(mainElement));
51 Expect.isTrue(inferrer.getCallersOf(fieldB).contains(mainElement));
52 }));
53 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698