luau/tests/ConstraintGraphBuilderFixture.h

39 lines
952 B
C
Raw Normal View History

2022-09-15 15:13:58 -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/ConstraintGraphBuilder.h"
2022-10-21 10:33:43 -07:00
#include "Luau/ConstraintSolver.h"
2022-09-15 15:13:58 -07:00
#include "Luau/DcrLogger.h"
#include "Luau/TypeArena.h"
#include "Luau/Module.h"
#include "Fixture.h"
#include "ScopedFlags.h"
namespace Luau
{
struct ConstraintGraphBuilderFixture : Fixture
{
TypeArena arena;
ModulePtr mainModule;
DcrLogger logger;
2022-10-21 10:33:43 -07:00
UnifierSharedState sharedState{&ice};
2023-01-03 19:33:19 +02:00
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
2022-10-21 10:33:43 -07:00
std::unique_ptr<DataFlowGraph> dfg;
std::unique_ptr<ConstraintGraphBuilder> cgb;
Scope* rootScope = nullptr;
std::vector<NotNull<Constraint>> constraints;
2022-09-15 15:13:58 -07:00
ScopedFastFlag forceTheFlag;
ConstraintGraphBuilderFixture();
2022-10-21 10:33:43 -07:00
void generateConstraints(const std::string& code);
void solve(const std::string& code);
2022-09-15 15:13:58 -07:00
};
2022-10-14 01:59:53 +03:00
} // namespace Luau