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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.summary.flat_buffers; 5 library analyzer.src.summary.flat_buffers;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:math'; 9 import 'dart:math';
10 import 'dart:typed_data'; 10 import 'dart:typed_data';
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Set the VTable offset. 239 // Set the VTable offset.
240 _setInt32AtTail(_buf, tableTail, vTableTail - tableTail); 240 _setInt32AtTail(_buf, tableTail, vTableTail - tableTail);
241 // Done with this table. 241 // Done with this table.
242 _currentVTable = null; 242 _currentVTable = null;
243 return new Offset(tableTail); 243 return new Offset(tableTail);
244 } 244 }
245 245
246 /** 246 /**
247 * Finish off the creation of the buffer. The given [offset] is used as the 247 * Finish off the creation of the buffer. The given [offset] is used as the
248 * root object offset, and usually references directly or indirectly every 248 * root object offset, and usually references directly or indirectly every
249 * written object. 249 * written object. If [fileIdentifier] is specified (and not `null`), it is
250 * interpreted as a 4-byte Latin-1 encoded string that should be placed at
251 * bytes 4-7 of the file.
250 */ 252 */
251 Uint8List finish(Offset offset) { 253 Uint8List finish(Offset offset, [String fileIdentifier]) {
252 _prepare(max(4, _maxAlign), 1); 254 _prepare(max(4, _maxAlign), fileIdentifier == null ? 1 : 2);
253 int alignedTail = _tail + ((-_tail) % _maxAlign); 255 int alignedTail = _tail + ((-_tail) % _maxAlign);
254 _setUint32AtTail(_buf, alignedTail, alignedTail - offset._tail); 256 _setUint32AtTail(_buf, alignedTail, alignedTail - offset._tail);
257 if (fileIdentifier != null) {
258 for (int i = 0; i < 4; i++) {
259 _setUint8AtTail(
260 _buf, alignedTail - 4 - i, fileIdentifier.codeUnitAt(i));
261 }
262 }
255 return _buf.buffer.asUint8List(_buf.lengthInBytes - alignedTail); 263 return _buf.buffer.asUint8List(_buf.lengthInBytes - alignedTail);
256 } 264 }
257 265
258 /** 266 /**
259 * This is a low-level method, it should not be invoked by clients. 267 * This is a low-level method, it should not be invoked by clients.
260 */ 268 */
261 Uint8List lowFinish() { 269 Uint8List lowFinish() {
262 int alignedTail = _tail + ((-_tail) % _maxAlign); 270 int alignedTail = _tail + ((-_tail) % _maxAlign);
263 return _buf.buffer.asUint8List(_buf.lengthInBytes - alignedTail); 271 return _buf.buffer.asUint8List(_buf.lengthInBytes - alignedTail);
264 } 272 }
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // Table size. 840 // Table size.
833 buf.setUint16(bufOffset, tableSize, Endianness.LITTLE_ENDIAN); 841 buf.setUint16(bufOffset, tableSize, Endianness.LITTLE_ENDIAN);
834 bufOffset += 2; 842 bufOffset += 2;
835 // Field offsets. 843 // Field offsets.
836 for (int fieldOffset in fieldOffsets) { 844 for (int fieldOffset in fieldOffsets) {
837 buf.setUint16(bufOffset, fieldOffset, Endianness.LITTLE_ENDIAN); 845 buf.setUint16(bufOffset, fieldOffset, Endianness.LITTLE_ENDIAN);
838 bufOffset += 2; 846 bufOffset += 2;
839 } 847 }
840 } 848 }
841 } 849 }
OLDNEW
« 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