refactor(dart/transform): Correct Dart analyzer warnings
- Fix numerous Dart analyzer warnings we had been ignoring. - Delete unused `in_progress` dir
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
library angular2.transform.common.logging;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/messages/build_logger.dart';
|
||||
import 'package:source_span/source_span.dart';
|
||||
|
||||
BuildLogger _logger;
|
||||
|
||||
@ -24,6 +26,11 @@ BuildLogger get logger {
|
||||
}
|
||||
|
||||
class PrintLogger implements BuildLogger {
|
||||
@override
|
||||
final String detailsUri = '';
|
||||
@override
|
||||
final bool convertErrorsToWarnings = false;
|
||||
|
||||
void _printWithPrefix(prefix, msg) => print('$prefix: $msg');
|
||||
void info(msg, {AssetId asset, SourceSpan span}) =>
|
||||
_printWithPrefix('INFO', msg);
|
||||
@ -43,7 +50,7 @@ class PrintLoggerError extends Error {
|
||||
final AssetId asset;
|
||||
final SourceSpan span;
|
||||
|
||||
PrintLoggerError(message, asset, span);
|
||||
PrintLoggerError(this.message, this.asset, this.span);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -3,6 +3,7 @@ library angular2.transform.common.names;
|
||||
const SETUP_METHOD_NAME = 'initReflector';
|
||||
const REFLECTOR_VAR_NAME = 'reflector';
|
||||
const DEPS_EXTENSION = '.ng_deps.dart';
|
||||
const REFLECTION_CAPABILITIES_NAME = 'ReflectionCapabilities';
|
||||
const REGISTER_TYPE_METHOD_NAME = 'registerType';
|
||||
const REGISTER_GETTERS_METHOD_NAME = 'registerGetters';
|
||||
const REGISTER_SETTERS_METHOD_NAME = 'registerSetters';
|
||||
|
@ -1,4 +1,4 @@
|
||||
library angular2.transform.common.options;
|
||||
library angular2.transform.common.options_reader;
|
||||
|
||||
import 'package:barback/barback.dart';
|
||||
import 'options.dart';
|
||||
|
@ -43,7 +43,7 @@ class Parser {
|
||||
Future<List<NgDeps>> _recurse(AssetId id,
|
||||
[List<NgDeps> allDeps, Set<AssetId> seen]) async {
|
||||
if (seen == null) seen = new Set<AssetId>();
|
||||
if (seen.contains(id)) return;
|
||||
if (seen.contains(id)) return null;
|
||||
seen.add(id);
|
||||
|
||||
if (allDeps == null) allDeps = [];
|
||||
@ -75,7 +75,6 @@ class NgDeps {
|
||||
|
||||
class _ParseNgDepsVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||
NgDeps ngDeps = null;
|
||||
_RegisteredTypeBuilder current = null;
|
||||
|
||||
@override
|
||||
Object visitImportDirective(ImportDirective node) {
|
||||
|
@ -1,111 +0,0 @@
|
||||
library angular2.transform.common;
|
||||
|
||||
import 'package:analyzer/analyzer.dart';
|
||||
import 'package:analyzer/src/generated/java_core.dart';
|
||||
import 'package:analyzer/src/generated/scanner.dart';
|
||||
|
||||
/// Visitor providing common methods for concrete implementations.
|
||||
class VisitorMixin {
|
||||
PrintWriter writer;
|
||||
|
||||
/**
|
||||
* Visit the given function body, printing the prefix before if given body is not empty.
|
||||
*
|
||||
* @param prefix the prefix to be printed if there is a node to visit
|
||||
* @param body the function body to be visited
|
||||
*/
|
||||
void visitFunctionWithPrefix(String prefix, FunctionBody body) {
|
||||
if (body is! EmptyFunctionBody) {
|
||||
writer.print(prefix);
|
||||
}
|
||||
visitNode(body);
|
||||
}
|
||||
|
||||
/// Safely visit [node].
|
||||
void visitNode(AstNode node) {
|
||||
if (node != null) {
|
||||
node.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// Print a list of [nodes] without any separation.
|
||||
void visitNodeList(NodeList<AstNode> nodes) {
|
||||
visitNodeListWithSeparator(nodes, "");
|
||||
}
|
||||
|
||||
/// Print a list of [nodes], separated by the given [separator].
|
||||
void visitNodeListWithSeparator(NodeList<AstNode> nodes, String separator) {
|
||||
if (nodes != null) {
|
||||
int size = nodes.length;
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (i > 0) {
|
||||
writer.print(separator);
|
||||
}
|
||||
nodes[i].accept(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Print a list of [nodes], separated by the given [separator] and
|
||||
/// preceded by the given [prefix].
|
||||
void visitNodeListWithSeparatorAndPrefix(
|
||||
String prefix, NodeList<AstNode> nodes, String separator) {
|
||||
if (nodes != null) {
|
||||
int size = nodes.length;
|
||||
if (size > 0) {
|
||||
writer.print(prefix);
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (i > 0) {
|
||||
writer.print(separator);
|
||||
}
|
||||
nodes[i].accept(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Print a list of [nodes], separated by the given [separator] and
|
||||
/// succeeded by the given [suffix].
|
||||
void visitNodeListWithSeparatorAndSuffix(
|
||||
NodeList<AstNode> nodes, String separator, String suffix) {
|
||||
if (nodes != null) {
|
||||
int size = nodes.length;
|
||||
if (size > 0) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (i > 0) {
|
||||
writer.print(separator);
|
||||
}
|
||||
nodes[i].accept(this);
|
||||
}
|
||||
writer.print(suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If [node] is null does nothing. Otherwise, prints [prefix], then
|
||||
/// visits [node].
|
||||
void visitNodeWithPrefix(String prefix, AstNode node) {
|
||||
if (node != null) {
|
||||
writer.print(prefix);
|
||||
node.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// If [node] is null does nothing. Otherwise, visits [node], then prints
|
||||
/// [suffix].
|
||||
void visitNodeWithSuffix(AstNode node, String suffix) {
|
||||
if (node != null) {
|
||||
node.accept(this);
|
||||
writer.print(suffix);
|
||||
}
|
||||
}
|
||||
|
||||
/// Safely visit [node], printing [suffix] after the node if it is
|
||||
/// non-`null`.
|
||||
void visitTokenWithSuffix(Token token, String suffix) {
|
||||
if (token != null) {
|
||||
writer.print(token.lexeme);
|
||||
writer.print(suffix);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user