Commit Graph
82 Commits
Author SHA1 Message Date
Anton Medvedev 00d167a791 Move code duplicate to conf package 2022-11-10 21:21:38 +01:00
Anton Medvedev a3281d9f3a Fix constant folding for floats and ints 2022-11-08 20:58:23 +01:00
Anton Medvedev 371e24c30d Add ^ as exponent operator 2022-11-05 20:21:48 +01:00
Anton Medvedev beb3569969 Add test for named array 2022-11-05 15:59:53 +01:00
Anton Medvedev 1b90cdba61 Fix tests 2022-11-05 13:51:18 +01:00
Furkan TürkalandGitHub b03f09d04c Fix DivideOp: change resulting type to float64 (#272) 2022-11-05 13:47:13 +01:00
Anton Medvedev 97b2a9e16d Simplify ast.Visitor interface 2022-11-02 22:27:34 +01:00
Anton Medvedev f015529ff2 Fix deref if types not available 2022-11-02 20:34:28 +01:00
Anton Medvedev fa60189e66 Cleanup 2022-10-26 18:48:27 +02:00
Anton Medvedev 0b523f347e Sort imports 2022-10-22 13:39:04 +02:00
Anton Medvedev c19d6d15fc Refactor operator patcher 2022-10-22 13:30:57 +02:00
Anton Medvedev 26975ea2f3 Cast to int and float64 by default 2022-10-19 22:50:34 +02:00
Anton Medvedev 2a34731b5a Add FieldByIndex optimization 2022-10-19 00:55:01 +02:00
Anton Medvedev b0705d7de2 Add OpDeref opcode 2022-10-18 00:08:53 +02:00
Anton Medvedev cfb9b8c8cd Split any type in checker 2022-10-16 22:09:38 +02:00
Anton Medvedev 22784d8183 More tests 2022-10-15 22:52:40 +02:00
Anton Medvedev 873d4eecac wip 2022-10-15 20:31:04 +02:00
Anton Medvedev 6ec345bffd Remove debug lines 2022-10-13 19:33:55 +02:00
Anton Medvedev c4a3d22ff1 More fixes 2022-10-13 18:59:12 +02:00
Anton Medvedev 514a6dcfa7 Fix OpCall 2022-10-13 10:39:56 +02:00
Anton Medvedev 6a7630dba1 Remove ast nodes 2022-10-10 20:26:59 +02:00
Anton Medvedev 56127510a5 Refactor tests and start refactoring nil safe operator 2022-10-09 12:28:51 +02:00
Erik GeiserandGitHub 76ccb0a468 Allow renaming struct fields using struct tags (#251) 2022-10-06 11:12:49 +02:00
Tommy MessbauerandGitHub d48f1e4ac9 Adds support for common operators for time.Time (#256)
* adds support for common operators for time.Time

* adds eval tests for time operators. updates checker to allow time.Time and time.Duration to be passed to the operator fns.

* allows duration to be the first arg in time addition. updates the checker return types as they were incorrect.

* add ability to compare time to any interface

* adds checker test for time + interface combinations
2022-10-03 20:40:53 +02:00
Brenan KelleyandGitHub 7bb3ef506e fix ConstExpr to handle custom functions returned error (#239) 2022-05-24 21:38:59 +02:00
Zach BadgettandGitHub 3eb822d35a Add nil safe operator (#173) 2021-06-07 22:53:12 +03:00
subham sarkarandGitHub 3d93d59b1c Fix double dot range for invalid input (#164)
* Fix double dot range for invalid input.

* Fix a corner case and add test case.
2021-03-01 13:19:14 +03:00
subham sarkarandAnton Medvedev cb0d7d27a5 Add test case for #123 2021-02-25 09:44:07 +01:00
Anton Medvedev 31ed24b493 Fix compiler fold optimization of "integer divide by zero" 2020-09-09 22:07:26 +02:00
Anton Medvedev 6ed6d6b850 Add support for maps in len builtin 2020-05-15 19:10:01 +03:00
Anton Medvedev 32f1f87d79 Fix parsing of pointers in nested closures 2020-05-15 19:03:50 +03:00
Anton Medvedev 887ea6b8c8 fix ambiguous embed struct reference 2020-05-10 15:16:43 +03:00
Ernest MickleiandAnton Medvedev 28881a233c fix folding of constant ints 2020-05-10 13:51:54 +03:00
Ernest MickleiandAnton Medvedev 8b0a8ef405 add test to demo issue 2020-05-10 13:51:54 +03:00
Anton Medvedev 5a5ea6b96f Fix type check for fast call path 2020-03-26 21:17:47 +03:00
Anton Medvedev 90c452a737 Fix type checker for filter builtin 2020-03-26 18:30:30 +03:00
Anton Medvedev 1a7df6aa1e Expose file.Error type for better error handling 2020-03-20 15:26:46 +03:00
Anton Medvedev 94400068f2 Add double type-check when a patch is present 2020-03-17 20:42:51 +03:00
Anton Medvedev e5049dfda3 Make conf top-level package 2020-03-16 16:29:25 +03:00
Anton Medvedev cd6348b6bf Add expr.Patch func 2020-03-16 16:29:25 +03:00
Anton MedvedevandGitHub acba548cab Add ConstExpr 2020-03-10 08:36:12 +03:00
Anton Medvedev 0223fa9f0c Make type checking non-strict by default 2020-03-06 14:26:58 +03:00
Anton Medvedev 70a3b730ce Add AllowUndefinedVariables option examples 2020-03-04 09:41:20 +03:00
Anton Medvedev 9d53cd2118 Add count builtin 2020-02-25 17:39:06 +03:00
Anton Medvedev 602e5d37a6 Fix fast call type checker and add error message to pointer accessor outside closure 2020-02-25 13:50:59 +03:00
Anton Medvedev 3c734b49a9 Improve error messages for eof 2020-02-25 09:33:17 +03:00
Anton Medvedev 0809f2c91b Refactor to use new parser 2020-02-25 09:33:17 +03:00
Anton Medvedev dfe6009884 Fix check for nil interface 2020-02-21 10:14:14 +03:00
fa91adf0ac Allow passing nil to functions as nil interface{} (#87)
* Update vm.go

golang gotcha: reflect calls with nil params fail without this trick

* Update vm.go

* Problem with passing "nil" when operators are overloaded with interface{} type parameters fixed

e.g.
a != nil
was not working when "!=" is overloaded with
func notEqual(a, b interface{}) interface{} {...}

* Compile fix

Forgot to close ")"

* Added test that illustrates what did not work when using overloaded operators and passing nil

* Updated test for overloaded eaqal with using nil

a == b replaced with a == nil to illustrated the problem when using nil directly in expression

* Fixed the problem for untyped nil

We use the trick only for untyped nil:
https://play.golang.org/p/MyAztoZaqhx

* Refactor call procedure

Co-authored-by: wintermute-cds <[email protected]>
2020-02-20 16:59:15 +03:00
TarasZakandAnton Medvedev 10b48c0915 Add compile checks for undefined variables (#85)
* Add compile checks for undefined variables

* Update expr_test.go

Co-authored-by: Anton Medvedev <[email protected]>
2020-01-24 14:53:53 +03:00