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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 2997593002: Replace comment style generic method syntax with real syntax (TBR) (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/analyzer/lib/task/model.dart ('k') | pkg/compiler/lib/src/ssa/interceptor_simplifier.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 dart2js.kernel.element_map; 5 library dart2js.kernel.element_map;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 8
9 import '../closure.dart' show BoxLocal; 9 import '../closure.dart' show BoxLocal;
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 244 }
245 245
246 void _ensureThisAndRawType(ClassEntity cls, ClassData data) { 246 void _ensureThisAndRawType(ClassEntity cls, ClassData data) {
247 assert(checkFamily(cls)); 247 assert(checkFamily(cls));
248 if (data.thisType == null) { 248 if (data.thisType == null) {
249 ir.Class node = data.cls; 249 ir.Class node = data.cls;
250 // TODO(johnniwinther): Add the type argument to the list literal when we 250 // TODO(johnniwinther): Add the type argument to the list literal when we
251 // no longer use resolution types. 251 // no longer use resolution types.
252 if (node.typeParameters.isEmpty) { 252 if (node.typeParameters.isEmpty) {
253 data.thisType = 253 data.thisType =
254 data.rawType = new InterfaceType(cls, const/*<DartType>*/ []); 254 data.rawType = new InterfaceType(cls, const <DartType>[]);
255 } else { 255 } else {
256 data.thisType = new InterfaceType( 256 data.thisType = new InterfaceType(
257 cls, 257 cls,
258 new List/*<DartType>*/ .generate(node.typeParameters.length, 258 new List<DartType>.generate(node.typeParameters.length,
259 (int index) { 259 (int index) {
260 return new TypeVariableType( 260 return new TypeVariableType(
261 _getTypeVariable(node.typeParameters[index])); 261 _getTypeVariable(node.typeParameters[index]));
262 })); 262 }));
263 data.rawType = new InterfaceType( 263 data.rawType = new InterfaceType(
264 cls, 264 cls,
265 new List/*<DartType>*/ .filled( 265 new List<DartType>.filled(
266 node.typeParameters.length, const DynamicType())); 266 node.typeParameters.length, const DynamicType()));
267 } 267 }
268 } 268 }
269 } 269 }
270 270
271 TypeVariableEntity getTypeVariable(ir.TypeParameter node) => 271 TypeVariableEntity getTypeVariable(ir.TypeParameter node) =>
272 _getTypeVariable(node); 272 _getTypeVariable(node);
273 273
274 TypeVariableEntity _getTypeVariable(ir.TypeParameter node); 274 TypeVariableEntity _getTypeVariable(ir.TypeParameter node);
275 275
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 FieldEntity getField(ir.Field node) => _getField(node); 390 FieldEntity getField(ir.Field node) => _getField(node);
391 391
392 FieldEntity _getField(ir.Field node); 392 FieldEntity _getField(ir.Field node);
393 393
394 @override 394 @override
395 DartType getDartType(ir.DartType type) => _typeConverter.convert(type); 395 DartType getDartType(ir.DartType type) => _typeConverter.convert(type);
396 396
397 List<DartType> getDartTypes(List<ir.DartType> types) { 397 List<DartType> getDartTypes(List<ir.DartType> types) {
398 // TODO(johnniwinther): Add the type argument to the list literal when we 398 // TODO(johnniwinther): Add the type argument to the list literal when we
399 // no longer use resolution types. 399 // no longer use resolution types.
400 List<DartType> list = /*<DartType>*/ []; 400 List<DartType> list = <DartType>[];
401 types.forEach((ir.DartType type) { 401 types.forEach((ir.DartType type) {
402 list.add(getDartType(type)); 402 list.add(getDartType(type));
403 }); 403 });
404 return list; 404 return list;
405 } 405 }
406 406
407 @override 407 @override
408 InterfaceType getInterfaceType(ir.InterfaceType type) => 408 InterfaceType getInterfaceType(ir.InterfaceType type) =>
409 _typeConverter.convert(type); 409 _typeConverter.convert(type);
410 410
411 @override 411 @override
412 FunctionType getFunctionType(ir.FunctionNode node) { 412 FunctionType getFunctionType(ir.FunctionNode node) {
413 DartType returnType; 413 DartType returnType;
414 if (node.parent is ir.Constructor) { 414 if (node.parent is ir.Constructor) {
415 // The return type on generative constructors is `void`, but we need 415 // The return type on generative constructors is `void`, but we need
416 // `dynamic` type to match the element model. 416 // `dynamic` type to match the element model.
417 returnType = const DynamicType(); 417 returnType = const DynamicType();
418 } else { 418 } else {
419 returnType = getDartType(node.returnType); 419 returnType = getDartType(node.returnType);
420 } 420 }
421 List<DartType> parameterTypes = /*<DartType>*/ []; 421 List<DartType> parameterTypes = <DartType>[];
422 List<DartType> optionalParameterTypes = /*<DartType>*/ []; 422 List<DartType> optionalParameterTypes = <DartType>[];
423 for (ir.VariableDeclaration variable in node.positionalParameters) { 423 for (ir.VariableDeclaration variable in node.positionalParameters) {
424 if (parameterTypes.length == node.requiredParameterCount) { 424 if (parameterTypes.length == node.requiredParameterCount) {
425 optionalParameterTypes.add(getDartType(variable.type)); 425 optionalParameterTypes.add(getDartType(variable.type));
426 } else { 426 } else {
427 parameterTypes.add(getDartType(variable.type)); 427 parameterTypes.add(getDartType(variable.type));
428 } 428 }
429 } 429 }
430 List<String> namedParameters = <String>[]; 430 List<String> namedParameters = <String>[];
431 List<DartType> namedParameterTypes = /*<DartType>*/ []; 431 List<DartType> namedParameterTypes = <DartType>[];
432 List<ir.VariableDeclaration> sortedNamedParameters = 432 List<ir.VariableDeclaration> sortedNamedParameters =
433 node.namedParameters.toList()..sort((a, b) => a.name.compareTo(b.name)); 433 node.namedParameters.toList()..sort((a, b) => a.name.compareTo(b.name));
434 for (ir.VariableDeclaration variable in sortedNamedParameters) { 434 for (ir.VariableDeclaration variable in sortedNamedParameters) {
435 namedParameters.add(variable.name); 435 namedParameters.add(variable.name);
436 namedParameterTypes.add(getDartType(variable.type)); 436 namedParameterTypes.add(getDartType(variable.type));
437 } 437 }
438 return new FunctionType(returnType, parameterTypes, optionalParameterTypes, 438 return new FunctionType(returnType, parameterTypes, optionalParameterTypes,
439 namedParameters, namedParameterTypes); 439 namedParameters, namedParameterTypes);
440 } 440 }
441 441
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 Map<String, MemberEntity> memberMap = <String, MemberEntity>{}; 1992 Map<String, MemberEntity> memberMap = <String, MemberEntity>{};
1993 _classEnvs.add(new ClosureClassEnv(memberMap)); 1993 _classEnvs.add(new ClosureClassEnv(memberMap));
1994 1994
1995 // Create a classData and set up the interfaces and subclass 1995 // Create a classData and set up the interfaces and subclass
1996 // relationships that _ensureSupertypes and _ensureThisAndRawType are doing 1996 // relationships that _ensureSupertypes and _ensureThisAndRawType are doing
1997 var closureData = new ClassData(null, 1997 var closureData = new ClassData(null,
1998 new ClosureClassDefinition(cls, computeSourceSpanFromTreeNode(node))); 1998 new ClosureClassDefinition(cls, computeSourceSpanFromTreeNode(node)));
1999 closureData 1999 closureData
2000 ..isMixinApplication = false 2000 ..isMixinApplication = false
2001 ..thisType = 2001 ..thisType =
2002 closureData.rawType = new InterfaceType(cls, const/*<DartType>*/ []) 2002 closureData.rawType = new InterfaceType(cls, const <DartType>[])
2003 ..supertype = supertype 2003 ..supertype = supertype
2004 ..interfaces = const <InterfaceType>[]; 2004 ..interfaces = const <InterfaceType>[];
2005 var setBuilder = new _KernelOrderedTypeSetBuilder(this, cls); 2005 var setBuilder = new _KernelOrderedTypeSetBuilder(this, cls);
2006 _classData.add(closureData); 2006 _classData.add(closureData);
2007 closureData.orderedTypeSet = setBuilder.createOrderedTypeSet( 2007 closureData.orderedTypeSet = setBuilder.createOrderedTypeSet(
2008 closureData.supertype, const Link<InterfaceType>()); 2008 closureData.supertype, const Link<InterfaceType>());
2009 2009
2010 int i = 0; 2010 int i = 0;
2011 for (ir.VariableDeclaration variable in info.freeVariables) { 2011 for (ir.VariableDeclaration variable in info.freeVariables) {
2012 // Make a corresponding field entity in this closure class for every 2012 // Make a corresponding field entity in this closure class for every
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 /// 2127 ///
2128 /// These names are not used in generated code, just as element name. 2128 /// These names are not used in generated code, just as element name.
2129 String _getClosureVariableName(String name, int id) { 2129 String _getClosureVariableName(String name, int id) {
2130 return "_captured_${name}_$id"; 2130 return "_captured_${name}_$id";
2131 } 2131 }
2132 2132
2133 String getDeferredUri(ir.LibraryDependency node) { 2133 String getDeferredUri(ir.LibraryDependency node) {
2134 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri'); 2134 throw new UnimplementedError('JsKernelToElementMap.getDeferredUri');
2135 } 2135 }
2136 } 2136 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/task/model.dart ('k') | pkg/compiler/lib/src/ssa/interceptor_simplifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698