Eval returns the type and, if constant, the value for the expression or type literal string str evaluated in scope. If the expression contains function literals, the function bodies are ignored (though they must be syntactically correct).

If pkg == nil, the Universe scope is used and the provided scope is ignored. Otherwise, the scope must belong to the package (either the package scope, or nested within the package scope).

An error is returned if the scope is incorrect, the string has syntax errors, or if it cannot be evaluated in the scope. Position info for objects in the result type is undefined.

Note: Eval should not be used instead of running Check to compute types and values, but in addition to Check. Eval will re-evaluate its argument each time, and it also does not know about the context in which an expression is used (e.g., an assignment). Thus, top- level untyped constants will return an untyped type rather then the respective context-specific type.

Eval is referenced in 0 repositories