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

Unified Diff: pkg/analyzer_plugin/tool/spec/from_html.dart

Issue 2880443006: Generate common types into a separate library (Closed)
Patch Set: add missed files 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
Index: pkg/analyzer_plugin/tool/spec/from_html.dart
diff --git a/pkg/analyzer_plugin/tool/spec/from_html.dart b/pkg/analyzer_plugin/tool/spec/from_html.dart
index d79242755e3d36f740cd03122f8d7c93232deffe..5ce58d4da852404574e885ace6de05e9111da32a 100644
--- a/pkg/analyzer_plugin/tool/spec/from_html.dart
+++ b/pkg/analyzer_plugin/tool/spec/from_html.dart
@@ -572,27 +572,35 @@ class ApiReader {
checkName(html, 'types');
String context = 'types';
checkAttributes(html, [], context);
- Map<String, TypeDefinition> types = <String, TypeDefinition>{};
+ List<String> importUris = <String>[];
+ Map<String, TypeDefinition> typeMap = <String, TypeDefinition>{};
List<dom.Element> childElements = <dom.Element>[];
recurse(html, context, {
'include': (dom.Element child) {
+ String importUri = child.attributes['import'];
+ if (importUri != null) {
+ importUris.add(importUri);
+ }
String relativePath = child.attributes['path'];
String path = normalize(join(dirname(filePath), relativePath));
ApiReader reader = new ApiReader(path);
Api api = reader.readApi();
for (TypeDefinition typeDefinition in api.types) {
+ typeDefinition.isExternal = true;
childElements.add(typeDefinition.html);
- types[typeDefinition.name] = typeDefinition;
+ typeMap[typeDefinition.name] = typeDefinition;
}
},
'type': (dom.Element child) {
TypeDefinition typeDefinition = typeDefinitionFromHtml(child);
- types[typeDefinition.name] = typeDefinition;
+ typeMap[typeDefinition.name] = typeDefinition;
}
});
for (dom.Element element in childElements) {
html.append(element);
}
- return new Types(types, html);
+ Types types = new Types(typeMap, html);
+ types.importUris.addAll(importUris);
+ return types;
}
}
« no previous file with comments | « pkg/analyzer_plugin/tool/spec/codegen_protocol_common.dart ('k') | pkg/analyzer_plugin/tool/spec/generate_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698