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
9b8da153
Commit
9b8da153
authored
Mar 20, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sync function generation
parent
29793d0f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
typon/trans/tests/gen_func.py
typon/trans/tests/gen_func.py
+5
-0
typon/trans/transpiler/phases/emit_cpp/expr.py
typon/trans/transpiler/phases/emit_cpp/expr.py
+6
-2
typon/trans/transpiler/phases/emit_cpp/visitors.py
typon/trans/transpiler/phases/emit_cpp/visitors.py
+1
-0
No files found.
typon/trans/tests/gen_func.py
View file @
9b8da153
def
f
[
T
](
x
:
T
):
def
f
[
T
](
x
:
T
):
return
x
return
x
def
g
[
X
](
a
:
X
,
b
:
X
):
return
a
+
b
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
#a = 5
#a = 5
print
(
f
(
"abc"
))
print
(
f
(
"abc"
))
print
(
f
(
6
))
print
(
f
(
6
))
print
(
g
(
6
,
8
))
print
(
g
(
"abc"
,
"def"
))
typon/trans/transpiler/phases/emit_cpp/expr.py
View file @
9b8da153
...
@@ -222,13 +222,17 @@ class ExpressionVisitor(NodeVisitor):
...
@@ -222,13 +222,17 @@ class ExpressionVisitor(NodeVisitor):
yield
from
self
.
visit_binary_operation
(
node
.
ops
[
0
],
node
.
left
,
node
.
comparators
[
0
],
linenodata
(
node
))
yield
from
self
.
visit_binary_operation
(
node
.
ops
[
0
],
node
.
left
,
node
.
comparators
[
0
],
linenodata
(
node
))
def
visit_binary_operation
(
self
,
op
,
left
:
ast
.
AST
,
right
:
ast
.
AST
,
lnd
:
dict
)
->
Iterable
[
str
]:
def
visit_binary_operation
(
self
,
op
,
left
:
ast
.
AST
,
right
:
ast
.
AST
,
lnd
:
dict
)
->
Iterable
[
str
]:
yield
"(co_await ("
if
self
.
generator
!=
CoroutineMode
.
SYNC
:
yield
"(co_await"
yield
"("
yield
from
self
.
visit
(
left
)
yield
from
self
.
visit
(
left
)
yield
" "
yield
" "
yield
SYMBOLS
[
type
(
op
)]
yield
SYMBOLS
[
type
(
op
)]
yield
" "
yield
" "
yield
from
self
.
visit
(
right
)
yield
from
self
.
visit
(
right
)
yield
"))"
yield
")"
if
self
.
generator
!=
CoroutineMode
.
SYNC
:
yield
")"
return
return
raise
NotImplementedError
()
raise
NotImplementedError
()
# if type(op) == ast.In:
# if type(op) == ast.In:
...
...
typon/trans/transpiler/phases/emit_cpp/visitors.py
View file @
9b8da153
...
@@ -75,6 +75,7 @@ class NodeVisitor(UniversalVisitor):
...
@@ -75,6 +75,7 @@ class NodeVisitor(UniversalVisitor):
if
em
:
if
em
:
yield
name
yield
name
else
:
else
:
raise
UnresolvedTypeVariableError
(
node
)
yield
f"$VAR__
{
name
}
"
yield
f"$VAR__
{
name
}
"
#raise UnresolvedTypeVariableError(node)
#raise UnresolvedTypeVariableError(node)
...
...
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