Update generic comment syntax
BUG=
R=kevmoo@google.com
Review-Url: https://codereview.chromium.org//2996603002 .
diff --git a/lib/dom.dart b/lib/dom.dart
index bd3e2bd..a500481 100644
--- a/lib/dom.dart
+++ b/lib/dom.dart
@@ -8,16 +8,17 @@
// implement that.
import 'dart:collection';
+
import 'package:source_span/source_span.dart';
+import 'dom_parsing.dart';
+import 'parser.dart';
import 'src/constants.dart';
import 'src/css_class_set.dart';
import 'src/list_proxy.dart';
import 'src/query_selector.dart' as query;
import 'src/token.dart';
import 'src/tokenizer.dart';
-import 'dom_parsing.dart';
-import 'parser.dart';
export 'src/css_class_set.dart' show CssClassSet;
@@ -110,8 +111,8 @@
List<Element> getElementsByTagName(String localName) =>
querySelectorAll(localName);
- List<Element> getElementsByClassName(String classNames) => querySelectorAll(
- classNames.splitMapJoin(' ',
+ List<Element> getElementsByClassName(String classNames) =>
+ querySelectorAll(classNames.splitMapJoin(' ',
onNonMatch: (m) => m.isNotEmpty ? '.$m' : m, onMatch: (m) => ''));
}
@@ -292,8 +293,8 @@
_attributeSpans[attr.name] =
sourceSpan.file.span(offset + attr.start, offset + attr.end);
if (attr.startValue != null) {
- _attributeValueSpans[attr.name] = sourceSpan.file.span(
- offset + attr.startValue, offset + attr.endValue);
+ _attributeValueSpans[attr.name] = sourceSpan.file
+ .span(offset + attr.startValue, offset + attr.endValue);
}
}
}
@@ -407,7 +408,9 @@
/// It will flatten back to a String on read.
var _data;
- Text(String data) : _data = data != null ? data : '', super._();
+ Text(String data)
+ : _data = data != null ? data : '',
+ super._();
int get nodeType => Node.TEXT_NODE;
@@ -476,7 +479,6 @@
// TODO(jmesserly): for our version we can do something smarter in the parser.
// All we really need is to set the correct parse state.
factory Element.html(String html) {
-
// TODO(jacobr): this method can be made more robust and performant.
// 1) Cache the dummy parent elements required to use innerHTML rather than
// creating them every call.
@@ -807,7 +809,8 @@
/// filtered so that only elements are in the collection.
// TODO(jmesserly): this was copied from dart:html
// TODO(jmesserly): "implements List<Element>" is a workaround for analyzer bug.
-class FilteredElementList extends IterableBase<Element> with ListMixin<Element>
+class FilteredElementList extends IterableBase<Element>
+ with ListMixin<Element>
implements List<Element> {
final List<Node> _childNodes;
@@ -817,9 +820,7 @@
///
/// var filteredElements = new FilteredElementList(query("#container"));
/// // filteredElements is [a, b, c].
- FilteredElementList(Node node)
- : _childNodes = node.nodes;
-
+ FilteredElementList(Node node) : _childNodes = node.nodes;
// We can't memoize this, since it's possible that children will be messed
// with externally to this class.
@@ -901,10 +902,9 @@
return result;
}
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(Element element)) => _filtered.map(f);
+ Iterable<T> map<T>(T f(Element element)) => _filtered.map(f);
Iterable<Element> where(bool f(Element element)) => _filtered.where(f);
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(Element element)) =>
- _filtered.expand(f);
+ Iterable<T> expand<T>(Iterable<T> f(Element element)) => _filtered.expand(f);
void insert(int index, Element value) {
_childNodes.insert(index, value);
@@ -936,8 +936,7 @@
return _filtered.reduce(combine);
}
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, Element element)) {
+ T fold<T>(T initialValue, T combine(T previousValue, Element element)) {
return _filtered.fold(initialValue, combine);
}
@@ -971,8 +970,7 @@
_filtered.getRange(start, end);
// TODO(sigmund): this should be typed Element, but we currently run into a
// bug where ListMixin<E>.indexOf() expects Object as the argument.
- int indexOf(element, [int start = 0]) =>
- _filtered.indexOf(element, start);
+ int indexOf(element, [int start = 0]) => _filtered.indexOf(element, start);
// TODO(sigmund): this should be typed Element, but we currently run into a
// bug where ListMixin<E>.lastIndexOf() expects Object as the argument.
diff --git a/lib/src/css_class_set.dart b/lib/src/css_class_set.dart
index ddc1612..40575c2 100644
--- a/lib/src/css_class_set.dart
+++ b/lib/src/css_class_set.dart
@@ -6,6 +6,7 @@
library html.dom.src;
import 'dart:collection';
+
import 'package:html/dom.dart';
class ElementCssClassSet extends CssClassSetImpl {
@@ -33,7 +34,6 @@
/** A Set that stores the CSS class names for an element. */
abstract class CssClassSet implements Set<String> {
-
/**
* Adds the class [value] to the element if it is not on it, removes it if it
* is.
@@ -151,11 +151,12 @@
String join([String separator = ""]) => readClasses().join(separator);
- Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(String e)) => readClasses().map(f);
+ Iterable<T> map<T>(T f(String e)) => readClasses().map(f);
Iterable<String> where(bool f(String element)) => readClasses().where(f);
- Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(String element)) => readClasses().expand(f);
+ Iterable<T> expand<T>(Iterable<T> f(String element)) =>
+ readClasses().expand(f);
bool every(bool f(String element)) => readClasses().every(f);
@@ -171,8 +172,7 @@
return readClasses().reduce(combine);
}
- dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
- dynamic/*=T*/ combine(var/*=T*/ previousValue, String element)) {
+ T fold<T>(T initialValue, T combine(T previousValue, String element)) {
return readClasses().fold(initialValue, combine);
}
// interface Collection - END
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 16837b0..909b899 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -43,7 +43,7 @@
}
// Like the python [:] operator.
-List/*<T>*/ slice/*<T>*/(List/*<T>*/ list, int start, [int end]) {
+List<T> slice<T>(List<T> list, int start, [int end]) {
if (end == null) end = list.length;
if (end < 0) end += list.length;
@@ -79,8 +79,7 @@
data.forEach((key, value) {
var result = new StringBuffer();
var search = '%($key)';
- int last = 0,
- match;
+ int last = 0, match;
while ((match = format.indexOf(search, last)) >= 0) {
result.write(format.substring(last, match));
match += search.length;