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('../elements/elements.dart'); | 9 #import('../elements/elements.dart'); |
10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
11 #import('../tree/tree.dart'); | 11 #import('../tree/tree.dart'); |
12 #import('../util/util.dart'); | 12 #import('../util/util.dart'); |
13 #import('../util/characters.dart'); | 13 #import('../util/characters.dart'); |
14 | 14 |
15 #source('bailout.dart'); | 15 #source('bailout.dart'); |
16 #source('builder.dart'); | 16 #source('builder.dart'); |
17 #source('closure.dart'); | 17 #source('closure.dart'); |
18 #source('codegen.dart'); | 18 #source('codegen.dart'); |
19 #source('codegen_helpers.dart'); | 19 #source('codegen_helpers.dart'); |
20 #source('js_names.dart'); | 20 #source('js_names.dart'); |
21 #source('nodes.dart'); | 21 #source('nodes.dart'); |
22 #source('optimize.dart'); | 22 #source('optimize.dart'); |
23 #source('types.dart'); | 23 #source('types.dart'); |
24 #source('types_propagation.dart'); | 24 #source('types_propagation.dart'); |
25 #source('validate.dart'); | 25 #source('validate.dart'); |
| 26 #source('variable_allocator.dart'); |
26 #source('value_set.dart'); | 27 #source('value_set.dart'); |
27 | 28 |
28 class RuntimeTypeInformation { | 29 class RuntimeTypeInformation { |
29 String asJsString(InterfaceType type) { | 30 String asJsString(InterfaceType type) { |
30 ClassElement element = type.element; | 31 ClassElement element = type.element; |
31 StringBuffer buffer = new StringBuffer(); | 32 StringBuffer buffer = new StringBuffer(); |
32 Link<Type> arguments = type.arguments; | 33 Link<Type> arguments = type.arguments; |
33 int index = 0; | 34 int index = 0; |
34 element.typeParameters.forEach((name, _) { | 35 element.typeParameters.forEach((name, _) { |
35 buffer.add("${name.slowToString()}: '${arguments.head}'"); | 36 buffer.add("${name.slowToString()}: '${arguments.head}'"); |
36 if (++index < element.typeParameters.length) { | 37 if (++index < element.typeParameters.length) { |
37 buffer.add(', '); | 38 buffer.add(', '); |
38 } | 39 } |
39 }); | 40 }); |
40 return "{$buffer}"; | 41 return "{$buffer}"; |
41 } | 42 } |
42 | 43 |
43 bool hasTypeArguments(Type type) { | 44 bool hasTypeArguments(Type type) { |
44 if (type is InterfaceType) { | 45 if (type is InterfaceType) { |
45 InterfaceType interfaceType = type; | 46 InterfaceType interfaceType = type; |
46 return (!interfaceType.arguments.isEmpty() && | 47 return (!interfaceType.arguments.isEmpty() && |
47 interfaceType.arguments.tail.isEmpty()); | 48 interfaceType.arguments.tail.isEmpty()); |
48 } | 49 } |
49 return false; | 50 return false; |
50 } | 51 } |
51 } | 52 } |
OLD | NEW |