fix analyzer warnings
diff --git a/lib/build/html_import_annotation_recorder.dart b/lib/build/html_import_annotation_recorder.dart
index d54b579..5f2a320 100644
--- a/lib/build/html_import_annotation_recorder.dart
+++ b/lib/build/html_import_annotation_recorder.dart
@@ -3,10 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
library web_components.build.html_import_recorder_inliner;
-import 'package:analyzer/analyzer.dart';
-import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
-import 'package:barback/barback.dart';
import 'package:initialize/transformer.dart';
import 'package:path/path.dart' as path;
import '../src/normalize_path.dart';
@@ -21,8 +18,6 @@
/// All the normalized import paths that were seen.
final Set<String> importPaths = new Set<String>();
- TransformLogger _logger;
-
HtmlImportAnnotationRecorder();
/// Applies to anything named `HtmlImport` which annotates a library.
@@ -63,8 +58,6 @@
var annotationElement = pluginData.initializer.annotationElement;
var element = pluginData.initializer.targetElement as LibraryElement;
var resolver = pluginData.resolver;
- var libraryDirective =
- pluginData.initializer.targetNode.parent.parent as LibraryDirective;
var originalImportPath;
if (annotationElement.element is PropertyAccessorElement) {
diff --git a/lib/build/import_inliner.dart b/lib/build/import_inliner.dart
index 8703ead..a603dda 100644
--- a/lib/build/import_inliner.dart
+++ b/lib/build/import_inliner.dart
@@ -176,9 +176,6 @@
/// Asset where the original content (and original url) was found.
final AssetId sourceId;
- /// Counter used to ensure that every library name we inject is unique.
- int _count = 0;
-
/// Path to the top level folder relative to the transform primaryInput.
/// This should just be some arbitrary # of ../'s.
final String topLevelPath;
diff --git a/lib/build/script_compactor.dart b/lib/build/script_compactor.dart
index 7537cf6..c3b0001 100644
--- a/lib/build/script_compactor.dart
+++ b/lib/build/script_compactor.dart
@@ -133,7 +133,6 @@
Future _extractInlineScripts(AssetId asset, dom.Document doc) {
var scripts = doc.querySelectorAll('script[type="$dartType"]');
return Future.forEach(scripts, (script) {
- var type = script.attributes['type'];
var src = script.attributes['src'];
if (src != null) {
@@ -174,7 +173,6 @@
var unit = parseDirectives(code, suppressErrors: true);
var file = new SourceFile(code, url: spanUrlFor(from, to, logger));
var output = new TextEditTransaction(code, file);
- var foundLibraryDirective = false;
for (Directive directive in unit.directives) {
if (directive is UriBasedDirective) {
var uri = directive.uri.stringValue;
@@ -188,8 +186,6 @@
if (newUri != uri) {
output.edit(span.start.offset, span.end.offset, "'$newUri'");
}
- } else if (directive is LibraryDirective) {
- foundLibraryDirective = true;
}
}
diff --git a/lib/polyfill.dart b/lib/polyfill.dart
index 6e7bbd9..e225e22 100644
--- a/lib/polyfill.dart
+++ b/lib/polyfill.dart
@@ -38,7 +38,7 @@
if (customElements == null) {
// Return true if native document.register, otherwise false.
// (Maybe the polyfill isn't loaded yet. Wait for it.)
- return document.supportsRegister;
+ return document.supportsRegisterElement;
}
return customElements['ready'] == true;
diff --git a/test/html_import_annotation_test.dart b/test/html_import_annotation_test.dart
index d935e57..64b7132 100644
--- a/test/html_import_annotation_test.dart
+++ b/test/html_import_annotation_test.dart
@@ -8,10 +8,11 @@
import 'dart:html';
import 'package:test/test.dart';
import 'package:web_components/web_components.dart';
-import 'foo/bar.dart';
+import 'foo/bar.dart' as foo_bar;
const String importPath = 'my_import.html';
+/// Uses [foo_bar].
main() async {
await initWebComponents();
diff --git a/test/interop_test.dart b/test/interop_test.dart
index 0155eda..0b7fcc5 100644
--- a/test/interop_test.dart
+++ b/test/interop_test.dart
@@ -5,7 +5,6 @@
library template_wrappers_test;
import 'dart:html';
-import 'dart:async';
import 'dart:js' show context, JsObject;
import 'package:test/test.dart';
import 'package:web_components/interop.dart';
@@ -42,13 +41,13 @@
onlyUpgradeNewElements();
registerDartType('x-d', XDWrapper); // late on purpose.
- a = document.querySelector('x-a');
+ a = document.querySelector('x-a') as XAWrapper;
expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement');
expect(a is XAWrapper, isTrue, reason: 'x-a is upgraded to XAWrapper');
expect(a.x, 0);
expect(a.wrapperCount, 0);
- b = document.querySelector('[is=x-b]');
+ b = document.querySelector('[is=x-b]') as XBWrapper;
expect(b is DivElement, isTrue, reason: 'x-b is DivElement');
expect(b is XBWrapper, isTrue, reason: 'x-b is upgraded to XBWrapper');
expect(b.x, 1);
@@ -75,7 +74,7 @@
expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement');
expect(a is XAWrapper, isTrue, reason: 'x-a is upgraded to XAWrapper');
expect(a.x, 3);
- expect(a.wrapperCount, 2);
+ expect((a as XAWrapper).wrapperCount, 2);
context.callMethod('addB');
list = document.querySelectorAll('[is=x-b]');
@@ -84,7 +83,7 @@
expect(b is DivElement, isTrue, reason: 'x-b is DivElement');
expect(b is XBWrapper, isTrue, reason: 'x-b is upgraded to XBWrapper');
expect(b.x, 4);
- expect(b.wrapperCount, 3);
+ expect((b as XBWrapper).wrapperCount, 3);
// New instances of x-d should be upgraded regardless.
context.callMethod('addD');
@@ -94,7 +93,7 @@
expect(d is HtmlElement, isTrue, reason: 'x-d is HtmlElement');
expect(d is XDWrapper, isTrue, reason: 'x-d is upgraded to XDWrapper');
expect(d.x, 5);
- expect(d.wrapperCount, 4);
+ expect((d as XDWrapper).wrapperCount, 4);
}, skip: 'https://github.com/dart-lang/web-components/issues/38');
test('events seen if Dart type is registered before registerElement', () {
@@ -106,7 +105,7 @@
c = document.querySelector('x-c');
expect(c is XCWrapper, isTrue);
expect(c.x, 6);
- expect(c.wrapperCount, 5);
+ expect((c as XCWrapper).wrapperCount, 5);
context.callMethod('addC');
var list = document.querySelectorAll('x-c');
@@ -116,7 +115,7 @@
expect(c is HtmlElement, isTrue, reason: 'x-c is HtmlElement');
expect(c is XCWrapper, isTrue, reason: 'x-c is upgraded to XCWrapper');
expect(c.x, 7);
- expect(c.wrapperCount, 6);
+ expect((c as XCWrapper).wrapperCount, 6);
}, skip: 'https://github.com/dart-lang/web-components/issues/38');
test('element can extend another element', () {