luau/Compiler/src/Types.h

33 lines
1.2 KiB
C
Raw Normal View History

2023-06-16 10:01:18 -07:00
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
#pragma once
#include "Luau/Ast.h"
2024-04-25 13:57:23 -07:00
#include "Luau/Bytecode.h"
2023-08-11 15:55:30 +03:00
#include "Luau/DenseHash.h"
2024-05-03 09:38:34 -07:00
#include "ValueTracking.h"
2023-06-16 10:01:18 -07:00
2023-07-07 10:14:35 -07:00
#include <string>
2023-06-16 10:01:18 -07:00
namespace Luau
{
2023-07-07 10:14:35 -07:00
2024-05-03 09:38:34 -07:00
struct BuiltinTypes
{
BuiltinTypes(const char* vectorType)
: vectorType{{}, std::nullopt, AstName{vectorType}, std::nullopt, {}}
{
}
// AstName use here will not match the AstNameTable, but the was we use them here always force a full string compare
AstTypeReference booleanType{{}, std::nullopt, AstName{"boolean"}, std::nullopt, {}};
AstTypeReference numberType{{}, std::nullopt, AstName{"number"}, std::nullopt, {}};
AstTypeReference stringType{{}, std::nullopt, AstName{"string"}, std::nullopt, {}};
AstTypeReference vectorType;
};
void buildTypeMap(DenseHashMap<AstExprFunction*, std::string>& functionTypes, DenseHashMap<AstLocal*, LuauBytecodeType>& localTypes,
DenseHashMap<AstExpr*, LuauBytecodeType>& exprTypes, AstNode* root, const char* vectorType, const BuiltinTypes& builtinTypes,
const DenseHashMap<AstExprCall*, int>& builtinCalls, const DenseHashMap<AstName, Compile::Global>& globals);
2023-07-07 10:14:35 -07:00
2023-06-16 10:01:18 -07:00
} // namespace Luau