Skip to content

Commit 81ef8d4

Browse files
committed
[BUGFIX] properly surface deprecation message
I think wrapping these in LOCAL_DEBUG ends up causing these to not actually be seen by anyone. It's also unnecessary, `deprecate` should already be pluggable/strippable in Ember, but it probably doesn't matter in this case anyway, because most of the time the compiler isn't shipped to the browser anyway and should be (???) running in dev mode by default? I hope? Anyway if that last part isn't true and these still aren't being seen, then it would be something to fix in Ember.
1 parent dc76897 commit 81ef8d4

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

packages/@glimmer/syntax/lib/traversal/traverse.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { LOCAL_DEBUG } from '@glimmer/local-debug-flags';
21
import { deprecate, unwrap } from '@glimmer/util';
32

43
import type * as ASTv1 from '../v1/api';
@@ -70,11 +69,9 @@ function getNodeHandler<N extends ASTv1.Node>(
7069
): NodeTraversal<ASTv1.Node> | undefined {
7170
if (nodeType === 'Template' || nodeType === 'Block') {
7271
if (visitor.Program) {
73-
if (LOCAL_DEBUG) {
74-
deprecate(
75-
`The 'Program' visitor node is deprecated. Use 'Template' or 'Block' instead (node was '${nodeType}') `
76-
);
77-
}
72+
deprecate(
73+
`The 'Program' visitor node is deprecated. Use 'Template' or 'Block' instead (node was '${nodeType}') `
74+
);
7875

7976
return visitor.Program as NodeTraversal<ASTv1.Node>;
8077
}

packages/@glimmer/syntax/lib/v1/public-builders.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Dict, Nullable } from '@glimmer/interfaces';
2-
import { LOCAL_DEBUG } from '@glimmer/local-debug-flags';
32
import { asPresentArray, assert, assign, deprecate, isPresentArray } from '@glimmer/util';
43

54
import type { SourceLocation, SourcePosition } from '../source/location';
@@ -66,19 +65,15 @@ function buildBlock(
6665
let elseBlock: Nullable<ASTv1.Block> | undefined;
6766

6867
if (_defaultBlock.type === 'Template') {
69-
if (LOCAL_DEBUG) {
70-
deprecate(`b.program is deprecated. Use b.blockItself instead.`);
71-
}
68+
deprecate(`b.program is deprecated. Use b.blockItself instead.`);
7269

7370
defaultBlock = assign({}, _defaultBlock, { type: 'Block' }) as unknown as ASTv1.Block;
7471
} else {
7572
defaultBlock = _defaultBlock;
7673
}
7774

7875
if (_elseBlock !== undefined && _elseBlock !== null && _elseBlock.type === 'Template') {
79-
if (LOCAL_DEBUG) {
80-
deprecate(`b.program is deprecated. Use b.blockItself instead.`);
81-
}
76+
deprecate(`b.program is deprecated. Use b.blockItself instead.`);
8277

8378
elseBlock = assign({}, _elseBlock, { type: 'Block' }) as unknown as ASTv1.Block;
8479
} else {

0 commit comments

Comments
 (0)