Skip to content

Commit a080b77

Browse files
authored
fix analysis issues in the sample (#1281)
* fix analysis issues in the sample * commit generated code
1 parent 7df73ef commit a080b77

Some content is hidden

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

48 files changed

+412
-58
lines changed

lib/src/html/html_generator_instance.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class HtmlGeneratorInstance implements HtmlOptions {
5151
void _generateSearchIndex() {
5252
File jsonFile = _createOutputFile(out, 'index.json');
5353
String json = JSON.encode(documentedElements.map((ModelElement e) {
54-
// TODO: find a better string for type
5554
Map data = {
5655
'name': e.name,
5756
'qualifiedName': e.name,
@@ -69,7 +68,7 @@ class HtmlGeneratorInstance implements HtmlOptions {
6968
}
7069
return data;
7170
}).toList());
72-
jsonFile.writeAsStringSync(json);
71+
jsonFile.writeAsStringSync('${json}\n');
7372
}
7473

7574
void _generateDocs() {

test/model_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,16 +588,16 @@ void main() {
588588
});
589589

590590
test('get methods', () {
591-
expect(Dog.instanceMethods, hasLength(4));
591+
expect(Dog.instanceMethods, hasLength(5));
592592
});
593593

594594
test('get operators', () {
595595
expect(Dog.operators, hasLength(1));
596596
expect(Dog.operators[0].name, 'operator ==');
597597
});
598598

599-
test('inherited methods,including from Object ', () {
600-
expect(B.inheritedMethods, hasLength(7));
599+
test('inherited methods, including from Object ', () {
600+
expect(B.inheritedMethods, hasLength(6));
601601
expect(B.hasInheritedMethods, isTrue);
602602
});
603603

@@ -957,6 +957,7 @@ String topLevelFunction(int param1, bool param2, Cool coolBeans,
957957
'Map<String, dynamic>');
958958
});
959959

960+
960961
test('parameter is a function', () {
961962
var functionArgParam = m4.parameters[1];
962963
expect(functionArgParam.modelType.createLinkedReturnTypeName(), 'String');

testing/test_package/lib/example.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class B extends Apple with Cat {
144144
*/
145145
List<String> list;
146146

147+
@override
147148
bool get isImplemented => false;
148149

149150
@deprecated
@@ -159,6 +160,9 @@ class B extends Apple with Cat {
159160
void writeMsg(String msg, [String transformMsg(String origMsg, bool flag)]) {
160161
// do nothing
161162
}
163+
164+
@override
165+
void abstractMethod() { }
162166
}
163167

164168
// Do NOT add a doc comment to C. Testing blank comments.
@@ -176,8 +180,10 @@ class ConstantCat implements Cat {
176180

177181
const ConstantCat(this.name);
178182

183+
@override
179184
bool get isImplemented => true;
180185

186+
@override
181187
void abstractMethod() {
182188
// do nothing
183189
}
@@ -207,7 +213,8 @@ class Dog implements Cat, E {
207213
@override
208214
bool get isImplemented => true;
209215

210-
operator ==(Dog other) => name == other.name;
216+
@override
217+
operator ==(other) => other is Dog && name == other.name;
211218

212219
foo() async => 42;
213220

@@ -224,6 +231,9 @@ class Dog implements Cat, E {
224231
static Dog createDog(String s) {
225232
return new Dog.deprecatedCreate(s);
226233
}
234+
235+
@override
236+
void abstractMethod() { }
227237
}
228238

229239
abstract class E {}
@@ -249,12 +259,14 @@ class Klass {
249259
method() {}
250260

251261
/// A shadowed method
262+
@override
252263
toString() {}
253264
}
254265

255266
class MyError extends Error {}
256267

257268
class MyErrorImplements implements Error {
269+
@override
258270
StackTrace get stackTrace => null;
259271
}
260272

@@ -312,5 +324,6 @@ class _RetainedEnum {
312324
final String name;
313325

314326
const _RetainedEnum(this.name);
327+
@override
315328
String toString() => name;
316329
}

testing/test_package_docs/ex/B-class.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,13 @@ <h2>Operators</h2>
279279
<section class="summary offset-anchor" id="instance-methods">
280280
<h2>Methods</h2>
281281
<dl class="callables">
282-
<dt id="abstractMethod" class="callable inherited">
283-
<span class="name"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></span><span class="signature">(<wbr>)
282+
<dt id="abstractMethod" class="callable">
283+
<span class="name"><a href="ex/B/abstractMethod.html">abstractMethod</a></span><span class="signature">(<wbr>)
284284
<span class="returntype parameter">&#8594; void</span>
285285
</span>
286286
</dt>
287-
<dd class="inherited">
287+
<dd>
288288
<p></p>
289-
<div class="features">inherited</div>
290289
</dd>
291290
<dt id="doNothing" class="callable">
292291
<span class="name deprecated"><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></span><span class="signature">(<wbr>)
@@ -396,7 +395,7 @@ <h5>B</h5>
396395
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
397396

398397
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
399-
<li class="inherited"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></li>
398+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
400399
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
401400
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
402401
<li><a href="ex/B/m1.html">m1</a></li>

testing/test_package_docs/ex/B/B.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ <h5><a href="ex/B-class.html">B</a></h5>
9696
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
9797

9898
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
99-
<li class="inherited"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></li>
99+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
100100
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
101101
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
102102
<li><a href="ex/B/m1.html">m1</a></li>
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta name="description" content="API docs for the abstractMethod method from the B class, for the Dart programming language.">
8+
<title>abstractMethod method - B class - ex library - Dart API</title>
9+
<!-- required because all the links are pseudo-absolute -->
10+
<base href="../..">
11+
12+
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Code+Pro|Roboto:500,400italic,300,400' type='text/css'>
13+
<link rel="stylesheet" href="static-assets/prettify.css">
14+
<link rel="stylesheet" href="static-assets/css/bootstrap.min.css">
15+
<link rel="stylesheet" href="static-assets/styles.css">
16+
<link rel="icon" href="static-assets/favicon.png">
17+
18+
<!-- Do not remove placeholder -->
19+
<!-- Header Placeholder -->
20+
</head>
21+
22+
<body>
23+
24+
<div id="overlay-under-drawer"></div>
25+
26+
<header class="container-fluid" id="title">
27+
<nav class="navbar navbar-fixed-top">
28+
<div class="container">
29+
<div class="row">
30+
<div class="col-sm-12 contents">
31+
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
32+
<ol class="breadcrumbs gt-separated hidden-xs">
33+
<li><a href="index.html">test_package</a></li>
34+
<li><a href="ex/ex-library.html">ex</a></li>
35+
<li><a href="ex/B-class.html">B</a></li>
36+
<li class="self-crumb">abstractMethod</li>
37+
</ol>
38+
<div class="self-name">abstractMethod</div>
39+
<form class="search navbar-right" role="search">
40+
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
41+
</form>
42+
</div> <!-- /col -->
43+
</div> <!-- /row -->
44+
</div> <!-- /container -->
45+
</nav>
46+
47+
<div class="container masthead">
48+
<div class="row">
49+
<div class="col-sm-12 contents">
50+
<ol class="breadcrumbs gt-separated visible-xs">
51+
<li><a href="index.html">test_package</a></li>
52+
<li><a href="ex/ex-library.html">ex</a></li>
53+
<li><a href="ex/B-class.html">B</a></li>
54+
<li class="self-crumb">abstractMethod</li>
55+
</ol>
56+
<div class="title-description">
57+
<h1 class="title">
58+
<span class="kind">method</span> abstractMethod
59+
</h1>
60+
</div>
61+
</div> <!-- /col -->
62+
</div> <!-- /row -->
63+
</div> <!-- /container -->
64+
65+
</header>
66+
67+
<div class="container body">
68+
<div class="row">
69+
70+
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
71+
<h5><a href="index.html">test_package</a></h5>
72+
<h5><a href="ex/ex-library.html">ex</a></h5>
73+
<h5><a href="ex/B-class.html">B</a></h5>
74+
75+
<ol>
76+
77+
78+
79+
<li class="section-title"><a href="ex/B-class.html#constructors">Constructors</a></li>
80+
<li><a href="ex/B/B.html">B</a></li>
81+
82+
<li class="section-title">
83+
<a href="ex/B-class.html#instance-properties">Properties</a>
84+
</li>
85+
<li><a href="ex/B/autoCompress.html">autoCompress</a></li>
86+
<li class="inherited"><a href="ex/B/hashCode.html">hashCode</a></li>
87+
<li><a href="ex/B/isImplemented.html">isImplemented</a></li>
88+
<li><a href="ex/B/list.html">list</a></li>
89+
<li class="inherited"><a href="ex/Apple/m.html">m</a></li>
90+
<li class="inherited"><a href="ex/B/runtimeType.html">runtimeType</a></li>
91+
<li class="inherited"><a href="ex/Apple/s.html">s</a></li>
92+
93+
<li class="section-title inherited"><a href="ex/B-class.html#operators">Operators</a></li>
94+
<li class="inherited"><a href="ex/Apple/operator_multiply.html">operator *</a></li>
95+
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
96+
97+
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
98+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
99+
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
100+
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
101+
<li><a href="ex/B/m1.html">m1</a></li>
102+
<li class="inherited"><a href="ex/Apple/methodWithTypedefParam.html">methodWithTypedefParam</a></li>
103+
<li class="inherited"><a href="ex/B/noSuchMethod.html">noSuchMethod</a></li>
104+
<li class="inherited"><a href="ex/Apple/paramFromExportLib.html">paramFromExportLib</a></li>
105+
<li class="inherited"><a href="ex/Apple/printMsg.html">printMsg</a></li>
106+
<li class="inherited"><a href="ex/B/toString.html">toString</a></li>
107+
<li><a href="ex/B/writeMsg.html">writeMsg</a></li>
108+
</ol>
109+
110+
</div><!--/.sidebar-offcanvas-->
111+
112+
<div class="col-xs-12 col-sm-9 col-md-8 main-content">
113+
<section class="multi-line-signature">
114+
<div>
115+
<ol class="annotation-list">
116+
<li>override</li>
117+
</ol>
118+
</div>
119+
<span class="returntype">void</span>
120+
<span class="name ">abstractMethod</span>(<wbr>)
121+
</section>
122+
123+
124+
125+
</div> <!-- /.main-content -->
126+
127+
</div> <!-- row -->
128+
</div> <!-- container -->
129+
130+
<footer>
131+
<div class="container-fluid">
132+
<div class="container">
133+
<p class="text-center">
134+
<span class="no-break">
135+
test_package 0.0.1
136+
</span>
137+
&bull;
138+
<span class="no-break">
139+
<a href="https://www.dartlang.org">
140+
<img src="static-assets/favicon.png" alt="Dart" title="Dart" width="16" height="16">
141+
</a>
142+
</span>
143+
&bull;
144+
<span class="copyright no-break">
145+
<a href="http://creativecommons.org/licenses/by-sa/4.0/">cc license</a>
146+
</span>
147+
</p>
148+
</div>
149+
</div>
150+
</footer>
151+
152+
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
153+
<script src="static-assets/typeahead.bundle.min.js"></script>
154+
<script src="static-assets/prettify.js"></script>
155+
<script src="static-assets/URI.js"></script>
156+
<script src="static-assets/script.js"></script>
157+
<!-- Do not remove placeholder -->
158+
<!-- Footer Placeholder -->
159+
160+
</body>
161+
162+
</html>

testing/test_package_docs/ex/B/autoCompress.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h5><a href="ex/B-class.html">B</a></h5>
9595
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
9696

9797
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
98-
<li class="inherited"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></li>
98+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
9999
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
100100
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
101101
<li><a href="ex/B/m1.html">m1</a></li>

testing/test_package_docs/ex/B/doNothing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h5><a href="ex/B-class.html">B</a></h5>
9595
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
9696

9797
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
98-
<li class="inherited"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></li>
98+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
9999
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
100100
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
101101
<li><a href="ex/B/m1.html">m1</a></li>

testing/test_package_docs/ex/B/hashCode.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h5><a href="ex/B-class.html">B</a></h5>
9595
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
9696

9797
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
98-
<li class="inherited"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></li>
98+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
9999
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
100100
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
101101
<li><a href="ex/B/m1.html">m1</a></li>

testing/test_package_docs/ex/B/isImplemented.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h5><a href="ex/B-class.html">B</a></h5>
9595
<li class="inherited"><a href="ex/B/operator_equals.html">operator ==</a></li>
9696

9797
<li class="section-title"><a href="ex/B-class.html#instance-methods">Methods</a></li>
98-
<li class="inherited"><a href="ex/Cat/abstractMethod.html">abstractMethod</a></li>
98+
<li><a href="ex/B/abstractMethod.html">abstractMethod</a></li>
9999
<li><a class="deprecated" href="ex/B/doNothing.html">doNothing</a></li>
100100
<li class="inherited"><a href="ex/Apple/isGreaterThan.html">isGreaterThan</a></li>
101101
<li><a href="ex/B/m1.html">m1</a></li>

0 commit comments

Comments
 (0)