@@ -14,12 +14,14 @@ type Node interface {
14
14
// Statement is the interface for statement (Ex command or Comment).
15
15
type Statement interface {
16
16
Node
17
+ stmtNode ()
17
18
}
18
19
19
20
// ExCommand is the interface for Ex-command.
20
21
type ExCommand interface {
21
22
Node
22
23
Cmd () Cmd
24
+ stmtNode ()
23
25
}
24
26
25
27
// Expr is the interface for expression.
@@ -524,6 +526,40 @@ type LambdaExpr struct {
524
526
525
527
func (i * LambdaExpr ) Pos () Pos { return i .Lcurlybrace }
526
528
529
+ // stmtNode() ensures that only ExComamnd and Comment nodes can be assigned to
530
+ // an Statement.
531
+ //
532
+ func (* Break ) stmtNode () {}
533
+ func (* Catch ) stmtNode () {}
534
+ func (* Continue ) stmtNode () {}
535
+ func (DelFunction ) stmtNode () {}
536
+ func (* EchoCmd ) stmtNode () {}
537
+ func (* Echohl ) stmtNode () {}
538
+ func (* Else ) stmtNode () {}
539
+ func (* ElseIf ) stmtNode () {}
540
+ func (* EndFor ) stmtNode () {}
541
+ func (EndFunction ) stmtNode () {}
542
+ func (* EndIf ) stmtNode () {}
543
+ func (* EndTry ) stmtNode () {}
544
+ func (* EndWhile ) stmtNode () {}
545
+ func (* ExCall ) stmtNode () {}
546
+ func (Excmd ) stmtNode () {}
547
+ func (* Execute ) stmtNode () {}
548
+ func (* Finally ) stmtNode () {}
549
+ func (* For ) stmtNode () {}
550
+ func (Function ) stmtNode () {}
551
+ func (* If ) stmtNode () {}
552
+ func (* Let ) stmtNode () {}
553
+ func (* LockVar ) stmtNode () {}
554
+ func (* Return ) stmtNode () {}
555
+ func (* Throw ) stmtNode () {}
556
+ func (* Try ) stmtNode () {}
557
+ func (* UnLet ) stmtNode () {}
558
+ func (* UnLockVar ) stmtNode () {}
559
+ func (* While ) stmtNode () {}
560
+
561
+ func (* Comment ) stmtNode () {}
562
+
527
563
// exprNode() ensures that only expression nodes can be assigned to an Expr.
528
564
//
529
565
func (* TernaryExpr ) exprNode () {}
0 commit comments