Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
fix(transformer): Fixing some analyzer warnings
Browse files Browse the repository at this point in the history
A couple appear to have crept in, found when integrating into Dart's repo.

Closes #955
  • Loading branch information
blois authored and [email protected] committed Apr 24, 2014
1 parent 1df0f64 commit 1360d19
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
12 changes: 5 additions & 7 deletions lib/tools/transformer/metadata_extractor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:code_transformers/resolver.dart';

class AnnotatedType {
final ClassElement type;
Iterable<Annotation> annotations;
List<Annotation> annotations;

AnnotatedType(this.type);

Expand Down Expand Up @@ -269,19 +269,17 @@ class AnnotationExtractor {
.where((Annotation annotation) {
var element = annotation.element;
if (element != null && !element.isPublic) {
warn('Annotation $annotation is not public.',
annotation.parent.element);
warn('Annotation $annotation is not public.', cls);
return false;
}
if (element is! ConstructorElement) {
// Only keeping constructor elements.
return false;
}
ConstructorElement ctor = element;
var cls = ctor.enclosingElement;
if (!cls.isPublic) {
warn('Annotation $annotation is not public.',
annotation.parent.element);
var annotationClass = ctor.enclosingElement;
if (!annotationClass.isPublic) {
warn('Annotation $annotation is not public.', cls);
return false;
}
return element.enclosingElement.type.isAssignableTo(directiveType.type) ||
Expand Down
1 change: 0 additions & 1 deletion lib/tools/transformer/metadata_generator.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
library angular.tools.transformer.metadata_generator;

import 'dart:async';
import 'package:analyzer/src/generated/element.dart';
import 'package:angular/tools/transformer/options.dart';
import 'package:barback/barback.dart';
Expand Down
4 changes: 0 additions & 4 deletions lib/tools/transformer/options.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
library angular.tools.transformer.options;

import 'dart:async';

import 'package:barback/barback.dart';
import 'package:code_transformers/resolver.dart';
import 'package:di/transformer/options.dart' as di;

/** Options used by Angular transformers */
Expand Down
1 change: 0 additions & 1 deletion lib/tools/transformer/static_angular_generator.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
library angular.tools.transformer.static_angular_generator;

import 'dart:async';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
import 'package:angular/tools/transformer/options.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:angular/tools/transformer/html_dart_references_generator.dart';
import 'package:angular/tools/transformer/options.dart';
import 'package:barback/barback.dart';
import 'package:code_transformers/resolver.dart';
import 'package:di/transformer/injector_generator.dart' as di;
import 'package:di/transformer/injector_generator.dart' show InjectorGenerator;
import 'package:di/transformer/options.dart' as di;
import 'package:path/path.dart' as path;

Expand Down Expand Up @@ -126,7 +126,7 @@ List<List<Transformer>> _createPhases(TransformOptions options) {
[new HtmlDartReferencesGenerator(options)],
[new _SerialTransformer([
new ExpressionGenerator(options, resolvers),
new di.InjectorGenerator(options.diOptions, resolvers),
new InjectorGenerator(options.diOptions, resolvers),
new MetadataGenerator(options, resolvers),
new StaticAngularGenerator(options, resolvers)
])]
Expand All @@ -145,7 +145,7 @@ class _SerialTransformer extends Transformer {
final Iterable<Transformer> _transformers;
_SerialTransformer(this._transformers);

Future<bool> isPrimary(Asset input) =>
Future<bool> isPrimary(input) =>
Future.wait(_transformers.map((t) => t.isPrimary(input)))
.then((l) => l.any((result) => result));

Expand Down

0 comments on commit 1360d19

Please sign in to comment.