mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 05:20:38 +00:00
54324867df
* Support `["prop"]` syntax on class definitions in definition files. (#704) * Improve type checking performance for complex overloaded functions * Fix rare cases of incorrect stack traces for out of memory errors at runtime
32 lines
1,017 B
C++
32 lines
1,017 B
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "Luau/Ast.h"
|
|
|
|
#include <unordered_map>
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
static const std::unordered_map<AstExprBinary::Op, const char*> kBinaryOpMetamethods{
|
|
{AstExprBinary::Op::CompareEq, "__eq"},
|
|
{AstExprBinary::Op::CompareNe, "__eq"},
|
|
{AstExprBinary::Op::CompareGe, "__lt"},
|
|
{AstExprBinary::Op::CompareGt, "__le"},
|
|
{AstExprBinary::Op::CompareLe, "__le"},
|
|
{AstExprBinary::Op::CompareLt, "__lt"},
|
|
{AstExprBinary::Op::Add, "__add"},
|
|
{AstExprBinary::Op::Sub, "__sub"},
|
|
{AstExprBinary::Op::Mul, "__mul"},
|
|
{AstExprBinary::Op::Div, "__div"},
|
|
{AstExprBinary::Op::Pow, "__pow"},
|
|
{AstExprBinary::Op::Mod, "__mod"},
|
|
{AstExprBinary::Op::Concat, "__concat"},
|
|
};
|
|
|
|
static const std::unordered_map<AstExprUnary::Op, const char*> kUnaryOpMetamethods{
|
|
{AstExprUnary::Op::Minus, "__unm"},
|
|
{AstExprUnary::Op::Len, "__len"},
|
|
};
|
|
|
|
} // namespace Luau
|