| OLD | NEW |
| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 */ | 288 */ |
| 289 final int maxConcreteTypeSize; | 289 final int maxConcreteTypeSize; |
| 290 final bool analyzeAllFlag; | 290 final bool analyzeAllFlag; |
| 291 final bool analyzeOnly; | 291 final bool analyzeOnly; |
| 292 /** | 292 /** |
| 293 * If true, skip analysis of method bodies and field initializers. Implies | 293 * If true, skip analysis of method bodies and field initializers. Implies |
| 294 * [analyzeOnly]. | 294 * [analyzeOnly]. |
| 295 */ | 295 */ |
| 296 final bool analyzeSignaturesOnly; | 296 final bool analyzeSignaturesOnly; |
| 297 final bool enableNativeLiveTypeAnalysis; | 297 final bool enableNativeLiveTypeAnalysis; |
| 298 final bool rejectDeprecatedFeatures; | |
| 299 final bool checkDeprecationInSdk; | |
| 300 | 298 |
| 301 /** | 299 /** |
| 302 * If [:true:], comment tokens are collected in [commentMap] during scanning. | 300 * If [:true:], comment tokens are collected in [commentMap] during scanning. |
| 303 */ | 301 */ |
| 304 final bool preserveComments; | 302 final bool preserveComments; |
| 305 | 303 |
| 306 /** | 304 /** |
| 307 * Is the compiler in verbose mode. | 305 * Is the compiler in verbose mode. |
| 308 */ | 306 */ |
| 309 final bool verbose; | 307 final bool verbose; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 this.disableTypeInferenceFlag: false, | 491 this.disableTypeInferenceFlag: false, |
| 494 this.maxConcreteTypeSize: 5, | 492 this.maxConcreteTypeSize: 5, |
| 495 this.enableMinification: false, | 493 this.enableMinification: false, |
| 496 this.enableNativeLiveTypeAnalysis: false, | 494 this.enableNativeLiveTypeAnalysis: false, |
| 497 bool emitJavaScript: true, | 495 bool emitJavaScript: true, |
| 498 bool generateSourceMap: true, | 496 bool generateSourceMap: true, |
| 499 bool disallowUnsafeEval: false, | 497 bool disallowUnsafeEval: false, |
| 500 this.analyzeAllFlag: false, | 498 this.analyzeAllFlag: false, |
| 501 bool analyzeOnly: false, | 499 bool analyzeOnly: false, |
| 502 bool analyzeSignaturesOnly: false, | 500 bool analyzeSignaturesOnly: false, |
| 503 this.rejectDeprecatedFeatures: false, | |
| 504 this.checkDeprecationInSdk: false, | |
| 505 this.preserveComments: false, | 501 this.preserveComments: false, |
| 506 this.verbose: false, | 502 this.verbose: false, |
| 507 this.sourceMapUri: null, | 503 this.sourceMapUri: null, |
| 508 this.buildId: UNDETERMINED_BUILD_ID, | 504 this.buildId: UNDETERMINED_BUILD_ID, |
| 509 this.globalJsName: r'$', | 505 this.globalJsName: r'$', |
| 510 outputProvider, | 506 outputProvider, |
| 511 List<String> strips: const []}) | 507 List<String> strips: const []}) |
| 512 : this.analyzeOnly = analyzeOnly || analyzeSignaturesOnly, | 508 : this.analyzeOnly = analyzeOnly || analyzeSignaturesOnly, |
| 513 this.analyzeSignaturesOnly = analyzeSignaturesOnly, | 509 this.analyzeSignaturesOnly = analyzeSignaturesOnly, |
| 514 this.outputProvider = (outputProvider == null) | 510 this.outputProvider = (outputProvider == null) |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 reportError( | 1181 reportError( |
| 1186 node, MessageKind.GENERIC, {'text': 'Internal Error: $message'}); | 1182 node, MessageKind.GENERIC, {'text': 'Internal Error: $message'}); |
| 1187 } | 1183 } |
| 1188 | 1184 |
| 1189 void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) { | 1185 void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) { |
| 1190 // TODO(ahe): The names Diagnostic and api.Diagnostic are in | 1186 // TODO(ahe): The names Diagnostic and api.Diagnostic are in |
| 1191 // conflict. Fix it. | 1187 // conflict. Fix it. |
| 1192 reportDiagnostic(span, "$message", kind); | 1188 reportDiagnostic(span, "$message", kind); |
| 1193 } | 1189 } |
| 1194 | 1190 |
| 1195 /// Returns true if a diagnostic was emitted. | |
| 1196 bool onDeprecatedFeature(Spannable span, String feature) { | |
| 1197 if (currentElement == null) | |
| 1198 throw new SpannableAssertionFailure(span, feature); | |
| 1199 if (!checkDeprecationInSdk && | |
| 1200 currentElement.getLibrary().isPlatformLibrary) { | |
| 1201 return false; | |
| 1202 } | |
| 1203 var kind = rejectDeprecatedFeatures | |
| 1204 ? api.Diagnostic.ERROR : api.Diagnostic.WARNING; | |
| 1205 var message = rejectDeprecatedFeatures | |
| 1206 ? MessageKind.DEPRECATED_FEATURE_ERROR.error({'featureName': feature}) | |
| 1207 : MessageKind.DEPRECATED_FEATURE_WARNING.error( | |
| 1208 {'featureName': feature}); | |
| 1209 reportMessage(spanFromSpannable(span), message, kind); | |
| 1210 return true; | |
| 1211 } | |
| 1212 | |
| 1213 void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind); | 1191 void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind); |
| 1214 | 1192 |
| 1215 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { | 1193 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { |
| 1216 if (begin == null || end == null) { | 1194 if (begin == null || end == null) { |
| 1217 // TODO(ahe): We can almost always do better. Often it is only | 1195 // TODO(ahe): We can almost always do better. Often it is only |
| 1218 // end that is null. Otherwise, we probably know the current | 1196 // end that is null. Otherwise, we probably know the current |
| 1219 // URI. | 1197 // URI. |
| 1220 throw 'Cannot find tokens to produce error message.'; | 1198 throw 'Cannot find tokens to produce error message.'; |
| 1221 } | 1199 } |
| 1222 if (uri == null && currentElement != null) { | 1200 if (uri == null && currentElement != null) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 | 1435 |
| 1458 void close() {} | 1436 void close() {} |
| 1459 | 1437 |
| 1460 toString() => name; | 1438 toString() => name; |
| 1461 | 1439 |
| 1462 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1440 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1463 static NullSink outputProvider(String name, String extension) { | 1441 static NullSink outputProvider(String name, String extension) { |
| 1464 return new NullSink('$name.$extension'); | 1442 return new NullSink('$name.$extension'); |
| 1465 } | 1443 } |
| 1466 } | 1444 } |
| OLD | NEW |