mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
16fbfe912c
- Cleaned up `FFlag::FixFindBindingAtFunctionName`, `FFlag::LuauNormalizeBlockedTypes`, `FFlag::LuauPCallDebuggerFix` - Added support for break and continue into control flow analysis - The old type unification engine will now report a more fine-grained error at times, indicating that type normalization in particular failed # New Type Solver - Refactor of Unifier2, the new unification implementation for Luau - Completed MVP of new unification implementation - Dramatically simplified overload selection logic - Type family reduction can now apply sooner to free types that have been solved - Subtyping now supports table indexers - Generalization now replaces bad generics with unknown # Native Code Generation - Reduce stack spills caused by FINDUPVAL and STORE_TAG - Improve Generate SHL/SHR/SAR/rotates with immediate operands in X64 - Removed redundant case re-check in table lookup fallback --------- Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com>
37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "ConstraintGraphBuilderFixture.h"
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
ConstraintGraphBuilderFixture::ConstraintGraphBuilderFixture()
|
|
: Fixture()
|
|
, mainModule(new Module)
|
|
, forceTheFlag{"DebugLuauDeferredConstraintResolution", true}
|
|
{
|
|
mainModule->name = "MainModule";
|
|
mainModule->humanReadableName = "MainModule";
|
|
|
|
BlockedTypePack::nextIndex = 0;
|
|
}
|
|
|
|
void ConstraintGraphBuilderFixture::generateConstraints(const std::string& code)
|
|
{
|
|
AstStatBlock* root = parse(code);
|
|
dfg = std::make_unique<DataFlowGraph>(DataFlowGraphBuilder::build(root, NotNull{&ice}));
|
|
cgb = std::make_unique<ConstraintGraphBuilder>(mainModule, NotNull{&normalizer}, NotNull(&moduleResolver), builtinTypes, NotNull(&ice),
|
|
frontend.globals.globalScope, /*prepareModuleScope*/ nullptr, &logger, NotNull{dfg.get()}, std::vector<RequireCycle>());
|
|
cgb->visit(root);
|
|
rootScope = cgb->rootScope;
|
|
constraints = Luau::borrowConstraints(cgb->constraints);
|
|
}
|
|
|
|
void ConstraintGraphBuilderFixture::solve(const std::string& code)
|
|
{
|
|
generateConstraints(code);
|
|
ConstraintSolver cs{NotNull{&normalizer}, NotNull{rootScope}, constraints, "MainModule", NotNull(&moduleResolver), {}, &logger, {}};
|
|
cs.run();
|
|
}
|
|
|
|
} // namespace Luau
|