Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'dart:collection' show LinkedHashMap; | 7 import 'dart:collection' show LinkedHashMap; |
| 8 | 8 |
| 9 import 'elements.dart'; | 9 import 'elements.dart'; |
| 10 import '../../compiler.dart' as api; | 10 import '../../compiler.dart' as api; |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1391 | 1391 |
| 1392 /** | 1392 /** |
| 1393 * A constructor that is not defined in the source code but rather implied by | 1393 * A constructor that is not defined in the source code but rather implied by |
| 1394 * the language semantics. | 1394 * the language semantics. |
| 1395 * | 1395 * |
| 1396 * This class is used to represent default constructors and forwarding | 1396 * This class is used to represent default constructors and forwarding |
| 1397 * constructors for mixin applications. | 1397 * constructors for mixin applications. |
| 1398 */ | 1398 */ |
| 1399 class SynthesizedConstructorElementX extends FunctionElementX { | 1399 class SynthesizedConstructorElementX extends FunctionElementX { |
| 1400 final FunctionElement superMember; | 1400 final FunctionElement superMember; |
| 1401 final bool isDefaultConstructor; | |
| 1401 | 1402 |
| 1402 SynthesizedConstructorElementX(SourceString name, | 1403 SynthesizedConstructorElementX(SourceString name, |
| 1403 this.superMember, | 1404 this.superMember, |
| 1404 Element enclosing) | 1405 Element enclosing, |
| 1406 this.isDefaultConstructor) | |
|
ngeoffray
2013/08/08 21:55:24
Did you consider a named parameter?
| |
| 1405 : super(name, | 1407 : super(name, |
| 1406 ElementKind.GENERATIVE_CONSTRUCTOR, | 1408 ElementKind.GENERATIVE_CONSTRUCTOR, |
| 1407 Modifiers.EMPTY, | 1409 Modifiers.EMPTY, |
| 1408 enclosing); | 1410 enclosing); |
| 1409 | 1411 |
| 1410 SynthesizedConstructorElementX.forDefault(superMember, Element enclosing) | 1412 SynthesizedConstructorElementX.forDefault(superMember, Element enclosing) |
| 1411 : this(const SourceString(''), superMember, enclosing); | 1413 : this(const SourceString(''), superMember, enclosing, true); |
| 1412 | 1414 |
| 1413 Token position() => enclosingElement.position(); | 1415 Token position() => enclosingElement.position(); |
| 1414 | 1416 |
| 1415 bool get isSynthesized => true; | 1417 bool get isSynthesized => true; |
| 1416 | 1418 |
| 1417 FunctionElement get targetConstructor => superMember; | 1419 FunctionElement get targetConstructor => superMember; |
| 1418 | 1420 |
| 1419 FunctionSignature computeSignature(compiler) { | 1421 FunctionSignature computeSignature(compiler) { |
| 1422 if (isDefaultConstructor) { | |
| 1423 return new FunctionSignatureX( | |
| 1424 const Link<Element>(), const Link<Element>(), 0, 0, false, | |
| 1425 getEnclosingClass().thisType); | |
| 1426 } | |
| 1420 if (superMember.isErroneous()) { | 1427 if (superMember.isErroneous()) { |
| 1421 return compiler.objectClass.localLookup( | 1428 return compiler.objectClass.localLookup( |
| 1422 const SourceString('')).computeSignature(compiler); | 1429 const SourceString('')).computeSignature(compiler); |
| 1423 } | 1430 } |
| 1424 return superMember.computeSignature(compiler); | 1431 return superMember.computeSignature(compiler); |
| 1425 } | 1432 } |
| 1426 | 1433 |
| 1427 get declaration => this; | 1434 get declaration => this; |
| 1428 get implementation => this; | 1435 get implementation => this; |
| 1429 get defaultImplementation => this; | 1436 get defaultImplementation => this; |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2179 | 2186 |
| 2180 MetadataAnnotation ensureResolved(Compiler compiler) { | 2187 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2181 if (resolutionState == STATE_NOT_STARTED) { | 2188 if (resolutionState == STATE_NOT_STARTED) { |
| 2182 compiler.resolver.resolveMetadataAnnotation(this); | 2189 compiler.resolver.resolveMetadataAnnotation(this); |
| 2183 } | 2190 } |
| 2184 return this; | 2191 return this; |
| 2185 } | 2192 } |
| 2186 | 2193 |
| 2187 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2194 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2188 } | 2195 } |
| OLD | NEW |