| Index: reflectable/lib/transformer.dart
|
| diff --git a/reflectable/lib/transformer.dart b/reflectable/lib/transformer.dart
|
| index 0fc3f4010d38f6300d81c93e1ba4101f65c713ad..2f4edcd5e80e24f8d1287e4ba3782735f7b59fd5 100644
|
| --- a/reflectable/lib/transformer.dart
|
| +++ b/reflectable/lib/transformer.dart
|
| @@ -15,6 +15,8 @@ class ReflectableTransformer extends AggregateTransformer
|
| BarbackSettings _settings;
|
| List<String> _entryPoints = <String>[];
|
| bool _formatted;
|
| + List<implementation.WarningKind> _suppressWarnings =
|
| + <implementation.WarningKind>[];
|
|
|
| /// Reports an error in a situation where we do not yet have
|
| /// a [Logger].
|
| @@ -64,10 +66,47 @@ class ReflectableTransformer extends AggregateTransformer
|
| }
|
| }
|
|
|
| + List<implementation.WarningKind> _findSuppressWarnings(
|
| + suppressWarningsSettings) {
|
| + Iterable<implementation.WarningKind> helper(setting) sync* {
|
| + // With no settings, no warnings are suppressed; same for `false`.
|
| + if (setting == null || setting == false) return;
|
| + // Setting `true` means suppress them all.
|
| + if (setting == true) {
|
| + yield implementation.WarningKind.allWarnings;
|
| + } else if (suppressWarningsSettings == "missingEntryPoint") {
|
| + yield implementation.WarningKind.missingEntryPoint;
|
| + } else if (suppressWarningsSettings == "badSuperclass") {
|
| + yield implementation.WarningKind.badSuperclass;
|
| + } else if (suppressWarningsSettings == "badNamePattern") {
|
| + yield implementation.WarningKind.badNamePattern;
|
| + } else if (suppressWarningsSettings == "badMetadata") {
|
| + yield implementation.WarningKind.badMetadata;
|
| + } else {
|
| + _reportEarlyError(
|
| + "Encountered unknown value for the 'suppressWarnings' option.\n"
|
| + "Accepted values: true, false, missingEntryPoint, "
|
| + "badSuperclass, badNamePattern, badMetadata.");
|
| + return;
|
| + }
|
| + }
|
| +
|
| + List<implementation.WarningKind> result = <implementation.WarningKind>[];
|
| + if (suppressWarningsSettings is Iterable) {
|
| + suppressWarningsSettings
|
| + .forEach((setting) => helper(setting).forEach(result.add));
|
| + } else {
|
| + result.addAll(helper(suppressWarningsSettings));
|
| + }
|
| + return new List<implementation.WarningKind>.unmodifiable(result);
|
| + }
|
| +
|
| /// Creates new instance as required by Barback.
|
| ReflectableTransformer.asPlugin(this._settings) {
|
| _entryPoints = _findEntryPoints(_settings.configuration['entry_points']);
|
| _formatted = _findFormatted(_settings.configuration['formatted']);
|
| + _suppressWarnings =
|
| + _findSuppressWarnings(_settings.configuration['suppressWarnings']);
|
| }
|
|
|
| /// Return a [String] or [Future<String>] valued key for each
|
| @@ -86,7 +125,7 @@ class ReflectableTransformer extends AggregateTransformer
|
| @override
|
| Future apply(AggregateTransform transform) {
|
| return new implementation.TransformerImplementation()
|
| - .apply(transform, _entryPoints, _formatted);
|
| + .apply(transform, _entryPoints, _formatted, _suppressWarnings);
|
| }
|
|
|
| @override
|
|
|