OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
6 * To use it, from this directory, run: | 6 * To use it, from this directory, run: |
7 * | 7 * |
8 * $ ./dartdoc <path to .dart file> | 8 * $ ./dartdoc <path to .dart file> |
9 * | 9 * |
10 * This will create a "docs" directory with the docs for your libraries. To | 10 * This will create a "docs" directory with the docs for your libraries. To |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 } | 513 } |
514 | 514 |
515 // Translate specially-named methods: getters, setters, operators. | 515 // Translate specially-named methods: getters, setters, operators. |
516 var name = method.name; | 516 var name = method.name; |
517 if (name.startsWith('get:')) { | 517 if (name.startsWith('get:')) { |
518 // Getter. | 518 // Getter. |
519 name = 'get ${name.substring(4)}'; | 519 name = 'get ${name.substring(4)}'; |
520 } else if (name.startsWith('set:')) { | 520 } else if (name.startsWith('set:')) { |
521 // Setter. | 521 // Setter. |
522 name = 'set ${name.substring(4)}'; | 522 name = 'set ${name.substring(4)}'; |
| 523 } else if (name == ':negate') { |
| 524 // Dart uses 'negate' for prefix negate operators, not '!'. |
| 525 name = 'operator negate'; |
523 } else { | 526 } else { |
524 // See if it's an operator. | 527 // See if it's an operator. |
525 name = TokenKind.rawOperatorFromMethod(name); | 528 name = TokenKind.rawOperatorFromMethod(name); |
526 if (name == null) { | 529 if (name == null) { |
527 name = method.name; | 530 name = method.name; |
528 } else { | 531 } else { |
529 name = 'operator $name'; | 532 name = 'operator $name'; |
530 } | 533 } |
531 } | 534 } |
532 | 535 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 847 |
845 return new md.Element.text('code', name); | 848 return new md.Element.text('code', name); |
846 } | 849 } |
847 | 850 |
848 // TODO(rnystrom): Move into SourceSpan? | 851 // TODO(rnystrom): Move into SourceSpan? |
849 int getSpanColumn(SourceSpan span) { | 852 int getSpanColumn(SourceSpan span) { |
850 final line = span.file.getLine(span.start); | 853 final line = span.file.getLine(span.start); |
851 return span.file.getColumn(line, span.start); | 854 return span.file.getColumn(line, span.start); |
852 } | 855 } |
853 } | 856 } |
OLD | NEW |