Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
a19c66b5
Commit
a19c66b5
authored
3 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Plain Diff
Merge branch 'bauerd/canonicalize' into 'v2.0-dev'
Extend symbol canonicalization See merge request
!451
parents
3b9860fb
2a23ec52
No related branches found
No related tags found
1 merge request
!451
Extend symbol canonicalization
Pipeline
#74226
passed
3 months ago
Stage: Code Quality
Stage: Unit Tests
Stage: legacy_test
Stage: docs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils/backend/transformations/canonicalize_symbols.py
+20
-1
20 additions, 1 deletion
...ystencils/backend/transformations/canonicalize_symbols.py
with
20 additions
and
1 deletion
src/pystencils/backend/transformations/canonicalize_symbols.py
+
20
−
1
View file @
a19c66b5
...
...
@@ -3,7 +3,15 @@ from ..memory import PsSymbol
from
..exceptions
import
PsInternalCompilerError
from
..ast
import
PsAstNode
from
..ast.structural
import
PsDeclaration
,
PsAssignment
,
PsLoop
,
PsConditional
,
PsBlock
from
..ast.structural
import
(
PsDeclaration
,
PsAssignment
,
PsLoop
,
PsConditional
,
PsBlock
,
PsStatement
,
PsEmptyLeafMixIn
,
)
from
..ast.expressions
import
PsSymbolExpr
,
PsExpression
from
...types
import
constify
...
...
@@ -117,3 +125,14 @@ class CanonicalizeSymbols:
case
PsBlock
(
statements
):
for
stmt
in
statements
[::
-
1
]:
self
.
visit
(
stmt
,
cc
)
case
PsStatement
(
expr
):
self
.
visit
(
expr
,
cc
)
case
PsEmptyLeafMixIn
():
...
case
unknown
:
raise
PsInternalCompilerError
(
f
"
Can
'
t canonicalize symbols in
{
unknown
}
(
{
repr
(
unknown
)
}
).
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment