// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details #include "Luau/GlobalTypes.h" namespace Luau { GlobalTypes::GlobalTypes(NotNull builtinTypes) : builtinTypes(builtinTypes) { globalScope = std::make_shared(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("buffer", TypeFun{{}, builtinTypes->bufferType}); globalScope->addBuiltinTypeBinding("unknown", TypeFun{{}, builtinTypes->unknownType}); globalScope->addBuiltinTypeBinding("never", TypeFun{{}, builtinTypes->neverType}); unfreeze(*builtinTypes->arena); TypeId stringMetatableTy = makeStringMetatable(builtinTypes); asMutable(builtinTypes->stringType)->ty.emplace(PrimitiveType::String, stringMetatableTy); persist(stringMetatableTy); freeze(*builtinTypes->arena); } } // namespace Luau