Better handling of casting
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-08-18 13:17:53 +02:00
parent 0fde3d46df
commit 1d72e2eccd
8 changed files with 78 additions and 21 deletions

View File

@@ -28,6 +28,7 @@ namespace Porygon::Binder {
NumericalTable,
Table,
Require,
ImplicitCast,
};
class BoundExpression {
@@ -332,6 +333,28 @@ namespace Porygon::Binder {
}
};
class BoundImplicitCastExpression : public BoundExpression {
const BoundExpression* _expression;
public:
BoundImplicitCastExpression(BoundExpression* expression, shared_ptr<const ScriptType> castType)
: BoundExpression(expression->GetStartPosition(), expression->GetLength(), castType),
_expression(expression)
{}
const BoundExpression* GetExpression() const{
return _expression;
}
~BoundImplicitCastExpression() final {
delete _expression;
}
[[nodiscard]]
inline BoundExpressionKind GetKind() const final {
return BoundExpressionKind::ImplicitCast;
}
};
}
#endif //PORYGONLANG_BOUNDEXPRESSION_HPP