Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
Decode null as NULL token in yaml decoder
Browse files Browse the repository at this point in the history
This PR will fix #185 as `BasicLit` will be returned for null value.

When we walk through the ast to create the instance, null value will be handled as `BasicLit` instead of `Ident`.

Closes #186
#186

GitOrigin-RevId: 9dadc29
Change-Id: I8bfd84c5c1c4ab60bbc1fbfcd76bb5a4561a8237
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4100
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
adieu authored and mpvl committed Nov 22, 2019
1 parent d7d2837 commit 503fecd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/third_party/yaml/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,11 @@ func (d *decoder) scalar(n *node) ast.Expr {
}
}
if resolved == nil {
return d.ident(n, "null")
return &ast.BasicLit{
ValuePos: d.start(n),
Kind: token.NULL,
Value: "null",
}
}
switch tag {
// TODO: use parse literal or parse expression instead.
Expand Down

0 comments on commit 503fecd

Please sign in to comment.