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

Unified Diff: pkg/analyzer/tool/summary/generate.dart

Issue 1828973002: Add the --build-summary-exclude-informative flag. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/tool/summary/idl_model.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/tool/summary/generate.dart
diff --git a/pkg/analyzer/tool/summary/generate.dart b/pkg/analyzer/tool/summary/generate.dart
index cfa14a0093c60b319c1461bb96e8448107c6abcd..51dad39cfa4c33cff46d39245972d273c1a9d710 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -283,6 +283,7 @@ class _CodeGenerator {
}
int id;
bool isDeprecated = false;
+ bool isInformative = false;
for (Annotation annotation in classMember.metadata) {
if (annotation.name.name == 'Id') {
if (id != null) {
@@ -305,6 +306,8 @@ class _CodeGenerator {
throw new Exception('@deprecated does not take args ($desc)');
}
isDeprecated = true;
+ } else if (annotation.name.name == 'informative') {
+ isInformative = true;
}
}
if (id == null) {
@@ -314,7 +317,12 @@ class _CodeGenerator {
idlModel.FieldType fieldType =
new idlModel.FieldType(type.name.name, isList);
cls.allFields.add(new idlModel.FieldDeclaration(
- doc, classMember.name.name, fieldType, id, isDeprecated));
+ doc,
+ classMember.name.name,
+ fieldType,
+ id,
+ isDeprecated,
+ isInformative));
} else if (classMember is ConstructorDeclaration &&
classMember.name.name == 'fromBuffer') {
// Ignore `fromBuffer` declarations; they simply forward to the
@@ -589,6 +597,30 @@ class _CodeGenerator {
String suffix = i == fields.length - 1 ? ';' : ',';
out('${prefix}_${field.name} = ${field.name}$suffix');
}
+ // Generate flushInformative().
+ {
+ out();
+ out('/**');
+ out(' * Flush [informative] data recursively.');
+ out(' */');
+ out('void flushInformative() {');
+ indent(() {
+ for (idlModel.FieldDeclaration field in cls.fields) {
+ idlModel.FieldType fieldType = field.type;
+ String valueName = '_' + field.name;
+ if (field.isInformative) {
+ out('$valueName = null;');
+ } else if (_idl.classes.containsKey(fieldType.typeName)) {
+ if (fieldType.isList) {
+ out('$valueName?.forEach((b) => b.flushInformative());');
+ } else {
+ out('$valueName?.flushInformative();');
+ }
+ }
+ }
+ });
+ out('}');
+ }
// Generate finish.
if (cls.isTopLevel) {
out();
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/tool/summary/idl_model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698