Created
July 28, 2014 05:48
-
-
Save shannah/dbdc271568487d998b94 to your computer and use it in GitHub Desktop.
Mirah macros for private and protected methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MirahClass | |
macro def self.protected(mthd:MethodDefinition) | |
anno = Annotation.new(@call.name.position, Constant.new(SimpleString.new('org.mirah.jvm.types.Modifiers')), | |
[HashEntry.new(SimpleString.new('access'), SimpleString.new('PROTECTED'))]) | |
mthd.annotations.add(anno) | |
mthd.setParent(nil) | |
mthd | |
end | |
macro def self.private(mthd:MethodDefinition) | |
anno = Annotation.new(@call.name.position, Constant.new(SimpleString.new('org.mirah.jvm.types.Modifiers')), | |
[HashEntry.new(SimpleString.new('access'), SimpleString.new('PRIVATE'))]) | |
mthd.annotations.add(anno) | |
mthd.setParent(nil) | |
mthd | |
end | |
macro def self.package_private(mthd:MethodDefinition) | |
anno = Annotation.new(@call.name.position, Constant.new(SimpleString.new('org.mirah.jvm.types.Modifiers')), | |
[HashEntry.new(SimpleString.new('access'), SimpleString.new('DEFAULT'))]) | |
mthd.annotations.add(anno) | |
mthd.setParent(nil) | |
mthd | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment