mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-14 22:21:10 +00:00
279855df91
- A series of major optimizations to type checking performance on complex programs/types (up to two orders of magnitude speedup for programs involving huge tagged unions) - Fix a few issues encountered by UBSAN (and maybe fix s390x builds) - Fix gcc-11 test builds - Fix a rare corner case where luau_load wouldn't wake inactive threads which could result in a use-after-free due to GC - Fix CLI crash when error object that's not a string escapes to top level - Fix Makefile suffixes on macOS Co-authored-by: Rodactor <rodactor@roblox.com>
51 lines
2.5 KiB
C++
51 lines
2.5 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/Scope.h"
|
|
#include "Luau/TypeInfer.h"
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
void registerBuiltinTypes(TypeChecker& typeChecker);
|
|
|
|
TypeId makeUnion(TypeArena& arena, std::vector<TypeId>&& types);
|
|
TypeId makeIntersection(TypeArena& arena, std::vector<TypeId>&& types);
|
|
|
|
/** Build an optional 't'
|
|
*/
|
|
TypeId makeOption(TypeChecker& typeChecker, TypeArena& arena, TypeId t);
|
|
|
|
/** Small utility function for building up type definitions from C++.
|
|
*/
|
|
TypeId makeFunction( // Monomorphic
|
|
TypeArena& arena, std::optional<TypeId> selfType, std::initializer_list<TypeId> paramTypes, std::initializer_list<TypeId> retTypes);
|
|
|
|
TypeId makeFunction( // Polymorphic
|
|
TypeArena& arena, std::optional<TypeId> selfType, std::initializer_list<TypeId> generics, std::initializer_list<TypePackId> genericPacks,
|
|
std::initializer_list<TypeId> paramTypes, std::initializer_list<TypeId> retTypes);
|
|
|
|
TypeId makeFunction( // Monomorphic
|
|
TypeArena& arena, std::optional<TypeId> selfType, std::initializer_list<TypeId> paramTypes, std::initializer_list<std::string> paramNames,
|
|
std::initializer_list<TypeId> retTypes);
|
|
|
|
TypeId makeFunction( // Polymorphic
|
|
TypeArena& arena, std::optional<TypeId> selfType, std::initializer_list<TypeId> generics, std::initializer_list<TypePackId> genericPacks,
|
|
std::initializer_list<TypeId> paramTypes, std::initializer_list<std::string> paramNames, std::initializer_list<TypeId> retTypes);
|
|
|
|
void attachMagicFunction(TypeId ty, MagicFunction fn);
|
|
|
|
Property makeProperty(TypeId ty, std::optional<std::string> documentationSymbol = std::nullopt);
|
|
void assignPropDocumentationSymbols(TableTypeVar::Props& props, const std::string& baseName);
|
|
|
|
std::string getBuiltinDefinitionSource();
|
|
|
|
void addGlobalBinding(TypeChecker& typeChecker, const std::string& name, TypeId ty, const std::string& packageName);
|
|
void addGlobalBinding(TypeChecker& typeChecker, const std::string& name, Binding binding);
|
|
void addGlobalBinding(TypeChecker& typeChecker, const ScopePtr& scope, const std::string& name, TypeId ty, const std::string& packageName);
|
|
void addGlobalBinding(TypeChecker& typeChecker, const ScopePtr& scope, const std::string& name, Binding binding);
|
|
std::optional<Binding> tryGetGlobalBinding(TypeChecker& typeChecker, const std::string& name);
|
|
Binding* tryGetGlobalBindingRef(TypeChecker& typeChecker, const std::string& name);
|
|
TypeId getGlobalBinding(TypeChecker& typeChecker, const std::string& name);
|
|
|
|
} // namespace Luau
|