Skip to content

Commit 1f41308

Browse files
committed
Improve coverage
1 parent f8f4d5e commit 1f41308

File tree

6 files changed

+90
-11
lines changed

6 files changed

+90
-11
lines changed

ast/ast.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,12 @@ type Starred struct {
560560
Ctx ExprContext
561561
}
562562

563-
func (o *Starred) SetCtx(Ctx ExprContext) { o.Ctx = Ctx }
563+
func (o *Starred) SetCtx(Ctx ExprContext) {
564+
o.Ctx = Ctx
565+
if setCtx, ok := o.Value.(SetCtxer); ok {
566+
setCtx.SetCtx(Ctx)
567+
}
568+
}
564569

565570
var _ = SetCtxer((*Starred)(nil))
566571

parser/grammar.y

+5-3
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ inputs:
216216
single_input:
217217
NEWLINE
218218
{
219+
// panic("FIXME no coverage")
219220
$$ = &ast.Interactive{ModBase: ast.ModBase{$<pos>$}}
220221
}
221222
| simple_stmt
@@ -224,6 +225,7 @@ single_input:
224225
}
225226
| compound_stmt NEWLINE
226227
{
228+
// panic("FIXME no coverage")
227229
$$ = &ast.Interactive{ModBase: ast.ModBase{$<pos>$}, Body: []ast.Stmt{$1}}
228230
}
229231

@@ -401,7 +403,7 @@ tfpdeftests1:
401403

402404
optional_tfpdef:
403405
{
404-
$$ = &ast.Arg{Pos: $<pos>$, Arg: ast.Identifier("")}
406+
$$ = nil
405407
}
406408
| tfpdef
407409
{
@@ -494,7 +496,7 @@ vfpdeftests1:
494496

495497
optional_vfpdef:
496498
{
497-
$$ = &ast.Arg{Pos: $<pos>$, Arg: ast.Identifier("")}
499+
$$ = nil
498500
}
499501
| vfpdef
500502
{
@@ -1234,7 +1236,6 @@ lambdef:
12341236
$$ = &ast.Lambda{ExprBase: ast.ExprBase{$<pos>$}, Args: $2, Body: $4}
12351237
}
12361238

1237-
// FIXME not sure this is necessary
12381239
lambdef_nocond:
12391240
LAMBDA ':' test_nocond
12401241
{
@@ -1333,6 +1334,7 @@ comp_op:
13331334
}
13341335
| LTGT
13351336
{
1337+
// panic("FIXME no coverage")
13361338
yylex.Error("Invalid syntax")
13371339
}
13381340
| PLINGEQ

0 commit comments

Comments
 (0)