@@ -14,6 +14,7 @@ import io.github.danielnaczo.python3parser.model.expr.operators.binaryops.compar
1414import io.github.danielnaczo.python3parser.model.mods.Module
1515import io.github.danielnaczo.python3parser.model.stmts.Body
1616import io.github.danielnaczo.python3parser.model.stmts.Statement
17+ import io.github.danielnaczo.python3parser.model.stmts.compoundStmts.If
1718import io.github.danielnaczo.python3parser.model.stmts.compoundStmts.functionStmts.FunctionDef
1819import io.github.danielnaczo.python3parser.model.stmts.compoundStmts.functionStmts.parameters.Parameter
1920import io.github.danielnaczo.python3parser.model.stmts.compoundStmts.functionStmts.parameters.Parameters
@@ -159,32 +160,25 @@ object PythonCodeGenerator {
159160 listOf (Name (" out['output']" )),
160161 Atom (Name (" repr" ), listOf (createArguments(listOf (Name (outputName)))))
161162 ),
162- Assign (
163- listOf (Name (" out['type']" )),
164- Add (
165- Atom (
166- Atom (
167- Name (" inspect.getmodule" ),
168- listOf (createArguments(listOf (
163+ If (
164+ Name (" $outputName != None" ),
165+ Body (listOf (Assign (
166+ listOf (Name (" out['type']" )),
167+ Add (
168+ Name (" type($outputName ).__module__" ),
169+ Add (
170+ Str (" ." ),
171+ Atom (
169172 Atom (
170173 Name (" type" ),
171174 listOf (createArguments(listOf (Name (outputName))))
172- )
173- )))
174- ),
175- listOf (Attribute (Identifier (" __name__" )))
176- ),
177- Add (
178- Str (" ." ),
179- Atom (
180- Atom (
181- Name (" type" ),
182- listOf (createArguments(listOf (Name (outputName))))
175+ ),
176+ listOf (Attribute (Identifier (" __name__" )))
183177 ),
184- listOf (Attribute (Identifier (" __name__" )))
185- ),
178+ )
186179 )
187- )
180+ ))),
181+ Body (listOf (Name (" out['type'] = 'types.NoneType'" )))
188182 ),
189183 Atom (
190184 Name (" print" ),
0 commit comments