Commit Graph

82 Commits

Author SHA1 Message Date
Dave Cunningham
e1e74dbf46 Change golden files back again; 2019-06-04 16:55:43 +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
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
686c77b2db Add missing error handling branch
Fixes #255
2019-03-20 10:23:24 -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
c1743b9a2a Add std.encodeUTF8 and std.decodeUTF8 2019-03-04 09:41:01 -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
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
Dave Cunningham
b4603b0c32 match change to cpp version re: unrecognized native returning null 2018-07-19 14:32:32 -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
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
Dave Cunningham
5cc426ed04 Bring submodule and stdlib to cpp master 2018-03-06 23:49:02 -05:00
Marcelo Cantos
ed5f280c59 Apply golint recommendations (#196)
* Apply golint recommendations
2018-02-26 14:12:25 -05:00
Stanisław Barzowski
44770e75dd Add std.sign and fix division by zero in stdlib 2018-02-21 20:31:04 -05:00
Dave Cunningham
2ea01b24d8
Introduce a Parens AST (#189)
* Introduce a Parens AST
2018-02-16 13:01:14 -05:00
Dave Cunningham
f46dea2835 Update std.jsonnet 2018-02-01 14:21:39 -05:00
Stanisław Barzowski
61b33d1a2a Fast, native implementation of strReplace 2018-01-31 15:27:59 -05:00
Dave Cunningham
741f9f06a2 Update stdlib and ||| fix 2018-01-23 23:26:28 -05:00
Stanisław Barzowski
eedf6760ad Convert non-string errors to string 2018-01-18 12:48:38 -05:00
Stanisław Barzowski
d135effbe4 Add missing check for array out of bounds 2018-01-17 15:26:31 -05:00
Dave Cunningham
7c8f4d0b12
Call top level function even if there are no TLAs (match cpp semantics) (#169)
* Call top level function even if there are no TLAs (match cpp semantics)
2018-01-10 20:43:55 -05:00
Cam Hutchison
c7a5b68f1c Add test case for native function returning error
A native function returning an error should be reported as a runtime
error, with a stack trace.
2017-12-18 10:22:53 -05:00
Stanisław Barzowski
8ade994928 Efficient native implementation of std.join
It changes the behavior slightly - mixing strings
and arrays in join is no longer allowed.
2017-12-13 18:09:56 -05:00
Dave Cunningham
b6ee2c2f51
String token end location off-by-one error (#139)
* String token end location off-by-one error
2017-11-03 21:36:31 -04:00
Dave Cunningham
3eaf189897 Allow bitwise operations on floats, according to Spec (and Javascript behavior) 2017-10-26 20:26:16 -04:00
Stanisław Barzowski
10d377f068 [WIP] Disallow floating point indexing (waiting for #116) 2017-10-14 00:49:04 -04:00
Stanisław Barzowski
bb8d424f73 Add previously forgotten tests 2017-10-13 19:55:24 -04:00
Stanisław Barzowski
ed281bc563 Support for native callbacks 2017-10-13 15:49:06 -04:00
Stanisław Barzowski
5c946dfb76 Eliminate duplication in builtin names
Actually there was one (objectFieldEx) that was inconsistent, i.e.
it was available by a different name from what appeared in the stack
trace. This is now fixed.
2017-10-13 15:33:34 -04:00
Stanisław Barzowski
0f049eaa38 Basic tailstrict support 2017-10-13 15:33:23 -04:00
Stanisław Barzowski
4a4a7fe459 Check index types (#116)
Before it would just crash
2017-10-10 00:09:32 -04:00
Stanisław Barzowski
ba0f236b14 Optional eval (#92)
* Optional arguments
2017-10-10 00:06:14 -04:00
Stanisław Barzowski
f0f70419f8 Clean up some TODOs
Some were stale, some were transformed into issues, some were fixed
2017-10-05 22:13:09 -04:00
Stanisław Barzowski
a4058fc177 Support for stack trace size limit 2017-10-05 03:31:16 -04:00
Stanisław Barzowski
02a4eed22d Support $ in comprehesions, fixes #68 2017-10-03 19:51:01 -04:00
Stanisław Barzowski
774715b3cf Support for std.thisFile, fixes #91.
Sadly it means that std in no longer the same object in each file.
2017-10-03 15:17:43 -04:00
Stanisław Barzowski
82f213a1e3 Fix tests (after rebase) 2017-10-03 15:17:32 -04:00
Stanisław Barzowski
33377907ec Allow all kinds of string literals as object field names 2017-10-03 14:30:32 -04:00
Stanisław Barzowski
80ce6ac112 Don't escape block strings (#98)
* Don't escape block strings
2017-10-03 14:29:12 -04:00
Stanisław Barzowski
c3459153df Location, error formatting and stack trace improvements (#59)
* Location, error formatting and stack trace improvements

* Static context for AST nodes
* Thunks no longer need `name`
* Prototype for showing snippets in error messages (old format still
available)
* Use ast.Function to represent methods and local function sugar.
* Change tests so that the error output is pretty
2017-10-03 14:27:44 -04:00
Stanisław Barzowski
a1b8248e84 Fix comprehensions (#90)
* Fix comprehensions

Only first and last forspec was used due to a parser bug.
2017-09-29 23:33:55 -04:00