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

Side by Side Diff: pkg/front_end/lib/src/fasta/source/source_loader.dart

Issue 2751093004: [fasta] Flip source flag and include source by default (Closed)
Patch Set: Created 3 years, 9 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/front_end/lib/src/fasta/compiler_command_line.dart ('k') | 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) 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 fasta.source_loader; 5 library fasta.source_loader;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show FileSystemException; 9 import 'dart:io' show FileSystemException;
10 10
(...skipping 28 matching lines...) Expand all
39 import 'diet_listener.dart' show DietListener; 39 import 'diet_listener.dart' show DietListener;
40 40
41 import 'diet_parser.dart' show DietParser; 41 import 'diet_parser.dart' show DietParser;
42 42
43 import 'source_library_builder.dart' show SourceLibraryBuilder; 43 import 'source_library_builder.dart' show SourceLibraryBuilder;
44 44
45 import '../compiler_context.dart' show CompilerContext; 45 import '../compiler_context.dart' show CompilerContext;
46 46
47 class SourceLoader<L> extends Loader<L> { 47 class SourceLoader<L> extends Loader<L> {
48 final Map<Uri, List<int>> sourceBytes = <Uri, List<int>>{}; 48 final Map<Uri, List<int>> sourceBytes = <Uri, List<int>>{};
49 final includeSource = CompilerContext.current.options.includeSource; 49 final excludeSource = CompilerContext.current.options.excludeSource;
50 50
51 // Used when building directly to kernel. 51 // Used when building directly to kernel.
52 ClassHierarchy hierarchy; 52 ClassHierarchy hierarchy;
53 CoreTypes coreTypes; 53 CoreTypes coreTypes;
54 54
55 SourceLoader(TargetImplementation target) : super(target); 55 SourceLoader(TargetImplementation target) : super(target);
56 56
57 Future<Token> tokenize(SourceLibraryBuilder library, 57 Future<Token> tokenize(SourceLibraryBuilder library,
58 {bool suppressLexicalErrors: false}) async { 58 {bool suppressLexicalErrors: false}) async {
59 Uri uri = library.fileUri; 59 Uri uri = library.fileUri;
(...skipping 25 matching lines...) Expand all
85 String message = e.message; 85 String message = e.message;
86 String osMessage = e.osError?.message; 86 String osMessage = e.osError?.message;
87 if (osMessage != null && osMessage.isNotEmpty) { 87 if (osMessage != null && osMessage.isNotEmpty) {
88 message = osMessage; 88 message = osMessage;
89 } 89 }
90 return inputError(uri, -1, message); 90 return inputError(uri, -1, message);
91 } 91 }
92 } 92 }
93 93
94 List<int> getSource(List<int> bytes) { 94 List<int> getSource(List<int> bytes) {
95 if (!includeSource) return const <int>[]; 95 if (excludeSource) return const <int>[];
96 96
97 // bytes is 0-terminated. We don't want that included. 97 // bytes is 0-terminated. We don't want that included.
98 if (bytes is Uint8List) { 98 if (bytes is Uint8List) {
99 return new Uint8List.view( 99 return new Uint8List.view(
100 bytes.buffer, bytes.offsetInBytes, bytes.length - 1); 100 bytes.buffer, bytes.offsetInBytes, bytes.length - 1);
101 } 101 }
102 return bytes.sublist(0, bytes.length - 1); 102 return bytes.sublist(0, bytes.length - 1);
103 } 103 }
104 104
105 Future<Null> buildOutline(SourceLibraryBuilder library) async { 105 Future<Null> buildOutline(SourceLibraryBuilder library) async {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 void computeHierarchy(Program program) { 356 void computeHierarchy(Program program) {
357 hierarchy = new ClassHierarchy(program); 357 hierarchy = new ClassHierarchy(program);
358 ticker.logMs("Computed class hierarchy"); 358 ticker.logMs("Computed class hierarchy");
359 coreTypes = new CoreTypes(program); 359 coreTypes = new CoreTypes(program);
360 ticker.logMs("Computed core types"); 360 ticker.logMs("Computed core types");
361 } 361 }
362 362
363 List<Uri> getDependencies() => sourceBytes.keys.toList(); 363 List<Uri> getDependencies() => sourceBytes.keys.toList();
364 } 364 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/compiler_command_line.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698