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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 } | 1150 } |
1151 | 1151 |
1152 abstract class ConstructorElementZ extends DeserializedElementZ | 1152 abstract class ConstructorElementZ extends DeserializedElementZ |
1153 with | 1153 with |
1154 AnalyzableElementMixin, | 1154 AnalyzableElementMixin, |
1155 AstElementMixinZ, | 1155 AstElementMixinZ, |
1156 ClassMemberMixin, | 1156 ClassMemberMixin, |
1157 FunctionTypedElementMixin, | 1157 FunctionTypedElementMixin, |
1158 ParametersMixin, | 1158 ParametersMixin, |
1159 TypedElementMixin, | 1159 TypedElementMixin, |
1160 MemberElementMixin | 1160 MemberElementMixin, |
| 1161 ConstructorElementCommon |
1161 implements | 1162 implements |
1162 ConstructorElement, | 1163 ConstructorElement, |
1163 // TODO(johnniwinther): Sort out whether a constructor is a method. | 1164 // TODO(johnniwinther): Sort out whether a constructor is a method. |
1164 MethodElement { | 1165 MethodElement { |
1165 ConstantConstructor _constantConstructor; | 1166 ConstantConstructor _constantConstructor; |
1166 ConstructorElement _effectiveTarget; | 1167 ConstructorElement _effectiveTarget; |
1167 | 1168 |
1168 ConstructorElementZ(ObjectDecoder decoder) : super(decoder); | 1169 ConstructorElementZ(ObjectDecoder decoder) : super(decoder); |
1169 | 1170 |
1170 accept(ElementVisitor visitor, arg) { | 1171 accept(ElementVisitor visitor, arg) { |
1171 return visitor.visitConstructorElement(this, arg); | 1172 return visitor.visitConstructorElement(this, arg); |
1172 } | 1173 } |
1173 | 1174 |
1174 @override | 1175 @override |
1175 bool get isConst => _decoder.getBool(Key.IS_CONST); | 1176 bool get isConst => _decoder.getBool(Key.IS_CONST); |
1176 | 1177 |
1177 @override | 1178 @override |
1178 bool get isExternal => _decoder.getBool(Key.IS_EXTERNAL); | 1179 bool get isExternal => _decoder.getBool(Key.IS_EXTERNAL); |
1179 | 1180 |
1180 bool get isFromEnvironmentConstructor { | |
1181 return name == 'fromEnvironment' && | |
1182 library.isDartCore && | |
1183 (enclosingClass.name == 'bool' || | |
1184 enclosingClass.name == 'int' || | |
1185 enclosingClass.name == 'String'); | |
1186 } | |
1187 | |
1188 ConstantConstructor get constantConstructor { | 1181 ConstantConstructor get constantConstructor { |
1189 if (isConst && _constantConstructor == null) { | 1182 if (isConst && _constantConstructor == null) { |
1190 ObjectDecoder data = | 1183 ObjectDecoder data = |
1191 _decoder.getObject(Key.CONSTRUCTOR, isOptional: true); | 1184 _decoder.getObject(Key.CONSTRUCTOR, isOptional: true); |
1192 if (data == null) { | 1185 if (data == null) { |
1193 assert(isFromEnvironmentConstructor || isExternal); | 1186 assert(isFromEnvironmentConstructor || isExternal); |
1194 return null; | 1187 return null; |
1195 } | 1188 } |
1196 _constantConstructor = ConstantConstructorDeserializer.deserialize(data); | 1189 _constantConstructor = ConstantConstructorDeserializer.deserialize(data); |
1197 } | 1190 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 @override | 1399 @override |
1407 bool get isEffectiveTargetMalformed => false; | 1400 bool get isEffectiveTargetMalformed => false; |
1408 | 1401 |
1409 @override | 1402 @override |
1410 bool get isExternal => false; | 1403 bool get isExternal => false; |
1411 | 1404 |
1412 @override | 1405 @override |
1413 bool get isFromEnvironmentConstructor => false; | 1406 bool get isFromEnvironmentConstructor => false; |
1414 | 1407 |
1415 @override | 1408 @override |
| 1409 bool get isIntFromEnvironmentConstructor => false; |
| 1410 |
| 1411 @override |
| 1412 bool get isBoolFromEnvironmentConstructor => false; |
| 1413 |
| 1414 @override |
| 1415 bool get isStringFromEnvironmentConstructor => false; |
| 1416 |
| 1417 @override |
1416 bool get isRedirectingFactory => false; | 1418 bool get isRedirectingFactory => false; |
1417 | 1419 |
1418 @override | 1420 @override |
1419 bool get isRedirectingGenerative => false; | 1421 bool get isRedirectingGenerative => false; |
1420 | 1422 |
1421 @override | 1423 @override |
1422 bool get isSynthesized => true; | 1424 bool get isSynthesized => true; |
1423 | 1425 |
1424 @override | 1426 @override |
1425 ElementKind get kind => ElementKind.GENERATIVE_CONSTRUCTOR; | 1427 ElementKind get kind => ElementKind.GENERATIVE_CONSTRUCTOR; |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 } | 2255 } |
2254 | 2256 |
2255 @override | 2257 @override |
2256 ElementKind get kind => ElementKind.PREFIX; | 2258 ElementKind get kind => ElementKind.PREFIX; |
2257 | 2259 |
2258 @override | 2260 @override |
2259 Element lookupLocalMember(String memberName) { | 2261 Element lookupLocalMember(String memberName) { |
2260 return _unsupported('lookupLocalMember'); | 2262 return _unsupported('lookupLocalMember'); |
2261 } | 2263 } |
2262 } | 2264 } |
OLD | NEW |