Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ast/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
type Node interface {
Location() file.Location
SetLocation(file.Location)
Nature() nature.Nature
Nature() *nature.Nature
SetNature(nature.Nature)
Type() reflect.Type
SetType(reflect.Type)
Expand Down Expand Up @@ -47,8 +47,8 @@ func (n *base) SetLocation(loc file.Location) {
}

// Nature returns the nature of the node.
func (n *base) Nature() nature.Nature {
return n.nature
func (n *base) Nature() *nature.Nature {
return &n.nature
}

// SetNature sets the nature of the node.
Expand Down
3 changes: 1 addition & 2 deletions checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,7 @@ func (v *Checker) callNode(node *ast.CallNode) Nature {
// checker pass we should replace anyType on method node
// with new correct function return type.
if typ := node.Type(); typ != nil && typ != anyType {
nt := node.Nature()
return nt
return *node.Nature()
}

nt := v.visit(node.Callee)
Expand Down
3 changes: 1 addition & 2 deletions checker/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ func FieldIndex(c *Cache, env Nature, node ast.Node) (bool, []int, string) {
return true, idx, n.Value
}
case *ast.MemberNode:
base := n.Node.Nature()
base = base.Deref(c)
base := n.Node.Nature().Deref(c)
if base.Kind == reflect.Struct {
if prop, ok := n.Property.(*ast.StringNode); ok {
if idx, ok := base.FieldIndex(c, prop.Value); ok {
Expand Down
3 changes: 1 addition & 2 deletions compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,8 +1088,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) {
for i, arg := range node.Arguments {
c.compile(arg)
argType := arg.Type()
argNature := arg.Nature()
if argType.Kind() == reflect.Ptr || argNature.IsUnknown(c.ntCache) {
if argType.Kind() == reflect.Ptr || arg.Nature().IsUnknown(c.ntCache) {
if f.Deref == nil {
// By default, builtins expect arguments to be dereferenced.
c.emit(OpDeref)
Expand Down
Loading