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

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

Issue 2610513005: Use Entity instead of Element in ConstantValue (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/optimize.dart ('k') | tests/compiler/dart2js/kernel/visitor_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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:compiler/src/compiler.dart' show Compiler; 5 import 'package:compiler/src/compiler.dart' show Compiler;
6 import 'package:compiler/src/elements/elements.dart'; 6 import 'package:compiler/src/elements/elements.dart';
7 import 'package:test/test.dart'; 7 import 'package:test/test.dart';
8 8
9 import 'helper.dart' show check; 9 import 'helper.dart' show check;
10 10
(...skipping 16 matching lines...) Expand all
27 int x = 1; 27 int x = 1;
28 } 28 }
29 29
30 main() { 30 main() {
31 var a = new A(); 31 var a = new A();
32 return a; 32 return a;
33 }'''; 33 }''';
34 return check(code, lookup: defaultConstructorFor('A')); 34 return check(code, lookup: defaultConstructorFor('A'));
35 }); 35 });
36 36
37 test('redirecting constructor with field', () { 37 test('redirecting constructor with field', () {
38 String code = ''' 38 String code = '''
39 class Foo { 39 class Foo {
40 final int value; 40 final int value;
41 const Foo({int number: 0}) : this.poodle(number * 2); 41 const Foo({int number: 0}) : this.poodle(number * 2);
42 const Foo.poodle(this.value); 42 const Foo.poodle(this.value);
43 } 43 }
44 44
45 main() => new Foo(number: 3); 45 main() => new Foo(number: 3);
46 '''; 46 ''';
47 return check(code, lookup: defaultConstructorFor('Foo')); 47 return check(code, lookup: defaultConstructorFor('Foo'));
48 }); 48 });
49 } 49 }
50 50
51 defaultConstructorFor(String className) => (Compiler compiler) { 51 defaultConstructorFor(String className) => (Compiler compiler) {
52 ClassElement clazz = compiler.mainApp.find(className); 52 ClassElement clazz = compiler.mainApp.find(className);
53 return clazz.lookupDefaultConstructor(); 53 return clazz.lookupDefaultConstructor();
54 }; 54 };
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/optimize.dart ('k') | tests/compiler/dart2js/kernel/visitor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698