mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-12 21:10:37 +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>
71 lines
1.4 KiB
C++
71 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/Location.h"
|
|
#include "Luau/Lexer.h"
|
|
#include "Luau/StringUtils.h"
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
class AstStatBlock;
|
|
|
|
class ParseError : public std::exception
|
|
{
|
|
public:
|
|
ParseError(const Location& location, const std::string& message);
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
const Location& getLocation() const;
|
|
const std::string& getMessage() const;
|
|
|
|
static LUAU_NORETURN void raise(const Location& location, const char* format, ...) LUAU_PRINTF_ATTR(2, 3);
|
|
|
|
private:
|
|
Location location;
|
|
std::string message;
|
|
};
|
|
|
|
class ParseErrors : public std::exception
|
|
{
|
|
public:
|
|
ParseErrors(std::vector<ParseError> errors);
|
|
|
|
virtual const char* what() const throw();
|
|
|
|
const std::vector<ParseError>& getErrors() const;
|
|
|
|
private:
|
|
std::vector<ParseError> errors;
|
|
std::string message;
|
|
};
|
|
|
|
struct HotComment
|
|
{
|
|
bool header;
|
|
Location location;
|
|
std::string content;
|
|
};
|
|
|
|
struct Comment
|
|
{
|
|
Lexeme::Type type; // Comment, BlockComment, or BrokenComment
|
|
Location location;
|
|
};
|
|
|
|
struct ParseResult
|
|
{
|
|
AstStatBlock* root;
|
|
size_t lines = 0;
|
|
|
|
std::vector<HotComment> hotcomments;
|
|
std::vector<ParseError> errors;
|
|
|
|
std::vector<Comment> commentLocations;
|
|
};
|
|
|
|
static constexpr const char* kParseNameError = "%error-id%";
|
|
|
|
} // namespace Luau
|