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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2893803003: Add metadata annotations to library definitions. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/binary.md ('k') | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 01daa37834255a4d48acc57ce16705ceae4bba48..bcfae72741e3639c107f73b1187437b65eb1abcd 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -264,6 +264,7 @@ class Library extends NamedNode implements Comparable<Library> {
bool isExternal;
String name;
+ final List<Expression> annotations;
final List<LibraryDependency> dependencies;
final List<Typedef> typedefs;
final List<Class> classes;
@@ -273,6 +274,7 @@ class Library extends NamedNode implements Comparable<Library> {
Library(this.importUri,
{this.name,
this.isExternal: false,
+ List<Expression> annotations,
List<LibraryDependency> dependencies,
List<Typedef> typedefs,
List<Class> classes,
@@ -280,7 +282,8 @@ class Library extends NamedNode implements Comparable<Library> {
List<Field> fields,
this.fileUri,
Reference reference})
- : this.dependencies = dependencies ?? <LibraryDependency>[],
+ : this.annotations = annotations ?? <Expression>[],
+ this.dependencies = dependencies ?? <LibraryDependency>[],
this.typedefs = typedefs ?? <Typedef>[],
this.classes = classes ?? <Class>[],
this.procedures = procedures ?? <Procedure>[],
@@ -321,6 +324,11 @@ class Library extends NamedNode implements Comparable<Library> {
typedefs.add(typedef_);
}
+ void addAnnotation(Expression node) {
+ node.parent = this;
+ annotations.add(node);
+ }
+
void computeCanonicalNames() {
assert(canonicalName != null);
for (var typedef_ in typedefs) {
« no previous file with comments | « pkg/kernel/binary.md ('k') | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698