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

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

Issue 10915054: Mark the local for this as used if a constructor call needs type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
Index: lib/compiler/implementation/ssa/builder.dart
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index e8517ce475764335c6489bd52a864f9fbc6c4a97..6d73ca630e1619de217f8c0dc83e04b50262c3f0 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -328,7 +328,6 @@ class LocalsHandler {
Compiler compiler = builder.compiler;
closureData = compiler.closureToClassMapper.computeClosureToClassMapping(
node, builder.elements);
-
FunctionSignature signature = function.computeSignature(compiler);
signature.forEachParameter((Element element) {
HInstruction parameter = new HParameterValue(element);
@@ -2469,6 +2468,11 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
// factory.
return localsHandler.readLocal(argument.element);
} else if (work.element.isInstanceMember()) {
+ Element thisElement = localsHandler.closureData.thisElement;
+ if (!localsHandler.hasValueForDirectLocal(thisElement)) {
+ HInstruction thisValue = new HThis();
ngeoffray 2012/09/03 12:57:23 I don't think this is right, you should use [thisI
karlklose 2012/09/03 13:55:19 This was actually unnecessary. Removed.
+ add(thisValue);
+ }
// The type variable is stored in [this].
pushInvokeHelper1(interceptors.getGetRuntimeTypeInfo(),
localsHandler.readThis());
@@ -2528,8 +2532,12 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
compiler.cancel('Unimplemented non-matching static call', node: node);
}
- TypeAnnotation annotation = getTypeAnnotationFromSend(node);
- elements.getType(annotation).arguments.forEach((DartType argument) {
+ TypeAnnotation annotation = node.getTypeAnnotation();
+ if (annotation == null) {
+ compiler.internalError("malformed send in new expression");
+ }
+ InterfaceType type = elements.getType(annotation);
+ type.arguments.forEach((DartType argument) {
inputs.add(analyzeTypeArgument(argument, node));
});
@@ -2589,20 +2597,6 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
compiler.internalError(reason, node: node);
}
- // TODO(karlklose): share with resolver.
- TypeAnnotation getTypeAnnotationFromSend(Send send) {
- if (send.selector is TypeAnnotation) {
- return send.selector;
- } else if (send.selector is Send) {
- Send selector = send.selector;
- if (selector.receiver is TypeAnnotation) {
- return selector.receiver;
- }
- } else {
- compiler.internalError("malformed send in new expression");
- }
- }
-
void generateRuntimeError(Node node, String message) {
DartString messageObject = new DartString.literal(message);
HInstruction errorMessage = graph.addConstantString(messageObject, node);

Powered by Google App Engine
This is Rietveld 408576698