mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-08 12:29:09 +00:00
c7c986b996
* Fixed `Frontend::markDirty` not working on modules that were not typechecked yet * Fixed generic variadic function unification succeeding when it should have reported an error New Type Solver: * Implemented semantic subtyping check for function types Native Code Generation: * Improved performance of numerical loops with a constant step * Simplified IR for `bit32.extract` calls extracting first/last bits * Improved performance of NaN checks
34 lines
1.5 KiB
C++
34 lines
1.5 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#include "Luau/GlobalTypes.h"
|
|
|
|
LUAU_FASTFLAG(LuauInitializeStringMetatableInGlobalTypes)
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
GlobalTypes::GlobalTypes(NotNull<BuiltinTypes> builtinTypes)
|
|
: builtinTypes(builtinTypes)
|
|
{
|
|
globalScope = std::make_shared<Scope>(globalTypes.addTypePack(TypePackVar{FreeTypePack{TypeLevel{}}}));
|
|
|
|
globalScope->addBuiltinTypeBinding("any", TypeFun{{}, builtinTypes->anyType});
|
|
globalScope->addBuiltinTypeBinding("nil", TypeFun{{}, builtinTypes->nilType});
|
|
globalScope->addBuiltinTypeBinding("number", TypeFun{{}, builtinTypes->numberType});
|
|
globalScope->addBuiltinTypeBinding("string", TypeFun{{}, builtinTypes->stringType});
|
|
globalScope->addBuiltinTypeBinding("boolean", TypeFun{{}, builtinTypes->booleanType});
|
|
globalScope->addBuiltinTypeBinding("thread", TypeFun{{}, builtinTypes->threadType});
|
|
globalScope->addBuiltinTypeBinding("unknown", TypeFun{{}, builtinTypes->unknownType});
|
|
globalScope->addBuiltinTypeBinding("never", TypeFun{{}, builtinTypes->neverType});
|
|
|
|
if (FFlag::LuauInitializeStringMetatableInGlobalTypes)
|
|
{
|
|
unfreeze(*builtinTypes->arena);
|
|
TypeId stringMetatableTy = makeStringMetatable(builtinTypes);
|
|
asMutable(builtinTypes->stringType)->ty.emplace<PrimitiveType>(PrimitiveType::String, stringMetatableTy);
|
|
persist(stringMetatableTy);
|
|
freeze(*builtinTypes->arena);
|
|
}
|
|
}
|
|
|
|
}
|