Skip to content

Commit

Permalink
Remove copy & Copyable
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Jul 18, 2021
1 parent 3d93487 commit e3b80e4
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 298 deletions.
2 changes: 0 additions & 2 deletions packages/@ember/-internals/runtime/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { default as Object, FrameworkObject } from './lib/system/object';
export { default as RegistryProxyMixin } from './lib/mixins/registry_proxy';
export { default as ContainerProxyMixin } from './lib/mixins/container_proxy';
export { default as copy } from './lib/copy';
export { default as compare } from './lib/compare';
export { default as isEqual } from './lib/is-equal';
export {
Expand All @@ -19,7 +18,6 @@ export { default as ArrayProxy } from './lib/system/array_proxy';
export { default as ObjectProxy } from './lib/system/object_proxy';
export { default as CoreObject } from './lib/system/core_object';
export { default as ActionHandler } from './lib/mixins/action_handler';
export { default as Copyable } from './lib/mixins/copyable';
export { default as Enumerable } from './lib/mixins/enumerable';
export { default as _ProxyMixin, contentFor as _contentFor } from './lib/mixins/-proxy';
export { default as Observable } from './lib/mixins/observable';
Expand Down
120 changes: 0 additions & 120 deletions packages/@ember/-internals/runtime/lib/copy.js

This file was deleted.

34 changes: 0 additions & 34 deletions packages/@ember/-internals/runtime/lib/mixins/copyable.js

This file was deleted.

This file was deleted.

64 changes: 0 additions & 64 deletions packages/@ember/-internals/runtime/tests/core/copy_test.js

This file was deleted.

61 changes: 2 additions & 59 deletions packages/@ember/-internals/runtime/tests/helpers/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import EmberArray, { A as emberA, MutableArray } from '../../lib/mixins/array';
import { generateGuid, guidFor } from '@ember/-internals/utils';
import {
get,
set,
computed,
addArrayObserver,
removeArrayObserver,
arrayContentWillChange,
arrayContentDidChange,
} from '@ember/-internals/metal';
import EmberObject from '../../lib/system/object';
import Copyable from '../../lib/mixins/copyable';
import { moduleFor } from 'internal-test-helpers';

export function newFixture(cnt) {
Expand Down Expand Up @@ -147,42 +145,6 @@ class NativeArrayHelpers extends AbstractArrayHelper {
}
}

class CopyableNativeArray extends AbstractArrayHelper {
newObject() {
return emberA([generateGuid()]);
}

isEqual(a, b) {
if (!(a instanceof Array)) {
return false;
}

if (!(b instanceof Array)) {
return false;
}

if (a.length !== b.length) {
return false;
}

return a[0] === b[0];
}
}

class CopyableArray extends AbstractArrayHelper {
newObject() {
return CopyableObject.create();
}

isEqual(a, b) {
if (!(a instanceof CopyableObject) || !(b instanceof CopyableObject)) {
return false;
}

return get(a, 'id') === get(b, 'id');
}
}

class ArrayProxyHelpers extends AbstractArrayHelper {
newObject(ary) {
return ArrayProxy.create({ content: emberA(super.newObject(ary)) });
Expand Down Expand Up @@ -271,21 +233,6 @@ const TestMutableArray = EmberObject.extend(MutableArray, {
},
});

const CopyableObject = EmberObject.extend(Copyable, {
id: null,

init() {
this._super(...arguments);
set(this, 'id', generateGuid());
},

copy() {
let ret = CopyableObject.create();
set(ret, 'id', get(this, 'id'));
return ret;
},
});

class MutableArrayHelpers extends NativeArrayHelpers {
newObject(ary) {
return TestMutableArray.create(super.newObject(ary));
Expand Down Expand Up @@ -316,15 +263,11 @@ export function runArrayTests(name, Tests, ...types) {
case 'MutableArray':
moduleFor(`MutableArray: ${name}`, Tests, MutableArrayHelpers);
break;
case 'CopyableArray':
moduleFor(`CopyableArray: ${name}`, Tests, CopyableArray);
break;
case 'CopyableNativeArray':
moduleFor(`CopyableNativeArray: ${name}`, Tests, CopyableNativeArray);
break;
case 'NativeArray':
moduleFor(`NativeArray: ${name}`, Tests, NativeArrayHelpers);
break;
default:
throw new Error(`runArrayTests passed unexpected type ${type}`);
}
});
} else {
Expand Down
1 change: 0 additions & 1 deletion packages/@ember/object/internals.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { getCachedValueFor as cacheFor } from '@ember/-internals/metal';
export { copy } from '@ember/-internals/runtime';
export { guidFor } from '@ember/-internals/utils';
4 changes: 0 additions & 4 deletions packages/ember/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ import {
RegistryProxyMixin,
ContainerProxyMixin,
compare,
copy,
isEqual,
Array as EmberArray,
Copyable,
MutableEnumerable,
MutableArray,
TargetActionSupport,
Expand Down Expand Up @@ -397,7 +395,6 @@ Ember.Object = EmberObject;
Ember._RegistryProxyMixin = RegistryProxyMixin;
Ember._ContainerProxyMixin = ContainerProxyMixin;
Ember.compare = compare;
Ember.copy = copy;
Ember.isEqual = isEqual;

/**
Expand Down Expand Up @@ -430,7 +427,6 @@ Ember.ObjectProxy = ObjectProxy;
Ember.ActionHandler = ActionHandler;
Ember.CoreObject = CoreObject;
Ember.NativeArray = NativeArray;
Ember.Copyable = Copyable;
Ember.MutableEnumerable = MutableEnumerable;
Ember.MutableArray = MutableArray;
Ember.Evented = Evented;
Expand Down
2 changes: 0 additions & 2 deletions packages/ember/tests/reexports_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ let allExports = [

// @ember/object/internals
['cacheFor', '@ember/object/internals', 'cacheFor'],
['copy', '@ember/object/internals', 'copy'],
['guidFor', '@ember/object/internals', 'guidFor'],

// @ember/object/mixin
Expand Down Expand Up @@ -546,7 +545,6 @@ let allExports = [
['Comparable', '@ember/-internals/runtime'],
['ActionHandler', '@ember/-internals/runtime'],
['NativeArray', '@ember/-internals/runtime'],
['Copyable', '@ember/-internals/runtime'],
['MutableEnumerable', '@ember/-internals/runtime'],
EMBER_MODERNIZED_BUILT_IN_COMPONENTS
? null
Expand Down

0 comments on commit e3b80e4

Please sign in to comment.