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

Unified Diff: tests/compiler/dart2js/type_representation_test.dart

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: New check encoding Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/type_representation_test.dart
diff --git a/tests/compiler/dart2js/type_representation_test.dart b/tests/compiler/dart2js/type_representation_test.dart
index 2edf6440be1f77a54ef3ff09df0b100061bdd9cd..73bfa4f7b71c190f101a8be23f46dfafecf67c13 100644
--- a/tests/compiler/dart2js/type_representation_test.dart
+++ b/tests/compiler/dart2js/type_representation_test.dart
@@ -9,7 +9,7 @@ import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
show Element, ClassElement;
import '../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart'
- show TypeRepresentationGenerator;
+ show JavaScriptBackend, TypeRepresentationGenerator;
void main() {
testTypeRepresentations();
@@ -41,6 +41,14 @@ void testTypeRepresentations() {
Expect.stringEquals(expectedRepresentation, foundRepresentation);
}
+ JavaScriptBackend backend = env.compiler.backend;
+ String func = backend.namer.functionTypeTag();
+ String retvoid = backend.namer.functionTypeVoidReturnTag();
+ String ret = backend.namer.functionTypeReturnTypeTag();
+ String args = backend.namer.functionTypeRequiredParametersTag();
+ String opt = backend.namer.functionTypeOptionalParametersTag();
+ String named = backend.namer.functionTypeNamedParametersTag();
+
ClassElement List_ = env.getElement('List');
TypeVariableType List_E = List_.typeVariables.head;
ClassElement Map_ = env.getElement('Map');
@@ -76,7 +84,7 @@ void testTypeRepresentations() {
// List<int>
expect('[$List_rep, $int_rep]', instantiate(List_, [int_]));
// List<Typedef>
- expect('[$List_rep, {func: true, retvoid: true}]',
+ expect('[$List_rep, {$func: true, $retvoid: true}]',
instantiate(List_, [Typedef_]));
// Map<K,V>
@@ -90,46 +98,46 @@ void testTypeRepresentations() {
instantiate(Map_, [int_, String_]));
// void m1() {}
- expect("{func: true, retvoid: true}",
+ expect("{$func: true, $retvoid: true}",
env.getElement('m1').computeType(env.compiler));
// int m2() => 0;
- expect("{func: true, ret: $int_rep}",
+ expect("{$func: true, $ret: $int_rep}",
env.getElement('m2').computeType(env.compiler));
// List<int> m3() => null;
- expect("{func: true, ret: [$List_rep, $int_rep]}",
+ expect("{$func: true, $ret: [$List_rep, $int_rep]}",
env.getElement('m3').computeType(env.compiler));
// m4() {}
- expect("{func: true}",
+ expect("{$func: true}",
env.getElement('m4').computeType(env.compiler));
// m5(int a, String b) {}
- expect("{func: true, args: [$int_rep, $String_rep]}",
+ expect("{$func: true, $args: [$int_rep, $String_rep]}",
env.getElement('m5').computeType(env.compiler));
// m6(int a, [String b]) {}
- expect("{func: true, args: [$int_rep], opt: [$String_rep]}",
+ expect("{$func: true, $args: [$int_rep], $opt: [$String_rep]}",
env.getElement('m6').computeType(env.compiler));
// m7(int a, String b, [List<int> c, d]) {}
- expect("{func: true, args: [$int_rep, $String_rep],"
- " opt: [[$List_rep, $int_rep], null]}",
+ expect("{$func: true, $args: [$int_rep, $String_rep],"
+ " $opt: [[$List_rep, $int_rep], null]}",
env.getElement('m7').computeType(env.compiler));
// m8(int a, {String b}) {}
- expect("{func: true, args: [$int_rep], named: {b: $String_rep}}",
+ expect("{$func: true, $args: [$int_rep], $named: {b: $String_rep}}",
env.getElement('m8').computeType(env.compiler));
// m9(int a, String b, {List<int> c, d}) {}
- expect("{func: true, args: [$int_rep, $String_rep],"
- " named: {c: [$List_rep, $int_rep], d: null}}",
+ expect("{$func: true, $args: [$int_rep, $String_rep],"
+ " $named: {c: [$List_rep, $int_rep], d: null}}",
env.getElement('m9').computeType(env.compiler));
// m10(void f(int a, [b])) {}
- expect("{func: true, args:"
- " [{func: true, retvoid: true, args: [$int_rep], opt: [null]}]}",
+ expect("{$func: true, $args:"
+ " [{$func: true, $retvoid: true, $args: [$int_rep], $opt: [null]}]}",
env.getElement('m10').computeType(env.compiler));
}

Powered by Google App Engine
This is Rietveld 408576698