| OLD | NEW |
| 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('ssa'); | 5 #library('ssa'); |
| 6 | 6 |
| 7 #import('../leg.dart'); | 7 #import('../leg.dart'); |
| 8 #import('../native_handler.dart', prefix: 'native'); | 8 #import('../native_handler.dart', prefix: 'native'); |
| 9 #import('../source_file.dart'); | 9 #import('../source_file.dart'); |
| 10 #import('../source_map_builder.dart'); | 10 #import('../source_map_builder.dart'); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #source('types.dart'); | 25 #source('types.dart'); |
| 26 #source('types_propagation.dart'); | 26 #source('types_propagation.dart'); |
| 27 #source('validate.dart'); | 27 #source('validate.dart'); |
| 28 #source('variable_allocator.dart'); | 28 #source('variable_allocator.dart'); |
| 29 #source('value_set.dart'); | 29 #source('value_set.dart'); |
| 30 | 30 |
| 31 class RuntimeTypeInformation { | 31 class RuntimeTypeInformation { |
| 32 String asJsString(InterfaceType type) { | 32 String asJsString(InterfaceType type) { |
| 33 ClassElement element = type.element; | 33 ClassElement element = type.element; |
| 34 StringBuffer buffer = new StringBuffer(); | 34 StringBuffer buffer = new StringBuffer(); |
| 35 Link<Type> arguments = type.arguments; | 35 Link<Type> arguments = type.typeArguments; |
| 36 int index = 0; | 36 Link<TypeVariableType> typeVariables = element.typeVariables; |
| 37 element.typeParameters.forEach((name, _) { | 37 while (!typeVariables.isEmpty()) { |
| 38 buffer.add("${name.slowToString()}: '${arguments.head}'"); | 38 TypeVariableType typeVariable = typeVariables.head; |
| 39 if (++index < element.typeParameters.length) { | 39 buffer.add("${typeVariable}: '${arguments.head}'"); |
| 40 |
| 41 typeVariables = typeVariables.tail; |
| 42 if (!typeVariables.isEmpty()) { |
| 40 buffer.add(', '); | 43 buffer.add(', '); |
| 41 } | 44 } |
| 42 }); | 45 } |
| 43 return "{$buffer}"; | 46 return "{$buffer}"; |
| 44 } | 47 } |
| 45 | 48 |
| 46 bool hasTypeArguments(Type type) { | 49 bool hasTypeArguments(Type type) { |
| 47 if (type is InterfaceType) { | 50 if (type is InterfaceType) { |
| 48 InterfaceType interfaceType = type; | 51 InterfaceType interfaceType = type; |
| 49 return (!interfaceType.arguments.isEmpty() && | 52 return (!interfaceType.typeArguments.isEmpty() && |
| 50 interfaceType.arguments.tail.isEmpty()); | 53 interfaceType.typeArguments.tail.isEmpty()); |
| 51 } | 54 } |
| 52 return false; | 55 return false; |
| 53 } | 56 } |
| 54 } | 57 } |
| OLD | NEW |