Skip to content

Commit cc03f3d

Browse files
authored
[NFC] Remove unnecessary std::optional in FuncData (#7950)
std::function can already be empty, so wrapping it in std::optional is redundant.
1 parent 8c8b213 commit cc03f3d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/wasm-interpreter.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ struct FuncData {
142142

143143
// A way to execute this function. We use this when it is called.
144144
using Call = std::function<Flow(Literals)>;
145-
std::optional<Call> call;
145+
Call call;
146146

147-
FuncData(Name name,
148-
void* self = nullptr,
149-
std::optional<Call> call = std::nullopt)
147+
FuncData(Name name, void* self = nullptr, Call call = {})
150148
: name(name), self(self), call(call) {}
151149

152150
bool operator==(const FuncData& other) const {
@@ -155,7 +153,7 @@ struct FuncData {
155153

156154
Flow doCall(Literals arguments) {
157155
assert(call);
158-
return (*call)(arguments);
156+
return call(arguments);
159157
}
160158
};
161159

0 commit comments

Comments
 (0)