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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend_serialization.dart

Issue 2685673004: Handle Creates and Returns annotations in KernelBehaviorBuilder (Closed)
Patch Set: Updated cf. comment Created 3 years, 10 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
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 library js_backend.serialization; 5 library js_backend.serialization;
6 6
7 import '../common/backend_api.dart' show BackendSerialization; 7 import '../common/backend_api.dart' show BackendSerialization;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../elements/resolution_types.dart'; 9 import '../elements/resolution_types.dart';
10 import '../elements/types.dart'; 10 import '../elements/types.dart';
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 class NativeBehaviorSerialization { 154 class NativeBehaviorSerialization {
155 static const int NORMAL_TYPE = 0; 155 static const int NORMAL_TYPE = 0;
156 static const int THIS_TYPE = 1; 156 static const int THIS_TYPE = 1;
157 static const int SPECIAL_TYPE = 2; 157 static const int SPECIAL_TYPE = 2;
158 158
159 static int getTypeKind(var type) { 159 static int getTypeKind(var type) {
160 if (type is DartType) { 160 if (type is DartType) {
161 // TODO(johnniwinther): Remove this when annotation are no longer resolved 161 // TODO(johnniwinther): Remove this when annotation are no longer resolved
162 // to this-types. 162 // to this-types.
163 if (type is GenericType && 163 if (type is InterfaceType &&
164 type.isGeneric && 164 type.typeArguments.isNotEmpty &&
165 type == type.element.thisType) { 165 type.typeArguments.first is TypeVariableType) {
166 return THIS_TYPE; 166 return THIS_TYPE;
167 } 167 }
168 return NORMAL_TYPE; 168 return NORMAL_TYPE;
169 } 169 }
170 return SPECIAL_TYPE; 170 return SPECIAL_TYPE;
171 } 171 }
172 172
173 /// Returns a list of the non-this-type [ResolutionDartType]s in [types]. 173 /// Returns a list of the non-this-type [ResolutionDartType]s in [types].
174 static List<ResolutionDartType> filterDartTypes(List types) { 174 static List<ResolutionDartType> filterDartTypes(List types) {
175 return types.where((type) => getTypeKind(type) == NORMAL_TYPE).toList(); 175 return types.where((type) => getTypeKind(type) == NORMAL_TYPE).toList();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 behavior.codeTemplate = js.js.parseForeignJS(behavior.codeTemplateText); 250 behavior.codeTemplate = js.js.parseForeignJS(behavior.codeTemplateText);
251 } 251 }
252 252
253 behavior.throwBehavior = 253 behavior.throwBehavior =
254 decoder.getEnum(THROW_BEHAVIOR, NativeThrowBehavior.values); 254 decoder.getEnum(THROW_BEHAVIOR, NativeThrowBehavior.values);
255 behavior.isAllocation = decoder.getBool(IS_ALLOCATION); 255 behavior.isAllocation = decoder.getBool(IS_ALLOCATION);
256 behavior.useGvn = decoder.getBool(USE_GVN); 256 behavior.useGvn = decoder.getBool(USE_GVN);
257 return behavior; 257 return behavior;
258 } 258 }
259 } 259 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/kernel/element_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698