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

Unified Diff: lib/compiler/implementation/ssa/ssa.dart

Issue 11088022: Move RuntimeTypeInformation to its own library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/runtime_types.dart ('k') | lib/compiler/implementation/universe/universe.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/ssa.dart
diff --git a/lib/compiler/implementation/ssa/ssa.dart b/lib/compiler/implementation/ssa/ssa.dart
index 87cb6a6091cb8173980fa932085fcbf89388449e..c5b4f1e57b4769be0b0fd167421198e8b9a6775a 100644
--- a/lib/compiler/implementation/ssa/ssa.dart
+++ b/lib/compiler/implementation/ssa/ssa.dart
@@ -12,6 +12,7 @@
#import('../elements/elements.dart');
#import('../js_backend/js_backend.dart');
#import('../native_handler.dart', prefix: 'native');
+#import('../runtime_types.dart');
#import('../scanner/scannerlib.dart');
#import('../tree/tree.dart');
#import('../universe/universe.dart');
@@ -31,68 +32,3 @@
#source('variable_allocator.dart');
#source('value_range_analyzer.dart');
#source('value_set.dart');
-
-class RuntimeTypeInformation {
- bool hasTypeArguments(DartType type) {
- if (type is InterfaceType) {
- InterfaceType interfaceType = type;
- return !interfaceType.arguments.isEmpty();
- }
- return false;
- }
-
- /**
- * Map type variables to strings calling [:stringify:] and joins the results
- * to a single string separated by commas.
- * The argument [:hasValue:] is used to treat variables that will not receive
- * a value at the use site of the code that is generated with this function.
- */
- static String stringifyTypeVariables(Link collection,
- int numberOfInputs,
- stringify(TypeVariableType variable,
- bool hasValue)) {
- int currentVariable = 0;
- bool isFirst = true;
- StringBuffer buffer = new StringBuffer();
- collection.forEach((TypeVariableType variable) {
- if (!isFirst) buffer.add(", ");
- bool hasValue = currentVariable < numberOfInputs;
- buffer.add(stringify(variable, hasValue));
- isFirst = false;
- currentVariable++;
- });
- return buffer.toString();
- }
-
- /**
- * Generate a string representation template for this element, using '#' to
- * denote the place for the type argument input. If there are more type
- * variables than [numberOfInputs], 'Dynamic' is used as the value for these
- * arguments.
- */
- static String generateRuntimeTypeString(ClassElement element,
- int numberOfInputs) {
- String elementName = element.name.slowToString();
- if (element.typeVariables.isEmpty()) return "'$elementName'";
- String stringify(_, bool hasValue) => hasValue ? "' + # + '" : "Dynamic";
- String arguments = stringifyTypeVariables(element.typeVariables,
- numberOfInputs,
- stringify);
- return "'$elementName<$arguments>'";
- }
-
- /**
- * Generate a string template for the runtime type fields that contain the
- * type descriptions of the reified type arguments, using '#' to denote the
- * place for the type argument value, or [:null:] if there are more than
- * [numberOfInputs] type variables.
- */
- static String generateTypeVariableString(ClassElement element,
- int numberOfInputs) {
- String stringify(TypeVariableType variable, bool hasValue) {
- return "'${variable.name.slowToString()}': #";
- }
- return stringifyTypeVariables(element.typeVariables, numberOfInputs,
- stringify);
- }
-}
« no previous file with comments | « lib/compiler/implementation/runtime_types.dart ('k') | lib/compiler/implementation/universe/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698