File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -136,23 +136,25 @@ impl PySymbolTable {
136
136
137
137
#[ pymethod( name = "get_symbols" ) ]
138
138
fn get_symbols ( & self , vm : & VirtualMachine ) -> PyResult {
139
- let mut symbols: Vec < PyObjectRef > = vec ! [ ] ;
140
- for symbol in self . symtable . symbols . values ( ) {
141
- symbols. push (
142
- PySymbol {
143
- symbol : symbol. clone ( ) ,
139
+ let symbols = self
140
+ . symtable
141
+ . symbols
142
+ . values ( )
143
+ . map ( |s| {
144
+ ( PySymbol {
145
+ symbol : s. clone ( ) ,
144
146
namespaces : self
145
147
. symtable
146
148
. sub_tables
147
149
. iter ( )
148
- . filter ( |& table| table. name == symbol . name )
150
+ . filter ( |& table| table. name == s . name )
149
151
. cloned ( )
150
152
. collect ( ) ,
151
- }
153
+ } )
152
154
. into_ref ( vm)
153
- . into_object ( ) ,
154
- )
155
- }
155
+ . into_object ( )
156
+ } )
157
+ . collect ( ) ;
156
158
Ok ( vm. ctx . new_list ( symbols) )
157
159
}
158
160
You can’t perform that action at this time.
0 commit comments