From 87a9840c69815a48990f04bf2545d6af3f984b37 Mon Sep 17 00:00:00 2001 From: UtoECat Date: Fri, 15 Dec 2023 06:33:13 +0300 Subject: [PATCH] fix Luau::Codegen::hasTypedParameters static function duplication --- CodeGen/src/BytecodeAnalysis.cpp | 7 +------ CodeGen/src/IrBuilder.cpp | 6 +----- CodeGen/src/IrProtoUtils.h | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 CodeGen/src/IrProtoUtils.h diff --git a/CodeGen/src/BytecodeAnalysis.cpp b/CodeGen/src/BytecodeAnalysis.cpp index 7e231054..9ef7ecbc 100644 --- a/CodeGen/src/BytecodeAnalysis.cpp +++ b/CodeGen/src/BytecodeAnalysis.cpp @@ -5,18 +5,13 @@ #include "Luau/IrData.h" #include "Luau/IrUtils.h" -#include "lobject.h" +#include "IrProtoUtils.h" namespace Luau { namespace CodeGen { -static bool hasTypedParameters(Proto* proto) -{ - return proto->typeinfo && proto->numparams != 0; -} - static uint8_t getBytecodeConstantTag(Proto* proto, unsigned ki) { TValue protok = proto->k[ki]; diff --git a/CodeGen/src/IrBuilder.cpp b/CodeGen/src/IrBuilder.cpp index 1fcc516c..f00b70c6 100644 --- a/CodeGen/src/IrBuilder.cpp +++ b/CodeGen/src/IrBuilder.cpp @@ -8,6 +8,7 @@ #include "Luau/IrUtils.h" #include "IrTranslation.h" +#include "IrProtoUtils.h" #include "lapi.h" @@ -27,11 +28,6 @@ IrBuilder::IrBuilder() { } -static bool hasTypedParameters(Proto* proto) -{ - return proto->typeinfo && proto->numparams != 0; -} - static void buildArgumentTypeChecks(IrBuilder& build, Proto* proto) { LUAU_ASSERT(hasTypedParameters(proto)); diff --git a/CodeGen/src/IrProtoUtils.h b/CodeGen/src/IrProtoUtils.h new file mode 100644 index 00000000..b3587c56 --- /dev/null +++ b/CodeGen/src/IrProtoUtils.h @@ -0,0 +1,18 @@ +// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details +#pragma once + +#include "lobject.h" +#include + +namespace Luau +{ +namespace CodeGen +{ + +static bool hasTypedParameters(Proto* proto) +{ + return proto->typeinfo && proto->numparams != 0; +} + +} // namespace CodeGen +} // namespace Luau