| Copyright | (c) Kimiyuki Onaka 2021 |
|---|---|
| License | Apache License 2.0 |
| Maintainer | kimiyuki95@gmail.com |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Jikka.RestrictedPython.Convert.Alpha
Description
Synopsis
- run :: (MonadAlpha m, MonadError Error m) => Program -> m Program
Documentation
run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #
run renames variables.
This assumes doesntHaveAssignmentToBuiltin.
- This introduce a new name for each assignment if possible. For example, the following
x = 21
x += x
x = 42
x += x
for _ in range(100):
x = x + 1
x = x + 1turns the following
x0 = 21
x1 += x0
x2 = 42
x3 += x2
for a4 in range(100):
x3 = x3 + 1
x5 = x3 + 1- This blames leaks of loop counters of for-statements, i.e.
doesntHaveLeakOfLoopCounters. For example, the followings is not allowed.
for i in range(10):
a = 0
return a # error- This blames leaks of names from for-statements and if-statements at all. For example, the followings are not allowed.
if True:
a = 0
else:
b = 1
return a # errorfor i in range(10):
a = 0
return a # error