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

Side by Side Diff: lib/src/rules/super_goes_last.dart

Issue 2318333002: Fix broken markdown in docs (#306). (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « lib/src/rules/slash_for_doc_comments.dart ('k') | lib/src/rules/type_annotate_public_apis.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library linter.src.rules.super_goes_last; 5 library linter.src.rules.super_goes_last;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/visitor.dart'; 8 import 'package:analyzer/dart/ast/visitor.dart';
9 import 'package:linter/src/linter.dart'; 9 import 'package:linter/src/linter.dart';
10 10
11 const desc = 11 const desc =
12 'Place the super() call last in a constructor initialization list.'; 12 'Place the super() call last in a constructor initialization list.';
13 13
14 const details = ''' 14 const details = '''
15 From the [style guide] (https://www.dartlang.org/articles/style-guide/): 15 From the [style guide](https://www.dartlang.org/articles/style-guide/):
16 16
17 **DO** place the `super()` call last in a constructor initialization list. 17 **DO** place the `super()` call last in a constructor initialization list.
18 18
19 Field initializers are evaluated in the order that they appear in the 19 Field initializers are evaluated in the order that they appear in the
20 constructor initialization list. If you place a `super()` call in the 20 constructor initialization list. If you place a `super()` call in the
21 middle of an initializer list, the superclass's initializers will be evaluated 21 middle of an initializer list, the superclass's initializers will be evaluated
22 right then before evaluating the rest of the subclass's initializers. 22 right then before evaluating the rest of the subclass's initializers.
23 23
24 What it doesn't mean is that the superclass's constructor body will be executed 24 What it doesn't mean is that the superclass's constructor body will be executed
25 then. That always happens after all initializers are run regardless of where 25 then. That always happens after all initializers are run regardless of where
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 var last = node.initializers.length - 1; 68 var last = node.initializers.length - 1;
69 69
70 for (int i = 0; i <= last; ++i) { 70 for (int i = 0; i <= last; ++i) {
71 var init = node.initializers[i]; 71 var init = node.initializers[i];
72 if (init is SuperConstructorInvocation && i != last) { 72 if (init is SuperConstructorInvocation && i != last) {
73 rule.reportLint(init); 73 rule.reportLint(init);
74 } 74 }
75 } 75 }
76 } 76 }
77 } 77 }
OLDNEW
« no previous file with comments | « lib/src/rules/slash_for_doc_comments.dart ('k') | lib/src/rules/type_annotate_public_apis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698