| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 */ | 299 */ |
| 300 final int maxConcreteTypeSize; | 300 final int maxConcreteTypeSize; |
| 301 final bool analyzeAllFlag; | 301 final bool analyzeAllFlag; |
| 302 final bool analyzeOnly; | 302 final bool analyzeOnly; |
| 303 /** | 303 /** |
| 304 * If true, skip analysis of method bodies and field initializers. Implies | 304 * If true, skip analysis of method bodies and field initializers. Implies |
| 305 * [analyzeOnly]. | 305 * [analyzeOnly]. |
| 306 */ | 306 */ |
| 307 final bool analyzeSignaturesOnly; | 307 final bool analyzeSignaturesOnly; |
| 308 final bool enableNativeLiveTypeAnalysis; | 308 final bool enableNativeLiveTypeAnalysis; |
| 309 final bool rejectDeprecatedFeatures; | |
| 310 final bool checkDeprecationInSdk; | |
| 311 | 309 |
| 312 /** | 310 /** |
| 313 * If [:true:], comment tokens are collected in [commentMap] during scanning. | 311 * If [:true:], comment tokens are collected in [commentMap] during scanning. |
| 314 */ | 312 */ |
| 315 final bool preserveComments; | 313 final bool preserveComments; |
| 316 | 314 |
| 317 /** | 315 /** |
| 318 * Is the compiler in verbose mode. | 316 * Is the compiler in verbose mode. |
| 319 */ | 317 */ |
| 320 final bool verbose; | 318 final bool verbose; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 this.disableTypeInferenceFlag: false, | 509 this.disableTypeInferenceFlag: false, |
| 512 this.maxConcreteTypeSize: 5, | 510 this.maxConcreteTypeSize: 5, |
| 513 this.enableMinification: false, | 511 this.enableMinification: false, |
| 514 this.enableNativeLiveTypeAnalysis: false, | 512 this.enableNativeLiveTypeAnalysis: false, |
| 515 bool emitJavaScript: true, | 513 bool emitJavaScript: true, |
| 516 bool generateSourceMap: true, | 514 bool generateSourceMap: true, |
| 517 bool disallowUnsafeEval: false, | 515 bool disallowUnsafeEval: false, |
| 518 this.analyzeAllFlag: false, | 516 this.analyzeAllFlag: false, |
| 519 bool analyzeOnly: false, | 517 bool analyzeOnly: false, |
| 520 bool analyzeSignaturesOnly: false, | 518 bool analyzeSignaturesOnly: false, |
| 521 this.rejectDeprecatedFeatures: false, | |
| 522 this.checkDeprecationInSdk: false, | |
| 523 this.preserveComments: false, | 519 this.preserveComments: false, |
| 524 this.verbose: false, | 520 this.verbose: false, |
| 525 this.sourceMapUri: null, | 521 this.sourceMapUri: null, |
| 526 this.buildId: UNDETERMINED_BUILD_ID, | 522 this.buildId: UNDETERMINED_BUILD_ID, |
| 527 this.globalJsName: r'$', | 523 this.globalJsName: r'$', |
| 528 outputProvider, | 524 outputProvider, |
| 529 List<String> strips: const []}) | 525 List<String> strips: const []}) |
| 530 : this.analyzeOnly = analyzeOnly || analyzeSignaturesOnly, | 526 : this.analyzeOnly = analyzeOnly || analyzeSignaturesOnly, |
| 531 this.analyzeSignaturesOnly = analyzeSignaturesOnly, | 527 this.analyzeSignaturesOnly = analyzeSignaturesOnly, |
| 532 this.outputProvider = (outputProvider == null) | 528 this.outputProvider = (outputProvider == null) |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 reportError( | 1210 reportError( |
| 1215 node, MessageKind.GENERIC, {'text': 'Internal Error: $message'}); | 1211 node, MessageKind.GENERIC, {'text': 'Internal Error: $message'}); |
| 1216 } | 1212 } |
| 1217 | 1213 |
| 1218 void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) { | 1214 void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) { |
| 1219 // TODO(ahe): The names Diagnostic and api.Diagnostic are in | 1215 // TODO(ahe): The names Diagnostic and api.Diagnostic are in |
| 1220 // conflict. Fix it. | 1216 // conflict. Fix it. |
| 1221 reportDiagnostic(span, "$message", kind); | 1217 reportDiagnostic(span, "$message", kind); |
| 1222 } | 1218 } |
| 1223 | 1219 |
| 1224 /// Returns true if a diagnostic was emitted. | |
| 1225 bool onDeprecatedFeature(Spannable span, String feature) { | |
| 1226 if (currentElement == null) | |
| 1227 throw new SpannableAssertionFailure(span, feature); | |
| 1228 if (!checkDeprecationInSdk && | |
| 1229 currentElement.getLibrary().isPlatformLibrary) { | |
| 1230 return false; | |
| 1231 } | |
| 1232 var kind = rejectDeprecatedFeatures | |
| 1233 ? api.Diagnostic.ERROR : api.Diagnostic.WARNING; | |
| 1234 var message = rejectDeprecatedFeatures | |
| 1235 ? MessageKind.DEPRECATED_FEATURE_ERROR.error({'featureName': feature}) | |
| 1236 : MessageKind.DEPRECATED_FEATURE_WARNING.error( | |
| 1237 {'featureName': feature}); | |
| 1238 reportMessage(spanFromSpannable(span), message, kind); | |
| 1239 return true; | |
| 1240 } | |
| 1241 | |
| 1242 void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind); | 1220 void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind); |
| 1243 | 1221 |
| 1244 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { | 1222 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { |
| 1245 if (begin == null || end == null) { | 1223 if (begin == null || end == null) { |
| 1246 // TODO(ahe): We can almost always do better. Often it is only | 1224 // TODO(ahe): We can almost always do better. Often it is only |
| 1247 // end that is null. Otherwise, we probably know the current | 1225 // end that is null. Otherwise, we probably know the current |
| 1248 // URI. | 1226 // URI. |
| 1249 throw 'Cannot find tokens to produce error message.'; | 1227 throw 'Cannot find tokens to produce error message.'; |
| 1250 } | 1228 } |
| 1251 if (uri == null && currentElement != null) { | 1229 if (uri == null && currentElement != null) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 | 1464 |
| 1487 void close() {} | 1465 void close() {} |
| 1488 | 1466 |
| 1489 toString() => name; | 1467 toString() => name; |
| 1490 | 1468 |
| 1491 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1469 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1492 static NullSink outputProvider(String name, String extension) { | 1470 static NullSink outputProvider(String name, String extension) { |
| 1493 return new NullSink('$name.$extension'); | 1471 return new NullSink('$name.$extension'); |
| 1494 } | 1472 } |
| 1495 } | 1473 } |
| OLD | NEW |