D Chiesa | 4 May 2010 17:19
Picon
Favicon

Is there a fn to retrieve instance variables?

Hi, I'm using the Csharp grammar from the contrib directory.

I'd like to know if there's a function to retrieve the instance variables on 
a type.

I've seen semantic-get-local-variables and 
semantic-get-all-local-variables.  Those work just fine, but aren't what I 
want.  What I'd like are in-scope instance variables.

To illustrate, the semantic--buffer-cache for a really simple C# module 
looks like this:

(("System" include nil nil #<overlay from 475 to 488 in a.cs>)
 ("System.Reflection" include nil nil #<overlay from 489 to 513 in a.cs>)
 ("Cheeso.Tools" type
  (:members
   (("Example" type
     (typemodifiers
      ("public")
      :members
      (("flavor" variable
	(:type "int")
	(reparse-symbol class_member_declaration)
	#<overlay from 580 to 595 in a.cs>)
       ("label" variable
	(:type "String")
	(reparse-symbol class_member_declaration)
	#<overlay from 604 to 628 in a.cs>)
       ("Example" function
	(typemodifiers
	 ("private"))
	(reparse-symbol class_member_declaration)
	#<overlay from 654 to 675 in a.cs>)
       ("Main" function
	(typemodifiers
	 ("public" "static")
	 :arguments
	 (("args" variable
	   (:type "string[]")
	   (reparse-symbol formal_parameters)
	   #<overlay from 709 to 722 in a.cs>))
	 :type "void")
	(reparse-symbol class_member_declaration)
	#<overlay from 685 to 830 in a.cs>))
      :type "class")
     (reparse-symbol namespace_member_declaration)
     #<overlay from 545 to 837 in a.cs>))
   :type "namespace")
  nil #<overlay from 516 to 839 in a.cs>))

There's a type ("Example") and it declares 2 variables (flavor, label) and 2 
functions (a private constructor, and a public static Main).  Can I retrieve 
the list of instance variables for the Example type?  If so, how?

Thanks,

Dino Chiesa
dpchiesa <at> hotmail.com

------------------------------------------------------------------------------

Gmane