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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/native_handler.dart

Issue 177963002: Use List instead of Link in the type system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 native; 5 library native;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 import 'dart2jslib.dart'; 8 import 'dart2jslib.dart';
9 import 'dart_types.dart'; 9 import 'dart_types.dart';
10 import 'elements/elements.dart'; 10 import 'elements/elements.dart';
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 939
940 /// Models the behavior of having intances of [type] escape from Dart code 940 /// Models the behavior of having intances of [type] escape from Dart code
941 /// into native code. 941 /// into native code.
942 void _escape(DartType type, Compiler compiler) { 942 void _escape(DartType type, Compiler compiler) {
943 type = type.unalias(compiler); 943 type = type.unalias(compiler);
944 if (type is FunctionType) { 944 if (type is FunctionType) {
945 FunctionType functionType = type; 945 FunctionType functionType = type;
946 // A function might be called from native code, passing us novel 946 // A function might be called from native code, passing us novel
947 // parameters. 947 // parameters.
948 _escape(functionType.returnType, compiler); 948 _escape(functionType.returnType, compiler);
949 for (Link<DartType> parameters = functionType.parameterTypes; 949 for (DartType parameter in functionType.parameterTypes) {
950 !parameters.isEmpty; 950 _capture(parameter, compiler);
951 parameters = parameters.tail) {
952 _capture(parameters.head, compiler);
953 } 951 }
954 } 952 }
955 } 953 }
956 954
957 /// Models the behavior of Dart code receiving instances and methods of [type] 955 /// Models the behavior of Dart code receiving instances and methods of [type]
958 /// from native code. We usually start the analysis by capturing a native 956 /// from native code. We usually start the analysis by capturing a native
959 /// method that has been used. 957 /// method that has been used.
960 void _capture(DartType type, Compiler compiler) { 958 void _capture(DartType type, Compiler compiler) {
961 type = type.unalias(compiler); 959 type = type.unalias(compiler);
962 if (type is FunctionType) { 960 if (type is FunctionType) {
963 FunctionType functionType = type; 961 FunctionType functionType = type;
964 _capture(functionType.returnType, compiler); 962 _capture(functionType.returnType, compiler);
965 for (Link<DartType> parameters = functionType.parameterTypes; 963 for (DartType parameter in functionType.parameterTypes) {
966 !parameters.isEmpty; 964 _escape(parameter, compiler);
967 parameters = parameters.tail) {
968 _escape(parameters.head, compiler);
969 } 965 }
970 } else { 966 } else {
971 typesInstantiated.add(type); 967 typesInstantiated.add(type);
972 } 968 }
973 } 969 }
974 970
975 static _parseType(String typeString, Compiler compiler, 971 static _parseType(String typeString, Compiler compiler,
976 lookup(name), locationNodeOrElement) { 972 lookup(name), locationNodeOrElement) {
977 if (typeString == '=Object') return SpecialType.JsObject; 973 if (typeString == '=Object') return SpecialType.JsObject;
978 if (typeString == 'dynamic') { 974 if (typeString == 'dynamic') {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 LiteralString jsCode = nativeBody.asLiteralString(); 1189 LiteralString jsCode = nativeBody.asLiteralString();
1194 builder.push(new HForeign.statement( 1190 builder.push(new HForeign.statement(
1195 js.js.statementTemplateYielding( 1191 js.js.statementTemplateYielding(
1196 new js.LiteralStatement(jsCode.dartString.slowToString())), 1192 new js.LiteralStatement(jsCode.dartString.slowToString())),
1197 <HInstruction>[], 1193 <HInstruction>[],
1198 new SideEffects(), 1194 new SideEffects(),
1199 null, 1195 null,
1200 backend.dynamicType)); 1196 backend.dynamicType));
1201 } 1197 }
1202 } 1198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698