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

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

Issue 1570383002: Use addBool() and BoolReader in summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/format.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 f8301578ea4b08b75432a69f88b43b85667eb65f..25be01743850acb39e0c1d5d3eefff507a413988 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -401,9 +401,8 @@ class _CodeGenerator {
condition = '$offsetName != null';
writeCode = 'fbBuilder.addOffset($index, $offsetName);';
} else if (fieldType.typeName == 'bool') {
- // TODO(scheglov) implement booleans merging?
condition = '$valueName == true';
- writeCode = 'fbBuilder.addInt8($index, 1);';
+ writeCode = 'fbBuilder.addBool($index, true);';
} else if (fieldType.typeName == 'int') {
condition += ' && $valueName != ${defaultValue(fieldType)}';
writeCode = 'fbBuilder.addInt32($index, $valueName);';
@@ -499,7 +498,6 @@ class _CodeGenerator {
List<String> readLines;
String readCode;
String def = defaultValue(type);
- String readSuffix = '';
if (type.isList) {
if (typeName == 'int') {
String itemCode = 'const fb.Int32Reader()';
@@ -512,10 +510,7 @@ class _CodeGenerator {
readCode = 'const fb.ListReader<$itemCode)';
}
} else if (typeName == 'bool') {
- // TODO(scheglov) implement booleans merging?
- def = '0';
- readCode = 'const fb.Int8Reader()';
- readSuffix = ' == 1';
+ readCode = 'const fb.BoolReader()';
} else if (typeName == 'int') {
readCode = 'const fb.Int32Reader()';
} else if (typeName == 'String') {
@@ -540,7 +535,7 @@ class _CodeGenerator {
});
out('}');
} else {
- String expr = '$readCode.vTableGet(_bp, $index, $def)$readSuffix';
+ String expr = '$readCode.vTableGet(_bp, $index, $def)';
out('$returnType get $fieldName => $expr;');
}
});
« no previous file with comments | « pkg/analyzer/lib/src/summary/format.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698