Index: pkg/dartdoc/mirrors/dart2js_mirror.dart |
diff --git a/pkg/dartdoc/mirrors/dart2js_mirror.dart b/pkg/dartdoc/mirrors/dart2js_mirror.dart |
index 2f0530ecc4174f91dd8f3a4daf89bce0e2a2a55e..ce7c64febb7429e34017eec457b3e2caec841d34 100644 |
--- a/pkg/dartdoc/mirrors/dart2js_mirror.dart |
+++ b/pkg/dartdoc/mirrors/dart2js_mirror.dart |
@@ -83,12 +83,10 @@ Collection<Dart2JsMemberMirror> _convertElementMemberToMemberMirrors( |
} else if (element is AbstractFieldElement) { |
var members = <Dart2JsMemberMirror>[]; |
if (element.getter !== null) { |
- members.add(new Dart2JsMethodMirror(library, element.getter, |
- Dart2JsMethodKind.GETTER)); |
+ members.add(new Dart2JsMethodMirror(library, element.getter)); |
} |
if (element.setter !== null) { |
- members.add(new Dart2JsMethodMirror(library, element.setter, |
- Dart2JsMethodKind.SETTER)); |
+ members.add(new Dart2JsMethodMirror(library, element.setter)); |
} |
return members; |
} |
@@ -1198,58 +1196,54 @@ class Dart2JsMethodMirror extends Dart2JsElementMirror |
String _canonicalName; |
Dart2JsMethodMirror(Dart2JsObjectMirror objectMirror, |
- FunctionElement function, |
- [Dart2JsMethodKind kind = null]) |
+ FunctionElement function) |
: this._objectMirror = objectMirror, |
- this._kind = kind, |
super(objectMirror.system, function) { |
_name = _element.name.slowToString(); |
- if (kind == null) { |
- if (_function.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { |
- _constructorName = ''; |
- int dollarPos = _name.indexOf('\$'); |
- if (dollarPos != -1) { |
- _constructorName = _name.substring(dollarPos+1); |
- _name = _name.substring(0, dollarPos); |
- // canonical name is TypeName.constructorName |
- _canonicalName = '$_name.$_constructorName'; |
- } else { |
- // canonical name is TypeName |
- _canonicalName = _name; |
- } |
- if (_function.modifiers !== null && _function.modifiers.isConst()) { |
- _kind = Dart2JsMethodKind.CONST; |
- } else { |
- _kind = Dart2JsMethodKind.CONSTRUCTOR; |
- } |
- } else if (_function.modifiers !== null |
- && _function.modifiers.isFactory()) { |
- _constructorName = ''; |
- int dollarPos = _name.indexOf('\$'); |
- if (dollarPos != -1) { |
- _constructorName = _name.substring(dollarPos+1); |
- _name = _name.substring(0, dollarPos); |
- } |
- _kind = Dart2JsMethodKind.FACTORY; |
+ if (_function.kind == ElementKind.GETTER) { |
+ _kind = Dart2JsMethodKind.GETTER; |
+ _canonicalName = _name; |
+ } else if (_function.kind == ElementKind.SETTER) { |
+ _kind = Dart2JsMethodKind.SETTER; |
+ _canonicalName = '$_name='; |
+ } else if (_function.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { |
+ _constructorName = ''; |
+ int dollarPos = _name.indexOf('\$'); |
+ if (dollarPos != -1) { |
+ _constructorName = _name.substring(dollarPos+1); |
+ _name = _name.substring(0, dollarPos); |
// canonical name is TypeName.constructorName |
_canonicalName = '$_name.$_constructorName'; |
- } else if (_name.startsWith('operator\$')) { |
- String str = _name.substring(9); |
- _name = 'operator'; |
- _kind = Dart2JsMethodKind.OPERATOR; |
- _operatorName = _getOperatorFromOperatorName(str); |
- // canonical name is 'operator operatorName' |
- _canonicalName = 'operator $_operatorName'; |
} else { |
- _kind = Dart2JsMethodKind.NORMAL; |
+ // canonical name is TypeName |
_canonicalName = _name; |
} |
- } else if (kind == Dart2JsMethodKind.GETTER) { |
- _canonicalName = _name; |
- } else if (kind == Dart2JsMethodKind.SETTER) { |
- _canonicalName = '$_name='; |
+ if (_function.modifiers !== null && _function.modifiers.isConst()) { |
+ _kind = Dart2JsMethodKind.CONST; |
+ } else { |
+ _kind = Dart2JsMethodKind.CONSTRUCTOR; |
+ } |
+ } else if (_function.modifiers !== null && |
+ _function.modifiers.isFactory()) { |
+ _kind = Dart2JsMethodKind.FACTORY; |
+ _constructorName = ''; |
+ int dollarPos = _name.indexOf('\$'); |
+ if (dollarPos != -1) { |
+ _constructorName = _name.substring(dollarPos+1); |
Lasse Reichstein Nielsen
2012/08/20 13:07:58
Spaces around '+'.
Johnni Winther
2012/08/23 10:19:50
Done.
|
+ _name = _name.substring(0, dollarPos); |
+ } |
+ // canonical name is TypeName.constructorName |
+ _canonicalName = '$_name.$_constructorName'; |
+ } else if (_name.startsWith('operator\$')) { |
+ String str = _name.substring(9); |
+ _name = 'operator'; |
+ _kind = Dart2JsMethodKind.OPERATOR; |
+ _operatorName = _getOperatorFromOperatorName(str); |
+ // canonical name is 'operator operatorName' |
+ _canonicalName = 'operator $_operatorName'; |
} else { |
- assert(false); |
+ _kind = Dart2JsMethodKind.NORMAL; |
+ _canonicalName = _name; |
} |
} |