* Naive pointer implementation

* Bug fixes and better pointer tests

* Remove debug print statement

* Implement changes suggested by @geoffromer

Also add a failing test case that tests applying the address-of operator
to an rvalue.
This commit is contained in:
Darshal Shetty
2022-02-05 10:27:54 -05:00
committed by GitHub
parent f6cbd2231e
commit 4479c55305
11 changed files with 131 additions and 5 deletions
+5 -1
View File
@@ -179,8 +179,11 @@ void Value::Print(llvm::raw_ostream& out) const {
case Value::Kind::FunctionValue:
out << "fun<" << cast<FunctionValue>(*this).declaration().name() << ">";
break;
case Value::Kind::PointerValue:
out << "ptr<" << cast<PointerValue>(*this).address() << ">";
break;
case Value::Kind::LValue:
out << "ptr<" << cast<LValue>(*this).address() << ">";
out << "lval<" << cast<LValue>(*this).address() << ">";
break;
case Value::Kind::BoolType:
out << "Bool";
@@ -434,6 +437,7 @@ auto ValueEqual(Nonnull<const Value*> v1, Nonnull<const Value*> v2) -> bool {
case Value::Kind::BindingPlaceholderValue:
case Value::Kind::AlternativeConstructorValue:
case Value::Kind::ContinuationValue:
case Value::Kind::PointerValue:
case Value::Kind::LValue:
// TODO: support pointer comparisons once we have a clearer distinction
// between pointers and lvalues.