Skip to content

Commit

Permalink
Merge pull request #2156 from onflow/bastian/improve-reference-static…
Browse files Browse the repository at this point in the history
…-type

Improve reference static type
  • Loading branch information
turbolent authored Nov 21, 2022
2 parents 8b67509 + c74bcfd commit 81b491b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions runtime/interpreter/statictype.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,10 @@ outer:
// ReferenceStaticType

type ReferenceStaticType struct {
Authorized bool
BorrowedType StaticType
Authorized bool
// BorrowedType is the type of the usage (T in &T)
BorrowedType StaticType
// ReferencedType is type of the referenced value (the type of the target)
ReferencedType StaticType
}

Expand All @@ -481,15 +483,15 @@ var _ StaticType = ReferenceStaticType{}
func NewReferenceStaticType(
memoryGauge common.MemoryGauge,
authorized bool,
staticType StaticType,
referenceType StaticType,
borrowedType StaticType,
referencedType StaticType,
) ReferenceStaticType {
common.UseMemory(memoryGauge, common.ReferenceStaticTypeMemoryUsage)

return ReferenceStaticType{
Authorized: authorized,
BorrowedType: staticType,
ReferencedType: referenceType,
BorrowedType: borrowedType,
ReferencedType: referencedType,
}
}

Expand Down

0 comments on commit 81b491b

Please sign in to comment.