Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2590)

Unified Diff: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart

Issue 14333011: Make source mirror ObjectMirror.getField synchronous (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
index 7305602b351a21fc2dcdc26c07598291d0a6eae8..fbde5f95c6b073b9e7136648dfc71056995c7132 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
@@ -1483,7 +1483,7 @@ class Dart2JsConstantMirror extends InstanceMirror {
throw new UnsupportedError('InstanceMirror does not have a reflectee');
}
- Future<InstanceMirror> getField(String fieldName) {
+ InstanceMirror getField(String fieldName) {
// TODO(johnniwinther): Which exception/error should be thrown here?
throw new UnsupportedError('InstanceMirror does not have a reflectee');
}
@@ -1553,11 +1553,10 @@ class Dart2JsListConstantMirror extends Dart2JsConstantMirror
int get length => _constant.length;
- Future<InstanceMirror> operator[](int index) {
+ InstanceMirror operator[](int index) {
if (index < 0) throw new RangeError('Negative index');
if (index >= _constant.length) throw new RangeError('Index out of bounds');
- return new Future<InstanceMirror>.value(
- _convertConstantToInstanceMirror(mirrors, _constant.entries[index]));
+ return _convertConstantToInstanceMirror(mirrors, _constant.entries[index]);
}
}
@@ -1590,11 +1589,10 @@ class Dart2JsMapConstantMirror extends Dart2JsConstantMirror
return new List<String>.from(_list);
}
- Future<InstanceMirror> operator[](String key) {
+ InstanceMirror operator[](String key) {
int index = _list.indexOf(key);
if (index == -1) return null;
- return new Future<InstanceMirror>.value(
- _convertConstantToInstanceMirror(mirrors, _constant.values[index]));
+ return _convertConstantToInstanceMirror(mirrors, _constant.values[index]);
}
}
@@ -1636,11 +1634,10 @@ class Dart2JsConstructedConstantMirror extends Dart2JsConstantMirror {
return _fieldMapCache;
}
- Future<InstanceMirror> getField(String fieldName) {
+ InstanceMirror getField(String fieldName) {
Constant fieldConstant = _fieldMap[fieldName];
if (fieldConstant != null) {
- return new Future<InstanceMirror>.value(
- _convertConstantToInstanceMirror(mirrors, fieldConstant));
+ return _convertConstantToInstanceMirror(mirrors, fieldConstant);
}
return super.getField(fieldName);
}
@@ -1673,16 +1670,13 @@ class Dart2JsCommentInstanceMirror implements CommentInstanceMirror {
throw new UnsupportedError('InstanceMirror does not have a reflectee');
}
- Future<InstanceMirror> getField(String fieldName) {
+ InstanceMirror getField(String fieldName) {
if (fieldName == 'isDocComment') {
- return new Future.value(
- new Dart2JsBoolConstantMirror.fromBool(mirrors, isDocComment));
+ return new Dart2JsBoolConstantMirror.fromBool(mirrors, isDocComment);
} else if (fieldName == 'text') {
- return new Future.value(
- new Dart2JsStringConstantMirror.fromString(mirrors, text));
+ return new Dart2JsStringConstantMirror.fromString(mirrors, text);
} else if (fieldName == 'trimmedText') {
- return new Future.value(
- new Dart2JsStringConstantMirror.fromString(mirrors, trimmedText));
+ return new Dart2JsStringConstantMirror.fromString(mirrors, trimmedText);
}
// TODO(johnniwinther): Which exception/error should be thrown here?
throw new UnsupportedError('InstanceMirror does not have a reflectee');
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart » ('j') | tools/dom/docs/lib/docs.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698