diff options
author | Alon Zakai <azakai@google.com> | 2020-11-14 15:26:12 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-14 15:26:12 -0800 |
commit | 54612e4f28bc1c68606713b1a5483dcde02047b5 (patch) | |
tree | dd7388f8dc592e15bbdc1b61448b0bd783ebd894 /src/literal.h | |
parent | 878c90a938a7aa78a48bb82d03cfcfea751ab908 (diff) | |
download | binaryen-54612e4f28bc1c68606713b1a5483dcde02047b5.tar.gz binaryen-54612e4f28bc1c68606713b1a5483dcde02047b5.tar.bz2 binaryen-54612e4f28bc1c68606713b1a5483dcde02047b5.zip |
[TypedFunctionReferences] Allow creation of literals with typed function types (#3358)
* [TypedFunctionReferences] Allow creation of literals with typed function types
* feedback
Diffstat (limited to 'src/literal.h')
-rw-r--r-- | src/literal.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/literal.h b/src/literal.h index 625b3eb43..f96d6c7f5 100644 --- a/src/literal.h +++ b/src/literal.h @@ -71,7 +71,8 @@ public: explicit Literal(const std::array<Literal, 8>&); explicit Literal(const std::array<Literal, 4>&); explicit Literal(const std::array<Literal, 2>&); - explicit Literal(Name func) : func(func), type(Type::funcref) {} + explicit Literal(Name func, Type type = Type::funcref) + : func(func), type(type) {} explicit Literal(std::unique_ptr<ExceptionPackage>&& exn) : exn(std::move(exn)), type(Type::exnref) {} Literal(const Literal& other); @@ -233,7 +234,9 @@ public: assert(type.isNullable()); return Literal(type); } - static Literal makeFunc(Name func) { return Literal(func.c_str()); } + static Literal makeFunc(Name func, Type type = Type::funcref) { + return Literal(func, type); + } static Literal makeExn(std::unique_ptr<ExceptionPackage>&& exn) { return Literal(std::move(exn)); } |