Skip to content

Commit efa006a

Browse files
committed
Remove Node.Kind() method
1 parent 73cb42d commit efa006a

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

ast/node.go

-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type Node interface {
1717
SetLocation(file.Location)
1818
Nature() nature.Nature
1919
SetNature(nature.Nature)
20-
Kind() reflect.Kind
2120
Type() reflect.Type
2221
SetType(reflect.Type)
2322
String() string
@@ -57,15 +56,6 @@ func (n *base) SetNature(nature nature.Nature) {
5756
n.nature = nature
5857
}
5958

60-
// Kind returns the kind of the node.
61-
// If the type is nil (meaning unknown) then it returns reflect.Interface.
62-
func (n *base) Kind() reflect.Kind {
63-
if n.nature.Type == nil {
64-
return reflect.Interface
65-
}
66-
return n.nature.Type.Kind()
67-
}
68-
6959
// Type returns the type of the node.
7060
func (n *base) Type() reflect.Type {
7161
if n.nature.Type == nil {

compiler/compiler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func (c *compiler) IntegerNode(node *ast.IntegerNode) {
377377
}
378378

379379
func (c *compiler) FloatNode(node *ast.FloatNode) {
380-
switch node.Kind() {
380+
switch node.Type().Kind() {
381381
case reflect.Float32:
382382
c.emitPush(float32(node.Value))
383383
case reflect.Float64:
@@ -1199,7 +1199,7 @@ func (c *compiler) PairNode(node *ast.PairNode) {
11991199
}
12001200

12011201
func (c *compiler) derefInNeeded(node ast.Node) {
1202-
switch node.Kind() {
1202+
switch node.Type().Kind() {
12031203
case reflect.Ptr, reflect.Interface:
12041204
c.emit(OpDeref)
12051205
}

0 commit comments

Comments
 (0)