@@ -36,7 +36,6 @@
37namespace PureScript {
37namespace PureScript {
39−using integer = std::intptr_t;
40using cstring = const char *;
39using cstring = const char *;
41using nullptr_t = std::nullptr_t;
40using nullptr_t = std::nullptr_t;
@@ -46,9 +45,6 @@ public:
46 runtime_error(const char message[]) : std::runtime_error(std::string(message)) {}
45 runtime_error(const char message[]) : std::runtime_error(std::string(message)) {}
49−const integer INTEGER_MIN = INTPTR_MIN;
50−const integer INTEGER_MAX = INTPTR_MAX;
52const bool undefined = false;
48const bool undefined = false;
53const size_t constructor = 0;
49const size_t constructor = 0;
@@ -128,7 +124,7 @@ class any {
130 mutable thunk t;
126 mutable thunk t;
131− mutable integer i;
127+ mutable int i;
132 mutable double d;
128 mutable double d;
133 mutable char c;
129 mutable char c;
134 mutable bool b;
130 mutable bool b;
@@ -147,9 +143,11 @@ class any {
150− any(const integer val) noexcept : type(Type::Integer), i(val) {}
151 any(const int val) noexcept : type(Type::Integer), i(val) {}
146 any(const int val) noexcept : type(Type::Integer), i(val) {}
152− any(const unsigned int val) noexcept : type(Type::Integer), i(val) {}
147+ any(const long int_value) noexcept : type(Type::Integer), i(int_value) {
148+ assert(int_value >= INT_MIN && int_value <= INT_MAX);
153 any(const double val) noexcept : type(Type::Double), d(val) {}
151 any(const double val) noexcept : type(Type::Double), d(val) {}
154 any(const char val) noexcept : type(Type::Character), c(val) {}
152 any(const char val) noexcept : type(Type::Character), c(val) {}
@@ -305,7 +303,7 @@ class any {
305 auto operator()(const as_thunk) const -> const any&;
303 auto operator()(const as_thunk) const -> const any&;
306 auto operator()() const -> any;
304 auto operator()() const -> any;
308− operator integer() const;
306+ operator int() const;
309 operator double() const;
307 operator double() const;
310 operator bool() const;
308 operator bool() const;
311 operator char() const;
309 operator char() const;
@@ -338,21 +336,12 @@ class any {
338 return lhs op (ty)rhs; \
336 return lhs op (ty)rhs; \
341− #define DEFINE_INT_OPERATOR(op, rty) \
342− inline friend auto operator op (const any& lhs, int rhs) -> rty { \
343− return (integer)lhs op (integer)rhs; \
345− inline friend auto operator op (int lhs, const any& rhs) -> rty { \
346− return (integer)lhs op (integer)rhs; \
349 #define DECLARE_COMPARISON_OPERATOR(op) \
339 #define DECLARE_COMPARISON_OPERATOR(op) \
350 friend auto operator op (const any&, const any&) -> bool; \
340 friend auto operator op (const any&, const any&) -> bool; \
351− DEFINE_OPERATOR(op, integer, bool) \
341+ DEFINE_OPERATOR(op, int, bool) \
352 DEFINE_OPERATOR(op, double, bool) \
342 DEFINE_OPERATOR(op, double, bool) \
353 DEFINE_OPERATOR(op, char, bool) \
343 DEFINE_OPERATOR(op, char, bool) \
354 DEFINE_OPERATOR(op, bool, bool) \
344 DEFINE_OPERATOR(op, bool, bool) \
355− DEFINE_INT_OPERATOR(op, bool) \
356 friend auto operator op (const any&, const char * const) -> bool; \
345 friend auto operator op (const any&, const char * const) -> bool; \
357 friend auto operator op (const char * const, const any&) -> bool;
346 friend auto operator op (const char * const, const any&) -> bool;
@@ -365,39 +354,34 @@ class any {
366 friend auto operator+(const any&, const any&) -> any;
355 friend auto operator+(const any&, const any&) -> any;
368− DEFINE_OPERATOR(+, integer, integer)
357+ DEFINE_OPERATOR(+, int, int)
369 DEFINE_OPERATOR(+, double, double)
358 DEFINE_OPERATOR(+, double, double)
370 DEFINE_OPERATOR(+, char, char)
359 DEFINE_OPERATOR(+, char, char)
371− DEFINE_INT_OPERATOR(+, integer)
372 friend auto operator+(const any& lhs, const char * const rhs) -> std::string;
360 friend auto operator+(const any& lhs, const char * const rhs) -> std::string;
373 friend auto operator+(const char * const lhs, const any& rhs) -> std::string;
361 friend auto operator+(const char * const lhs, const any& rhs) -> std::string;
375 friend auto operator-(const any&, const any&) -> any;
363 friend auto operator-(const any&, const any&) -> any;
377− DEFINE_OPERATOR(-, integer, integer)
365+ DEFINE_OPERATOR(-, int, int)
378 DEFINE_OPERATOR(-, double, double)
366 DEFINE_OPERATOR(-, double, double)
379 DEFINE_OPERATOR(-, char, char)
367 DEFINE_OPERATOR(-, char, char)
380− DEFINE_INT_OPERATOR(-, integer)
382 friend auto operator*(const any&, const any&) -> any;
369 friend auto operator*(const any&, const any&) -> any;
384− DEFINE_OPERATOR(*, integer, integer)
371+ DEFINE_OPERATOR(*, int, int)
385 DEFINE_OPERATOR(*, double, double)
372 DEFINE_OPERATOR(*, double, double)
386 DEFINE_OPERATOR(*, char, char)
373 DEFINE_OPERATOR(*, char, char)
387− DEFINE_INT_OPERATOR(*, integer)
389 friend auto operator/(const any&, const any&) -> any;
375 friend auto operator/(const any&, const any&) -> any;
391− DEFINE_OPERATOR(/, integer, integer)
377+ DEFINE_OPERATOR(/, int, int)
392 DEFINE_OPERATOR(/, double, double)
378 DEFINE_OPERATOR(/, double, double)
393 DEFINE_OPERATOR(/, char, char)
379 DEFINE_OPERATOR(/, char, char)
394− DEFINE_INT_OPERATOR(/, integer)
396 friend auto operator%(const any&, const any&) -> any;
381 friend auto operator%(const any&, const any&) -> any;
398− DEFINE_OPERATOR(%, integer, integer)
383+ DEFINE_OPERATOR(%, int, int)
399 DEFINE_OPERATOR(%, char, char)
384 DEFINE_OPERATOR(%, char, char)
400− DEFINE_INT_OPERATOR(%, integer)
402 friend auto operator-(const any&) -> any; // unary negate
386 friend auto operator-(const any&) -> any; // unary negate
@@ -436,7 +420,6 @@ inline auto cast(const any& a) ->
436#undef WITH_ALLOCATOR
420#undef WITH_ALLOCATOR
437#undef IS_POINTER_TYPE
421#undef IS_POINTER_TYPE
438#undef DEFINE_OPERATOR
422#undef DEFINE_OPERATOR
439−#undef DEFINE_INT_OPERATOR
440#undef DECLARE_COMPARISON_OPERATOR
423#undef DECLARE_COMPARISON_OPERATOR
442#endif // PureScript_HH
425#endif // PureScript_HH