mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Add FFlag
This commit is contained in:
parent
7c5dffd424
commit
da7557c453
2 changed files with 5 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution);
|
LUAU_FASTFLAG(DebugLuauDeferredConstraintResolution);
|
||||||
|
LUAU_FASTFLAGVARIABLE(LuauFixBindingForGlobalPos, false);
|
||||||
|
|
||||||
namespace Luau
|
namespace Luau
|
||||||
{
|
{
|
||||||
|
@ -334,7 +335,7 @@ static std::optional<AstStatLocal*> findBindingLocalStatement(const SourceModule
|
||||||
{
|
{
|
||||||
// Bindings coming from global sources (e.g., definition files) have a zero position.
|
// Bindings coming from global sources (e.g., definition files) have a zero position.
|
||||||
// They cannot be defined from a local statement
|
// They cannot be defined from a local statement
|
||||||
if (binding.location == Location{{0, 0}, {0, 0}})
|
if (FFlag::LuauFixBindingForGlobalPos && binding.location == Location{{0, 0}, {0, 0}})
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
std::vector<AstNode*> nodes = findAstAncestryOfPosition(source, binding.location.begin);
|
std::vector<AstNode*> nodes = findAstAncestryOfPosition(source, binding.location.begin);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "doctest.h"
|
#include "doctest.h"
|
||||||
#include "Fixture.h"
|
#include "Fixture.h"
|
||||||
|
|
||||||
|
LUAU_FASTFLAG(LuauFixBindingForGlobalPos);
|
||||||
|
|
||||||
using namespace Luau;
|
using namespace Luau;
|
||||||
|
|
||||||
struct DocumentationSymbolFixture : BuiltinsFixture
|
struct DocumentationSymbolFixture : BuiltinsFixture
|
||||||
|
@ -333,6 +335,7 @@ TEST_CASE_FIXTURE(Fixture, "find_expr_ancestry")
|
||||||
|
|
||||||
TEST_CASE_FIXTURE(BuiltinsFixture, "find_binding_at_position_global_start_of_file")
|
TEST_CASE_FIXTURE(BuiltinsFixture, "find_binding_at_position_global_start_of_file")
|
||||||
{
|
{
|
||||||
|
ScopedFastFlag sff{FFlag::LuauFixBindingForGlobalPos, true};
|
||||||
check("local x = string.char(1)");
|
check("local x = string.char(1)");
|
||||||
const Position pos(0, 12);
|
const Position pos(0, 12);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue