Commit graph

69 commits

Author SHA1 Message Date
Noah
a0790d4906 Use ahash in the compiler 2021-01-08 17:00:23 -06:00
Noah
ff8512cd54 Apply review suggestions 2020-12-05 16:36:38 -06:00
Noah
8458e13e35 Fast locals part 3 2020-12-05 16:36:35 -06:00
Noah
e18275566a Fast locals part 2 2020-12-05 16:36:00 -06:00
Noah
410bd76f38 Fast locals part 1 2020-12-05 16:36:00 -06:00
Noah
e9095a741d Split the ast from the parser, remove compiler dep on parser 2020-11-07 15:43:23 -06:00
Noah
eedbf3aa6c Fix __class__ nonlocal resolution 2020-10-07 19:33:11 -05:00
Noah
16a896d513 Fix accessing __doc__ while inside a class definition 2020-10-07 19:28:19 -05:00
Jeong YunWon
09b8414162 Fix nightly clippy 2020-10-01 07:08:55 +09:00
minoring
09e4e9a86c Refactor checks for symbol in register_name 2020-09-06 11:40:32 +09:00
minoring
678b8e779b Modify nonlocal to be declared multiple times
Related to #2183
2020-09-05 22:42:52 +09:00
minoring
de7396347f Fix nonlocal checks
Related to #2189
2020-09-05 22:41:24 +09:00
Yiqun Ling
d8c8b11726 Add nested and optimized for symtable 2020-08-13 04:12:28 +09:00
lynskylate
2b54fa871f Fix load context 2020-08-08 13:08:13 +08:00
lynskylate
f6eb1168bc Fix scope error 2020-08-08 01:53:13 +08:00
lynskylate
a6be7eea26 Merge remote-tracking branch 'origin/master' into try-to-use-local 2020-08-07 01:18:56 +08:00
lynskylate
32232811fb Fix scope change 2020-08-02 03:43:19 +08:00
lynskylate
dcca662432 Optimize code 2020-08-01 02:05:44 +08:00
Yiqun Ling
70eeb28748 Apply suggestions from code review
Co-authored-by: Jeong YunWon <youknowone@users.noreply.github.com>
2020-08-01 01:29:11 +08:00
lynskylate
66731121ab Introduce symtable test and add is_annotation for symbol 2020-07-31 02:11:00 +08:00
lynskylate
5ca3fc79f4 Try to use loadname local replace loadname free 2020-07-18 04:02:42 +08:00
Jeong YunWon
1125a529e7 CompilerError always contains source_path 2020-07-14 13:48:39 +09:00
TheAnyKey
60a787e3e0 fixed scoping issue, commented test with references to original version 2020-06-21 22:18:43 +00:00
TheAnyKey
162e5d02ab commented and cleaned up 2020-06-14 12:06:39 +00:00
TheAnyKey
71f2603556 completion of error handling for named expressions and scope handling improvements 2020-06-13 21:16:51 +00:00
TheAnyKey
50c0b99136 fixed scoping issue for nonlocals - now also indirect outer scopes are supported 2020-06-01 22:47:28 +00:00
TheAnyKey
097b6a1889 Implement Py38 named expression (PEP 572) (#1934)
* Initial implementation of named expression and  import  according CPython tests

* added new instruction with inversed evaluation order for dict comprehension, in other cases use regular evaluation order

* added further aspects to implementation, cleaned up, imported test from CPython

* implemented first parts of scoping enhancement and extended checks

* completion of name resolution ongoing, now more test passing, still warinings and cleanup required

* further optimization of name resolution in nested scopes

* Initialize the vm with imports from _io instead of io

* Add the OpenBSD support that I am smart enough to

* adapted grammer to full support, most test are passing now, esp. all invalids are passed. Cleaned up in symboltable

* more conditional compiling, this time for errors

* rustfmt was not pleased

* premature push, whoops

* Add expected_failure result type to jsontests

* Initial implementation of named expression and  import  according CPython tests

* added new instruction with inversed evaluation order for dict comprehension, in other cases use regular evaluation order

* added further aspects to implementation, cleaned up, imported test from CPython

* implemented first parts of scoping enhancement and extended checks

* completion of name resolution ongoing, now more test passing, still warinings and cleanup required

* further optimization of name resolution in nested scopes

* adapted grammer to full support, most test are passing now, esp. all invalids are passed. Cleaned up in symboltable

* Fixed nameing convention violation and removed unnecessary information from symbol resolution. Added some more comments.

* Fixed nameing convention violation and removed unnecessary information from symbol resolution. Added some more comments.

Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
Co-authored-by: Reuben Staley <lighthousemaniac@gmail.com>
2020-06-01 11:22:15 +02:00
Jeong YunWon
3f2b414fcc Merge pull request #1843 from RustPython/coolreader18/clippy-fixes
Fix some clippy lints that were previously 'allow'ed
2020-04-27 00:10:01 +09:00
HyeockJinKim
e85baf4dfb Remove unused variable
Removed unused `is_param` variable for symbol.

Closes RustPython#1879
2020-04-25 13:59:54 +09:00
Noah
c27abf862f Fix some clippy lints that were 'allow'ed 2020-04-05 14:55:51 -05:00
Jeong YunWon
04c29f384e &str::to_string -> &str::to_owned for variables 2020-02-05 22:55:34 +09:00
Aviv Palivoda
9a599e81a4 Fix clippy warning 2019-12-27 10:27:51 +02:00
Aviv Palivoda
3827dbfc49 Parse FormattedValue spec in symboltable 2019-12-27 10:19:07 +02:00
Jeong YunWon
23993c2833 implement SyntaxError attributes 2019-12-16 00:08:16 +09:00
yanganto
28fbdffdc8 Provide caret diagnostics for SyntaxError
visualize syntax error with caret diagnostics in shell, eval, exec,
when the error statement and error location are provided.
2019-11-22 09:17:50 +08:00
Noah
fee1b6f2c7 Only overwrite the locals in __build_class__ if it's a class 2019-09-28 00:41:41 -05:00
HyeockJinKim
18c243854e 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
HyeockJinKim
c852c5d272 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
5919a1e1ba Don't clone SymbolTables when analyzing 2019-09-07 18:12:02 -05:00
coolreader18
d7f99dc7b1 Fix class scopes by modifying symboltable 2019-09-07 01:29:11 -05:00
Windel Bouwman
f98d54f09f Merge pull request #1336 from RustPython/comprehension-scope
Add symboltable scope for comprehensions.
2019-09-04 15:45:55 +02:00
Adam
4ae902f788 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
f3ecba02b1 Be somewhat less conservative about declaring things global. 2019-09-02 09:35:29 +01:00
Windel Bouwman
024cf5db04 Add symboltable scope for comprehensions. Add _ast module nodes for comprehensions. 2019-09-01 22:31:16 +02:00
Adam Kelly
9c17d982ff Be extremely conservative about guessing scopes when we don't know. 2019-08-31 16:39:27 +01:00
Jeong YunWon
efecef9d48 Remove duplicated contains_key test 2019-08-31 00:25:16 +09:00
Jeong YunWon
a02ba6104f Fix scan_expression not to mark sequence as Load 2019-08-31 00:25:16 +09:00
Windel Bouwman
a0dcfdd57f Add scope type and other symboltable properties. 2019-08-29 19:16:45 +02:00
Windel Bouwman
39c095d12c 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
9b1771b483 Fix clippy warnings. Add proper names to symboltables. 2019-08-18 10:03:00 +02:00