Skip to content

Commit 48f36a9

Browse files
committed
show source for more element types
1 parent f96ef94 commit 48f36a9

File tree

174 files changed

+224
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+224
-36
lines changed

lib/src/model.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ void _addToImplementors(Class c) {
8181
}
8282

8383
/// Getters and setters.
84-
class Accessor extends ModelElement implements EnclosedElement {
84+
class Accessor extends ModelElement
85+
with SourceCodeMixin
86+
implements EnclosedElement {
8587
Accessor(PropertyAccessorElement element, Library library)
8688
: super(element, library);
8789

@@ -2171,7 +2173,9 @@ class TopLevelVariable extends ModelElement
21712173
TopLevelVariableElement get _variable => (element as TopLevelVariableElement);
21722174
}
21732175

2174-
class Typedef extends ModelElement implements EnclosedElement {
2176+
class Typedef extends ModelElement
2177+
with SourceCodeMixin
2178+
implements EnclosedElement {
21752179
Typedef(FunctionTypeAliasElement element, Library library)
21762180
: super(element, library) {
21772181
if (element.type != null) {

lib/templates/constant.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ <h5><a href="{{href}}">{{name}}</a></h5>
2323

2424
{{#property}}
2525
{{>documentation}}
26+
{{>source_code}}
2627
{{/property}}
2728

2829
</div> <!-- /.main-content -->

lib/templates/property.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ <h5><a href="{{href}}">{{name}}</a></h5>
2424
{{#property.hasExplicitGetter}}
2525
{{#property.getter}}
2626
{{>accessor_getter}}
27+
{{>source_code}}
2728
{{/property.getter}}
2829
{{/property.hasExplicitGetter}}
2930

3031
{{#property.hasExplicitSetter}}
3132
{{#property.setter}}
3233
{{>accessor_setter}}
34+
{{>source_code}}
3335
{{/property.setter}}
3436
{{/property.hasExplicitSetter}}
3537

lib/templates/top_level_constant.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ <h5><a href="{{href}}">{{name}}</a></h5>
1919

2020
{{#property}}
2121
{{>documentation}}
22+
{{>source_code}}
2223
{{/property}}
2324

2425
</div> <!-- /.main-content -->

lib/templates/top_level_property.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ <h5><a href="{{href}}">{{name}}</a></h5>
2222
{{#property.hasExplicitGetter}}
2323
{{#property.getter}}
2424
{{>accessor_getter}}
25+
{{>source_code}}
2526
{{/property.getter}}
2627
{{/property.hasExplicitGetter}}
2728

2829
{{#property.hasExplicitSetter}}
2930
{{#property.setter}}
3031
{{>accessor_setter}}
32+
{{>source_code}}
3133
{{/property.setter}}
3234
{{/property.hasExplicitSetter}}
3335

lib/templates/typedef.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ <h5><a href="{{href}}">{{name}}</a></h5>
1717

1818
{{#typeDef}}
1919
{{>documentation}}
20+
{{>source_code}}
2021
{{/typeDef}}
2122

2223
</div> <!-- /.main-content -->

test/model_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ void main() {
570570
expect(Apple.staticProperties, hasLength(1));
571571
});
572572

573+
test('constructors have source', () {
574+
Constructor ctor = Dog.constructors.first;
575+
expect(ctor.sourceCode, isNotEmpty);
576+
});
577+
573578
test('get constants', () {
574579
expect(Apple.constants, hasLength(1));
575580
});

testing/test_package/lib/example.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ class Dog implements Cat, E {
191191
@deprecated
192192
int deprecatedField;
193193

194-
Dog();
194+
Dog() {
195+
testMethod([]);
196+
}
195197

196198
@deprecated
197199
Dog.deprecatedCreate(this.name);

testing/test_package_docs/ex/Apple/hashCode.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ <h5><a href="ex/Apple-class.html">Apple</a></h5>
128128
equality operator as well to maintain consistency.</p>
129129
</section>
130130
</section>
131+
131132

132133

133134
</div> <!-- /.main-content -->

testing/test_package_docs/ex/Apple/n-constant.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ <h5><a href="ex/Apple-class.html">Apple</a></h5>
117117
<span class="constant-value">5</span>
118118
</section>
119119

120-
120+
121+
121122
</div> <!-- /.main-content -->
122123

123124
</div> <!-- row -->

0 commit comments

Comments
 (0)