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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 EventSink, | 8 EventSink, |
9 Future; | 9 Future; |
10 | 10 |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 [Map arguments = const {}]) { | 1657 [Map arguments = const {}]) { |
1658 reportDiagnosticInternal( | 1658 reportDiagnosticInternal( |
1659 createMessage(node, messageKind, arguments), | 1659 createMessage(node, messageKind, arguments), |
1660 const <DiagnosticMessage>[], | 1660 const <DiagnosticMessage>[], |
1661 api.Diagnostic.INFO); | 1661 api.Diagnostic.INFO); |
1662 } | 1662 } |
1663 | 1663 |
1664 void reportDiagnosticInternal(DiagnosticMessage message, | 1664 void reportDiagnosticInternal(DiagnosticMessage message, |
1665 List<DiagnosticMessage> infos, | 1665 List<DiagnosticMessage> infos, |
1666 api.Diagnostic kind) { | 1666 api.Diagnostic kind) { |
1667 if (!options.showPackageWarnings && | 1667 if (!options.showAllPackageWarnings && |
1668 message.spannable != NO_LOCATION_SPANNABLE) { | 1668 message.spannable != NO_LOCATION_SPANNABLE) { |
1669 switch (kind) { | 1669 switch (kind) { |
1670 case api.Diagnostic.WARNING: | 1670 case api.Diagnostic.WARNING: |
1671 case api.Diagnostic.HINT: | 1671 case api.Diagnostic.HINT: |
1672 Element element = elementFromSpannable(message.spannable); | 1672 Element element = elementFromSpannable(message.spannable); |
1673 if (!compiler.inUserCode(element, assumeInUserCode: true)) { | 1673 if (!compiler.inUserCode(element, assumeInUserCode: true)) { |
1674 Uri uri = compiler.getCanonicalUri(element); | 1674 Uri uri = compiler.getCanonicalUri(element); |
| 1675 if (options.showPackageWarningsFor(uri)) { |
| 1676 reportDiagnostic(message, infos, kind); |
| 1677 return; |
| 1678 } |
1675 SuppressionInfo info = | 1679 SuppressionInfo info = |
1676 suppressedWarnings.putIfAbsent(uri, () => new SuppressionInfo()); | 1680 suppressedWarnings.putIfAbsent(uri, () => new SuppressionInfo()); |
1677 if (kind == api.Diagnostic.WARNING) { | 1681 if (kind == api.Diagnostic.WARNING) { |
1678 info.warnings++; | 1682 info.warnings++; |
1679 } else { | 1683 } else { |
1680 info.hints++; | 1684 info.hints++; |
1681 } | 1685 } |
1682 lastDiagnosticWasFiltered = true; | 1686 lastDiagnosticWasFiltered = true; |
1683 return; | 1687 return; |
1684 } | 1688 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 throw error; | 1929 throw error; |
1926 } | 1930 } |
1927 | 1931 |
1928 void onCrashInUserCode(String message, exception, stackTrace) { | 1932 void onCrashInUserCode(String message, exception, stackTrace) { |
1929 hasCrashed = true; | 1933 hasCrashed = true; |
1930 print('$message: ${tryToString(exception)}'); | 1934 print('$message: ${tryToString(exception)}'); |
1931 print(tryToString(stackTrace)); | 1935 print(tryToString(stackTrace)); |
1932 } | 1936 } |
1933 | 1937 |
1934 void reportSuppressedMessagesSummary() { | 1938 void reportSuppressedMessagesSummary() { |
1935 if (!options.showPackageWarnings && !options.suppressWarnings) { | 1939 if (!options.showAllPackageWarnings && !options.suppressWarnings) { |
1936 suppressedWarnings.forEach((Uri uri, SuppressionInfo info) { | 1940 suppressedWarnings.forEach((Uri uri, SuppressionInfo info) { |
1937 MessageKind kind = MessageKind.HIDDEN_WARNINGS_HINTS; | 1941 MessageKind kind = MessageKind.HIDDEN_WARNINGS_HINTS; |
1938 if (info.warnings == 0) { | 1942 if (info.warnings == 0) { |
1939 kind = MessageKind.HIDDEN_HINTS; | 1943 kind = MessageKind.HIDDEN_HINTS; |
1940 } else if (info.hints == 0) { | 1944 } else if (info.hints == 0) { |
1941 kind = MessageKind.HIDDEN_WARNINGS; | 1945 kind = MessageKind.HIDDEN_WARNINGS; |
1942 } | 1946 } |
1943 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; | 1947 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; |
1944 Message message = template.message( | 1948 Message message = template.message( |
1945 {'warnings': info.warnings, | 1949 {'warnings': info.warnings, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 if (_otherDependencies == null) { | 2098 if (_otherDependencies == null) { |
2095 _otherDependencies = new Setlet<Element>(); | 2099 _otherDependencies = new Setlet<Element>(); |
2096 } | 2100 } |
2097 _otherDependencies.add(element.implementation); | 2101 _otherDependencies.add(element.implementation); |
2098 } | 2102 } |
2099 | 2103 |
2100 Iterable<Element> get otherDependencies { | 2104 Iterable<Element> get otherDependencies { |
2101 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2105 return _otherDependencies != null ? _otherDependencies : const <Element>[]; |
2102 } | 2106 } |
2103 } | 2107 } |
OLD | NEW |