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

Side by Side Diff: pkg/compiler/lib/src/resolution/send_resolver.dart

Issue 1971193002: Patches to support Dart VM patch files in dart2js. (Closed) Base URL: sso://user/ahe/dart-sdk@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.semantics_visitor.resolver; 5 library dart2js.semantics_visitor.resolver;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 default: 52 default:
53 break; 53 break;
54 } 54 }
55 throw new SpannableAssertionFailure( 55 throw new SpannableAssertionFailure(
56 node, "Unhandled constructor declaration kind: ${kind}"); 56 node, "Unhandled constructor declaration kind: ${kind}");
57 } 57 }
58 } 58 }
59 59
60 class RedirectingFactoryConstructorDeclStructure<R, A> 60 class RedirectingFactoryConstructorDeclStructure<R, A>
61 extends DeclStructure<R, A> { 61 extends DeclStructure<R, A> {
62 InterfaceType redirectionTargetType; 62 // TODO(ahe): Construct invalid something instead.
63 DartType redirectionTargetType;
63 ConstructorElement redirectionTarget; 64 ConstructorElement redirectionTarget;
64 65
65 RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor, 66 RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor,
66 this.redirectionTargetType, this.redirectionTarget) 67 this.redirectionTargetType, this.redirectionTarget)
67 : super(constructor); 68 : super(constructor);
68 69
69 R dispatch(SemanticDeclarationVisitor<R, A> visitor, FunctionExpression node, 70 R dispatch(SemanticDeclarationVisitor<R, A> visitor, FunctionExpression node,
70 A arg) { 71 A arg) {
71 return visitor.visitRedirectingFactoryConstructorDeclaration(node, element, 72 return visitor.visitRedirectingFactoryConstructorDeclaration(node, element,
72 node.parameters, redirectionTargetType, redirectionTarget, arg); 73 node.parameters, redirectionTargetType, redirectionTarget, arg);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return new FunctionDeclStructure(kind, element); 218 return new FunctionDeclStructure(kind, element);
218 } 219 }
219 } 220 }
220 221
221 InitializersStructure computeInitializersStructure(FunctionExpression node) { 222 InitializersStructure computeInitializersStructure(FunctionExpression node) {
222 List<InitializerStructure> initializers = <InitializerStructure>[]; 223 List<InitializerStructure> initializers = <InitializerStructure>[];
223 NodeList list = node.initializers; 224 NodeList list = node.initializers;
224 bool constructorInvocationSeen = false; 225 bool constructorInvocationSeen = false;
225 if (list != null) { 226 if (list != null) {
226 for (Node initializer in list) { 227 for (Node initializer in list) {
227 InitializerStructure structure = 228 if (elements[initializer] != null) {
228 computeInitializerStructure(initializer); 229 // TODO(ahe): Create erroneous structure.
229 if (structure.isConstructorInvoke) { 230 InitializerStructure structure =
230 constructorInvocationSeen = true; 231 computeInitializerStructure(initializer);
232 if (structure.isConstructorInvoke) {
233 constructorInvocationSeen = true;
234 }
235 initializers.add(structure);
231 } 236 }
232 initializers.add(structure);
233 } 237 }
234 } 238 }
235 if (!constructorInvocationSeen) { 239 if (!constructorInvocationSeen) {
236 ConstructorElement currentConstructor = elements[node]; 240 ConstructorElement currentConstructor = elements[node];
237 ClassElement currentClass = currentConstructor.enclosingClass; 241 ClassElement currentClass = currentConstructor.enclosingClass;
238 InterfaceType supertype = currentClass.supertype; 242 InterfaceType supertype = currentClass.supertype;
239 if (supertype != null) { 243 if (supertype != null) {
240 ClassElement superclass = supertype.element; 244 ClassElement superclass = supertype.element;
241 ConstructorElement superConstructor = 245 ConstructorElement superConstructor =
242 superclass.lookupDefaultConstructor(); 246 superclass.lookupDefaultConstructor();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 return internalError(node, "Unexpected variable $element."); 333 return internalError(node, "Unexpected variable $element.");
330 } 334 }
331 if (element.isConst) { 335 if (element.isConst) {
332 ConstantExpression constant = elements.getConstant(element.initializer); 336 ConstantExpression constant = elements.getConstant(element.initializer);
333 return new ConstantVariableStructure(kind, node, element, constant); 337 return new ConstantVariableStructure(kind, node, element, constant);
334 } else { 338 } else {
335 return new NonConstantVariableStructure(kind, node, element); 339 return new NonConstantVariableStructure(kind, node, element);
336 } 340 }
337 } 341 }
338 } 342 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | pkg/compiler/lib/src/resolution/type_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698