MCPcopy Create free account
hub / github.com/cel-expr/cel-go / SubsetMacro

Method SubsetMacro

common/env/env.go:625–650  ·  view source on GitHub ↗

SubsetMacro indicates whether the macro function should be included in the library subset.

(macroFunction string)

Source from the content-addressed store, hash-verified

623
624// SubsetMacro indicates whether the macro function should be included in the library subset.
625func (lib *LibrarySubset) SubsetMacro(macroFunction string) bool {
626 // When lib is null, it should indicate that all values are included in the subset.
627 if lib == nil {
628 return true
629 }
630 if lib.Disabled || lib.DisableMacros {
631 return false
632 }
633 if len(lib.IncludeMacros) != 0 {
634 for _, name := range lib.IncludeMacros {
635 if name == macroFunction {
636 return true
637 }
638 }
639 return false
640 }
641 if len(lib.ExcludeMacros) != 0 {
642 for _, name := range lib.ExcludeMacros {
643 if name == macroFunction {
644 return false
645 }
646 }
647 return true
648 }
649 return true
650}
651
652// SetDisabled disables or enables the library.
653func (lib *LibrarySubset) SetDisabled(value bool) *LibrarySubset {

Callers 2

CompileOptionsMethod · 0.80
TestSubsetMacroFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestSubsetMacroFunction · 0.64