Skip to content

Commit

Permalink
Merge pull request #241 from dart-lang/display-operators
Browse files Browse the repository at this point in the history
display the operators for a class
  • Loading branch information
sethladd committed Mar 1, 2015
2 parents 30c5836 + 2514e16 commit a3c2f55
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ class Class extends ModelElement {
return _operators;
}

bool get hasOperators => operators.isNotEmpty;

List<Method> get staticMethods {
if (_staticMethods != null) return _staticMethods;

Expand Down
21 changes: 21 additions & 0 deletions templates/new/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,27 @@ <h2>Instance Methods</h2>
</section>
{{/class.hasInstanceMethods}}

{{#class.hasOperators}}
<section id="operators-summary" class="summary">
<h2>Operators</h2>
<dl class="withreturntypes">
{{#class.operators}}
<dt>
<code>
<span class="returntype">{{{ linkedReturnType }}}</span>
<span class="name-and-params">
<span class="name">{{ name }}</span>({{{ linkedParams }})
</span>
</code>
</dt>
<dd>
{{#oneLiner}}{{ documentation }}{{/oneLiner}}
</dd>
{{/class.operators}}
</dl>
</section>
{{/class.hasOperators}}

</div>

{{>footer}}
10 changes: 10 additions & 0 deletions test/fake_package/lib/fake.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ class LongFirstLine extends SuperAwesomeClass with MixMeIn implements Interface,
/// Only a setter, with a single param, of type double.
void set onlySetter(double d) {}

/// Adds another one of these thingies.
LongFirstLine operator +(LongFirstLine other) {
return null;
}

/// Multiplies a thingies to this thingie and then returns a new thingie.
LongFirstLine operator *(LongFirstLine other) {
return null;
}

static int get staticGetter => 11111;

static void set staticOnlySetter(bool thing) {}
Expand Down

0 comments on commit a3c2f55

Please sign in to comment.