Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tom Niget
typon
Commits
9d41a0a0
Commit
9d41a0a0
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle invalid nodes in exception display
parent
d258d294
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
trans/transpiler/phases/utils.py
trans/transpiler/phases/utils.py
+14
-2
No files found.
trans/transpiler/phases/utils.py
View file @
9d41a0a0
import
ast
from
dataclasses
import
dataclass
from
transpiler.utils
import
UnsupportedNodeError
...
...
@@ -10,12 +14,20 @@ class NodeVisitorSeq:
else
:
for
parent
in
node
.
__class__
.
__mro__
:
if
visitor
:
=
getattr
(
self
,
'visit_'
+
parent
.
__name__
,
None
):
return
visitor
(
node
)
try
:
return
visitor
(
node
)
except
Exception
as
e
:
raise
#raise IncompatibleTypesError(f"{e} in `{ast.unparse(node)}`")
else
:
self
.
missing_impl
(
node
)
def
missing_impl
(
self
,
node
):
raise
UnsupportedNodeError
(
node
)
try
:
raise
UnsupportedNodeError
(
str
(
node
))
except
Exception
as
e
:
raise
NotImplementedError
(
type
(
node
))
@
dataclass
class
PlainBlock
(
ast
.
stmt
):
body
:
list
[
ast
.
stmt
]
\ No newline at end of file
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