|
1 |
| -import { computed, isElementDescriptor, alias, expandProperties } from '@ember/-internals/metal'; |
| 1 | +import { computed, isDecoratorCall, alias, expandProperties } from '@ember/-internals/metal'; |
2 | 2 | import { get, set } from '@ember/object';
|
3 | 3 | import type { DeprecationOptions } from '@ember/debug';
|
4 | 4 | import { assert, deprecate } from '@ember/debug';
|
@@ -33,7 +33,7 @@ function generateComputedWithPredicate(name: string, predicate: (value: unknown)
|
33 | 33 |
|
34 | 34 | assert(
|
35 | 35 | `You attempted to use @${name} as a decorator directly, but it requires at least one dependent key parameter`,
|
36 |
| - !isElementDescriptor(properties) |
| 36 | + !isDecoratorCall(properties) |
37 | 37 | );
|
38 | 38 |
|
39 | 39 | let dependentKeys = expandPropertiesToArray(name, properties);
|
@@ -98,7 +98,7 @@ function generateComputedWithPredicate(name: string, predicate: (value: unknown)
|
98 | 98 | export function empty(dependentKey: string) {
|
99 | 99 | assert(
|
100 | 100 | 'You attempted to use @empty as a decorator directly, but it requires a `dependentKey` parameter',
|
101 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 101 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
102 | 102 | );
|
103 | 103 |
|
104 | 104 | return computed(`${dependentKey}.length`, function () {
|
@@ -144,7 +144,7 @@ export function empty(dependentKey: string) {
|
144 | 144 | export function notEmpty(dependentKey: string) {
|
145 | 145 | assert(
|
146 | 146 | 'You attempted to use @notEmpty as a decorator directly, but it requires a `dependentKey` parameter',
|
147 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 147 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
148 | 148 | );
|
149 | 149 |
|
150 | 150 | return computed(`${dependentKey}.length`, function () {
|
@@ -187,7 +187,7 @@ export function notEmpty(dependentKey: string) {
|
187 | 187 | export function none(dependentKey: string) {
|
188 | 188 | assert(
|
189 | 189 | 'You attempted to use @none as a decorator directly, but it requires a `dependentKey` parameter',
|
190 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 190 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
191 | 191 | );
|
192 | 192 |
|
193 | 193 | return computed(dependentKey, function () {
|
@@ -229,7 +229,7 @@ export function none(dependentKey: string) {
|
229 | 229 | export function not(dependentKey: string) {
|
230 | 230 | assert(
|
231 | 231 | 'You attempted to use @not as a decorator directly, but it requires a `dependentKey` parameter',
|
232 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 232 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
233 | 233 | );
|
234 | 234 |
|
235 | 235 | return computed(dependentKey, function () {
|
@@ -277,7 +277,7 @@ export function not(dependentKey: string) {
|
277 | 277 | export function bool(dependentKey: string) {
|
278 | 278 | assert(
|
279 | 279 | 'You attempted to use @bool as a decorator directly, but it requires a `dependentKey` parameter',
|
280 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 280 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
281 | 281 | );
|
282 | 282 |
|
283 | 283 | return computed(dependentKey, function () {
|
@@ -323,7 +323,7 @@ export function bool(dependentKey: string) {
|
323 | 323 | export function match(dependentKey: string, regexp: RegExp) {
|
324 | 324 | assert(
|
325 | 325 | 'You attempted to use @match as a decorator directly, but it requires `dependentKey` and `regexp` parameters',
|
326 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 326 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
327 | 327 | );
|
328 | 328 |
|
329 | 329 | return computed(dependentKey, function () {
|
@@ -369,7 +369,7 @@ export function match(dependentKey: string, regexp: RegExp) {
|
369 | 369 | export function equal(dependentKey: string, value: unknown) {
|
370 | 370 | assert(
|
371 | 371 | 'You attempted to use @equal as a decorator directly, but it requires `dependentKey` and `value` parameter',
|
372 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 372 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
373 | 373 | );
|
374 | 374 |
|
375 | 375 | return computed(dependentKey, function () {
|
@@ -414,7 +414,7 @@ export function equal(dependentKey: string, value: unknown) {
|
414 | 414 | export function gt(dependentKey: string, value: number) {
|
415 | 415 | assert(
|
416 | 416 | 'You attempted to use @gt as a decorator directly, but it requires `dependentKey` and `value` parameters',
|
417 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 417 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
418 | 418 | );
|
419 | 419 |
|
420 | 420 | return computed(dependentKey, function () {
|
@@ -459,7 +459,7 @@ export function gt(dependentKey: string, value: number) {
|
459 | 459 | export function gte(dependentKey: string, value: number) {
|
460 | 460 | assert(
|
461 | 461 | 'You attempted to use @gte as a decorator directly, but it requires `dependentKey` and `value` parameters',
|
462 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 462 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
463 | 463 | );
|
464 | 464 |
|
465 | 465 | return computed(dependentKey, function () {
|
@@ -504,7 +504,7 @@ export function gte(dependentKey: string, value: number) {
|
504 | 504 | export function lt(dependentKey: string, value: number) {
|
505 | 505 | assert(
|
506 | 506 | 'You attempted to use @lt as a decorator directly, but it requires `dependentKey` and `value` parameters',
|
507 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 507 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
508 | 508 | );
|
509 | 509 |
|
510 | 510 | return computed(dependentKey, function () {
|
@@ -549,7 +549,7 @@ export function lt(dependentKey: string, value: number) {
|
549 | 549 | export function lte(dependentKey: string, value: number) {
|
550 | 550 | assert(
|
551 | 551 | 'You attempted to use @lte as a decorator directly, but it requires `dependentKey` and `value` parameters',
|
552 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 552 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
553 | 553 | );
|
554 | 554 |
|
555 | 555 | return computed(dependentKey, function () {
|
@@ -723,7 +723,7 @@ export const or = generateComputedWithPredicate('or', (value) => !value);
|
723 | 723 | export function oneWay(dependentKey: string) {
|
724 | 724 | assert(
|
725 | 725 | 'You attempted to use @oneWay as a decorator directly, but it requires a `dependentKey` parameter',
|
726 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 726 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
727 | 727 | );
|
728 | 728 |
|
729 | 729 | return alias(dependentKey).oneWay() as PropertyDecorator;
|
@@ -787,7 +787,7 @@ export function oneWay(dependentKey: string) {
|
787 | 787 | export function readOnly(dependentKey: string) {
|
788 | 788 | assert(
|
789 | 789 | 'You attempted to use @readOnly as a decorator directly, but it requires a `dependentKey` parameter',
|
790 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 790 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
791 | 791 | );
|
792 | 792 |
|
793 | 793 | return alias(dependentKey).readOnly() as PropertyDecorator;
|
@@ -831,7 +831,7 @@ export function readOnly(dependentKey: string) {
|
831 | 831 | export function deprecatingAlias(dependentKey: string, options: DeprecationOptions) {
|
832 | 832 | assert(
|
833 | 833 | 'You attempted to use @deprecatingAlias as a decorator directly, but it requires `dependentKey` and `options` parameters',
|
834 |
| - !isElementDescriptor(Array.prototype.slice.call(arguments)) |
| 834 | + !isDecoratorCall(Array.prototype.slice.call(arguments)) |
835 | 835 | );
|
836 | 836 |
|
837 | 837 | return computed(dependentKey, {
|
|
0 commit comments