2022-09-15 23:38:17 +01:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
2023-11-03 23:45:04 +00:00
|
|
|
#include "Luau/ConstraintGenerator.h"
|
2022-10-21 18:54:01 +01:00
|
|
|
#include "Luau/ConstraintSolver.h"
|
2022-09-15 23:38:17 +01:00
|
|
|
#include "Luau/DcrLogger.h"
|
|
|
|
#include "Luau/TypeArena.h"
|
|
|
|
#include "Luau/Module.h"
|
|
|
|
|
|
|
|
#include "Fixture.h"
|
|
|
|
#include "ScopedFlags.h"
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
|
2023-11-03 23:45:04 +00:00
|
|
|
struct ConstraintGeneratorFixture : Fixture
|
2022-09-15 23:38:17 +01:00
|
|
|
{
|
|
|
|
TypeArena arena;
|
|
|
|
ModulePtr mainModule;
|
|
|
|
DcrLogger logger;
|
2022-10-21 18:54:01 +01:00
|
|
|
UnifierSharedState sharedState{&ice};
|
2023-01-04 20:53:17 +00:00
|
|
|
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
|
2022-10-21 18:54:01 +01:00
|
|
|
|
|
|
|
std::unique_ptr<DataFlowGraph> dfg;
|
2023-11-03 23:45:04 +00:00
|
|
|
std::unique_ptr<ConstraintGenerator> cg;
|
2022-10-21 18:54:01 +01:00
|
|
|
Scope* rootScope = nullptr;
|
|
|
|
|
|
|
|
std::vector<NotNull<Constraint>> constraints;
|
2022-09-15 23:38:17 +01:00
|
|
|
|
|
|
|
ScopedFastFlag forceTheFlag;
|
|
|
|
|
2023-11-03 23:45:04 +00:00
|
|
|
ConstraintGeneratorFixture();
|
2022-10-21 18:54:01 +01:00
|
|
|
|
|
|
|
void generateConstraints(const std::string& code);
|
|
|
|
void solve(const std::string& code);
|
2022-09-15 23:38:17 +01:00
|
|
|
};
|
|
|
|
|
2022-10-14 20:48:41 +01:00
|
|
|
} // namespace Luau
|