Merge pull request #149 from Acconut/fix-missing-assign

json/parser: set Assign property when parsing object item
This commit is contained in:
Mitchell Hashimoto 2016-10-08 15:35:57 +08:00 committed by GitHub
commit 6f5bfed9a0

View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/hashicorp/hcl/hcl/ast"
hcltoken "github.com/hashicorp/hcl/hcl/token"
"github.com/hashicorp/hcl/json/scanner"
"github.com/hashicorp/hcl/json/token"
)
@ -103,6 +104,14 @@ func (p *Parser) objectItem() (*ast.ObjectItem, error) {
switch p.tok.Type {
case token.COLON:
pos := p.tok.Pos
o.Assign = hcltoken.Pos{
Filename: pos.Filename,
Offset: pos.Offset,
Line: pos.Line,
Column: pos.Column,
}
o.Val, err = p.objectValue()
if err != nil {
return nil, err