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

Unified Diff: lib/protobuf.dart

Issue 814213003: Allow constants as field initial values as well as creation thunks (Closed) Base URL: https://github.com/dart-lang/dart-protobuf@master
Patch Set: Created 6 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 | « no previous file | lib/src/protobuf/builder_info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/protobuf.dart
diff --git a/lib/protobuf.dart b/lib/protobuf.dart
index f1e55cd21534cb6604e5d7a8a2d2a4e76460a555..d74c9c8b813b52e8f66dd75c7d847f5c3363906c 100644
--- a/lib/protobuf.dart
+++ b/lib/protobuf.dart
@@ -26,6 +26,15 @@ part 'src/protobuf/unknown_field_set.dart';
part 'src/protobuf/utils.dart';
part 'src/protobuf/wire_format.dart';
+// TODO(sra): Remove this method when clients upgrade to protoc 0.3.5
Int64 makeLongInt(int n) => new Int64(n);
+// TODO(sra): Use Int64.parse() when available - see http://dartbug.com/21915.
+Int64 parseLongInt(String text) {
+ if (text.startsWith('0x')) return Int64.parseHex(text.substring(2));
+ if (text.startsWith('+0x')) return Int64.parseHex(text.substring(3));
+ if (text.startsWith('-0x')) return -Int64.parseHex(text.substring(3));
+ return Int64.parseInt(text);
+}
+
const _UTF8 = const Utf8Codec(allowMalformed: true);
« no previous file with comments | « no previous file | lib/src/protobuf/builder_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698