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

Side by Side Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 1290643007: dart2js: remove trailing 0 byte when reading .packages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 leg_apiimpl; 5 library leg_apiimpl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:package_config/packages.dart'; 10 import 'package:package_config/packages.dart';
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 Future setupPackages(Uri uri) { 385 Future setupPackages(Uri uri) {
386 if (packageRoot != null) { 386 if (packageRoot != null) {
387 // Use "non-file" packages because the file version requires a [Directory] 387 // Use "non-file" packages because the file version requires a [Directory]
388 // and we can't depend on 'dart:io' classes. 388 // and we can't depend on 'dart:io' classes.
389 packages = new NonFilePackagesDirectoryPackages(packageRoot); 389 packages = new NonFilePackagesDirectoryPackages(packageRoot);
390 } else if (packageConfig != null) { 390 } else if (packageConfig != null) {
391 return callUserProvider(packageConfig).then((packageConfigContents) { 391 return callUserProvider(packageConfig).then((packageConfigContents) {
392 if (packageConfigContents is String) { 392 if (packageConfigContents is String) {
393 packageConfigContents = UTF8.encode(packageConfigContents); 393 packageConfigContents = UTF8.encode(packageConfigContents);
394 } 394 }
395 // The input provider may put a trailing 0 byte when it reads a source
Siggi Cherem (dart-lang) 2015/08/13 00:52:19 I'm surprised that we get a null terminated string
Harry Terkelsen 2015/08/13 17:02:41 I asked Johnni about it this morning. It apparentl
396 // file, which confuses the package config parser.
397 if (packageConfigContents.length > 0
398 && packageConfigContents.last == 0) {
399 packageConfigContents = packageConfigContents.removeLast();
400 }
395 packages = 401 packages =
396 new MapPackages(pkgs.parse(packageConfigContents, packageConfig)); 402 new MapPackages(pkgs.parse(packageConfigContents, packageConfig));
397 }); 403 });
398 } else { 404 } else {
399 if (packagesDiscoveryProvider == null) { 405 if (packagesDiscoveryProvider == null) {
400 packages = Packages.noPackages; 406 packages = Packages.noPackages;
401 } else { 407 } else {
402 return callUserPackagesDiscovery(uri).then((p) { 408 return callUserPackagesDiscovery(uri).then((p) {
403 packages = p; 409 packages = p;
404 }); 410 });
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 print('$message: ${tryToString(exception)}'); 497 print('$message: ${tryToString(exception)}');
492 print(tryToString(stackTrace)); 498 print(tryToString(stackTrace));
493 } 499 }
494 500
495 fromEnvironment(String name) => environment[name]; 501 fromEnvironment(String name) => environment[name];
496 502
497 LibraryInfo lookupLibraryInfo(String libraryName) { 503 LibraryInfo lookupLibraryInfo(String libraryName) {
498 return library_info.LIBRARIES[libraryName]; 504 return library_info.LIBRARIES[libraryName];
499 } 505 }
500 } 506 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698