OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:front_end/src/base/source.dart'; | 5 import 'package:front_end/src/base/source.dart'; |
6 | 6 |
7 /** | 7 /** |
8 * Information about a single top-level declaration. | 8 * Information about a single top-level declaration. |
9 */ | 9 */ |
10 class TopLevelDeclaration { | 10 class TopLevelDeclaration { |
11 final TopLevelDeclarationKind kind; | 11 final TopLevelDeclarationKind kind; |
12 final String name; | 12 final String name; |
13 | 13 |
14 TopLevelDeclaration(this.kind, this.name); | 14 TopLevelDeclaration(this.kind, this.name); |
| 15 |
| 16 @override |
| 17 String toString() => '($kind, $name)'; |
| 18 } |
| 19 |
| 20 /** |
| 21 * A declaration in a source. |
| 22 */ |
| 23 class TopLevelDeclarationInSource { |
| 24 /** |
| 25 * The declaring source. |
| 26 */ |
| 27 final Source source; |
| 28 |
| 29 /** |
| 30 * The declaration. |
| 31 */ |
| 32 final TopLevelDeclaration declaration; |
| 33 |
| 34 TopLevelDeclarationInSource(this.source, this.declaration); |
| 35 |
| 36 @override |
| 37 String toString() => '($source, $declaration)'; |
15 } | 38 } |
16 | 39 |
17 /** | 40 /** |
18 * Kind of a top-level declaration. | 41 * Kind of a top-level declaration. |
19 * | 42 * |
20 * We don't need it to be precise, just enough to support quick fixes. | 43 * We don't need it to be precise, just enough to support quick fixes. |
21 */ | 44 */ |
22 enum TopLevelDeclarationKind { type, function, variable } | 45 enum TopLevelDeclarationKind { type, function, variable } |
23 | |
24 /** | |
25 * Top-level declarations in the export namespace of a library. | |
26 */ | |
27 class TopLevelLibraryDeclarations { | |
28 /** | |
29 * The source of the library. | |
30 */ | |
31 final Source source; | |
32 | |
33 /** | |
34 * Top-level declarations in the export namespace of the library. | |
35 */ | |
36 final List<TopLevelDeclaration> declarations = []; | |
37 | |
38 TopLevelLibraryDeclarations(this.source); | |
39 } | |
OLD | NEW |