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

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

Issue 1690183003: Store enums in summary file as bytes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/test/src/summary/flat_buffers_test.dart ('k') | no next file » | 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 2c851586646cbc456e2b3c3a75f11bd0254f0a55..2d584e77ac654dc095864601438ef92ea010d3cf 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -463,7 +463,7 @@ class _CodeGenerator {
} else if (_idl.enums.containsKey(fieldType.typeName)) {
String itemCode = 'b.index';
String listCode = '$valueName.map((b) => $itemCode).toList()';
- writeCode = '$offsetName = fbBuilder.writeListUint32($listCode);';
+ writeCode = '$offsetName = fbBuilder.writeListUint8($listCode);';
} else if (fieldType.typeName == 'int') {
writeCode =
'$offsetName = fbBuilder.writeListUint32($valueName);';
@@ -515,7 +515,7 @@ class _CodeGenerator {
writeCode = 'fbBuilder.addUint32($index, $valueName);';
} else if (_idl.enums.containsKey(fieldType.typeName)) {
condition += ' && $valueName != ${defaultValue(fieldType, true)}';
- writeCode = 'fbBuilder.addUint32($index, $valueName.index);';
+ writeCode = 'fbBuilder.addUint8($index, $valueName.index);';
}
if (writeCode == null) {
throw new UnimplementedError('Writing type ${fieldType.typeName}');
@@ -541,12 +541,12 @@ class _CodeGenerator {
out('const $readerName() : super();');
out();
out('@override');
- out('int get size => 4;');
+ out('int get size => 1;');
out();
out('@override');
out('${idlPrefix(name)} read(fb.BufferPointer bp) {');
indent(() {
- out('int index = const fb.Uint32Reader().read(bp);');
+ out('int index = const fb.Uint8Reader().read(bp);');
out('return ${idlPrefix(name)}.values[index];');
});
out('}');
« no previous file with comments | « pkg/analyzer/test/src/summary/flat_buffers_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698