mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-14 22:21:10 +00:00
32fb6d10a7
- Fix some cases where type checking would overflow the native stack - Improve autocomplete behavior when assigning a partially written function call (not currently exposed through command line tools) - Improve autocomplete type inference feedback for some expressions where previously the type would not be known - Improve quantification performance during type checking for large types - Improve type checking for table literals when the expected type of the table is known because of a type annotation - Fix type checking errors in cases where required module has errors in the resulting type - Fix debug line information for multi-line chained call sequences (Add function name information for "attempt to call a nil value" #255) - lua_newuserdata now takes 2 arguments to match Lua/LuaJIT APIs better; lua_newuserdatatagged should be used if the third argument was non-0. - lua_ref can no longer be used with LUA_REGISTRYINDEX to prevent mistakes when migrating Lua FFI (Inconsistency with lua_ref #247) - Fix assertions and possible crashes when executing script code indirectly via metatable dispatch from lua_equal/lua_lessthan/lua_getfield/etc. (Hitting a crash in an assert after lua_equal is called. #259) - Fix flamegraph scripts to run under Python 2
64 lines
1.1 KiB
C++
64 lines
1.1 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 <string>
|
|
#include <optional>
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
class AstExpr;
|
|
|
|
using ModuleName = std::string;
|
|
|
|
struct SourceCode
|
|
{
|
|
enum Type
|
|
{
|
|
None,
|
|
Module,
|
|
Script,
|
|
Local
|
|
};
|
|
|
|
std::string source;
|
|
Type type;
|
|
};
|
|
|
|
struct ModuleInfo
|
|
{
|
|
ModuleName name;
|
|
bool optional = false;
|
|
};
|
|
|
|
struct FileResolver
|
|
{
|
|
virtual ~FileResolver() {}
|
|
|
|
virtual std::optional<SourceCode> readSource(const ModuleName& name) = 0;
|
|
|
|
virtual std::optional<ModuleInfo> resolveModule(const ModuleInfo* context, AstExpr* expr)
|
|
{
|
|
return std::nullopt;
|
|
}
|
|
|
|
virtual std::string getHumanReadableModuleName(const ModuleName& name) const
|
|
{
|
|
return name;
|
|
}
|
|
|
|
virtual std::optional<std::string> getEnvironmentForModule(const ModuleName& name) const
|
|
{
|
|
return std::nullopt;
|
|
}
|
|
};
|
|
|
|
struct NullFileResolver : FileResolver
|
|
{
|
|
std::optional<SourceCode> readSource(const ModuleName& name) override
|
|
{
|
|
return std::nullopt;
|
|
}
|
|
};
|
|
|
|
} // namespace Luau
|