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

Side by Side Diff: tests/lib/mirrors/relation_subclass_test.dart

Issue 360493002: Emit declarations for typedefs that are needed by reflection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/typedef_declaration_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library test.relation_subclass; 5 library test.relation_subclass;
6 6
7 import "dart:mirrors"; 7 import "dart:mirrors";
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Expect.isFalse(Obj.isSubclassOf(Sub2)); 50 Expect.isFalse(Obj.isSubclassOf(Sub2));
51 51
52 Expect.isTrue(Super.isSubclassOf(Obj)); 52 Expect.isTrue(Super.isSubclassOf(Obj));
53 Expect.isFalse(Obj.isSubclassOf(Super)); 53 Expect.isFalse(Obj.isSubclassOf(Super));
54 54
55 var Func = coreLibrary.declarations[#Function]; 55 var Func = coreLibrary.declarations[#Function];
56 Expect.isTrue(Func.isSubclassOf(Obj)); 56 Expect.isTrue(Func.isSubclassOf(Obj));
57 Expect.isFalse(Obj.isSubclassOf(Func)); 57 Expect.isFalse(Obj.isSubclassOf(Func));
58 58
59 // Function typedef. 59 // Function typedef.
60 // TODO(16939): retrieve via declaration when dart2js supports it. 60 var NumPred = thisLibrary.declarations[#NumberPredicate];
61 var NumPred = reflectType(NumberPredicate); 61 var IntPred = thisLibrary.declarations[#IntegerPredicate];
62 var IntPred = reflectType(IntegerPredicate); 62 var DubPred = thisLibrary.declarations[#DoublePredicate];
63 var DubPred = reflectType(DoublePredicate); 63 var NumGen = thisLibrary.declarations[#NumberGenerator];
64 var NumGen = reflectType(NumberGenerator); 64 var IntGen = thisLibrary.declarations[#IntegerGenerator];
65 var IntGen = reflectType(IntegerGenerator); 65 var DubGen = thisLibrary.declarations[#DoubleGenerator];
66 var DubGen = reflectType(DoubleGenerator);
67 66
68 isArgumentOrTypeError(e) => e is ArgumentError || e is TypeError; 67 isArgumentOrTypeError(e) => e is ArgumentError || e is TypeError;
69 Expect.throws(() => Func.isSubclassOf(NumPred), isArgumentOrTypeError); 68 Expect.throws(() => Func.isSubclassOf(NumPred), isArgumentOrTypeError);
70 Expect.throws(() => Func.isSubclassOf(IntPred), isArgumentOrTypeError); 69 Expect.throws(() => Func.isSubclassOf(IntPred), isArgumentOrTypeError);
71 Expect.throws(() => Func.isSubclassOf(DubPred), isArgumentOrTypeError); 70 Expect.throws(() => Func.isSubclassOf(DubPred), isArgumentOrTypeError);
72 Expect.throws(() => Func.isSubclassOf(NumGen), isArgumentOrTypeError); 71 Expect.throws(() => Func.isSubclassOf(NumGen), isArgumentOrTypeError);
73 Expect.throws(() => Func.isSubclassOf(IntGen), isArgumentOrTypeError); 72 Expect.throws(() => Func.isSubclassOf(IntGen), isArgumentOrTypeError);
74 Expect.throws(() => Func.isSubclassOf(DubGen), isArgumentOrTypeError); 73 Expect.throws(() => Func.isSubclassOf(DubGen), isArgumentOrTypeError);
75 74
76 isNoSuchMethodError(e) => e is NoSuchMethodError; 75 isNoSuchMethodError(e) => e is NoSuchMethodError;
(...skipping 25 matching lines...) Expand all
102 // IntPredRef.isSubclassOf(Func); 101 // IntPredRef.isSubclassOf(Func);
103 // DubPredRef.isSubclassOf(Func); 102 // DubPredRef.isSubclassOf(Func);
104 // NumGenRef.isSubclassOf(Func); 103 // NumGenRef.isSubclassOf(Func);
105 // IntGenRef.isSubclassOf(Func); 104 // IntGenRef.isSubclassOf(Func);
106 // DubGenRef.isSubclassOf(Func); 105 // DubGenRef.isSubclassOf(Func);
107 } 106 }
108 107
109 main() { 108 main() {
110 test(currentMirrorSystem()); 109 test(currentMirrorSystem());
111 } 110 }
OLDNEW
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/typedef_declaration_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698