Skip to content

Commit e081a30

Browse files
author
Robert Jackson
committed
Cleanup meta's native WeakMap support.
1 parent 460aad4 commit e081a30

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, assert } from './debug';
@@ -448,17 +453,6 @@ if (isEnabled('mandatory-setter')) {
448453
};
449454
}
450455

451-
const HAS_NATIVE_WEAKMAP = (function() {
452-
// detect if `WeakMap` is even present
453-
let hasWeakMap = typeof WeakMap === 'function';
454-
if (!hasWeakMap) { return false; }
455-
456-
let instance = new WeakMap();
457-
// use `Object`'s `.toString` directly to prevent us from detecting
458-
// polyfills as native weakmaps
459-
return Object.prototype.toString.call(instance) === '[object WeakMap]';
460-
})();
461-
462456
let setMeta, peekMeta;
463457

464458
// choose the one appropriate for given platform
@@ -472,12 +466,6 @@ if (HAS_NATIVE_WEAKMAP) {
472466
};
473467

474468
peekMeta = function WeakMap_peekMeta(obj) {
475-
runInDebug(() => counters.peekCalls++);
476-
477-
return metaStore.get(obj);
478-
};
479-
480-
peekMeta = function WeakMap_peekParentMeta(obj) {
481469
let pointer = obj;
482470
let meta;
483471
while (pointer) {

0 commit comments

Comments
 (0)