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

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

Issue 1615453002: Use Uint32 for `int` in IDL. (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') | 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 5e41b4ad711884f6d8678571c0147c4e052dd529..b813bb0af3528a9eb250bcd164fc429b742037a9 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -388,9 +388,9 @@ class _CodeGenerator {
} else if (_idl.enums.containsKey(fieldType.typeName)) {
String itemCode = 'b.index';
String listCode = '$valueName.map((b) => $itemCode).toList()';
- writeCode = '$offsetName = fbBuilder.writeListInt32($listCode);';
+ writeCode = '$offsetName = fbBuilder.writeListUint32($listCode);';
} else if (fieldType.typeName == 'int') {
- writeCode = '$offsetName = fbBuilder.writeListInt32($valueName);';
+ writeCode = '$offsetName = fbBuilder.writeListUint32($valueName);';
} else if (fieldType.typeName == 'double') {
writeCode = '$offsetName = fbBuilder.writeListFloat64($valueName);';
} else {
@@ -434,10 +434,10 @@ class _CodeGenerator {
writeCode = 'fbBuilder.addBool($index, true);';
} else if (fieldType.typeName == 'int') {
condition += ' && $valueName != ${defaultValue(fieldType)}';
- writeCode = 'fbBuilder.addInt32($index, $valueName);';
+ writeCode = 'fbBuilder.addUint32($index, $valueName);';
} else if (_idl.enums.containsKey(fieldType.typeName)) {
condition += ' && $valueName != ${defaultValue(fieldType)}';
- writeCode = 'fbBuilder.addInt32($index, $valueName.index);';
+ writeCode = 'fbBuilder.addUint32($index, $valueName.index);';
}
if (writeCode == null) {
throw new UnimplementedError('Writing type ${fieldType.typeName}');
@@ -480,7 +480,7 @@ class _CodeGenerator {
out('@override');
out('$name read(fb.BufferPointer bp) {');
indent(() {
- out('int index = const fb.Int32Reader().read(bp);');
+ out('int index = const fb.Uint32Reader().read(bp);');
out('return $name.values[index];');
});
out('}');
@@ -514,7 +514,7 @@ class _CodeGenerator {
String def = defaultValue(type);
if (type.isList) {
if (typeName == 'int') {
- String itemCode = 'const fb.Int32Reader()';
+ String itemCode = 'const fb.Uint32Reader()';
readCode = 'const fb.ListReader<int>($itemCode)';
} else if (typeName == 'double') {
readCode = 'const fb.Float64ListReader()';
@@ -532,7 +532,7 @@ class _CodeGenerator {
} else if (typeName == 'bool') {
readCode = 'const fb.BoolReader()';
} else if (typeName == 'int') {
- readCode = 'const fb.Int32Reader()';
+ readCode = 'const fb.Uint32Reader()';
} else if (typeName == 'String') {
readCode = 'const fb.StringReader()';
} else if (_idl.enums.containsKey(typeName)) {
« no previous file with comments | « pkg/analyzer/lib/src/summary/format.dart ('k') | pkg/analyzer/tool/summary/idl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698