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 /// Implementation of the element model used for deserialiation. | 5 /// Implementation of the element model used for deserialiation. |
6 /// | 6 /// |
7 /// These classes are created by [ElementDeserializer] triggered by the | 7 /// These classes are created by [ElementDeserializer] triggered by the |
8 /// [Deserializer]. | 8 /// [Deserializer]. |
9 | 9 |
10 library dart2js.serialization.modelz; | 10 library dart2js.serialization.modelz; |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 } | 1291 } |
1292 | 1292 |
1293 class FactoryConstructorElementZ extends ConstructorElementZ { | 1293 class FactoryConstructorElementZ extends ConstructorElementZ { |
1294 FactoryConstructorElementZ(ObjectDecoder decoder) : super(decoder); | 1294 FactoryConstructorElementZ(ObjectDecoder decoder) : super(decoder); |
1295 | 1295 |
1296 @override | 1296 @override |
1297 ElementKind get kind => ElementKind.FACTORY_CONSTRUCTOR; | 1297 ElementKind get kind => ElementKind.FACTORY_CONSTRUCTOR; |
1298 } | 1298 } |
1299 | 1299 |
1300 class RedirectingFactoryConstructorElementZ extends ConstructorElementZ { | 1300 class RedirectingFactoryConstructorElementZ extends ConstructorElementZ { |
1301 InterfaceType _effectiveTargetType; | 1301 DartType _effectiveTargetType; |
1302 ConstructorElement _immediateRedirectionTarget; | 1302 ConstructorElement _immediateRedirectionTarget; |
1303 PrefixElement _redirectionDeferredPrefix; | 1303 PrefixElement _redirectionDeferredPrefix; |
| 1304 bool _effectiveTargetIsMalformed; |
1304 | 1305 |
1305 RedirectingFactoryConstructorElementZ(ObjectDecoder decoder) : super(decoder); | 1306 RedirectingFactoryConstructorElementZ(ObjectDecoder decoder) : super(decoder); |
1306 | 1307 |
1307 @override | 1308 @override |
1308 ElementKind get kind => ElementKind.FACTORY_CONSTRUCTOR; | 1309 ElementKind get kind => ElementKind.FACTORY_CONSTRUCTOR; |
1309 | 1310 |
1310 @override | 1311 @override |
1311 bool get isRedirectingFactory => true; | 1312 bool get isRedirectingFactory => true; |
1312 | 1313 |
1313 void _ensureEffectiveTarget() { | 1314 void _ensureEffectiveTarget() { |
1314 if (_effectiveTarget == null) { | 1315 if (_effectiveTarget == null) { |
1315 _effectiveTarget = | 1316 _effectiveTarget = |
1316 _decoder.getElement(Key.EFFECTIVE_TARGET, isOptional: true); | 1317 _decoder.getElement(Key.EFFECTIVE_TARGET, isOptional: true); |
1317 if (_effectiveTarget == null) { | 1318 if (_effectiveTarget == null) { |
1318 _effectiveTarget = this; | 1319 _effectiveTarget = this; |
1319 _effectiveTargetType = enclosingClass.thisType; | 1320 _effectiveTargetType = enclosingClass.thisType; |
| 1321 _effectiveTargetIsMalformed = false; |
1320 } else { | 1322 } else { |
1321 _effectiveTargetType = _decoder.getType(Key.EFFECTIVE_TARGET_TYPE); | 1323 _effectiveTargetType = _decoder.getType(Key.EFFECTIVE_TARGET_TYPE); |
| 1324 _effectiveTargetIsMalformed = |
| 1325 _decoder.getBool(Key.EFFECTIVE_TARGET_IS_MALFORMED); |
1322 } | 1326 } |
1323 } | 1327 } |
1324 } | 1328 } |
1325 | 1329 |
| 1330 bool get isEffectiveTargetMalformed { |
| 1331 _ensureEffectiveTarget(); |
| 1332 return _effectiveTargetIsMalformed; |
| 1333 } |
| 1334 |
1326 @override | 1335 @override |
1327 ConstructorElement get effectiveTarget { | 1336 ConstructorElement get effectiveTarget { |
1328 _ensureEffectiveTarget(); | 1337 _ensureEffectiveTarget(); |
1329 return _effectiveTarget; | 1338 return _effectiveTarget; |
1330 } | 1339 } |
1331 | 1340 |
1332 @override | 1341 @override |
1333 InterfaceType computeEffectiveTargetType(InterfaceType newType) { | 1342 DartType computeEffectiveTargetType(InterfaceType newType) { |
1334 _ensureEffectiveTarget(); | 1343 _ensureEffectiveTarget(); |
1335 return _effectiveTargetType.substByContext(newType); | 1344 return _effectiveTargetType.substByContext(newType); |
1336 } | 1345 } |
1337 | 1346 |
1338 void _ensureRedirection() { | 1347 void _ensureRedirection() { |
1339 if (_immediateRedirectionTarget == null) { | 1348 if (_immediateRedirectionTarget == null) { |
1340 _immediateRedirectionTarget = | 1349 _immediateRedirectionTarget = |
1341 _decoder.getElement(Key.IMMEDIATE_REDIRECTION_TARGET); | 1350 _decoder.getElement(Key.IMMEDIATE_REDIRECTION_TARGET); |
1342 _redirectionDeferredPrefix = | 1351 _redirectionDeferredPrefix = |
1343 _decoder.getElement(Key.PREFIX, isOptional: true); | 1352 _decoder.getElement(Key.PREFIX, isOptional: true); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 } | 2336 } |
2328 | 2337 |
2329 @override | 2338 @override |
2330 Node get node => throw new UnsupportedError('${this}.node'); | 2339 Node get node => throw new UnsupportedError('${this}.node'); |
2331 | 2340 |
2332 @override | 2341 @override |
2333 bool get hasNode => false; | 2342 bool get hasNode => false; |
2334 | 2343 |
2335 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})'; | 2344 String toString() => 'MetadataAnnotationZ(${constant.toDartText()})'; |
2336 } | 2345 } |
OLD | NEW |