Skip to content

Commit 534cfbc

Browse files
author
Robert Jackson
committed
Cleanup meta's native WeakMap support.
1 parent 5c9b1d5 commit 534cfbc

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

packages/ember-metal/lib/meta.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
// Remove "use strict"; from transpiled module until
33
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
44

5-
import { EmptyObject, lookupDescriptor, symbol } from 'ember-utils';
5+
import {
6+
EmptyObject,
7+
lookupDescriptor,
8+
symbol,
9+
HAS_NATIVE_WEAKMAP
10+
} from 'ember-utils';
611
import isEnabled from './features';
712
import { protoMethods as listenerMethods } from './meta_listeners';
813
import { runInDebug } from './debug';
@@ -365,17 +370,6 @@ if (isEnabled('mandatory-setter')) {
365370
};
366371
}
367372

368-
const HAS_NATIVE_WEAKMAP = (function() {
369-
// detect if `WeakMap` is even present
370-
let hasWeakMap = typeof WeakMap === 'function';
371-
if (!hasWeakMap) { return false; }
372-
373-
let instance = new WeakMap();
374-
// use `Object`'s `.toString` directly to prevent us from detecting
375-
// polyfills as native weakmaps
376-
return Object.prototype.toString.call(instance) === '[object WeakMap]';
377-
})();
378-
379373
let setMeta, peekMeta, deleteMeta;
380374

381375
// choose the one appropriate for given platform
@@ -389,12 +383,6 @@ if (HAS_NATIVE_WEAKMAP) {
389383
};
390384

391385
peekMeta = function WeakMap_peekMeta(obj) {
392-
runInDebug(() => counters.peekCalls++);
393-
394-
return metaStore.get(obj);
395-
};
396-
397-
peekMeta = function WeakMap_peekParentMeta(obj) {
398386
let pointer = obj;
399387
let meta;
400388
while (pointer) {

0 commit comments

Comments
 (0)