Skip to content

Commit 917cfc7

Browse files
authored
Merge pull request #42 from rwjblue/revert-predicate-deduping
Revert "Update predicate based macros replace predicate when prefixing with it."
2 parents 4275b02 + 0c183a3 commit 917cfc7

File tree

5 files changed

+12
-32
lines changed

5 files changed

+12
-32
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
(true && !((() => true)()) && console.assert(false, 'This is an assertion'));
1+
(true && !((() => true)()) && console.assert((() => true)(), 'This is an assertion'));
22
(true && !(false) && console.assert(false, 'This is an assertion 2'));

fixtures/ember-cli-babel-config/expectation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ if (true) {
55
}
66

77
(true && Ember.warn('This is a warning'));
8-
(true && !(foo) && Ember.assert('Hahahaha', false));
9-
(true && !(false) && Ember.assert('without predicate', false));
10-
(true && !(true) && Ember.deprecate('This thing is donzo', false, {
8+
(true && !(foo) && Ember.assert('Hahahaha', foo));
9+
(true && !(false) && Ember.assert('without predicate'));
10+
(true && !(true) && Ember.deprecate('This thing is donzo', true, {
1111
id: 'donzo',
1212
until: '4.0.0',
1313
url: 'http://example.com'

fixtures/global-external-helpers/expectation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(true && __debugHelpers__.warn('This is a warning'));
22
(true && __debugHelpers__.assert('Hahahaha', foo));
3-
(true && !(true) && __debugHelpers__.deprecate('This thing is donzo', false, {
3+
(true && !(true) && __debugHelpers__.deprecate('This thing is donzo', true, {
44
id: 'donzo',
55
until: '4.0.0',
66
url: 'http://example.com'

fixtures/retain-module-external-helpers/expectation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { warn, assert, deprecate } from '@ember/debug-tools';
22

33
(true && warn('This is a warning'));
44
(true && assert('Hahahaha', false));
5-
(true && !(true) && deprecate('This thing is donzo', false, {
5+
(true && !(true) && deprecate('This thing is donzo', true, {
66
id: 'donzo',
77
until: '4.0.0',
88
url: 'http://example.com'

src/lib/utils/builder.js

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,19 @@ export default class Builder {
1616
*
1717
* ($DEBUG && console.assert($PREDICATE, $MESSAGE));
1818
*
19-
* or (when `assertPredicateIndex` specified)
20-
*
21-
* ($DEBUG && $PREDICATE && console.assert(false, $MESSAGE));
22-
*
23-
* or (`{ externalizeHelpers: { module: true } }`)
19+
* or
2420
*
2521
* ($DEBUG && assert($PREDICATE, $MESSAGE));
2622
*
27-
* or (when `{ externalizeHelpers: { module: true }, debugTools: { source: '...', assertPredicateIndex: 0 } }` specified)
28-
*
29-
* ($DEBUG && $PREDICATE && assert(false, $MESSAGE));
30-
*
31-
* or (when `{ externalizeHelpers: { global: '$GLOBLA_NS' }` specified)
23+
* or
3224
*
3325
* ($DEBUG && $GLOBAL_NS.assert($PREDICATE, $MESSAGE));
34-
*
35-
* or (when `{ externalizeHelpers: { global: '$GLOBLA_NS' }, debugTools: { source: '...', assertPredicateIndex: 0 } }` specified)
36-
*
37-
* ($DEBUG && $PREDICATE && $GLOBAL_NS.assert(false, $MESSAGE));
3826
*/
3927
assert(path) {
4028
let predicate;
4129
if (this.assertPredicateIndex !== undefined) {
4230
predicate = (expression, args) => {
43-
let predicate = args[this.assertPredicateIndex];
44-
args[this.assertPredicateIndex] = this.t.identifier('false');
45-
46-
return predicate;
31+
return args[this.assertPredicateIndex];
4732
};
4833
}
4934

@@ -149,20 +134,15 @@ export default class Builder {
149134
*
150135
* or
151136
*
152-
* ($DEBUG && $PREDICATE && deprecate($MESSAGE, false, { $ID, $URL, $UNTIL }));
137+
* ($DEBUG && $PREDICATE && deprecate($MESSAGE, $PREDICATE, { $ID, $URL, $UNTIL }));
153138
*
154139
* or
155140
*
156-
* ($DEBUG && $PREDICATE && $GLOBAL_NS.deprecate($MESSAGE, false, { $ID, $URL, $UNTIL }));
141+
* ($DEBUG && $PREDICATE && $GLOBAL_NS.deprecate($MESSAGE, $PREDICATE, { $ID, $URL, $UNTIL }));
157142
*/
158143
deprecate(path) {
159144
this._createMacroExpression(path, {
160-
predicate: (expression, args) => {
161-
let [, predicate] = args;
162-
args[1] = this.t.identifier('false');
163-
164-
return predicate;
165-
},
145+
predicate: (expression, args) => args[1],
166146

167147
buildConsoleAPI: (expression, args) => {
168148
let [message] = args;

0 commit comments

Comments
 (0)