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
4 changes: 2 additions & 2 deletions book/src/dev/libraries/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func main() {
return
}
s := val.Deref("s")
if s == nil {
if s.IsMissing() {
s = sctx.Missing().Ptr()
}
fmt.Println(sup.String(s))
Expand Down Expand Up @@ -141,7 +141,7 @@ func main() {
return
}
s := val.Deref("s")
if s == nil {
if s.IsMissing() {
s = sctx.Missing().Ptr()
}
fmt.Println(sup.String(s))
Expand Down
2 changes: 1 addition & 1 deletion compiler/semantic/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func unmarshalHeaders(val super.Value) (map[string][]string, error) {
headers := map[string][]string{}
for i, f := range val.Fields() {
fieldVal := val.DerefByColumn(i)
if fieldVal == nil {
if fieldVal.IsMissing() {
continue
}
headerStrings, err := decodeStrings(fieldVal)
Expand Down
2 changes: 1 addition & 1 deletion complex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set[1,2,3]`
}
require.NoError(t, err)
v := val.Deref("foo")
require.Nil(t, v)
require.True(t, v.IsMissing())
}
}

Expand Down
4 changes: 2 additions & 2 deletions runtime/sam/expr/agg/avg.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ const (

func (a *Avg) ConsumeAsPartial(partial super.Value) {
sumVal := partial.Deref(sumName)
if sumVal == nil {
if sumVal.IsMissing() {
panic(errors.New("avg: partial sum is missing"))
}
if sumVal.Type() != super.TypeFloat64 {
panic(fmt.Errorf("avg: partial sum has bad type: %s", sup.FormatValue(*sumVal)))
}
countVal := partial.Deref(countName)
if countVal == nil {
if countVal.IsMissing() {
panic("avg: partial count is missing")
}
if countVal.Type() != super.TypeUint64 {
Expand Down
2 changes: 1 addition & 1 deletion runtime/sam/expr/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ func indexRecordByName(sctx *super.Context, typ *super.TypeRecord, record scode.
}
field := super.DecodeString(index.Bytes())
val := super.NewValue(typ, record).Ptr().Deref(field)
if val == nil {
if val.IsMissing() {
return sctx.Missing()
}
return *val
Expand Down
2 changes: 1 addition & 1 deletion runtime/sam/expr/function/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (c *cast) toRecord(from super.Value, to *super.TypeRecord) (super.Value, bo
for i, f := range to.Fields {
var val2 super.Value
fieldVal := from.Deref(f.Name) // deref(fromRecType, from.Bytes(), f.Name)
if fieldVal == nil {
if fieldVal.IsMissing() {
// This field isn't present. If the target type is optional,
// code a none value. Otherwise, code error missing.
if optionType, _ := super.OptionUnion(f.Type); optionType != nil {
Expand Down
Loading