OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // VM-specific implementation of the dart:mirrors library. | 5 // VM-specific implementation of the dart:mirrors library. |
6 | 6 |
7 import "dart:collection"; | 7 import "dart:collection"; |
8 | 8 |
9 final emptyList = new UnmodifiableListView([]); | 9 final emptyList = new UnmodifiableListView([]); |
10 final emptyMap = new _UnmodifiableMapView({}); | 10 final emptyMap = new _UnmodifiableMapView({}); |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 native "MethodMirror_source"; | 1259 native "MethodMirror_source"; |
1260 } | 1260 } |
1261 | 1261 |
1262 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl | 1262 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl |
1263 implements VariableMirror { | 1263 implements VariableMirror { |
1264 _LocalVariableMirrorImpl(reflectee, | 1264 _LocalVariableMirrorImpl(reflectee, |
1265 String simpleName, | 1265 String simpleName, |
1266 this.owner, | 1266 this.owner, |
1267 this._type, | 1267 this._type, |
1268 this.isStatic, | 1268 this.isStatic, |
1269 this.isFinal) | 1269 this.isFinal, |
| 1270 this.isConst) |
1270 : super(reflectee, _s(simpleName)); | 1271 : super(reflectee, _s(simpleName)); |
1271 | 1272 |
1272 final DeclarationMirror owner; | 1273 final DeclarationMirror owner; |
1273 final bool isStatic; | 1274 final bool isStatic; |
1274 final bool isFinal; | 1275 final bool isFinal; |
| 1276 final bool isConst; |
1275 | 1277 |
1276 bool get isPrivate => _n(simpleName).startsWith('_'); | 1278 bool get isPrivate => _n(simpleName).startsWith('_'); |
1277 | 1279 |
1278 bool get isTopLevel => owner is LibraryMirror; | 1280 bool get isTopLevel => owner is LibraryMirror; |
1279 | 1281 |
1280 SourceLocation get location { | 1282 SourceLocation get location { |
1281 throw new UnimplementedError('VariableMirror.location is not implemented'); | 1283 throw new UnimplementedError('VariableMirror.location is not implemented'); |
1282 } | 1284 } |
1283 | 1285 |
1284 Type get _instantiator { | 1286 Type get _instantiator { |
(...skipping 23 matching lines...) Expand all Loading... |
1308 this.isOptional, | 1310 this.isOptional, |
1309 this.isNamed, | 1311 this.isNamed, |
1310 bool isFinal, | 1312 bool isFinal, |
1311 this._defaultValueReflectee, | 1313 this._defaultValueReflectee, |
1312 this._unmirroredMetadata) | 1314 this._unmirroredMetadata) |
1313 : super(reflectee, | 1315 : super(reflectee, |
1314 simpleName, | 1316 simpleName, |
1315 owner, | 1317 owner, |
1316 null, // We override the type. | 1318 null, // We override the type. |
1317 false, // isStatic does not apply. | 1319 false, // isStatic does not apply. |
1318 isFinal); | 1320 isFinal, |
| 1321 false // Not const. |
| 1322 ); |
1319 | 1323 |
1320 final int _position; | 1324 final int _position; |
1321 final bool isOptional; | 1325 final bool isOptional; |
1322 final bool isNamed; | 1326 final bool isNamed; |
1323 final List _unmirroredMetadata; | 1327 final List _unmirroredMetadata; |
1324 | 1328 |
1325 Object _defaultValueReflectee; | 1329 Object _defaultValueReflectee; |
1326 InstanceMirror _defaultValue; | 1330 InstanceMirror _defaultValue; |
1327 InstanceMirror get defaultValue { | 1331 InstanceMirror get defaultValue { |
1328 if (!isOptional) { | 1332 if (!isOptional) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 if (typeMirror == null) { | 1452 if (typeMirror == null) { |
1449 typeMirror = makeLocalTypeMirror(key); | 1453 typeMirror = makeLocalTypeMirror(key); |
1450 _instanitationCache[key] = typeMirror; | 1454 _instanitationCache[key] = typeMirror; |
1451 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1455 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1452 _declarationCache[key] = typeMirror; | 1456 _declarationCache[key] = typeMirror; |
1453 } | 1457 } |
1454 } | 1458 } |
1455 return typeMirror; | 1459 return typeMirror; |
1456 } | 1460 } |
1457 } | 1461 } |
OLD | NEW |