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

Unified Diff: pkg/compiler/lib/src/source_file_provider.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/compiler/lib/src/serialization/values.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/source_file_provider.dart
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index 2269a9edfc8655db77a73cbaeefe6926e27d2024..e5b3a0313dfdeca6ac40901e4d5dcaa23929fe48 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -56,50 +56,46 @@ abstract class SourceFileProvider implements CompilerInput {
source = readAll(resourceUri.toFilePath());
} on FileSystemException catch (ex) {
OSError ose = ex.osError;
- String detail = (ose != null && ose.message != null)
- ? ' (${ose.message})'
- : '';
+ String detail =
+ (ose != null && ose.message != null) ? ' (${ose.message})' : '';
return new Future.error(
"Error reading '${relativize(cwd, resourceUri, isWindows)}'"
"$detail");
}
dartCharactersRead += source.length;
- sourceFiles[resourceUri] =
- new CachingUtf8BytesSourceFile(
- resourceUri, relativizeUri(resourceUri), source);
+ sourceFiles[resourceUri] = new CachingUtf8BytesSourceFile(
+ resourceUri, relativizeUri(resourceUri), source);
return new Future.value(source);
}
Future<List<int>> _readFromHttp(Uri resourceUri) {
assert(resourceUri.scheme == 'http');
HttpClient client = new HttpClient();
- return client.getUrl(resourceUri)
+ return client
+ .getUrl(resourceUri)
.then((HttpClientRequest request) => request.close())
.then((HttpClientResponse response) {
- if (response.statusCode != HttpStatus.OK) {
- String msg = 'Failure getting $resourceUri: '
- '${response.statusCode} ${response.reasonPhrase}';
- throw msg;
- }
- return response.toList();
- })
- .then((List<List<int>> splitContent) {
- int totalLength = splitContent.fold(0, (int old, List list) {
- return old + list.length;
- });
- Uint8List result = new Uint8List(totalLength);
- int offset = 0;
- for (List<int> contentPart in splitContent) {
- result.setRange(
- offset, offset + contentPart.length, contentPart);
- offset += contentPart.length;
- }
- dartCharactersRead += totalLength;
- sourceFiles[resourceUri] =
- new CachingUtf8BytesSourceFile(
- resourceUri, resourceUri.toString(), result);
- return result;
- });
+ if (response.statusCode != HttpStatus.OK) {
+ String msg = 'Failure getting $resourceUri: '
+ '${response.statusCode} ${response.reasonPhrase}';
+ throw msg;
+ }
+ return response.toList();
+ }).then((List<List<int>> splitContent) {
+ int totalLength = splitContent.fold(0, (int old, List list) {
+ return old + list.length;
+ });
+ Uint8List result = new Uint8List(totalLength);
+ int offset = 0;
+ for (List<int> contentPart in splitContent) {
+ result.setRange(offset, offset + contentPart.length, contentPart);
+ offset += contentPart.length;
+ }
+ dartCharactersRead += totalLength;
+ sourceFiles[resourceUri] = new CachingUtf8BytesSourceFile(
+ resourceUri, resourceUri.toString(), result);
+ return result;
+ });
}
// TODO(johnniwinther): Remove this when no longer needed for the old compiler
@@ -140,7 +136,7 @@ class FormattingDiagnosticHandler implements CompilerDiagnostics {
FormattingDiagnosticHandler([SourceFileProvider provider])
: this.provider =
- (provider == null) ? new CompilerSourceFileProvider() : provider;
+ (provider == null) ? new CompilerSourceFileProvider() : provider;
void info(var message, [api.Diagnostic kind = api.Diagnostic.VERBOSE_INFO]) {
if (!verbose && kind == api.Diagnostic.VERBOSE_INFO) return;
@@ -171,7 +167,7 @@ class FormattingDiagnosticHandler implements CompilerDiagnostics {
@override
void report(var code, Uri uri, int begin, int end, String message,
- api.Diagnostic kind) {
+ api.Diagnostic kind) {
// TODO(ahe): Remove this when source map is handled differently.
if (identical(kind.name, 'source map')) return;
@@ -219,12 +215,12 @@ class FormattingDiagnosticHandler implements CompilerDiagnostics {
} else {
SourceFile file = provider.sourceFiles[uri];
if (file != null) {
- print(file.getLocationMessage(
- color(message), begin, end, colorize: color));
+ print(file.getLocationMessage(color(message), begin, end,
+ colorize: color));
} else {
String position = end - begin > 0 ? '@$begin+${end - begin}' : '';
print('${provider.relativizeUri(uri)}$position:\n'
- '${color(message)}');
+ '${color(message)}');
}
}
if (fatal && ++fatalCount >= throwOnErrorCount && throwOnError) {
@@ -251,10 +247,8 @@ class RandomAccessFileOutputProvider {
int totalCharactersWritten = 0;
List<String> allOutputFiles = new List<String>();
- RandomAccessFileOutputProvider(this.out,
- this.sourceMapOut,
- {this.onInfo,
- this.onFailure});
+ RandomAccessFileOutputProvider(this.out, this.sourceMapOut,
+ {this.onInfo, this.onFailure});
static Uri computePrecompiledUri(Uri out) {
String extension = 'precompiled.js';
@@ -281,7 +275,7 @@ class RandomAccessFileOutputProvider {
} else if (extension == 'precompiled.js') {
uri = computePrecompiledUri(out);
onInfo("File ($uri) is compatible with header"
- " \"Content-Security-Policy: script-src 'self'\"");
+ " \"Content-Security-Policy: script-src 'self'\"");
} else if (extension == 'js.map' || extension == 'dart.map') {
uri = sourceMapOut;
} else if (extension == "info.json") {
@@ -301,7 +295,7 @@ class RandomAccessFileOutputProvider {
RandomAccessFile output;
try {
output = new File(uri.toFilePath()).openSync(mode: FileMode.WRITE);
- } on FileSystemException catch(e) {
+ } on FileSystemException catch (e) {
onFailure('$e');
}
@@ -311,7 +305,7 @@ class RandomAccessFileOutputProvider {
writeStringSync(String data) {
// Write the data in chunks of 8kb, otherwise we risk running OOM.
- int chunkSize = 8*1024;
+ int chunkSize = 8 * 1024;
int offset = 0;
while (offset < data.length) {
« no previous file with comments | « pkg/compiler/lib/src/serialization/values.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698