aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/evaluator.cc16
-rw-r--r--boot/name_analysis.cc5
2 files changed, 19 insertions, 2 deletions
diff --git a/boot/evaluator.cc b/boot/evaluator.cc
index b7edd3a..7eb612b 100644
--- a/boot/evaluator.cc
+++ b/boot/evaluator.cc
@@ -534,6 +534,14 @@ namespace elna::boot
{
return constant_value{ static_cast<unsigned char>(0) };
}
+ if (is_primitive_type(resolved, "Bool"))
+ {
+ return constant_value{ false };
+ }
+ if (is_primitive_type(resolved, "Float"))
+ {
+ return constant_value{ -std::numeric_limits<double>::max() };
+ }
if (auto enumeration = resolved.get<enumeration_type>())
{
return constant_value{ 1 };
@@ -555,6 +563,14 @@ namespace elna::boot
{
return constant_value{ std::numeric_limits<unsigned char>::max() };
}
+ if (is_primitive_type(resolved, "Bool"))
+ {
+ return constant_value{ true };
+ }
+ if (is_primitive_type(resolved, "Float"))
+ {
+ return constant_value{ std::numeric_limits<double>::max() };
+ }
if (auto enumeration = resolved.get<enumeration_type>())
{
return constant_value{ static_cast<std::int32_t>(enumeration->members.size()) };
diff --git a/boot/name_analysis.cc b/boot/name_analysis.cc
index 22b7814..54a2d1a 100644
--- a/boot/name_analysis.cc
+++ b/boot/name_analysis.cc
@@ -539,9 +539,10 @@ for (const auto& member : expression->members)
if (!trait->type_decoration.empty())
{
type const resolved = resolve_underlying_type(trait->type_decoration);
- bool const is_enum = resolved.get<enumeration_type>() != nullptr;
- if (!is_enum && !is_discrete_type(resolved))
+ if (resolved.get<enumeration_type>() == nullptr
+ && !is_primitive_type(resolved, "Float")
+ && !is_discrete_type(resolved))
{
add_error<unsupported_trait_type_error>(trait->name,
trait->type_decoration);