Commit Graph

228 Commits

Author SHA1 Message Date
Dave Cunningham
e1e74dbf46 Change golden files back again; 2019-06-04 16:55:43 +01:00
Dave Cunningham
0d560aff58 Update for version v0.13.0 2019-06-03 18:46:24 +01:00
Dave Cunningham
d89367d4c9 golden files were out of date 2019-06-03 17:39:17 +01:00
Stanisław Barzowski
ee8aee43a3 Fix unintentionally invalid filename escaping test 2019-05-29 21:44:17 +02:00
Dave Cunningham
df7753e2c7 Bring up-to-date with cpp version 2019-05-22 20:43:37 +01:00
Dave Cunningham
6fa1db7d85 Update cpp submodule 2019-05-16 10:12:09 +01:00
Stanisław Barzowski
591b119591 Perform lookups from obj locals with right sb
When object fields are evaluated the locals from the object
are added to the environment. These locals should have the same
environment as the field, in particular they should be
at the same inheritance level. Instead they were evaluated as if
they were on the level from which original field lookup was performed,
resulting in subtle and hard to debug issues.
2019-05-13 17:42:04 +02:00
Stanisław Barzowski
83ed0b939f Proper env for obj locals in comprehensions
We didn't set the environment (upvalues) for objects
created as comprehensions - we set them for each field
separately, but that meant missing the locals.
2019-05-13 17:42:04 +02:00
Stanisław Barzowski
33b6dcfa53
Keep object locals only once in AST (#263)
Keep object locals only once in AST

For example this reduces the size of stdlib ast file
roughly 3x. Note that this change doesn't regenerate the stdlib,
so that the diff here is sane.

It is likely to slightly improve performance of code using
a lot of locals (~10% on bench.05.gen.jsonnet).

The desugaring is more strightforward now, and we're back
to desugaring each node exactly once.
2019-05-07 22:43:55 +02:00
Stanisław Barzowski
181c86d815 Add builtin implementation of std.split 2019-04-24 12:42:40 +02:00
Stanisław Barzowski
c195e570ef Share std.jsonnet with cpp-jsonnet
So far `std.jsonnet` needed to be updated seprately from
the cpp-jsonnet submodule. Since we should update it anyway
at the same time (to make sure the tests are running fine),
we can just as well get it directly from there, eliminating
the extra step of copying the new `std.jsonnet` version.

This change updates the cpp-jsonnet used.
2019-04-16 20:35:19 +02:00
Michael Schuett
2188e2d62a Add go mod / cleanup (#266)
Add go mod

Also make the build docs nicer and cleanup the file directory to be in line
with most other go projects. This also make it so you can build jsonnet
without setting -o on go build.
2019-04-03 15:46:19 +02:00
Stanisław Barzowski
aa47869bc4 Add basic tests for Children and add missing cases 2019-03-20 10:23:24 -04:00
Stanisław Barzowski
686c77b2db Add missing error handling branch
Fixes #255
2019-03-20 10:23:24 -04:00
Stanisław Barzowski
eea884b12f Minimal C bindings (#257)
* Minimal C bindings
* Fix version reporting in C bindings
* Apply suggestions about C bindings implementation
* Rename compat/ -> c-bindings/
* Add comment about indexing VMs in C bindings
2019-03-16 17:47:12 -04:00
Alexandre Bourget
ce90e53336 Expose Evaluate functions, to be able to reuse the AST from SnippetToAST.
Right now, SnippetToAST provides a `Node` but nothing consumes it it seems.
2019-03-11 12:03:15 -04:00
Stanisław Barzowski
530e7960bd Fix improper stack trimming with operators and tailstrict
My understanding of origin of this bug was that once we
were creating thunks for binary operator arguments. So the environment
was no longer needed once they were created, so they could be tailcalls.

Now we're calling i.evaluate directly (for performance) and now
the environment cannot be destroyed during the evaluation of the first
argument.
2019-03-07 09:10:23 -05:00
Stanisław Barzowski
9348a5d2b1 Update cpp-jsonnet submodule and stdlib
Current go-jsonnet is not really 0.12.1 - it even
reports 0.12.0. This brings all the good stuff
from recent cpp-jsonnet commits and actually syncs
the version.
2019-03-04 09:45:11 -05:00
Stanisław Barzowski
c1743b9a2a Add std.encodeUTF8 and std.decodeUTF8 2019-03-04 09:41:01 -05:00
Stanisław Barzowski
7af3b8496c Add missing error handling branch
Fixes #255
2019-01-14 15:09:42 -05:00
Dave Cunningham
493c45a403 Update cpp-jsonnet and bump version to 0.12.0 2018-12-18 14:32:59 -05:00
Dave Cunningham
ff0c19aa29 Update cpp-jsonnet 2018-12-18 13:42:53 -05:00
Stanisław Barzowski
767f100fd6 std.parseJson - a builtin for parsing json 2018-12-13 13:45:39 -05:00
Stanisław Barzowski
7012604878 Update stdlib 2018-12-12 21:01:20 +00:00
Lorenz Brun
d7fa222766 Update cpp-jsonnet to fix tests 2018-12-12 21:01:20 +00:00
Lorenz Brun
08080da8e2 Make automatically creating output dirs an option 2018-12-12 21:01:20 +00:00
Lorenz Brun
4122e4436e Automatically create output folders 2018-12-12 21:01:20 +00:00
Stanisław Barzowski
9a9954af24 Fix lexing of "!$".
See issues
    * https://github.com/google/jsonnet/issues/503
    * https://github.com/google/jsonnet/issues/572
2018-10-25 12:45:07 +01:00
Gareth Rushgrove
2999f7d4f6 Fix build instructions
Without downloading the dependency the current instructions fail to build.
2018-09-24 18:36:56 -04:00
Damien Lespiau
f7fcba659c travis: Support building pushed branches
This commit refactors travisBuild.sh to support building pushed branched on top
of PRs and tags.

This was prompted by enabling travis on a forked repository. The devlopment
flow then becomes:
  - Fork google/go-jsonnet
  - Enable travis on fork repository
  - Push branch to forked repository
  - Travis runs on the pushed branch
  - Submit pull request once happy and tests pass in the forked repository

I tested 3 scenarii and they seem behave nicely:
  - Running CI for pushed branch
  - Running CI for tag
  - Running CI for a Pull Request

As a side note, the previous error path didn't work as intented:
  - The TRAVIS_PULL variable didn't exist
  - We weren't exiting with a non 0 value in the else branch, so the build
    succeeded instead of failing when travisBuild.sh didn't know what to do
    with the pushed branch
2018-09-24 10:47:07 -04:00
Dave Cunningham
6144c57d2a Update cpp-jsonnet & bump version 2018-07-19 16:09:27 -04:00
Dave Cunningham
b4603b0c32 match change to cpp version re: unrecognized native returning null 2018-07-19 14:32:32 -04:00
Dave Cunningham
c038cd37e7 update cpp 2018-07-19 14:32:32 -04:00
Lars Wander
43294caaef Fix build during release 2018-07-18 20:25:08 -04:00
Lars Wander
e01563f538 Adds TravisCI releaes process
Given the <tag> chosen in the GitHub releases page, this builds jsonnet
for darwin & linux amd64 (we can add more if needed), and uploads to
gs://jsonnet/<tag>/<os>/<arch>/jsonnet
2018-06-22 14:14:14 -04:00
Jameson
39887d9751 pull Local.Binds[].Body out via specialChildren (#232)
* pull Local.Binds[].Body out via specialChildren

* move Local.Body to special from direct
2018-06-11 21:06:59 -04:00
Dave Cunningham
95e1c1790a
Lex fodder in a manner compatible with C++ (#231)
* Lex fodder in a manner compatible with C++
2018-06-11 14:40:28 -04:00
Jameson Lee
a1964b49f1 support for traversing AST tree with parens and objectcomps 2018-06-06 02:06:10 -04:00
Stanisław Barzowski
46256581d7 Travis fix as suggested by @jamesonjlee (#230) 2018-06-05 14:20:48 -04:00
Dave Cunningham
2973e24152
Internal refactor to improve performance (#225)
* Internal refactor to improve performance
2018-06-01 10:52:20 -04:00
Stanisław Barzowski
530cf7b07c Implement operators == and != as builtins (#221)
People use these operators in tight loops, without even
thinking about it, and it's previous implementation required
multiple object lookups (std.), string comparisons (for types)
and multiple jsonnet function calls.

This change introduces builtin, efficient implementation.
It results in ~3x speedup in strContains benchmark that
Angus provided on Slack.

Additional benefit is that equals/primitiveEquals distinction
is now obsolete, which made things simpler for everyone.
2018-05-23 22:26:30 -04:00
Dave Cunningham
d9b833b8a0
Bump C++ version, implement std.trace, fix parsing of -$, update std (#224) 2018-05-23 22:24:12 -04:00
Luke Granger-Brown
643210d274 Add string output support for multifile output (#220)
* Add test support for multi-file output.

* Add -update support for multi-file output tests.

* Add support for string output in multi-file output mode.

* Rename 'stringOutput' to 'stringOutputMode' to better express what it does

* Refactor main_test to make it less nested.

This also causes the -update flag to output a list of files which
have been updated. This does not include the paths which are deleted
for multi-file tests.
2018-05-09 11:49:07 -04:00
Stanisław Barzowski
f4428e6d47 Better Importer interface
As discussed in https://github.com/google/go-jsonnet/issues/190
2018-04-28 01:34:42 -04:00
Roger Peppe
fde815f6a1 godoc.org-compatible ast package
Change the dump code so that it hides the values of variable
definitions if they're large. This means that godoc.org should
be able to deal with the output, and the godoc output is
readable without needing to read through a huge struct literal definition.

Other approaches might be to always generate an extra variable
(seems unnecessary) or to pass to writer explicitly to the dump
methods rather than swapping s.w out temporarily. The former
seems unnecessarily intrusive to the usual output; the latter
seemed unnecessarily intrusive to the source itself.
YMMV.
2018-04-12 14:06:52 -04:00
Dave Cunningham
dfddf2b4e3 Update version 2018-03-16 22:34:36 -04:00
Dave Cunningham
0b46b25f0f Update to cpp jsonnet 2018-03-16 22:20:53 -04:00
Dave Cunningham
6efde9677d Handle base case of cloneForSpec 2018-03-15 13:56:17 -04:00
Marcelo Cantos
b0459e4867 Add AppVeyor Windows builds and releases (#206)
* Make some filenames Windows-friendly

* Update references to renamed files

* Fix escaped filenames to run on non-Windows platforms
2018-03-12 20:46:57 -04:00
Marcelo Cantos
d67779ed8d Refactor handling of --{ext,tla}-* flags (#212)
* Refactor handling of --{ext,tla}-* flags

* better helper function names for --{ext,tla}-* flags
2018-03-11 16:44:59 -04:00