| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 computer.outline; | 5 library computer.outline; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/collections.dart'; | 7 import 'package:analysis_server/src/collections.dart'; |
| 8 import 'package:analysis_server/src/protocol.dart'; | 8 import 'package:analysis_server/src/protocol.dart'; |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart' as engine; | 10 import 'package:analyzer/src/generated/element.dart' as engine; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
| 12 | 12 |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * A computer for [CompilationUnit] outline. | 15 * A computer for [CompilationUnit] outline. |
| 16 */ | 16 */ |
| 17 class DartUnitOutlineComputer { | 17 class DartUnitOutlineComputer { |
| 18 final String file; | 18 final String file; |
| 19 final CompilationUnit unit; | 19 final CompilationUnit unit; |
| 20 final LineInfo lineInfo; | 20 final LineInfo lineInfo; |
| 21 | 21 |
| 22 DartUnitOutlineComputer(Source source, this.lineInfo, this.unit) | 22 DartUnitOutlineComputer(this.file, this.lineInfo, this.unit); |
| 23 : file = source.fullName; | |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * Returns the computed outline, not `null`. | 25 * Returns the computed outline, not `null`. |
| 27 */ | 26 */ |
| 28 Outline compute() { | 27 Outline compute() { |
| 29 List<Outline> unitContents = <Outline>[]; | 28 List<Outline> unitContents = <Outline>[]; |
| 30 for (CompilationUnitMember unitMember in unit.declarations) { | 29 for (CompilationUnitMember unitMember in unit.declarations) { |
| 31 if (unitMember is ClassDeclaration) { | 30 if (unitMember is ClassDeclaration) { |
| 32 ClassDeclaration classDeclaration = unitMember; | 31 ClassDeclaration classDeclaration = unitMember; |
| 33 List<Outline> classContents = <Outline>[]; | 32 List<Outline> classContents = <Outline>[]; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 380 |
| 382 | 381 |
| 383 /** | 382 /** |
| 384 * A range of characters. | 383 * A range of characters. |
| 385 */ | 384 */ |
| 386 class _SourceRegion { | 385 class _SourceRegion { |
| 387 final int length; | 386 final int length; |
| 388 final int offset; | 387 final int offset; |
| 389 _SourceRegion(this.offset, this.length); | 388 _SourceRegion(this.offset, this.length); |
| 390 } | 389 } |
| OLD | NEW |