signatures for public properties

24 views
Skip to first unread message

Steve Hannah

unread,
Feb 26, 2015, 11:24:09 AM2/26/15
to mi...@googlegroups.com
I have a macro that is using method/property signatures to generate appropriate functionality.  I have a section of code like:

if method.kind_of? Member
          signature = Member(method).signature
          if signature 
            puts "Reading signature #{signature} for #{method.name}"
            reader = SignatureReader.new(signature.toString)
            visitor = BaseSignatureVisitor.new(1)
            reader.accept visitor
            signatureStruct = visitor.getParameters
          else
            puts "#{method.name} has no signature"
          end
          
        else
          puts "Method #{method.name} is of type #{method.getClass}"
          nil
        end

(In this example member is of type JVMMethod, and it may be a public property or getter method).  

With public properties Member(method).signature is always nil.  I haven't checked the actual bytecode to see if this is because of javac's output (i.e. the signature is actually retrievable) or if Mirah just isn't pulling this in.

Is there any way to pull in the signature for public properties?

Thanks for any pointers.

Best regards

Steve

--
Steve Hannah
Web Lite Solutions Corp.

Nick Howard

unread,
Feb 26, 2015, 12:35:56 PM2/26/15
to mi...@googlegroups.com
Hmm. Oh, I think I might know why that is: 
signature is attr_accessor'd, but as far as I can tell, never written to, which is pretty weird. There's definitely logic that check's its value--probably all that is bugs.

I'm not sure, but I think that in the mirror compiler Member is just used for intrinsics / methods that you can't make direct literal mappings for eg <init>.

There's still quite a bit of code in the mirror type system I don't get.

That said, are you trying to interact with public fields of Java classes, or are you trying to create public fields in Mirah? If it's Java classes, I think you'll find that you'll want to look for bytecode mirrors, and not members.

--
You received this message because you are subscribed to the Google Groups "The Mirah Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mirah+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Steve Hannah

unread,
Feb 26, 2015, 4:30:12 PM2/26/15
to mi...@googlegroups.com
On Thu, Feb 26, 2015 at 9:35 AM, Nick Howard <n...@baroquebobcat.com> wrote:
Hmm. Oh, I think I might know why that is: 
signature is attr_accessor'd, but as far as I can tell, never written to, which is pretty weird. There's definitely logic that check's its value--probably all that is bugs.

Thanks.  I think I found the issue.  I have created a pull request

Best regards

Steve
Reply all
Reply to author
Forward
0 new messages