1
- import { type BlockIRNode , IRNodeTypes , type WithDirectiveIRNode } from '../ir'
1
+ import {
2
+ type BlockIRNode ,
3
+ IRNodeTypes ,
4
+ type OperationNode ,
5
+ type WithDirectiveIRNode ,
6
+ } from '../ir'
2
7
import {
3
8
type CodeFragment ,
4
9
INDENT_END ,
@@ -41,11 +46,7 @@ export function genBlockContent(
41
46
push ( ...genChildren ( child , context , child . id ! ) )
42
47
}
43
48
44
- const directiveOps = operation . filter (
45
- ( oper ) : oper is WithDirectiveIRNode =>
46
- oper . type === IRNodeTypes . WITH_DIRECTIVE ,
47
- )
48
- for ( const directives of groupDirective ( directiveOps ) ) {
49
+ for ( const directives of groupDirective ( operation ) ) {
49
50
push ( ...genWithDirective ( directives , context ) )
50
51
}
51
52
@@ -67,9 +68,14 @@ export function genBlockContent(
67
68
return frag
68
69
}
69
70
70
- function groupDirective ( ops : WithDirectiveIRNode [ ] ) : WithDirectiveIRNode [ ] [ ] {
71
+ function groupDirective ( operation : OperationNode [ ] ) : WithDirectiveIRNode [ ] [ ] {
72
+ const directiveOps = operation . filter (
73
+ ( oper ) : oper is WithDirectiveIRNode =>
74
+ oper . type === IRNodeTypes . WITH_DIRECTIVE ,
75
+ )
76
+
71
77
const directiveMap : Record < number , WithDirectiveIRNode [ ] > = { }
72
- for ( const oper of ops ) {
78
+ for ( const oper of directiveOps ) {
73
79
if ( ! directiveMap [ oper . element ] ) directiveMap [ oper . element ] = [ ]
74
80
directiveMap [ oper . element ] . push ( oper )
75
81
}
0 commit comments