Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/tests/ConstraintGeneratorFixture.h
2723 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
#pragma once
3
4
#include "Luau/ConstraintGenerator.h"
5
#include "Luau/ConstraintSolver.h"
6
#include "Luau/DcrLogger.h"
7
#include "Luau/Module.h"
8
#include "Luau/TypeArena.h"
9
10
#include "Fixture.h"
11
#include "ScopedFlags.h"
12
13
namespace Luau
14
{
15
16
struct ConstraintGeneratorFixture : Fixture
17
{
18
TypeArena arena;
19
ModulePtr mainModule;
20
DcrLogger logger;
21
UnifierSharedState sharedState{&ice};
22
Normalizer normalizer{&arena, getBuiltins(), NotNull{&sharedState}, SolverMode::New};
23
TypeCheckLimits limits;
24
TypeFunctionRuntime typeFunctionRuntime{NotNull{&ice}, NotNull{&limits}};
25
26
std::unique_ptr<DataFlowGraph> dfg;
27
std::unique_ptr<ConstraintGenerator> cg;
28
Scope* rootScope = nullptr;
29
30
std::vector<NotNull<Constraint>> constraints;
31
32
ScopedFastFlag forceTheFlag;
33
34
ConstraintGeneratorFixture();
35
36
void generateConstraints(const std::string& code);
37
void solve(const std::string& code);
38
};
39
40
} // namespace Luau
41
42