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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 98c847a13a4fedff30956db6004861b17b9a1749..31aa661b9dfd29fc4f8681cc4355672433582897 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -977,7 +977,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
parameters = new Map<Element, HInstruction>(),
sourceElementStack = <Element>[work.element],
inliningStack = <InliningState>[],
- rti = builder.compiler.codegenWorld.rti,
+ rti = builder.backend.rti,
super(work.resolutionTree) {
localsHandler = new LocalsHandler(this);
}
@@ -2646,7 +2646,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
DartType type = elements.getType(typeAnnotation);
HInstruction typeInfo = null;
- if (compiler.codegenWorld.rti.hasTypeArguments(type)) {
+ if (rti.hasTypeArguments(type)) {
pushInvokeHelper1(interceptors.getGetRuntimeTypeInfo(), expression);
typeInfo = pop();
}
@@ -3381,22 +3381,17 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
visitTypeReferenceSend(Send node) {
Element element = elements[node];
- HInstruction name;
- Element helper =
- compiler.findHelper(const SourceString('createRuntimeType'));
- if (element.isClass()) {
- String string = rti.generateRuntimeTypeString(element, 0);
- name = addConstantString(node.selector, string);
- } else if (element.isTypedef()) {
- // TODO(karlklose): implement support for type variables in typedefs.
- name = addConstantString(node.selector, rti.getName(element));
+ if (element.isClass() || element.isTypedef()) {
+ // TODO(karlklose): add type representation
+ ConstantHandler handler = compiler.constantHandler;
+ Constant constant = handler.compileNodeWithDefinitions(node, elements);
+ stack.add(graph.addConstant(constant));
} else if (element.isTypeVariable()) {
// TODO(6248): implement support for type variables.
compiler.unimplemented('first class type for type variable', node: node);
} else {
- internalError('unexpected element $element', node: node);
+ internalError('unexpected element kind $element', node: node);
}
- pushInvokeHelper1(helper, name);
if (node.isCall) {
// This send is of the form 'e(...)', where e is resolved to a type
// reference. We create a regular closure call on the result of the type

Powered by Google App Engine
This is Rietveld 408576698