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
f8194eae
Commit
f8194eae
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix literal code emission for containers when empty
parent
c162e3ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
trans/transpiler/phases/emit_cpp/expr.py
trans/transpiler/phases/emit_cpp/expr.py
+21
-9
No files found.
trans/transpiler/phases/emit_cpp/expr.py
View file @
f8194eae
...
@@ -183,14 +183,22 @@ class ExpressionVisitor(NodeVisitor):
...
@@ -183,14 +183,22 @@ class ExpressionVisitor(NodeVisitor):
yield
node
.
attr
yield
node
.
attr
def
visit_List
(
self
,
node
:
ast
.
List
)
->
Iterable
[
str
]:
def
visit_List
(
self
,
node
:
ast
.
List
)
->
Iterable
[
str
]:
yield
"PyList{"
if
node
.
elts
:
yield
from
join
(
", "
,
map
(
self
.
reset
().
visit
,
node
.
elts
))
yield
"PyList{"
yield
"}"
yield
from
join
(
", "
,
map
(
self
.
reset
().
visit
,
node
.
elts
))
yield
"}"
else
:
yield
from
self
.
visit
(
node
.
type
)
yield
"{}"
def
visit_Set
(
self
,
node
:
ast
.
Set
)
->
Iterable
[
str
]:
def
visit_Set
(
self
,
node
:
ast
.
Set
)
->
Iterable
[
str
]:
yield
"PySet{"
if
node
.
elts
:
yield
from
join
(
", "
,
map
(
self
.
reset
().
visit
,
node
.
elts
))
yield
"PySet{"
yield
"}"
yield
from
join
(
", "
,
map
(
self
.
reset
().
visit
,
node
.
elts
))
yield
"}"
else
:
yield
from
self
.
visit
(
node
.
type
)
yield
"{}"
def
visit_Dict
(
self
,
node
:
ast
.
Dict
)
->
Iterable
[
str
]:
def
visit_Dict
(
self
,
node
:
ast
.
Dict
)
->
Iterable
[
str
]:
def
visit_item
(
key
,
value
):
def
visit_item
(
key
,
value
):
...
@@ -200,9 +208,13 @@ class ExpressionVisitor(NodeVisitor):
...
@@ -200,9 +208,13 @@ class ExpressionVisitor(NodeVisitor):
yield
from
self
.
reset
().
visit
(
value
)
yield
from
self
.
reset
().
visit
(
value
)
yield
"}"
yield
"}"
yield
"PyDict{"
if
node
.
keys
:
yield
from
join
(
", "
,
map
(
visit_item
,
node
.
keys
,
node
.
values
))
yield
"PyDict{"
yield
"}"
yield
from
join
(
", "
,
map
(
visit_item
,
node
.
keys
,
node
.
values
))
yield
"}"
else
:
yield
from
self
.
visit
(
node
.
type
)
yield
"{}"
def
visit_Subscript
(
self
,
node
:
ast
.
Subscript
)
->
Iterable
[
str
]:
def
visit_Subscript
(
self
,
node
:
ast
.
Subscript
)
->
Iterable
[
str
]:
yield
from
self
.
prec
(
"[]"
).
visit
(
node
.
value
)
yield
from
self
.
prec
(
"[]"
).
visit
(
node
.
value
)
...
...
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