Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
903334eb
Commit
903334eb
authored
May 25, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TypeVar instantiation
parent
b2eff1ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
trans/transpiler/phases/typing/stdlib.py
trans/transpiler/phases/typing/stdlib.py
+3
-6
No files found.
trans/transpiler/phases/typing/stdlib.py
View file @
903334eb
...
...
@@ -65,14 +65,11 @@ class StdlibVisitor(NodeVisitorSeq):
ty
=
FunctionType
(
arg_types
,
ret_type
)
if
node
.
args
.
vararg
:
ty
.
variadic
=
True
#arg_types.append(TY_VARARG)
if
self
.
cur_class
:
assert
isinstance
(
self
.
cur_class
,
TypeType
)
if
isinstance
(
self
.
cur_class
.
type_object
,
ABCMeta
):
self
.
cur_class
.
type_object
.
gen_methods
[
node
.
name
]
=
lambda
t
:
ty
.
gen_sub
(
t
,
self
.
typevars
)
else
:
# ty_inst = FunctionType(arg_types[1:], ret_type)
# self.cur_class.args[0].add_inst_member(node.name, ty_inst)
self
.
cur_class
.
type_object
.
methods
[
node
.
name
]
=
ty
.
gen_sub
(
self
.
cur_class
.
type_object
,
self
.
typevars
)
self
.
scope
.
vars
[
node
.
name
]
=
VarDecl
(
VarKind
.
LOCAL
,
ty
)
...
...
@@ -81,9 +78,9 @@ class StdlibVisitor(NodeVisitorSeq):
def
visit_Call
(
self
,
node
:
ast
.
Call
)
->
BaseType
:
ty_op
=
self
.
visit
(
node
.
func
)
if
isinstance
(
ty_op
,
t
ype
):
return
ty_op
(
*
[
ast
.
literal_eval
(
arg
)
for
arg
in
node
.
args
])
raise
NotImplementedError
if
isinstance
(
ty_op
,
TypeT
ype
):
return
ty_op
.
type_object
(
*
[
ast
.
literal_eval
(
arg
)
for
arg
in
node
.
args
])
raise
NotImplementedError
(
ast
.
unparse
(
node
))
def
anno
(
self
)
->
"TypeAnnotationVisitor"
:
return
TypeAnnotationVisitor
(
self
.
scope
,
self
.
cur_class
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment