luau/Analysis/src/Refinement.cpp

33 lines
909 B
C++
Raw Normal View History

2022-11-04 17:02:37 +00:00
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2023-02-03 12:34:12 +00:00
#include "Luau/Refinement.h"
2022-11-04 17:02:37 +00:00
namespace Luau
{
2023-02-03 12:34:12 +00:00
RefinementId RefinementArena::negation(RefinementId refinement)
2022-11-04 17:02:37 +00:00
{
2023-02-03 12:34:12 +00:00
return NotNull{allocator.allocate(Negation{refinement})};
2022-11-04 17:02:37 +00:00
}
2023-02-03 12:34:12 +00:00
RefinementId RefinementArena::conjunction(RefinementId lhs, RefinementId rhs)
2022-11-04 17:02:37 +00:00
{
return NotNull{allocator.allocate(Conjunction{lhs, rhs})};
}
2023-02-03 12:34:12 +00:00
RefinementId RefinementArena::disjunction(RefinementId lhs, RefinementId rhs)
2022-11-04 17:02:37 +00:00
{
return NotNull{allocator.allocate(Disjunction{lhs, rhs})};
}
2023-02-03 12:34:12 +00:00
RefinementId RefinementArena::equivalence(RefinementId lhs, RefinementId rhs)
2022-11-04 17:02:37 +00:00
{
return NotNull{allocator.allocate(Equivalence{lhs, rhs})};
}
2023-02-03 12:34:12 +00:00
RefinementId RefinementArena::proposition(DefId def, TypeId discriminantTy)
2022-11-04 17:02:37 +00:00
{
return NotNull{allocator.allocate(Proposition{def, discriminantTy})};
}
} // namespace Luau