|
@@ -22,8 +22,6 @@
|
|
|
|
|
|
package js.lib;
|
|
package js.lib;
|
|
|
|
|
|
-import js.lib.Map.MapEntry;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
The `js.Set` object lets you store unique values of any type, whether
|
|
The `js.Set` object lets you store unique values of any type, whether
|
|
primitive values or object references.
|
|
primitive values or object references.
|
|
@@ -95,41 +93,38 @@ extern class Set<T> {
|
|
This is kept similar to the `js.Map` object, so that each entry has the
|
|
This is kept similar to the `js.Map` object, so that each entry has the
|
|
same value for its key and value here.
|
|
same value for its key and value here.
|
|
**/
|
|
**/
|
|
- function entries():js.lib.Iterator<MapEntry<T, T>>;
|
|
|
|
|
|
+ function entries():js.lib.Iterator<KeyValue<T, T>>;
|
|
|
|
|
|
- inline function iterator(): HaxeIterator<T> {
|
|
|
|
|
|
+ inline function iterator():HaxeIterator<T> {
|
|
return new HaxeIterator(this.values());
|
|
return new HaxeIterator(this.values());
|
|
}
|
|
}
|
|
|
|
|
|
- inline function keyValueIterator(): SetKeyValueIterator<T> {
|
|
|
|
|
|
+ inline function keyValueIterator():SetKeyValueIterator<T> {
|
|
return new SetKeyValueIterator(this);
|
|
return new SetKeyValueIterator(this);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
key => value iterator for js.lib.Set, tracking the entry index for the key to match the behavior of haxe.ds.List
|
|
key => value iterator for js.lib.Set, tracking the entry index for the key to match the behavior of haxe.ds.List
|
|
**/
|
|
**/
|
|
class SetKeyValueIterator<T> {
|
|
class SetKeyValueIterator<T> {
|
|
-
|
|
|
|
- final set: js.lib.Set<T>;
|
|
|
|
- final values: HaxeIterator<T>;
|
|
|
|
|
|
+ final set:js.lib.Set<T>;
|
|
|
|
+ final values:HaxeIterator<T>;
|
|
var index = 0;
|
|
var index = 0;
|
|
|
|
|
|
- public inline function new(set: js.lib.Set<T>) {
|
|
|
|
|
|
+ public inline function new(set:js.lib.Set<T>) {
|
|
this.set = set;
|
|
this.set = set;
|
|
this.values = new HaxeIterator(set.values());
|
|
this.values = new HaxeIterator(set.values());
|
|
}
|
|
}
|
|
|
|
|
|
- public inline function hasNext() : Bool {
|
|
|
|
|
|
+ public inline function hasNext():Bool {
|
|
return values.hasNext();
|
|
return values.hasNext();
|
|
}
|
|
}
|
|
|
|
|
|
- public inline function next() : {key: Int, value: T} {
|
|
|
|
|
|
+ public inline function next():{key:Int, value:T} {
|
|
return {
|
|
return {
|
|
key: index++,
|
|
key: index++,
|
|
value: values.next(),
|
|
value: values.next(),
|
|
};
|
|
};
|
|
}
|
|
}
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+}
|