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

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: Minor fix Created 7 years, 6 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 132d3a7308becc89af9cbd31c7f0694917bb12f5..1c946eeea1453ebfc28d44020d0c67e40e00e6ab 100644
--- a/tests/compiler/dart2js/type_representation_test.dart
+++ b/tests/compiler/dart2js/type_representation_test.dart
@@ -10,7 +10,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();
@@ -42,6 +42,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');
@@ -77,7 +85,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: "void_", $retvoid: true}]',
instantiate(List_, [Typedef_]));
// Map<K,V>
@@ -91,46 +99,51 @@ void testTypeRepresentations() {
instantiate(Map_, [int_, String_]));
// void m1() {}
- expect("{func: true, retvoid: true}",
+ expect('{$func: "void_", $retvoid: true}',
env.getElement('m1').computeType(env.compiler));
// int m2() => 0;
- expect("{func: true, ret: $int_rep}",
+ expect('{$func: "int_", $ret: $int_rep}',
env.getElement('m2').computeType(env.compiler));
// List<int> m3() => null;
- expect("{func: true, ret: [$List_rep, $int_rep]}",
+ expect('{$func: "List_", $ret: [$List_rep, $int_rep]}',
env.getElement('m3').computeType(env.compiler));
// m4() {}
- expect("{func: true}",
+ expect('{$func: "dynamic_"}',
env.getElement('m4').computeType(env.compiler));
// m5(int a, String b) {}
- expect("{func: true, args: [$int_rep, $String_rep]}",
+ expect('{$func: "dynamic__int_String", $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: "dynamic__int__String", $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: "dynamic__int_String__List_dynamic",'
+ ' $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: "dynamic__int__String0",'
+ ' $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: "dynamic__int_String__List_dynamic0",'
+ ' $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: "dynamic__void__int__dynamic", $args:'
+ ' [{$func: "void__int__dynamic",'
+ ' $retvoid: true, $args: [$int_rep], $opt: [null]}]}',
env.getElement('m10').computeType(env.compiler));
}

Powered by Google App Engine
This is Rietveld 408576698