@@ -2129,7 +2129,7 @@ impl Symbol {
21292129 if let Some ( base_attr) = base_attr {
21302130 let attribute_type_sym = symbol;
21312131 //TODO shouldn't we set the from_module in the call to get_member_symbol?
2132- let get_method = attribute_type_sym. get_member_symbol ( session, & S ! ( "__get__" ) , None , true , false , true , false ) . 0 . first ( ) . cloned ( ) ;
2132+ let get_method = attribute_type_sym. get_member_symbol ( session, & S ! ( "__get__" ) , None , true , false , false , true , false ) . 0 . first ( ) . cloned ( ) ;
21332133 match get_method {
21342134 Some ( get_method) if ( base_attr. borrow ( ) . typ ( ) == SymType :: CLASS ) => {
21352135 let get_method = get_method. borrow ( ) ;
@@ -2757,12 +2757,33 @@ impl Symbol {
27572757 if not all, it will return the first found. If all, the all found symbols are returned, but the first one
27582758 is the one that is overriding others.
27592759 :param: from_module: optional, can change the from_module of the given class */
2760- pub fn get_member_symbol ( & self , session : & mut SessionInfo , name : & String , from_module : Option < Rc < RefCell < Symbol > > > , prevent_comodel : bool , only_fields : bool , all : bool , is_super : bool ) -> ( Vec < Rc < RefCell < Symbol > > > , Vec < Diagnostic > ) {
2760+ pub fn get_member_symbol (
2761+ & self ,
2762+ session : & mut SessionInfo ,
2763+ name : & String ,
2764+ from_module : Option < Rc < RefCell < Symbol > > > ,
2765+ prevent_comodel : bool ,
2766+ only_fields : bool ,
2767+ only_methods : bool ,
2768+ all : bool ,
2769+ is_super : bool
2770+ ) -> ( Vec < Rc < RefCell < Symbol > > > , Vec < Diagnostic > ) {
27612771 let mut visited_classes: PtrWeakHashSet < Weak < RefCell < Symbol > > > = PtrWeakHashSet :: new ( ) ;
2762- return self . _get_member_symbol_helper ( session, name, from_module, prevent_comodel, only_fields, all, is_super, & mut visited_classes) ;
2772+ return self . _get_member_symbol_helper ( session, name, from_module, prevent_comodel, only_fields, only_methods , all, is_super, & mut visited_classes) ;
27632773 }
27642774
2765- fn _get_member_symbol_helper ( & self , session : & mut SessionInfo , name : & String , from_module : Option < Rc < RefCell < Symbol > > > , prevent_comodel : bool , only_fields : bool , all : bool , is_super : bool , visited_classes : & mut PtrWeakHashSet < Weak < RefCell < Symbol > > > ) -> ( Vec < Rc < RefCell < Symbol > > > , Vec < Diagnostic > ) {
2775+ fn _get_member_symbol_helper (
2776+ & self ,
2777+ session : & mut SessionInfo ,
2778+ name : & String ,
2779+ from_module : Option < Rc < RefCell < Symbol > > > ,
2780+ prevent_comodel : bool ,
2781+ only_fields : bool ,
2782+ only_methods : bool ,
2783+ all : bool ,
2784+ is_super : bool ,
2785+ visited_classes : & mut PtrWeakHashSet < Weak < RefCell < Symbol > > >
2786+ ) -> ( Vec < Rc < RefCell < Symbol > > > , Vec < Diagnostic > ) {
27662787 let mut result: Vec < Rc < RefCell < Symbol > > > = vec ! [ ] ;
27672788 let mut visited_symbols: PtrWeakHashSet < Weak < RefCell < Symbol > > > = PtrWeakHashSet :: new ( ) ;
27682789 let mut extend_result = |syms : Vec < Rc < RefCell < Symbol > > > | {
@@ -2790,6 +2811,9 @@ impl Symbol {
27902811 if only_fields {
27912812 content_syms = content_syms. iter ( ) . filter ( |x| x. borrow ( ) . is_field ( session) ) . cloned ( ) . collect ( ) ;
27922813 }
2814+ if only_methods {
2815+ content_syms = content_syms. iter ( ) . filter ( |x| x. borrow ( ) . typ ( ) == SymType :: FUNCTION ) . cloned ( ) . collect ( ) ;
2816+ }
27932817 if !content_syms. is_empty ( ) {
27942818 if all {
27952819 extend_result ( content_syms) ;
@@ -2812,7 +2836,7 @@ impl Symbol {
28122836 continue ;
28132837 }
28142838 visited_classes. insert ( model_symbol. clone ( ) ) ;
2815- let ( attributs, att_diagnostic) = model_symbol. borrow ( ) . _get_member_symbol_helper ( session, name, None , true , only_fields, all, false , visited_classes) ;
2839+ let ( attributs, att_diagnostic) = model_symbol. borrow ( ) . _get_member_symbol_helper ( session, name, None , true , only_fields, only_methods , all, false , visited_classes) ;
28162840 diagnostics. extend ( att_diagnostic) ;
28172841 if all {
28182842 extend_result ( attributs) ;
@@ -2830,7 +2854,7 @@ impl Symbol {
28302854 continue ;
28312855 }
28322856 visited_classes. insert ( model_symbol. clone ( ) ) ;
2833- let ( attributs, att_diagnostic) = model_symbol. borrow ( ) . _get_member_symbol_helper ( session, name, None , true , true , all, false , visited_classes) ;
2857+ let ( attributs, att_diagnostic) = model_symbol. borrow ( ) . _get_member_symbol_helper ( session, name, None , true , true , only_methods , all, false , visited_classes) ;
28342858 diagnostics. extend ( att_diagnostic) ;
28352859 if all {
28362860 extend_result ( attributs) ;
@@ -2854,7 +2878,7 @@ impl Symbol {
28542878 continue ;
28552879 }
28562880 visited_classes. insert ( base. clone ( ) ) ;
2857- let ( s, s_diagnostic) = base. borrow ( ) . get_member_symbol ( session, name, from_module. clone ( ) , prevent_comodel, only_fields, all, false ) ;
2881+ let ( s, s_diagnostic) = base. borrow ( ) . get_member_symbol ( session, name, from_module. clone ( ) , prevent_comodel, only_fields, only_methods , all, false ) ;
28582882 diagnostics. extend ( s_diagnostic) ;
28592883 if !s. is_empty ( ) {
28602884 if all {
0 commit comments