| 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 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 } | 1410 } |
| 1411 return this.simpleName == other.simpleName; | 1411 return this.simpleName == other.simpleName; |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 int get hashCode => simpleName.hashCode; | 1414 int get hashCode => simpleName.hashCode; |
| 1415 | 1415 |
| 1416 String toString() => "TypeMirror on '${_n(simpleName)}'"; | 1416 String toString() => "TypeMirror on '${_n(simpleName)}'"; |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 class _Mirrors { | 1419 class _Mirrors { |
| 1420 // Does a port refer to our local isolate? | |
| 1421 static bool isLocalPort(SendPort port) native 'Mirrors_isLocalPort'; | |
| 1422 | |
| 1423 static MirrorSystem _currentMirrorSystem = null; | 1420 static MirrorSystem _currentMirrorSystem = null; |
| 1424 | 1421 |
| 1425 // Creates a new local MirrorSystem. | 1422 // Creates a new local MirrorSystem. |
| 1426 static MirrorSystem makeLocalMirrorSystem() | 1423 static MirrorSystem makeLocalMirrorSystem() |
| 1427 native 'Mirrors_makeLocalMirrorSystem'; | 1424 native 'Mirrors_makeLocalMirrorSystem'; |
| 1428 | 1425 |
| 1429 // The MirrorSystem for the current isolate. | 1426 // The MirrorSystem for the current isolate. |
| 1430 static MirrorSystem currentMirrorSystem() { | 1427 static MirrorSystem currentMirrorSystem() { |
| 1431 if (_currentMirrorSystem == null) { | 1428 if (_currentMirrorSystem == null) { |
| 1432 _currentMirrorSystem = makeLocalMirrorSystem(); | 1429 _currentMirrorSystem = makeLocalMirrorSystem(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 if (typeMirror == null) { | 1463 if (typeMirror == null) { |
| 1467 typeMirror = makeLocalTypeMirror(key); | 1464 typeMirror = makeLocalTypeMirror(key); |
| 1468 _instanitationCache[key] = typeMirror; | 1465 _instanitationCache[key] = typeMirror; |
| 1469 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1466 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
| 1470 _declarationCache[key] = typeMirror; | 1467 _declarationCache[key] = typeMirror; |
| 1471 } | 1468 } |
| 1472 } | 1469 } |
| 1473 return typeMirror; | 1470 return typeMirror; |
| 1474 } | 1471 } |
| 1475 } | 1472 } |
| OLD | NEW |