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

Unified Diff: pkg/analyzer/lib/src/summary/flat_buffers.dart

Issue 1738833004: Add file identifiers to summaries. (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/lib/src/summary/base.dart ('k') | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/flat_buffers.dart
diff --git a/pkg/analyzer/lib/src/summary/flat_buffers.dart b/pkg/analyzer/lib/src/summary/flat_buffers.dart
index c7a4f441b9b10a750392b0b8f81defeca5c6e848..65a786a650a19879153a7cf6175cb0b0b50af0d5 100644
--- a/pkg/analyzer/lib/src/summary/flat_buffers.dart
+++ b/pkg/analyzer/lib/src/summary/flat_buffers.dart
@@ -246,12 +246,20 @@ class Builder {
/**
* Finish off the creation of the buffer. The given [offset] is used as the
* root object offset, and usually references directly or indirectly every
- * written object.
+ * written object. If [fileIdentifier] is specified (and not `null`), it is
+ * interpreted as a 4-byte Latin-1 encoded string that should be placed at
+ * bytes 4-7 of the file.
*/
- Uint8List finish(Offset offset) {
- _prepare(max(4, _maxAlign), 1);
+ Uint8List finish(Offset offset, [String fileIdentifier]) {
+ _prepare(max(4, _maxAlign), fileIdentifier == null ? 1 : 2);
int alignedTail = _tail + ((-_tail) % _maxAlign);
_setUint32AtTail(_buf, alignedTail, alignedTail - offset._tail);
+ if (fileIdentifier != null) {
+ for (int i = 0; i < 4; i++) {
+ _setUint8AtTail(
+ _buf, alignedTail - 4 - i, fileIdentifier.codeUnitAt(i));
+ }
+ }
return _buf.buffer.asUint8List(_buf.lengthInBytes - alignedTail);
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/base.dart ('k') | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698