Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created June 12, 2019 02:36
Show Gist options
  • Save joseoliv/1f8b22aa24214f702521d30f652af4e4 to your computer and use it in GitHub Desktop.
Save joseoliv/1f8b22aa24214f702521d30f652af4e4 to your computer and use it in GitHub Desktop.
countFieldAccess
package metaobjectTest
@doc{*
Annotation 'countFieldAccess' should be attached to a field. It
creates an Int field countFieldAccess_fieldName if the attached field
is fieldName. countFieldAccess_fieldName is the number of times
the field was accessed for reading or writing.
*}
object CountFieldAccess
func run {
assert countFieldAccess_s == 0;
s = "1";
assert countFieldAccess_s == 1;
}
@countFieldAccess
var String s = "0";
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment