This will be useful later on when implementing the performance
improvements to compare how much we gain.
Signed-off-by: Leandro López <leandro.lopez@grafana.com>
This commit adds test cases for more types to ensure that
std.manifestJsonEx continues to work with all types that may be given
as the `value` parameter.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit adds a test case to prevent regressions in
std.manifestJsonEx accepting arrays as values.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit fixes a regression in std.manifestJsonEx that caused the
standard library function to error when the given value was an array.
Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This allows configuration of a VM with an external code variable that has been pre-parsed into an AST node.
This allows a caller to pre-parse a large object into a node and re-use that for multiple VMs. The cost
of converting the object to an ast.Node is incurred only once by the caller as opposed to having this
eagerly incurred (whether or not the object is used) before the eval.
Allow reset of ext and TLA vars for VM reuse
Currently ext and TLA vars can be set but not reset. This makes
re-using VMs that have different variables impossible.
Add VM methods to be able to reset ext and TLA vars
I was not able to find any evidences of darwin builds being disabled intentionally. Considering
the [documentation](https://goreleaser.com/customization/build/) I suspect that this was by
mistake. Currently, each list item is applied individually (OR). If I'm wrong, please discard this
PR and share your reasoning.
Fixes multiple issues with stack traces leading to missing
stack trace lines. Also, we no longer put builtin context
on the line which *calls* the builtin as if it was a part
of the builtin itself.
Code for stack trace handling was centralized. We no longer
need traceElement argument in ~every function. Now the stack
trace state is kept solely in the interpreter.
Desugar the locals in object comprehensions
"traditionally" instead of handling them manually.
Object comprehensions allow the locals to depend
on the index variable which means that they are separate
for each field. It doesn't make sense to treat them as
a property of the whole object.
Fixes#358.
This makes the goreleaser output two debian packages. One for jsonnet,
and another for jsonnetfmt. Since we don't use cgo, we don't need to
take dependencies, as we're fully statically linked. The package
name for this package will be jsonnet-go, and jsonnetfmt-go. There
is a package that Ubuntu has released that's based on the C++
version. We have a conflict statement with it in order to
avoid people installing both.
We can ask the C++ package to rename itself to jsonnet-c++, and then
add a provides for the package name jsonnet. The reason to not name
this jsonnet immediately, even though the Go version if meant to
supercede the C++ version, is that this doesn't fully implement the
C++ version (for example, man pages).
We used to treat dummy paths like <stdin>, <std>, <extvar> as
real import locations, which causes obvious problem for importers.
After this change we consistently pass "" (an empty string) as location
for non-imported paths.
We exposed new functions to properly handle all paths.
The first function family, EvaluateFile* which allow evaluating
a Jsonnet program at a specified importable path. It should
be used in most cases.
The second function family, EvaluateAnonymousSnippet* allows evaluating
a snippet without an importable path. It should be used for situations
like the code passed as a commandline argument, stdin, etc.
The old function family, EvaluateSnippet* is now deprecated, but
works the same as before, i.e. the passed filenames are treated
as imported paths.
Changes are required to custom importers to make sure they satisfy
the refined contract.
Fixes#329.