Skip to content

Commit 969a394

Browse files
authored
dsl: add ExprType.HasPointers() predicate (#336)
1 parent 184fad6 commit 969a394

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dsl/dsl.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,18 @@ func (ExprType) Implements(typ typeName) bool { return boolResult }
216216
// Is reports whether a type is identical to a given type.
217217
func (ExprType) Is(typ string) bool { return boolResult }
218218

219+
// HasPointers reports whether a type contains at least one pointer.
220+
//
221+
// We try to be as close to the Go sense of pointer-free objects as possible,
222+
// therefore string type is not considered to be a pointer-free type.
223+
//
224+
// This function may return "true" for some complicated cases as a
225+
// conservative result. It never returns "false" for a type that
226+
// actually contains a pointer.
227+
//
228+
// So this function is mostly useful for !HasPointers() form.
229+
func (ExprType) HasPointers() bool { return boolResult }
230+
219231
// OfKind reports whether a matched expr type is compatible with the specified kind.
220232
//
221233
// Only a few "kinds" are recognized, the list is provided below.

0 commit comments

Comments
 (0)