Merge pull request #43 from srawlins/generic-comments
Fix generic comment syntax
diff --git a/lib/src/change_notifier.dart b/lib/src/change_notifier.dart
index e07507f..40f5d4d 100644
--- a/lib/src/change_notifier.dart
+++ b/lib/src/change_notifier.dart
@@ -102,12 +102,10 @@
@Deprecated('Exists to make migrations off Observable easier')
@override
@protected
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
throw new UnsupportedError('Not supported by ChangeNotifier');
}
@@ -123,16 +121,14 @@
/// with ChangeNotifier<PropertyChangeRecord>, PropertyChangeMixin
class PropertyChangeNotifier extends ChangeNotifier<PropertyChangeRecord> {
@override
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
if (hasObservers && oldValue != newValue) {
notifyChange(
- new PropertyChangeRecord/*<T>*/(
+ new PropertyChangeRecord<T>(
this,
field,
oldValue,
diff --git a/lib/src/collections/observable_list.dart b/lib/src/collections/observable_list.dart
index bd92555..6e48e86 100644
--- a/lib/src/collections/observable_list.dart
+++ b/lib/src/collections/observable_list.dart
@@ -39,10 +39,10 @@
/// known usage is in `package:template_binding` - it will be upgraded before
/// removing this method.
@Deprecated('Use ListChangeRecord#apply instead')
- static void applyChangeRecords/*<T>*/(
- List/*<T>*/ previous,
- List/*<T>*/ current,
- List<ListChangeRecord/*<T>*/ > changes,
+ static void applyChangeRecords<T>(
+ List<T> previous,
+ List<T> current,
+ List<ListChangeRecord<T>> changes,
) {
if (identical(previous, current)) {
throw new ArgumentError("Can't use same list for previous and current");
@@ -58,11 +58,11 @@
///
/// This was moved into `ListDiffer.diff`.
@Deprecated('Use `ListDiffer.diff` instead')
- static List<ListChangeRecord/*<T>*/ > calculateChangeRecords/*<T>*/(
- List/*<T>*/ previous,
- List/*<T>*/ current,
+ static List<ListChangeRecord<T>> calculateChangeRecords<T>(
+ List<T> previous,
+ List<T> current,
) {
- return const ListDiffer/*<T>*/().diff(previous, current);
+ return const ListDiffer<T>().diff(previous, current);
}
/// Creates an observable list of the given [length].
@@ -186,16 +186,14 @@
}
@override
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
if (oldValue != newValue) {
_propChanges.notifyChange(
- new PropertyChangeRecord/*<T>*/(this, field, oldValue, newValue),
+ new PropertyChangeRecord<T>(this, field, oldValue, newValue),
);
}
return newValue;
@@ -505,12 +503,10 @@
}
@override
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
throw new UnsupportedError('Not modifiable');
}
diff --git a/lib/src/collections/observable_map.dart b/lib/src/collections/observable_map.dart
index f1c9191..3b9cc09 100644
--- a/lib/src/collections/observable_map.dart
+++ b/lib/src/collections/observable_map.dart
@@ -114,16 +114,14 @@
}
@override
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
if (oldValue != newValue) {
_allChanges.notifyChange(
- new PropertyChangeRecord/*<T>*/(this, field, oldValue, newValue),
+ new PropertyChangeRecord<T>(this, field, oldValue, newValue),
);
}
return newValue;
@@ -221,12 +219,10 @@
}
@override
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
throw new UnsupportedError('Not modifiable');
}
diff --git a/lib/src/collections/observable_set.dart b/lib/src/collections/observable_set.dart
index 79bd1d7..1117a29 100644
--- a/lib/src/collections/observable_set.dart
+++ b/lib/src/collections/observable_set.dart
@@ -200,12 +200,10 @@
}
@override
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
throw new UnsupportedError('Not modifiable');
}
diff --git a/lib/src/differs/list_differ.dart b/lib/src/differs/list_differ.dart
index 58004a7..78abd75 100644
--- a/lib/src/differs/list_differ.dart
+++ b/lib/src/differs/list_differ.dart
@@ -18,7 +18,7 @@
@override
List<ListChangeRecord<E>> diff(List<E> e1, List<E> e2) {
- return _calcSplices/*<E>*/(
+ return _calcSplices<E>(
e2,
_equality,
0,
@@ -48,11 +48,11 @@
// With 1-edit updates, the shortest path would be just to update all seven
// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
// leaves the substring '123' intact.
-List<List<int>> _calcEditDistance/*<E>*/(
- List/*<E>*/ current,
+List<List<int>> _calcEditDistance<E>(
+ List<E> current,
int currentStart,
int currentEnd,
- List/*<E>*/ old,
+ List<E> old,
int oldStart,
int oldEnd,
) {
@@ -134,10 +134,10 @@
return edits.reversed;
}
-int _sharedPrefix/*<E>*/(
- Equality/*<E>*/ equality,
- List/*<E>*/ e1,
- List/*<E>*/ e2,
+int _sharedPrefix<E>(
+ Equality<E> equality,
+ List<E> e1,
+ List<E> e2,
int searchLength,
) {
for (var i = 0; i < searchLength; i++) {
@@ -148,10 +148,10 @@
return searchLength;
}
-int _sharedSuffix/*<E>*/(
- Equality/*<E>*/ equality,
- List/*<E>*/ e1,
- List/*<E>*/ e2,
+int _sharedSuffix<E>(
+ Equality<E> equality,
+ List<E> e1,
+ List<E> e2,
int searchLength,
) {
var index1 = e1.length;
@@ -171,12 +171,12 @@
// Complexity: O(l * p)
// l: The length of the current array
// p: The length of the old array
-List<ListChangeRecord/*<E>*/ > _calcSplices/*<E>*/(
- List/*<E>*/ current,
- Equality/*<E>*/ equality,
+List<ListChangeRecord<E>> _calcSplices<E>(
+ List<E> current,
+ Equality<E> equality,
int currentStart,
int currentEnd,
- List/*<E>*/ old,
+ List<E> old,
int oldStart,
int oldEnd,
) {
@@ -212,7 +212,7 @@
if (currentStart == currentEnd) {
final spliceRemoved = old.sublist(oldStart, oldEnd);
return [
- new ListChangeRecord/*<E>*/ .remove(
+ new ListChangeRecord<E>.remove(
current,
currentStart,
spliceRemoved,
@@ -221,7 +221,7 @@
}
if (oldStart == oldEnd) {
return [
- new ListChangeRecord/*<E>*/ .add(
+ new ListChangeRecord<E>.add(
current,
currentStart,
currentEnd - currentStart,
@@ -241,17 +241,17 @@
);
var spliceIndex = -1;
- var spliceRemovals = /*<E>*/ [];
+ var spliceRemovals = <E>[];
var spliceAddedCount = 0;
bool hasSplice() => spliceIndex != -1;
void resetSplice() {
spliceIndex = -1;
- spliceRemovals = /*<E>*/ [];
+ spliceRemovals = <E>[];
spliceAddedCount = 0;
}
- var splices = <ListChangeRecord/*<E>*/ >[];
+ var splices = <ListChangeRecord<E>>[];
var index = currentStart;
var oldIndex = oldStart;
@@ -259,7 +259,7 @@
switch (op) {
case _Edit.leave:
if (hasSplice()) {
- splices.add(new ListChangeRecord/*<E>*/(
+ splices.add(new ListChangeRecord<E>(
current,
spliceIndex,
removed: spliceRemovals,
@@ -296,7 +296,7 @@
}
}
if (hasSplice()) {
- splices.add(new ListChangeRecord/*<E>*/(
+ splices.add(new ListChangeRecord<E>(
current,
spliceIndex,
removed: spliceRemovals,
@@ -304,7 +304,7 @@
));
}
assert(() {
- splices = new List<ListChangeRecord/*<E>*/ >.unmodifiable(splices);
+ splices = new List<ListChangeRecord<E>>.unmodifiable(splices);
return true;
});
return splices;
@@ -314,9 +314,9 @@
return math.min(end1, end2) - math.max(start1, start2);
}
-void _mergeSplices/*<E>*/(
- List<ListChangeRecord/*<E>*/ > splices,
- ListChangeRecord/*<E>*/ record,
+void _mergeSplices<E>(
+ List<ListChangeRecord<E>> splices,
+ ListChangeRecord<E> record,
) {
var spliceIndex = record.index;
var spliceRemoved = record.removed;
@@ -331,7 +331,7 @@
// - then continues and updates the subsequent splices with any offset diff.
for (var i = 0; i < splices.length; i++) {
var current = splices[i];
- current = splices[i] = new ListChangeRecord/*<E>*/(
+ current = splices[i] = new ListChangeRecord<E>(
current.object,
current.index + insertionOffset,
removed: current.removed,
@@ -386,7 +386,7 @@
inserted = true;
splices.insert(
i,
- new ListChangeRecord/*<E>*/(
+ new ListChangeRecord<E>(
record.object,
spliceIndex,
removed: spliceRemoved,
@@ -395,7 +395,7 @@
);
i++;
final offset = spliceAdded - spliceRemoved.length;
- current = splices[i] = new ListChangeRecord/*<E>*/(
+ current = splices[i] = new ListChangeRecord<E>(
current.object,
current.index + offset,
removed: current.removed,
@@ -405,7 +405,7 @@
}
}
if (!inserted) {
- splices.add(new ListChangeRecord/*<E>*/(
+ splices.add(new ListChangeRecord<E>(
record.object,
spliceIndex,
removed: spliceRemoved,
@@ -414,11 +414,11 @@
}
}
-List<ListChangeRecord/*<E>*/ > _createInitialSplices/*<E>*/(
- List/*<E>*/ list,
- List<ListChangeRecord/*<E>*/ > records,
+List<ListChangeRecord<E>> _createInitialSplices<E>(
+ List<E> list,
+ List<ListChangeRecord<E>> records,
) {
- final splices = <ListChangeRecord/*<E>*/ >[];
+ final splices = <ListChangeRecord<E>>[];
for (var i = 0; i < records.length; i++) {
_mergeSplices(splices, records[i]);
}
@@ -439,13 +439,13 @@
// Here, we inserted some records and then removed some of them.
// If someone processed these records naively, they would "play back" the
// insert incorrectly, because those items will be shifted.
-List<ListChangeRecord/*<E>*/ > projectListSplices/*<E>*/(
- List/*<E>*/ list,
- List<ListChangeRecord/*<E>*/ > records, [
- Equality/*<E>*/ equality = const DefaultEquality/*<E>*/(),
+List<ListChangeRecord<E>> projectListSplices<E>(
+ List<E> list,
+ List<ListChangeRecord<E>> records, [
+ Equality<E> equality = const DefaultEquality(),
]) {
if (records.length <= 1) return records;
- final splices = <ListChangeRecord/*<E>*/ >[];
+ final splices = <ListChangeRecord<E>>[];
final initialSplices = _createInitialSplices(list, records);
for (final splice in initialSplices) {
if (splice.addedCount == 1 && splice.removed.length == 1) {
diff --git a/lib/src/internal.dart b/lib/src/internal.dart
index d0ae2e1..780e317 100644
--- a/lib/src/internal.dart
+++ b/lib/src/internal.dart
@@ -2,10 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-List/*<E>*/ freezeInDevMode/*<E>*/(List/*<E>*/ list) {
+List<E> freezeInDevMode<E>(List<E> list) {
if (list == null) return const [];
assert(() {
- list = new List/*<E>*/ .unmodifiable(list);
+ list = new List<E>.unmodifiable(list);
return true;
});
return list;
diff --git a/lib/src/observable.dart b/lib/src/observable.dart
index de9c637..1688202 100644
--- a/lib/src/observable.dart
+++ b/lib/src/observable.dart
@@ -71,12 +71,10 @@
/// If you are using a typed `implements/extends Observable<C>`, it is illegal
/// to call this method - will throw an [UnsupportedError] when called.
@Deprecated('Use PropertyChangeNotifier')
- /*=T*/ notifyPropertyChange/*<T>*/(
+ T notifyPropertyChange<T>(
Symbol field,
- /*=T*/
- oldValue,
- /*=T*/
- newValue,
+ T oldValue,
+ T newValue,
) {
if (hasObservers && oldValue != newValue && _supportsPropertyChanges) {
notifyChange(
diff --git a/lib/src/records/list_change_record.dart b/lib/src/records/list_change_record.dart
index 59867b2..1fd81c7 100644
--- a/lib/src/records/list_change_record.dart
+++ b/lib/src/records/list_change_record.dart
@@ -41,7 +41,7 @@
/// Records a `remove` operation at `object[index]` of [removed] elements.
ListChangeRecord.remove(this.object, this.index, List<E> removed)
- : this.removed = freezeInDevMode/*<E>*/(removed),
+ : this.removed = freezeInDevMode<E>(removed),
this.addedCount = 0 {
_assertValidState();
}
@@ -51,7 +51,7 @@
/// If [addedCount] is not specified it defaults to `removed.length`.
ListChangeRecord.replace(this.object, this.index, List<E> removed,
[int addedCount])
- : this.removed = freezeInDevMode/*<E>*/(removed),
+ : this.removed = freezeInDevMode<E>(removed),
this.addedCount = addedCount ?? removed.length {
_assertValidState();
}