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('../closure.dart'); | 7 #import('../closure.dart'); |
8 #import('../js/js.dart', prefix: 'js'); | 8 #import('../js/js.dart', prefix: 'js'); |
9 #import('../leg.dart'); | 9 #import('../leg.dart'); |
10 #import('../source_file.dart'); | 10 #import('../source_file.dart'); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 /** | 67 /** |
68 * Generate a string representation template for this element, using '#' to | 68 * Generate a string representation template for this element, using '#' to |
69 * denote the place for the type argument input. If there are more type | 69 * denote the place for the type argument input. If there are more type |
70 * variables than [numberOfInputs], 'Dynamic' is used as the value for these | 70 * variables than [numberOfInputs], 'Dynamic' is used as the value for these |
71 * arguments. | 71 * arguments. |
72 */ | 72 */ |
73 static String generateRuntimeTypeString(ClassElement element, | 73 static String generateRuntimeTypeString(ClassElement element, |
74 int numberOfInputs) { | 74 int numberOfInputs) { |
75 String elementName = element.name.slowToString(); | 75 String elementName = element.name.slowToString(); |
76 if (element.typeVariables.isEmpty()) return "'$elementName'"; | 76 if (element.typeVariables.isEmpty()) return "$elementName"; |
77 String stringify(_, bool hasValue) => hasValue ? "' + # + '" : "Dynamic"; | 77 String stringify(_, bool hasValue) => hasValue ? "' + # + '" : "dynamic"; |
78 String arguments = stringifyTypeVariables(element.typeVariables, | 78 String arguments = stringifyTypeVariables(element.typeVariables, |
79 numberOfInputs, | 79 numberOfInputs, |
80 stringify); | 80 stringify); |
81 return "'$elementName<$arguments>'"; | 81 return "$elementName<$arguments>"; |
82 } | 82 } |
83 | 83 |
84 /** | 84 /** |
85 * Generate a string template for the runtime type fields that contain the | 85 * Generate a string template for the runtime type fields that contain the |
86 * type descriptions of the reified type arguments, using '#' to denote the | 86 * type descriptions of the reified type arguments, using '#' to denote the |
87 * place for the type argument value, or [:null:] if there are more than | 87 * place for the type argument value, or [:null:] if there are more than |
88 * [numberOfInputs] type variables. | 88 * [numberOfInputs] type variables. |
89 */ | 89 */ |
90 static String generateTypeVariableString(ClassElement element, | 90 static String generateTypeVariableString(ClassElement element, |
91 int numberOfInputs) { | 91 int numberOfInputs) { |
92 String stringify(TypeVariableType variable, bool hasValue) { | 92 String stringify(TypeVariableType variable, bool hasValue) { |
93 return "'${variable.name.slowToString()}': #"; | 93 return "'${variable.name.slowToString()}': #"; |
94 } | 94 } |
95 return stringifyTypeVariables(element.typeVariables, numberOfInputs, | 95 return stringifyTypeVariables(element.typeVariables, numberOfInputs, |
96 stringify); | 96 stringify); |
97 } | 97 } |
98 } | 98 } |
OLD | NEW |