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

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

Issue 1581943003: Make reporter customizable (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: No changes, hopefully Created 4 years, 11 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 | pkg/compiler/lib/src/compiler.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) 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 24 matching lines...) Expand all
35 35
36 const bool forceIncrementalSupport = 36 const bool forceIncrementalSupport =
37 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); 37 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT');
38 38
39 /// Locations of the platform descriptor files relative to the library root. 39 /// Locations of the platform descriptor files relative to the library root.
40 const String _clientPlatform = "lib/dart_client.platform"; 40 const String _clientPlatform = "lib/dart_client.platform";
41 const String _serverPlatform = "lib/dart_server.platform"; 41 const String _serverPlatform = "lib/dart_server.platform";
42 const String _sharedPlatform = "lib/dart_shared.platform"; 42 const String _sharedPlatform = "lib/dart_shared.platform";
43 const String _dart2dartPlatform = "lib/dart2dart.platform"; 43 const String _dart2dartPlatform = "lib/dart2dart.platform";
44 44
45 typedef DiagnosticOptions MakeDiagnosticOptionsFunction(
46 {bool suppressWarnings,
47 bool fatalWarnings,
48 bool suppressHints,
49 bool terseDiagnostics,
50 bool showPackageWarnings});
51
52 DiagnosticOptions makeDiagnosticOptions(
53 {bool suppressWarnings: false,
54 bool fatalWarnings: false,
55 bool suppressHints: false,
56 bool terseDiagnostics: false,
57 bool showPackageWarnings: false}) {
58 return new DiagnosticOptions(
59 suppressWarnings: suppressWarnings,
60 fatalWarnings: fatalWarnings,
61 suppressHints: suppressHints,
62 terseDiagnostics: terseDiagnostics,
63 showPackageWarnings: showPackageWarnings);
64 }
65
45 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the 66 /// Implements the [Compiler] using a [api.CompilerInput] for supplying the
46 /// sources. 67 /// sources.
47 class CompilerImpl extends Compiler { 68 class CompilerImpl extends Compiler {
48 api.CompilerInput provider; 69 api.CompilerInput provider;
49 api.CompilerDiagnostics handler; 70 api.CompilerDiagnostics handler;
50 final Uri platformConfigUri; 71 final Uri platformConfigUri;
51 final Uri packageConfig; 72 final Uri packageConfig;
52 final Uri packageRoot; 73 final Uri packageRoot;
53 final api.PackagesDiscoveryProvider packagesDiscoveryProvider; 74 final api.PackagesDiscoveryProvider packagesDiscoveryProvider;
54 Packages packages; 75 Packages packages;
55 List<String> options; 76 List<String> options;
56 Map<String, dynamic> environment; 77 Map<String, dynamic> environment;
57 bool mockableLibraryUsed = false; 78 bool mockableLibraryUsed = false;
58 79
59 /// A mapping of the dart: library-names to their location. 80 /// A mapping of the dart: library-names to their location.
60 /// 81 ///
61 /// Initialized in [setupSdk]. 82 /// Initialized in [setupSdk].
62 Map<String, Uri> sdkLibraries; 83 Map<String, Uri> sdkLibraries;
63 84
64 GenericTask userHandlerTask; 85 GenericTask userHandlerTask;
65 GenericTask userProviderTask; 86 GenericTask userProviderTask;
66 GenericTask userPackagesDiscoveryTask; 87 GenericTask userPackagesDiscoveryTask;
67 88
68 Uri get libraryRoot => platformConfigUri.resolve("."); 89 Uri get libraryRoot => platformConfigUri.resolve(".");
69 90
70 CompilerImpl(this.provider, 91 CompilerImpl(
71 api.CompilerOutput outputProvider, 92 this.provider,
72 this.handler, 93 api.CompilerOutput outputProvider,
73 Uri libraryRoot, 94 this.handler,
74 this.packageRoot, 95 Uri libraryRoot,
75 List<String> options, 96 this.packageRoot,
76 this.environment, 97 List<String> options,
77 [this.packageConfig, 98 this.environment,
78 this.packagesDiscoveryProvider, 99 [this.packageConfig,
79 Backend makeBackend(Compiler compiler)]) 100 this.packagesDiscoveryProvider,
101 MakeBackendFuncion makeBackend,
Johnni Winther 2016/01/21 08:52:58 MakeBackendFuncion -> MakeBackendFuncion
ahe 2016/01/22 11:04:49 What would be the point of that :-P
ahe 2016/01/22 11:58:22 Fixed in CL 1617183003.
102 MakeReporterFunction makeReporter,
103 MakeDiagnosticOptionsFunction makeDiagnosticOptionsFunction =
104 makeDiagnosticOptions])
80 : this.options = options, 105 : this.options = options,
81 this.platformConfigUri = resolvePlatformConfig(libraryRoot, options), 106 this.platformConfigUri = resolvePlatformConfig(libraryRoot, options),
82 super( 107 super(
83 outputProvider: outputProvider, 108 outputProvider: outputProvider,
84 enableTypeAssertions: hasOption(options, Flags.enableCheckedMode), 109 enableTypeAssertions: hasOption(options, Flags.enableCheckedMode),
85 enableUserAssertions: hasOption(options, Flags.enableCheckedMode), 110 enableUserAssertions: hasOption(options, Flags.enableCheckedMode),
86 trustTypeAnnotations: 111 trustTypeAnnotations:
87 hasOption(options, Flags.trustTypeAnnotations), 112 hasOption(options, Flags.trustTypeAnnotations),
88 trustPrimitives: 113 trustPrimitives:
89 hasOption(options, Flags.trustPrimitives), 114 hasOption(options, Flags.trustPrimitives),
(...skipping 24 matching lines...) Expand all
114 dumpInfo: hasOption(options, Flags.dumpInfo), 139 dumpInfo: hasOption(options, Flags.dumpInfo),
115 buildId: extractStringOption( 140 buildId: extractStringOption(
116 options, '--build-id=', 141 options, '--build-id=',
117 "build number could not be determined"), 142 "build number could not be determined"),
118 useContentSecurityPolicy: 143 useContentSecurityPolicy:
119 hasOption(options, Flags.useContentSecurityPolicy), 144 hasOption(options, Flags.useContentSecurityPolicy),
120 useStartupEmitter: hasOption(options, Flags.fastStartup), 145 useStartupEmitter: hasOption(options, Flags.fastStartup),
121 hasIncrementalSupport: 146 hasIncrementalSupport:
122 forceIncrementalSupport || 147 forceIncrementalSupport ||
123 hasOption(options, Flags.incrementalSupport), 148 hasOption(options, Flags.incrementalSupport),
124 diagnosticOptions: new DiagnosticOptions( 149 diagnosticOptions: makeDiagnosticOptions(
125 suppressWarnings: hasOption(options, Flags.suppressWarnings), 150 suppressWarnings: hasOption(options, Flags.suppressWarnings),
126 fatalWarnings: hasOption(options, Flags.fatalWarnings), 151 fatalWarnings: hasOption(options, Flags.fatalWarnings),
127 suppressHints: hasOption(options, Flags.suppressHints), 152 suppressHints: hasOption(options, Flags.suppressHints),
128 terseDiagnostics: hasOption(options, Flags.terse), 153 terseDiagnostics: hasOption(options, Flags.terse),
129 showPackageWarnings: 154 showPackageWarnings:
130 hasOption(options, Flags.showPackageWarnings)), 155 hasOption(options, Flags.showPackageWarnings)),
131 enableExperimentalMirrors: 156 enableExperimentalMirrors:
132 hasOption(options, Flags.enableExperimentalMirrors), 157 hasOption(options, Flags.enableExperimentalMirrors),
133 enableAssertMessage: 158 enableAssertMessage:
134 hasOption(options, Flags.enableAssertMessage), 159 hasOption(options, Flags.enableAssertMessage),
135 generateCodeWithCompileTimeErrors: 160 generateCodeWithCompileTimeErrors:
136 hasOption(options, Flags.generateCodeWithCompileTimeErrors), 161 hasOption(options, Flags.generateCodeWithCompileTimeErrors),
137 testMode: hasOption(options, Flags.testMode), 162 testMode: hasOption(options, Flags.testMode),
138 allowNativeExtensions: 163 allowNativeExtensions:
139 hasOption(options, Flags.allowNativeExtensions), 164 hasOption(options, Flags.allowNativeExtensions),
140 makeBackend: makeBackend) { 165 makeBackend: makeBackend,
166 makeReporter: makeReporter) {
141 tasks.addAll([ 167 tasks.addAll([
142 userHandlerTask = new GenericTask('Diagnostic handler', this), 168 userHandlerTask = new GenericTask('Diagnostic handler', this),
143 userProviderTask = new GenericTask('Input provider', this), 169 userProviderTask = new GenericTask('Input provider', this),
144 userPackagesDiscoveryTask = 170 userPackagesDiscoveryTask =
145 new GenericTask('Package discovery', this), 171 new GenericTask('Package discovery', this),
146 ]); 172 ]);
147 if (libraryRoot == null) { 173 if (libraryRoot == null) {
148 throw new ArgumentError("[libraryRoot] is null."); 174 throw new ArgumentError("[libraryRoot] is null.");
149 } 175 }
150 if (!libraryRoot.path.endsWith("/")) { 176 if (!libraryRoot.path.endsWith("/")) {
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 Uri lookupLibraryUri(String libraryName) { 606 Uri lookupLibraryUri(String libraryName) {
581 assert(invariant(NO_LOCATION_SPANNABLE, 607 assert(invariant(NO_LOCATION_SPANNABLE,
582 sdkLibraries != null, message: "setupSdk() has not been run")); 608 sdkLibraries != null, message: "setupSdk() has not been run"));
583 return sdkLibraries[libraryName]; 609 return sdkLibraries[libraryName];
584 } 610 }
585 611
586 Uri resolvePatchUri(String libraryName) { 612 Uri resolvePatchUri(String libraryName) {
587 return backend.resolvePatchUri(libraryName, platformConfigUri); 613 return backend.resolvePatchUri(libraryName, platformConfigUri);
588 } 614 }
589 } 615 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698