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

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

Issue 150693005: Fix ParameterMirror.hasDefaultValue/defaultValue in source mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix handling of external parameters Created 6 years, 10 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_member_mirrors.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_member_mirrors.dart b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_member_mirrors.dart
index 3f4b60489c1cf3634d41a210fcd8727d12e955d0..0a22d4d8724119bdb6004c9d1c428bf8ea4313f9 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_member_mirrors.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_member_mirrors.dart
@@ -239,17 +239,19 @@ class Dart2JsParameterMirror extends Dart2JsMemberMirror
bool get isConst => false;
InstanceMirror get defaultValue {
- Constant constant = mirrorSystem.compiler.constantHandler
- .getConstantForVariable(_variableElement);
- if (constant != null) {
+ if (hasDefaultValue) {
+ Constant constant = mirrorSystem.compiler.constantHandler
+ .getConstantForVariable(_variableElement);
+ assert(invariant(_variableElement, constant != null,
+ message: "Missing constant for parameter "
+ "$_variableElement with default value."));
return _convertConstantToInstanceMirror(mirrorSystem, constant);
}
return null;
}
bool get hasDefaultValue {
- return mirrorSystem.compiler.constantHandler
- .getConstantForVariable(_variableElement) != null;
+ return _variableElement.cachedNode.asSendSet() != null;
}
bool get isInitializingFormal => false;

Powered by Google App Engine
This is Rietveld 408576698