Commit Graph

84 Commits

Author SHA1 Message Date
HyeockJinKim
1b141f3022 Fix global declaration error in the function
Fix Global symbol to prevent syntax error
when global declaration for same variable in function.

Fixes #1353
2019-09-18 01:57:06 +09:00
coolreader18
a878ffc678 Remove useless_const optimization
There could be jump depending on the Pop being there, and then it
breaks.
2019-09-17 08:04:11 +02:00
coolreader18
b71b4e6f14 Don't emit None, ReturnValue if the last statement in a function is a return 2019-09-17 08:04:11 +02:00
coolreader18
c09ad9a3a6 Add optimization to remove unused LoadConst operations 2019-09-17 08:04:11 +02:00
Noah
9aaf887918 Merge pull request #1367 from j30ng/syntax-err-on-star
Return SyntaxError on Invalid Star Expression
2019-09-12 08:48:57 -05:00
j30ng
a5bea47bed Remove Enum Instruction::Unpack 2019-09-12 16:30:03 +09:00
j30ng
95d57ef9c4 Format Code with rustfmt 2019-09-12 04:36:31 +09:00
j30ng
ea69be5da5 Return SyntaxError on Invalid Star Expression 2019-09-12 04:04:27 +09:00
HyeockJinKim
7695851cde nonlocal generate syntax error
If the scope depth is less than 2,
a syntax error occurs in nonlocal.

Fixes #1360
2019-09-12 01:13:47 +09:00
coolreader18
cad53c2fec Don't clone SymbolTables when analyzing 2019-09-07 18:12:02 -05:00
coolreader18
b797b51369 Fix class scopes by modifying symboltable 2019-09-07 01:29:11 -05:00
coolreader18
ae45a4a3be Fix class vs method scopes 2019-09-05 00:27:16 -05:00
Windel Bouwman
a3081c5d7b Merge pull request #1336 from RustPython/comprehension-scope
Add symboltable scope for comprehensions.
2019-09-04 15:45:55 +02:00
Adam
814260e7e4 Merge pull request #1332 from RustPython/load_global_loading_local
load_global shouldn't load outermost locals.
2019-09-02 10:13:19 +01:00
Adam Kelly
527f3ff800 Be somewhat less conservative about declaring things global. 2019-09-02 09:35:29 +01:00
Windel Bouwman
b36bbfa91c Add symboltable scope for comprehensions. Add _ast module nodes for comprehensions. 2019-09-01 22:31:16 +02:00
Adam Kelly
b087325b8d Be extremely conservative about guessing scopes when we don't know. 2019-08-31 16:39:27 +01:00
Jeong YunWon
b73f3d6b1f Remove duplicated contains_key test 2019-08-31 00:25:16 +09:00
Jeong YunWon
e9c280368a Fix scan_expression not to mark sequence as Load 2019-08-31 00:25:16 +09:00
Windel Bouwman
036f464377 Merge pull request #1325 from RustPython/scoping
Add scope type and other symboltable properties.
2019-08-30 07:08:49 +02:00
Windel Bouwman
e181826b5f Add scope type and other symboltable properties. 2019-08-29 19:16:45 +02:00
Windel Bouwman
2517207175 Make subscript its own bytecode. Remove pass bytecode. Move complex bytecodes into seperate functions to reduce complexity of dispatch function. 2019-08-28 12:06:46 +02:00
Noah
c52328608e Make bytecode::Label its own struct 2019-08-27 21:19:18 +00:00
Windel Bouwman
2ca6e5d399 Implement execution of finally block. Fixes #1306. 2019-08-27 21:16:59 +02:00
Windel Bouwman
86fc18ec6c Refactor block stack unwinding to enable finally execution. 2019-08-27 19:40:00 +02:00
Windel Bouwman
eb3771ebff Add Free enum variant to the symbol scope to be able to distuingish between true local and free variables. 2019-08-18 12:12:27 +02:00
Windel Bouwman
edf647160f Fix clippy warnings. Add proper names to symboltables. 2019-08-18 10:03:00 +02:00
Windel Bouwman
f229831629 Merge pull request #1251 from RustPython/scope-detection
Extend AST python module. Add idea for scope detection.
2019-08-18 09:14:20 +02:00
coolreader18
0f4a80eec9 Compile docstrings for modules 2019-08-15 22:25:30 -05:00
coolreader18
5499d81d7a Address feedback, simplify compilation code 2019-08-15 15:52:30 -05:00
coolreader18
fe84f25fad Fix weirdness with import submodules 2019-08-15 15:30:14 -05:00
Windel Bouwman
5802d06bbb Extend AST python module. Add idea for scope detection. 2019-08-14 20:43:23 +02:00
Windel Bouwman
49ed782098 Merge pull request #1245 from RustPython/symbol-context
Improve symbol table processing.
2019-08-14 17:47:40 +02:00
coolreader18
2fb05d53e8 Fix errors 2019-08-13 23:04:32 -05:00
Windel Bouwman
e6edf71b33 Improve symbol table processing. 2019-08-13 21:13:16 +02:00
coolreader18
286051383e impl std::str::FromStr for compile::Mode 2019-08-13 12:35:07 -05:00
coolreader18
4f9a71ff89 Change compile::compile() to take a Mode instead of an &Mode 2019-08-13 12:34:39 -05:00
Windel Bouwman
752ac1df51 Merge pull request #1232 from corona10/gh-1212
gh-1212: Fix scope_for_name to catch NameError properly
2019-08-12 07:32:02 +02:00
Dong-hee Na
6df3800055 Fix scope_for_name to catch NameError properly 2019-08-12 10:19:31 +09:00
Windel Bouwman
36d8147e8e Improve the situation regarding boolean operations. 2019-08-11 20:20:15 +02:00
Noah
fb5ebea389 Revert "Fix compilation of nested boolean operations" 2019-08-11 12:29:10 -05:00
coolreader18
0e77f0e654 Fix compilation of nested boolean operations 2019-08-09 21:36:42 -05:00
Windel Bouwman
fc8aba1b68 Merge pull request #1215 from RustPython/syntax-fixes
Add variable annotation syntax.
2019-08-09 11:22:55 +02:00
coolreader18
8f28149f67 Address comments 2019-08-07 14:40:16 -05:00
Windel Bouwman
2fdfcb96a5 Add parser support for async for loop. Add yield expression inside parentheses. 2019-08-07 20:11:27 +02:00
Windel Bouwman
c5e7fbab11 Properly fill the __annotations__ dictionary. 2019-08-07 16:13:12 +02:00
Windel Bouwman
ded9d5ba5b Add variable annotation syntax. Simplify grammar for comprehensions. Add capital J suffix for complex numbers. 2019-08-07 15:31:24 +02:00
coolreader18
772460ea7f Add tuple unpacking optimization 2019-08-04 01:22:51 -05:00
coolreader18
b48f0c2a8b Fix label issue 2019-08-03 23:58:59 -05:00
coolreader18
496c5c82f2 Add constant optimization test 2019-08-03 22:44:36 -05:00