File tree 6 files changed +14
-52
lines changed
packages/@glimmer/syntax/lib
6 files changed +14
-52
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ export abstract class HandlebarsNodeVisitors extends Parser {
35
35
abstract override beginAttributeValue ( quoted : boolean ) : void ;
36
36
abstract override finishAttributeValue ( ) : void ;
37
37
38
- parse ( program : HBS . Program , locals : string [ ] ) : ASTv1 . Template {
38
+ parse ( program : HBS . Program , blockParams : string [ ] ) : ASTv1 . Template {
39
39
let node = b . template ( {
40
40
body : [ ] ,
41
- locals ,
41
+ blockParams ,
42
42
loc : this . source . spanFor ( program . loc ) ,
43
43
} ) ;
44
44
Original file line number Diff line number Diff line change @@ -5,35 +5,6 @@ import type * as ASTv1 from './nodes-v1';
5
5
6
6
import b from './public-builders' ;
7
7
8
- export type TemplateParams = Omit < ASTv1 . Template , 'type' | 'blockParams' > ;
9
-
10
- export function buildLegacyTemplate ( { body, locals, loc } : TemplateParams ) : ASTv1 . Template {
11
- const node = {
12
- type : 'Template' ,
13
- body,
14
- locals,
15
- loc,
16
- } ;
17
-
18
- Object . defineProperty ( node , 'blockParams' , {
19
- enumerable : false ,
20
- get ( ) : string [ ] {
21
- deprecate (
22
- `Template nodes can never have block params, for in-scope variables, use locals instead`
23
- ) ;
24
- return this . locals ;
25
- } ,
26
- set ( value : string [ ] ) {
27
- deprecate (
28
- `Template nodes can never have block params, for in-scope variables, use locals instead`
29
- ) ;
30
- this . locals = value ;
31
- } ,
32
- } ) ;
33
-
34
- return node as ASTv1 . Template ;
35
- }
36
-
37
8
export type MustacheStatementParams = Omit < ASTv1 . MustacheStatement , 'type' | 'escaped' > ;
38
9
39
10
export function buildLegacyMustache ( {
Original file line number Diff line number Diff line change @@ -29,11 +29,6 @@ export type EntityEncodingState = 'transformed' | 'raw';
29
29
30
30
export interface Template extends CommonProgram {
31
31
type : 'Template' ;
32
- locals : string [ ] ;
33
-
34
- /**
35
- * @deprecated use locals instead
36
- */
37
32
blockParams : string [ ] ;
38
33
}
39
34
Original file line number Diff line number Diff line change @@ -4,12 +4,7 @@ import { assert } from '@glimmer/util';
4
4
import type * as ASTv1 from './api' ;
5
5
6
6
import { SourceSpan } from '../source/span' ;
7
- import {
8
- buildLegacyLiteral ,
9
- buildLegacyMustache ,
10
- buildLegacyPath ,
11
- buildLegacyTemplate ,
12
- } from './legacy-interop' ;
7
+ import { buildLegacyLiteral , buildLegacyMustache , buildLegacyPath } from './legacy-interop' ;
13
8
14
9
const DEFAULT_STRIP = {
15
10
close : false ,
@@ -60,18 +55,19 @@ class Builders {
60
55
61
56
template ( {
62
57
body,
63
- locals ,
58
+ blockParams ,
64
59
loc,
65
60
} : {
66
61
body : ASTv1 . Statement [ ] ;
67
- locals : string [ ] ;
62
+ blockParams : string [ ] ;
68
63
loc : SourceSpan ;
69
64
} ) : ASTv1 . Template {
70
- return buildLegacyTemplate ( {
65
+ return {
66
+ type : 'Template' ,
71
67
body,
72
- locals ,
68
+ blockParams ,
73
69
loc,
74
- } ) ;
70
+ } ;
75
71
}
76
72
77
73
mustache ( {
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ function buildBlock(
68
68
if ( _defaultBlock . type === 'Template' ) {
69
69
deprecate ( `b.program is deprecated. Use b.blockItself instead.` ) ;
70
70
defaultBlock = b . blockItself ( {
71
- params : buildBlockParams ( _defaultBlock . locals ) ,
71
+ params : buildBlockParams ( _defaultBlock . blockParams ) ,
72
72
body : _defaultBlock . body ,
73
73
loc : _defaultBlock . loc ,
74
74
} ) ;
@@ -78,7 +78,7 @@ function buildBlock(
78
78
79
79
if ( _elseBlock ?. type === 'Template' ) {
80
80
deprecate ( `b.program is deprecated. Use b.blockItself instead.` ) ;
81
- assert ( _elseBlock . locals . length === 0 , '{{else}} block cannot have block params' ) ;
81
+ assert ( _elseBlock . blockParams . length === 0 , '{{else}} block cannot have block params' ) ;
82
82
83
83
elseBlock = b . blockItself ( {
84
84
params : [ ] ,
@@ -422,12 +422,12 @@ function buildBlockItself(
422
422
423
423
function buildTemplate (
424
424
body : ASTv1 . Statement [ ] = [ ] ,
425
- locals : string [ ] = [ ] ,
425
+ blockParams : string [ ] = [ ] ,
426
426
loc ?: SourceLocation
427
427
) : ASTv1 . Template {
428
428
return b . template ( {
429
429
body,
430
- locals ,
430
+ blockParams ,
431
431
loc : buildLoc ( loc || null ) ,
432
432
} ) ;
433
433
}
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export function normalize(
41
41
let normalizeOptions = {
42
42
strictMode : false ,
43
43
...options ,
44
- locals : ast . locals ,
44
+ locals : ast . blockParams ,
45
45
} ;
46
46
47
47
let top = SymbolTable . top (
You can’t perform that action at this time.
0 commit comments