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

Side by Side Diff: pkg/analyzer/tool/summary/build_sdk_summaries.dart

Issue 1998833002: Use BufferContext + offset instead of BufferPointer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks Created 4 years, 7 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
OLDNEW
1 import 'dart:io'; 1 import 'dart:io';
2 2
3 import 'package:analyzer/dart/ast/ast.dart'; 3 import 'package:analyzer/dart/ast/ast.dart';
4 import 'package:analyzer/dart/element/element.dart'; 4 import 'package:analyzer/dart/element/element.dart';
5 import 'package:analyzer/src/generated/engine.dart'; 5 import 'package:analyzer/src/generated/engine.dart';
6 import 'package:analyzer/src/generated/java_io.dart'; 6 import 'package:analyzer/src/generated/java_io.dart';
7 import 'package:analyzer/src/generated/sdk.dart'; 7 import 'package:analyzer/src/generated/sdk.dart';
8 import 'package:analyzer/src/generated/sdk_io.dart'; 8 import 'package:analyzer/src/generated/sdk_io.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analyzer/src/summary/flat_buffers.dart' as fb; 10 import 'package:analyzer/src/summary/flat_buffers.dart' as fb;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 _BuilderOutput strong = new _Builder(sdkPath, true).build(); 132 _BuilderOutput strong = new _Builder(sdkPath, true).build();
133 return new _Output(spec, strong); 133 return new _Output(spec, strong);
134 } 134 }
135 135
136 /** 136 /**
137 * Open the flat buffer in [inputPath] and extract the byte array in the [field] 137 * Open the flat buffer in [inputPath] and extract the byte array in the [field]
138 * into the [outputPath] file. 138 * into the [outputPath] file.
139 */ 139 */
140 void _extractSingleOutput(String inputPath, int field, String outputPath) { 140 void _extractSingleOutput(String inputPath, int field, String outputPath) {
141 List<int> bytes = new File(inputPath).readAsBytesSync(); 141 List<int> bytes = new File(inputPath).readAsBytesSync();
142 fb.BufferPointer root = new fb.BufferPointer.fromBytes(bytes); 142 fb.BufferContext root = new fb.BufferContext.fromBytes(bytes);
143 fb.BufferPointer table = root.derefObject(); 143 int tableOffset = root.derefObject(0);
144 List<int> fieldBytes = const fb.Uint8ListReader().vTableGet(table, field); 144 List<int> fieldBytes =
145 const fb.Uint8ListReader().vTableGet(root, tableOffset, field);
145 new File(outputPath).writeAsBytesSync(fieldBytes, mode: FileMode.WRITE_ONLY); 146 new File(outputPath).writeAsBytesSync(fieldBytes, mode: FileMode.WRITE_ONLY);
146 } 147 }
147 148
148 /** 149 /**
149 * Print information about how to use the SDK summaries builder. 150 * Print information about how to use the SDK summaries builder.
150 */ 151 */
151 void _printUsage() { 152 void _printUsage() {
152 // print('Usage: $BINARY_NAME command output_directory_path [sdk_path]'); 153 // print('Usage: $BINARY_NAME command output_directory_path [sdk_path]');
153 print('Usage: $BINARY_NAME command arguments'); 154 print('Usage: $BINARY_NAME command arguments');
154 print('Where command can be one of the following:'); 155 print('Where command can be one of the following:');
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 264 }
264 } 265 }
265 } 266 }
266 267
267 class _Output { 268 class _Output {
268 final _BuilderOutput spec; 269 final _BuilderOutput spec;
269 final _BuilderOutput strong; 270 final _BuilderOutput strong;
270 271
271 _Output(this.spec, this.strong); 272 _Output(this.spec, this.strong);
272 } 273 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/flat_buffers_test.dart ('k') | pkg/analyzer/tool/summary/generate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698