| 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 int index = 0; |
| 37 element.typeParameters.forEach((name, _) { | 37 element.typeParameters.forEach((name, _) { |
| 38 buffer.add("${name.slowToString()}: '${arguments.head}'"); | 38 buffer.add("${name.slowToString()}: '${arguments.head}'"); |
| 39 if (++index < element.typeParameters.length) { | 39 if (++index < element.typeParameters.length) { |
| 40 buffer.add(', '); | 40 buffer.add(', '); |
| 41 } | 41 } |
| 42 }); | 42 }); |
| 43 return "{$buffer}"; | 43 return "{$buffer}"; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool hasTypeArguments(Type type) { | 46 bool hasTypeArguments(Type type) { |
| 47 if (type is InterfaceType) { | 47 if (type is InterfaceType) { |
| 48 InterfaceType interfaceType = type; | 48 InterfaceType interfaceType = type; |
| 49 return (!interfaceType.arguments.isEmpty() && | 49 return (!interfaceType.typeArguments.isEmpty() && |
| 50 interfaceType.arguments.tail.isEmpty()); | 50 interfaceType.typeArguments.tail.isEmpty()); |
| 51 } | 51 } |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 } | 54 } |
| OLD | NEW |