internal/core/runtime: rename Interpreter/Compiler to Injection/Injector
Refactor the extern injection interfaces:
- Interpreter -> Injection, Compiler -> Injector
- NewCompiler -> InjectorForInstance, Compile -> InjectedValue
- SetInterpreter -> SetInjection
- cuelang.org/go/cue/interpreter -> cuelang.org/go/cue/inject
The current names are targetted at wasm but are not appropriate
for more general injection schemes, such as `@embed`.
The new Injector.InjectedValue method receives an *ExternAttr
(containing the parent AST node and parsed attribute) instead of
a pre-extracted name string. This moves name-related logic out of
the generic externDecorator and into the specific injector
implementations that need it (e.g. wasm).
This will also allow injection logic to let the top level
`@extern` attribute parameters influence the behavior
of an extern attribute, because that information is available
inside the `ExternAttr` type.
We leave a forwarding package in cue/interpreter/embed
so that we don't gratuitously break clients that are using embed.New;
technically we'd be entitled to just rename it as the package API
is noted as experimental, but given that embed users had
been required to use `embed.New` explicitly, some soft landing
seems better. The rest of the API is new and its renaming is unlikely to
cause problems. The wasm package does not work with EvalV3 anyway,
so moving it should hopefully not be an issue.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I75035e0b17d9857e38d60e06a8ff454da3889597
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1235341
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>