Skip to content

Commit

Permalink
cl/internal/typesutil: NewTypeAndValueForCallResult
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Nov 15, 2023
1 parent 5956193 commit 645ce6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cl/internal/typesutil/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewTypeAndValueForVariable(typ types.Type) (ret types.TypeAndValue) {
return
}

func NewTypeAndValueForCall(typ types.Type) (ret types.TypeAndValue) {
func NewTypeAndValueForCallResult(typ types.Type) (ret types.TypeAndValue) {
if typ == nil {
ret.Type = &types.Tuple{}
(*TypeAndValue)(unsafe.Pointer(&ret)).mode = novalue
Expand Down
8 changes: 6 additions & 2 deletions cl/internal/typesutil/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func TestTypeAndValue(t *testing.T) {
if !ret.Addressable() {
t.Fatal("NewTypeAndValueForVariable: not variable?")
}
ret = NewTypeAndValueForCall(tyInt)
ret = NewTypeAndValueForCallResult(tyInt)
if !ret.IsValue() {
t.Fatal("NewTypeAndValueForCall: not value?")
}
ret = NewTypeAndValueForCall(nil)
ret = NewTypeAndValueForCallResult(nil)
if !ret.IsVoid() {
t.Fatal("NewTypeAndValueForCall: not void?")
}
Expand Down Expand Up @@ -72,4 +72,8 @@ func TestTypeAndValue(t *testing.T) {
if !ret.IsNil() {
t.Fatal("NewTypeAndValueForObject: not nil?")
}
ret = NewTypeAndValueForObject(types.Universe.Lookup("len"))
if !ret.IsBuiltin() {
t.Fatal("NewTypeAndValueForObject: not builtin?")
}
}

0 comments on commit 645ce6b

Please sign in to comment.