mirror of
https://github.com/danog/liquid.git
synced 2024-12-02 11:57:47 +01:00
4354d48a04
Go's reflect API is very picky about arguments to Call method. You can't just pass in the "int" when function expects "int64", even on 64 bit machines. This patch solves this problem by performing conversions properly. Truncation problems however, as well as negative to uint issues are completely ignored. Which is perhaps not ideal, but still better than returning "int" when "int32" or "int64" is requested. I did split the Kind switch cases and moved value -> int and value -> float conversions to separate functions. An alternative to that would be using the reflection API, which might be less performant. Not that it matters much, but this solution is correct, even though looks a bit copy & pasty. Oh and of course all "uint" types were completely missing in the function and they are now added. |
||
---|---|---|
.. | ||
arrays.go | ||
call_test.go | ||
call.go | ||
compare_test.go | ||
compare.go | ||
convert_test.go | ||
convert.go | ||
docs.go | ||
drop_test.go | ||
drop.go | ||
evaluator_test.go | ||
mapslicevalue.go | ||
parsedate_test.go | ||
parsedate.go | ||
predicates_test.go | ||
predicates.go | ||
range.go | ||
sort.go | ||
structvalue_test.go | ||
structvalue.go | ||
value_test.go | ||
value.go |