mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-05 19:09:11 +00:00
cdd1a380db
### What's changed? * Syntax for [read-only and write-only properties](https://github.com/luau-lang/rfcs/pull/15) is now parsed, but is not yet supported in typechecking ### New Type Solver * `keyof` and `rawkeyof` type operators have been updated to match final text of the [RFC](https://github.com/luau-lang/rfcs/pull/16) * Fixed issues with cyclic type families that were generated for mutable loop variables ### Native Code Generation * Fixed inference for number / vector operation that caused an unnecessary VM assist --- ### Internal Contributors Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
30 lines
1.4 KiB
C++
30 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
|
|
|
|
#include "Luau/GlobalTypes.h"
|
|
|
|
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("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>(PrimitiveType::String, stringMetatableTy);
|
|
persist(stringMetatableTy);
|
|
freeze(*builtinTypes->arena);
|
|
}
|
|
|
|
} // namespace Luau
|