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

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

Issue 1544213002: Introduce code to generate UnlinkedPublicNamespace directly from an AST. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/tool/summary/build_sdk_summary.dart ('k') | pkg/analyzer/tool/summary/idl.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 42cf94ba7948bd05dbd7e77b6995f601c0e6fe81..44ee7f4d3aa6204bab5dd4a52a035a62f786eeeb 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -247,7 +247,7 @@ class _CodeGenerator {
out('library analyzer.src.summary.format;');
out();
out("import 'dart:convert';");
- out("import 'builder.dart' as builder;");
+ out("import 'base.dart' as base;");
out();
_idl.enums.forEach((String name, idlModel.EnumDeclaration enm) {
out('enum $name {');
@@ -260,7 +260,7 @@ class _CodeGenerator {
out();
});
_idl.classes.forEach((String name, idlModel.ClassDeclaration cls) {
- out('class $name {');
+ out('class $name extends base.SummaryClass {');
indent(() {
cls.fields.forEach((String fieldName, idlModel.FieldType type) {
out('${dartType(type)} _$fieldName;');
@@ -294,6 +294,15 @@ class _CodeGenerator {
}
});
out();
+ out('@override');
+ out('Map<String, Object> toMap() => {');
+ indent(() {
+ cls.fields.forEach((String fieldName, idlModel.FieldType type) {
+ out('${quoted(fieldName)}: $fieldName,');
+ });
+ });
+ out('};');
+ out();
if (cls.isTopLevel) {
out('$name.fromBuffer(List<int> buffer) : this.fromJson(JSON.decode(UTF8.decode(buffer)));');
out();
@@ -313,7 +322,7 @@ class _CodeGenerator {
out();
out('bool _finished = false;');
out();
- out('${name}Builder(builder.BuilderContext context);');
+ out('${name}Builder(base.BuilderContext context);');
cls.fields.forEach((String fieldName, idlModel.FieldType type) {
out();
String conversion = '_value';
@@ -363,7 +372,7 @@ class _CodeGenerator {
});
out('}');
out();
- out('${name}Builder encode$name(builder.BuilderContext builderContext, {${builderParams.join(', ')}}) {');
+ out('${name}Builder encode$name(base.BuilderContext builderContext, {${builderParams.join(', ')}}) {');
indent(() {
out('${name}Builder builder = new ${name}Builder(builderContext);');
cls.fields.forEach((String fieldName, idlModel.FieldType type) {
« no previous file with comments | « pkg/analyzer/tool/summary/build_sdk_summary.dart ('k') | pkg/analyzer/tool/summary/idl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698