mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:11:05 +01:00
Switch Ptr to a C++ pointer using the nonnull attribute (#831)
The advantage is a C++ pointer is special, and this approach eliminates the Ptr class type that was causing problems in conversions. Attribute suggestion was courtesy of chandlerc. We're sticking with the Ptr name because it's shorter than Nonnull, and we're likely to keep this in lots of places.
This commit is contained in:
@@ -465,7 +465,7 @@ auto Interpreter::StepExp() -> Transition {
|
||||
} else {
|
||||
// { { v :: [][i] :: C, E, F} :: S, H}
|
||||
// -> { { v_i :: C, E, F} : S, H}
|
||||
auto* tuple = dyn_cast<TupleValue>(act->Results()[0].Get());
|
||||
auto* tuple = dyn_cast<TupleValue>(act->Results()[0]);
|
||||
if (tuple == nullptr) {
|
||||
FATAL_RUNTIME_ERROR_NO_LINE()
|
||||
<< "expected a tuple in field access, not " << *act->Results()[0];
|
||||
@@ -578,7 +578,7 @@ auto Interpreter::StepExp() -> Transition {
|
||||
// TODO: Think about a cleaner way to cast between Ptr types.
|
||||
// (multiple TODOs)
|
||||
.function = Ptr<const FunctionValue>(
|
||||
cast<FunctionValue>(act->Results()[0].Get())),
|
||||
cast<FunctionValue>(act->Results()[0])),
|
||||
.args = act->Results()[1],
|
||||
.loc = exp->SourceLoc()};
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user