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
637bee47
Commit
637bee47
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle invalid nodes in exception display
parent
b1f44165
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 @
637bee47
import
ast
from
dataclasses
import
dataclass
from
transpiler.utils
import
UnsupportedNodeError
from
transpiler.utils
import
UnsupportedNodeError
...
@@ -10,12 +14,20 @@ class NodeVisitorSeq:
...
@@ -10,12 +14,20 @@ class NodeVisitorSeq:
else
:
else
:
for
parent
in
node
.
__class__
.
__mro__
:
for
parent
in
node
.
__class__
.
__mro__
:
if
visitor
:
=
getattr
(
self
,
'visit_'
+
parent
.
__name__
,
None
):
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
:
else
:
self
.
missing_impl
(
node
)
self
.
missing_impl
(
node
)
def
missing_impl
(
self
,
node
):
def
missing_impl
(
self
,
node
):
raise
UnsupportedNodeError
(
node
)
try
:
raise
UnsupportedNodeError
(
str
(
node
))
except
Exception
as
e
:
raise
NotImplementedError
(
type
(
node
))
@
dataclass
@
dataclass
class
PlainBlock
(
ast
.
stmt
):
class
PlainBlock
(
ast
.
stmt
):
body
:
list
[
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