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

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

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. 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 c86321f76324e716aa44acd0d9d93f22348b27f9..17f40f6824338b8328039134e7514ac41bec56ba 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
@@ -265,11 +265,9 @@ Future<MirrorSystem> analyzeUri(List<Uri> libraries,
compiler.librariesToAnalyzeWhenRun = libraries;
bool success = compiler.run(null);
if (success && !compilationFailed) {
- return new Future<MirrorSystem>.immediate(
- new Dart2JsMirrorSystem(compiler));
+ return new Future<MirrorSystem>.value(new Dart2JsMirrorSystem(compiler));
} else {
- return new Future<MirrorSystem>.immediateError(
- 'Failed to create mirror system.');
+ return new Future<MirrorSystem>.error('Failed to create mirror system.');
}
}
@@ -1626,7 +1624,7 @@ class Dart2JsListConstantMirror extends Dart2JsConstantMirror
Future<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>.immediate(
+ return new Future<InstanceMirror>.value(
_convertConstantToInstanceMirror(mirrors, _constant.entries[index]));
}
}
@@ -1663,7 +1661,7 @@ class Dart2JsMapConstantMirror extends Dart2JsConstantMirror
Future<InstanceMirror> operator[](String key) {
int index = _list.indexOf(key);
if (index == -1) return null;
- return new Future<InstanceMirror>.immediate(
+ return new Future<InstanceMirror>.value(
_convertConstantToInstanceMirror(mirrors, _constant.values[index]));
}
}
@@ -1709,7 +1707,7 @@ class Dart2JsConstructedConstantMirror extends Dart2JsConstantMirror {
Future<InstanceMirror> getField(String fieldName) {
Constant fieldConstant = _fieldMap[fieldName];
if (fieldConstant != null) {
- return new Future<InstanceMirror>.immediate(
+ return new Future<InstanceMirror>.value(
_convertConstantToInstanceMirror(mirrors, fieldConstant));
}
return super.getField(fieldName);
@@ -1745,13 +1743,13 @@ class Dart2JsCommentInstanceMirror implements CommentInstanceMirror {
Future<InstanceMirror> getField(String fieldName) {
if (fieldName == 'isDocComment') {
- return new Future.immediate(
+ return new Future.value(
new Dart2JsBoolConstantMirror.fromBool(mirrors, isDocComment));
} else if (fieldName == 'text') {
- return new Future.immediate(
+ return new Future.value(
new Dart2JsStringConstantMirror.fromString(mirrors, text));
} else if (fieldName == 'trimmedText') {
- return new Future.immediate(
+ return new Future.value(
new Dart2JsStringConstantMirror.fromString(mirrors, trimmedText));
}
// TODO(johnniwinther): Which exception/error should be thrown here?

Powered by Google App Engine
This is Rietveld 408576698