Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Source/DafnyCore/Dafny.atg
Original file line number Diff line number Diff line change
Expand Up @@ -3762,8 +3762,12 @@ ConstAtomExpression<out Expression e>
"|"
| "assigned" (. x = t; .)
"(" NameSegment<out e> ")" (. e = new UnaryOpExpr(x, UnaryOpExpr.Opcode.Assigned, e); .)
| IF(AcceptReferrersAndBacktick()) (. e = new ImplicitThisExpr(la); .)
FieldLocationSuffix<ref e>
| "`" (. if (!AcceptReferrers()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat. I would not have guess that this would work since "backtick name" is always a valid frame expression.
But it works great !

SemErr(ErrorId.p_needs_referrers, t, "To use field location expressions, you need --referrers");
}
Token backtick = t;
e = new ImplicitThisExpr(t); .)
FieldLocationBody<ref e, backtick>
| ParensExpression<out e>
) (. if(x!= null) { e.SetOrigin(new SourceOrigin(x, t, e.Center)); } .)
.
Expand Down Expand Up @@ -4506,7 +4510,11 @@ Suffix<ref Expression e>

FieldLocationSuffix<ref Expression e>
= "`" (. Token backtick = t; .)
( IF(IsIdentifier(la.kind)) (. Name name = null; .)
FieldLocationBody<ref e, backtick>
.

FieldLocationBody<ref Expression e, Token backtick>
= ( (. Name name = null; .)
NoDigitName<out name>
(.
e = new FieldLocationExpression(e, backtick, name);
Expand Down
Loading