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

Side by Side Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10127011: A generative consutructor on an interface can default to a factory constructor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { 2146 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
2147 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, 2147 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments,
2148 element, inputs); 2148 element, inputs);
2149 if (!succeeded) { 2149 if (!succeeded) {
2150 // TODO(ngeoffray): Match the VM behavior and throw an 2150 // TODO(ngeoffray): Match the VM behavior and throw an
2151 // exception at runtime. 2151 // exception at runtime.
2152 compiler.cancel('Unimplemented non-matching static call', node: node); 2152 compiler.cancel('Unimplemented non-matching static call', node: node);
2153 } 2153 }
2154 HType type = HType.UNKNOWN; 2154 HType type = HType.UNKNOWN;
2155 Element originalElement = elements[node]; 2155 Element originalElement = elements[node];
2156 if (originalElement.isGenerativeConstructor()) { 2156 if (originalElement.isGenerativeConstructor()
2157 ClassElement cls = originalElement.enclosingElement; 2157 && originalElement.enclosingElement === compiler.listClass) {
2158 if (cls === compiler.listClass) { 2158 type = HType.MUTABLE_ARRAY;
2159 type = HType.MUTABLE_ARRAY; 2159 } else if (element.isGenerativeConstructor()) {
2160 } else { 2160 ClassElement cls = element.enclosingElement;
2161 type = new HNonPrimitiveType(cls.type); 2161 type = new HNonPrimitiveType(cls.type);
2162 }
2163 } 2162 }
2164 push(new HInvokeStatic(selector, inputs, type)); 2163 push(new HInvokeStatic(selector, inputs, type));
2165 } else { 2164 } else {
2166 if (element.kind == ElementKind.GETTER) { 2165 if (element.kind == ElementKind.GETTER) {
2167 target = new HInvokeStatic(Selector.GETTER, inputs); 2166 target = new HInvokeStatic(Selector.GETTER, inputs);
2168 add(target); 2167 add(target);
2169 inputs = <HInstruction>[target]; 2168 inputs = <HInstruction>[target];
2170 } 2169 }
2171 addDynamicSendArgumentsToList(node, inputs); 2170 addDynamicSendArgumentsToList(node, inputs);
2172 push(new HInvokeClosure(selector, inputs)); 2171 push(new HInvokeClosure(selector, inputs));
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 false, 3108 false,
3110 <HInstruction>[target, input])); 3109 <HInstruction>[target, input]));
3111 return builder.pop(); 3110 return builder.pop();
3112 } 3111 }
3113 3112
3114 HInstruction result() { 3113 HInstruction result() {
3115 flushLiterals(); 3114 flushLiterals();
3116 return prefix; 3115 return prefix;
3117 } 3116 }
3118 } 3117 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698