Skip to content

Commit

Permalink
dsl: add ExprType.HasPointers() predicate (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
quasilyte committed Jan 1, 2022
1 parent 184fad6 commit 969a394
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dsl/dsl.go
Expand Up @@ -216,6 +216,18 @@ func (ExprType) Implements(typ typeName) bool { return boolResult }
// Is reports whether a type is identical to a given type.
func (ExprType) Is(typ string) bool { return boolResult }

// HasPointers reports whether a type contains at least one pointer.
//
// We try to be as close to the Go sense of pointer-free objects as possible,
// therefore string type is not considered to be a pointer-free type.
//
// This function may return "true" for some complicated cases as a
// conservative result. It never returns "false" for a type that
// actually contains a pointer.
//
// So this function is mostly useful for !HasPointers() form.
func (ExprType) HasPointers() bool { return boolResult }

// OfKind reports whether a matched expr type is compatible with the specified kind.
//
// Only a few "kinds" are recognized, the list is provided below.
Expand Down

0 comments on commit 969a394

Please sign in to comment.