MCPcopy Create free account
hub / github.com/goadesign/goa / Execute

Function Execute

eval/eval.go:69–85  ·  view source on GitHub ↗

Execute runs the given DSL to initialize the given expression. It returns true on success. It returns false and appends to Context.Errors on failure. Note that Run takes care of calling Execute on all expressions that implement Source. This function is intended for use by expressions that run the DS

(fn func(), def Expression)

Source from the content-addressed store, hash-verified

67// (usually simple independent expressions). The DSL should use ReportError to
68// record DSL execution errors.
69func Execute(fn func(), def Expression) bool {
70 if fn == nil {
71 return true
72 }
73 var startCount int
74 if Context.Errors != nil {
75 startCount = len(Context.Errors)
76 }
77 Context.Stack = append(Context.Stack, def)
78 fn()
79 Context.Stack = Context.Stack[:len(Context.Stack)-1]
80 var endCount int
81 if Context.Errors != nil {
82 endCount = len(Context.Errors)
83 }
84 return endCount <= startCount
85}
86
87// Current returns the expression whose DSL is currently being executed.
88// As a special case Current returns Top when the execution stack is empty.

Callers 15

projectCollectionFunction · 0.92
RunDSLFunction · 0.92
RunInvalidDSLFunction · 0.92
TestFormatFunction · 0.92
TestRequiredFunction · 0.92
FilesFunction · 0.92
ServerFunction · 0.92
HostFunction · 0.92
ContactFunction · 0.92
LicenseFunction · 0.92
DocsFunction · 0.92
GRPCFunction · 0.92

Calls

no outgoing calls

Tested by 10

TestFormatFunction · 0.74
TestRequiredFunction · 0.74
TestMethodFunction · 0.74
runDSLFunction · 0.74
TestMetaDataFunction · 0.74
TestViewFunction · 0.74
TestDescriptionFunction · 0.74
TestOneOfCustomKeysFunction · 0.74
TestGetMetaTypeImportsFunction · 0.74