Skip to content

Commit

Permalink
Revert change to size.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Aug 9, 2016
1 parent 2d7a7e7 commit e943685
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 52 deletions.
38 changes: 14 additions & 24 deletions Reflect.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Reflect.js.map

Large diffs are not rendered by default.

30 changes: 6 additions & 24 deletions Reflect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ namespace Reflect {
private _values: V[] = [];
private _cacheKey = cacheSentinel;
private _cacheIndex = -2;
size = 0;
get size() { return this._keys.length; }
has(key: K): boolean { return this._find(key, /*insert*/ false) >= 0; }
get(key: K): V {
const index = this._find(key, /*insert*/ false);
Expand All @@ -1293,7 +1293,6 @@ namespace Reflect {
this._keys[i - 1] = this._keys[i];
this._values[i - 1] = this._values[i];
}
this.size--;
this._keys.length--;
this._values.length--;
this._cacheKey = cacheSentinel;
Expand All @@ -1303,7 +1302,6 @@ namespace Reflect {
return false;
}
clear(): void {
this.size = 0;
this._keys.length = 0;
this._values.length = 0;
this._cacheKey = cacheSentinel;
Expand All @@ -1319,7 +1317,6 @@ namespace Reflect {
index = this._keys.length;
this._keys.push(key);
this._values.push(undefined);
this.size++;
}
return this._cacheKey = key, this._cacheIndex = index;
}
Expand All @@ -1330,26 +1327,11 @@ namespace Reflect {
function CreateSetPolyfill(): SetConstructor {
return class Set<T> {
private _map = new _Map<any, any>();
size = 0;
has(value: T): boolean {
return this._map.has(value);
}
add(value: T): Set<T> {
this._map.set(value, value);
this.size = this._map.size;
return this;
}
delete(value: T): boolean {
if (this._map.delete(value)) {
this.size--;
return true;
}
return false;
}
clear(): void {
this.size = 0;
this._map.clear();
}
get size() { return this._map.size; }
has(value: T): boolean { return this._map.has(value); }
add(value: T): Set<T> { return this._map.set(value, value), this; }
delete(value: T): boolean { return this._map.delete(value); }
clear(): void { this._map.clear(); }
keys() { return this._map.keys(); }
values() { return this._map.values(); }
entries() { return this._map.entries(); }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reflect-metadata",
"version": "0.1.6",
"version": "0.1.7",
"description": "Polyfill for Metadata Reflection API",
"main": "Reflect.js",
"typings": "typings.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es3",
"target": "es5",
"noImplicitAny": true,
"sourceMap": true,
"module": "commonjs",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es3",
"target": "es5",
"noImplicitAny": true,
"sourceMap": true
},
Expand Down

0 comments on commit e943685

Please sign in to comment.