mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 05:20:38 +00:00
a6b5051edc
* https://github.com/Roblox/luau/pull/719 * Improved `Failed to unify type packs` error message to be reported as `Type pack 'X' could not be converted into 'Y'` * https://github.com/Roblox/luau/pull/722 * 1% reduction in executed instruction count by removing a check in fast call dispatch * Additional fixes to reported error location of OOM errors in VM * Improve `math.sqrt`, `math.floor` and `math.ceil` performance on additional compilers and platforms (1-2% geomean improvement including 8-9% on math-cordic) * All thrown exceptions by Luau analysis are derived from `Luau::InternalCompilerError` * When a call site has fewer arguments than required, error now reports the location of the function name instead of the argument to the function * https://github.com/Roblox/luau/pull/724 * Fixed https://github.com/Roblox/luau/issues/725 Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Andy Friesen <afriesen@roblox.com>
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "Luau/Common.h"
|
|
#include "Luau/Error.h"
|
|
|
|
#include <stdexcept>
|
|
#include <exception>
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
struct RecursionLimitException : public InternalCompilerError
|
|
{
|
|
RecursionLimitException()
|
|
: InternalCompilerError("Internal recursion counter limit exceeded")
|
|
{
|
|
LUAU_ASSERT(FFlag::LuauIceExceptionInheritanceChange);
|
|
}
|
|
};
|
|
|
|
struct RecursionLimitException_DEPRECATED : public std::exception
|
|
{
|
|
const char* what() const noexcept
|
|
{
|
|
LUAU_ASSERT(!FFlag::LuauIceExceptionInheritanceChange);
|
|
return "Internal recursion counter limit exceeded";
|
|
}
|
|
};
|
|
|
|
struct RecursionCounter
|
|
{
|
|
RecursionCounter(int* count)
|
|
: count(count)
|
|
{
|
|
++(*count);
|
|
}
|
|
|
|
~RecursionCounter()
|
|
{
|
|
LUAU_ASSERT(*count > 0);
|
|
--(*count);
|
|
}
|
|
|
|
private:
|
|
int* count;
|
|
};
|
|
|
|
struct RecursionLimiter : RecursionCounter
|
|
{
|
|
RecursionLimiter(int* count, int limit)
|
|
: RecursionCounter(count)
|
|
{
|
|
if (limit > 0 && *count > limit)
|
|
{
|
|
if (FFlag::LuauIceExceptionInheritanceChange)
|
|
{
|
|
throw RecursionLimitException();
|
|
}
|
|
else
|
|
{
|
|
throw RecursionLimitException_DEPRECATED();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
} // namespace Luau
|