| OLD | NEW |
| 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 '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 default: | 51 default: |
| 52 break; | 52 break; |
| 53 } | 53 } |
| 54 throw new SpannableAssertionFailure( | 54 throw new SpannableAssertionFailure( |
| 55 node, "Unhandled constructor declaration kind: ${kind}"); | 55 node, "Unhandled constructor declaration kind: ${kind}"); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 class RedirectingFactoryConstructorDeclStructure<R, A> | 59 class RedirectingFactoryConstructorDeclStructure<R, A> |
| 60 extends DeclStructure<R, A> { | 60 extends DeclStructure<R, A> { |
| 61 InterfaceType redirectionTargetType; | 61 ResolutionInterfaceType redirectionTargetType; |
| 62 ConstructorElement redirectionTarget; | 62 ConstructorElement redirectionTarget; |
| 63 | 63 |
| 64 RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor, | 64 RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor, |
| 65 this.redirectionTargetType, this.redirectionTarget) | 65 this.redirectionTargetType, this.redirectionTarget) |
| 66 : super(constructor); | 66 : super(constructor); |
| 67 | 67 |
| 68 R dispatch(SemanticDeclarationVisitor<R, A> visitor, FunctionExpression node, | 68 R dispatch(SemanticDeclarationVisitor<R, A> visitor, FunctionExpression node, |
| 69 A arg) { | 69 A arg) { |
| 70 return visitor.visitRedirectingFactoryConstructorDeclaration(node, element, | 70 return visitor.visitRedirectingFactoryConstructorDeclaration(node, element, |
| 71 node.parameters, redirectionTargetType, redirectionTarget, arg); | 71 node.parameters, redirectionTargetType, redirectionTarget, arg); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 computeInitializerStructure(initializer); | 227 computeInitializerStructure(initializer); |
| 228 if (structure.isConstructorInvoke) { | 228 if (structure.isConstructorInvoke) { |
| 229 constructorInvocationSeen = true; | 229 constructorInvocationSeen = true; |
| 230 } | 230 } |
| 231 initializers.add(structure); | 231 initializers.add(structure); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 if (!constructorInvocationSeen) { | 234 if (!constructorInvocationSeen) { |
| 235 ConstructorElement currentConstructor = elements[node]; | 235 ConstructorElement currentConstructor = elements[node]; |
| 236 ClassElement currentClass = currentConstructor.enclosingClass; | 236 ClassElement currentClass = currentConstructor.enclosingClass; |
| 237 InterfaceType supertype = currentClass.supertype; | 237 ResolutionInterfaceType supertype = currentClass.supertype; |
| 238 if (supertype != null) { | 238 if (supertype != null) { |
| 239 ClassElement superclass = supertype.element; | 239 ClassElement superclass = supertype.element; |
| 240 ConstructorElement superConstructor = | 240 ConstructorElement superConstructor = |
| 241 superclass.lookupDefaultConstructor(); | 241 superclass.lookupDefaultConstructor(); |
| 242 initializers.add(new ImplicitSuperConstructorInvokeStructure( | 242 initializers.add(new ImplicitSuperConstructorInvokeStructure( |
| 243 node, superConstructor, supertype)); | 243 node, superConstructor, supertype)); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 return new InitializersStructure(initializers); | 246 return new InitializersStructure(initializers); |
| 247 } | 247 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 return internalError(node, "Unexpected variable $element."); | 328 return internalError(node, "Unexpected variable $element."); |
| 329 } | 329 } |
| 330 if (element.isConst) { | 330 if (element.isConst) { |
| 331 ConstantExpression constant = elements.getConstant(element.initializer); | 331 ConstantExpression constant = elements.getConstant(element.initializer); |
| 332 return new ConstantVariableStructure(kind, node, element, constant); | 332 return new ConstantVariableStructure(kind, node, element, constant); |
| 333 } else { | 333 } else { |
| 334 return new NonConstantVariableStructure(kind, node, element); | 334 return new NonConstantVariableStructure(kind, node, element); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 } | 337 } |
| OLD | NEW |