Commit 5a842595 authored by Harris Hancock's avatar Harris Hancock

Work around MSVC mutable copy capture bug

parent e70cb0e3
...@@ -74,7 +74,7 @@ kj::Promise<double> evaluateImpl( ...@@ -74,7 +74,7 @@ kj::Promise<double> evaluateImpl(
kj::joinPromises(kj::mv(paramPromises)); kj::joinPromises(kj::mv(paramPromises));
// When the parameters are complete, call the function. // When the parameters are complete, call the function.
return joinedParams.then([func](kj::Array<double>&& paramValues) mutable { return joinedParams.then([KJ_CPCAP(func)](kj::Array<double>&& paramValues) mutable {
auto request = func.callRequest(); auto request = func.callRequest();
request.setParams(paramValues); request.setParams(paramValues);
return request.send().then( return request.send().then(
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
KJ_REQUIRE(params.size() == paramCount, "Wrong number of parameters."); KJ_REQUIRE(params.size() == paramCount, "Wrong number of parameters.");
return evaluateImpl(body.getRoot<Calculator::Expression>(), params) return evaluateImpl(body.getRoot<Calculator::Expression>(), params)
.then([context](double value) mutable { .then([KJ_CPCAP(context)](double value) mutable {
context.getResults().setValue(value); context.getResults().setValue(value);
}); });
} }
...@@ -168,7 +168,7 @@ class CalculatorImpl final: public Calculator::Server { ...@@ -168,7 +168,7 @@ class CalculatorImpl final: public Calculator::Server {
public: public:
kj::Promise<void> evaluate(EvaluateContext context) override { kj::Promise<void> evaluate(EvaluateContext context) override {
return evaluateImpl(context.getParams().getExpression()) return evaluateImpl(context.getParams().getExpression())
.then([context](double value) mutable { .then([KJ_CPCAP(context)](double value) mutable {
context.getResults().setValue(kj::heap<ValueImpl>(value)); context.getResults().setValue(kj::heap<ValueImpl>(value));
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment