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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 native "MethodMirror_source"; | 1286 native "MethodMirror_source"; |
1287 } | 1287 } |
1288 | 1288 |
1289 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl | 1289 class _LocalVariableMirrorImpl extends _LocalDeclarationMirrorImpl |
1290 implements VariableMirror { | 1290 implements VariableMirror { |
1291 _LocalVariableMirrorImpl(reflectee, | 1291 _LocalVariableMirrorImpl(reflectee, |
1292 String simpleName, | 1292 String simpleName, |
1293 this.owner, | 1293 this.owner, |
1294 this._type, | 1294 this._type, |
1295 this.isStatic, | 1295 this.isStatic, |
1296 this.isFinal) | 1296 this.isFinal, |
| 1297 this.isConst) |
1297 : super(reflectee, _s(simpleName)); | 1298 : super(reflectee, _s(simpleName)); |
1298 | 1299 |
1299 final DeclarationMirror owner; | 1300 final DeclarationMirror owner; |
1300 final bool isStatic; | 1301 final bool isStatic; |
1301 final bool isFinal; | 1302 final bool isFinal; |
| 1303 final bool isConst; |
1302 | 1304 |
1303 bool get isPrivate => _n(simpleName).startsWith('_'); | 1305 bool get isPrivate => _n(simpleName).startsWith('_'); |
1304 | 1306 |
1305 bool get isTopLevel => owner is LibraryMirror; | 1307 bool get isTopLevel => owner is LibraryMirror; |
1306 | 1308 |
1307 SourceLocation get location { | 1309 SourceLocation get location { |
1308 throw new UnimplementedError('VariableMirror.location is not implemented'); | 1310 throw new UnimplementedError('VariableMirror.location is not implemented'); |
1309 } | 1311 } |
1310 | 1312 |
1311 TypeMirror _type; | 1313 TypeMirror _type; |
(...skipping 20 matching lines...) Expand all Loading... |
1332 this.isOptional, | 1334 this.isOptional, |
1333 this.isNamed, | 1335 this.isNamed, |
1334 bool isFinal, | 1336 bool isFinal, |
1335 this._defaultValueReflectee, | 1337 this._defaultValueReflectee, |
1336 this._unmirroredMetadata) | 1338 this._unmirroredMetadata) |
1337 : super(reflectee, | 1339 : super(reflectee, |
1338 simpleName, | 1340 simpleName, |
1339 owner, | 1341 owner, |
1340 null, // We override the type. | 1342 null, // We override the type. |
1341 false, // isStatic does not apply. | 1343 false, // isStatic does not apply. |
1342 isFinal); | 1344 isFinal, |
| 1345 false // Not const. |
| 1346 ); |
1343 | 1347 |
1344 final int _position; | 1348 final int _position; |
1345 final bool isOptional; | 1349 final bool isOptional; |
1346 final bool isNamed; | 1350 final bool isNamed; |
1347 final List _unmirroredMetadata; | 1351 final List _unmirroredMetadata; |
1348 | 1352 |
1349 Object _defaultValueReflectee; | 1353 Object _defaultValueReflectee; |
1350 InstanceMirror _defaultValue; | 1354 InstanceMirror _defaultValue; |
1351 InstanceMirror get defaultValue { | 1355 InstanceMirror get defaultValue { |
1352 if (!isOptional) { | 1356 if (!isOptional) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 if (typeMirror == null) { | 1472 if (typeMirror == null) { |
1469 typeMirror = makeLocalTypeMirror(key); | 1473 typeMirror = makeLocalTypeMirror(key); |
1470 _instanitationCache[key] = typeMirror; | 1474 _instanitationCache[key] = typeMirror; |
1471 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1475 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1472 _declarationCache[key] = typeMirror; | 1476 _declarationCache[key] = typeMirror; |
1473 } | 1477 } |
1474 } | 1478 } |
1475 return typeMirror; | 1479 return typeMirror; |
1476 } | 1480 } |
1477 } | 1481 } |
OLD | NEW |