Commit graph

143 commits

Author SHA1 Message Date
Yiqun Ling
f6e25fc0cb Set annotation for function args 2020-07-14 18:58:58 +09:00
Jeong YunWon
1125a529e7 CompilerError always contains source_path 2020-07-14 13:48:39 +09:00
lynskylate
fae42a0533 Add annotation setup 2020-07-08 01:06:12 +08:00
lynskylate
e1999cb698 Remove needless return 2020-07-07 06:11:02 +08:00
lynskylate
a3b7a83741 Add annotation setup 2020-07-07 06:00:50 +08:00
Noah
f7216a144a Fix Rust 1.44 clippy warnings 2020-06-06 15:37:47 -05:00
Noah
6708cef2a4 Fix compilation on redox 2020-06-02 15:21:33 -05: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
1257331101 Fix unpack_ex related messages 2020-05-30 01:07:38 +00:00
Jeong YunWon
0d139f9942 comprehension starred expression compatibility 2020-05-30 01:07:38 +00:00
Jeong YunWon
a77e0b8587 Distinguish MultipleStarArgs and InvalidStarArgs compile errors 2020-05-30 01:07:38 +00:00
Noah
1e12aa8afe Merge pull request #1834 from RustPython/coolreader18/jsontests
Add json output for CPython tests
2020-04-04 11:52:04 -05:00
Noah
8df7d73211 Fix clippy lints 2020-04-03 12:34:01 -05:00
Noah
9ac8969e0d Remove incognito from vm 2020-04-03 12:34:00 -05:00
Noah
ed09df8223 Make incognito a CodeFlag bit 2020-04-03 12:34:00 -05:00
Noah
a499fb775a Make from __future__ imports a syntactic construct in the compiler 2020-04-03 12:34:00 -05:00
Noah
330fdce246 Add "incognito" compilation 2020-04-03 12:34:00 -05:00
Noah
61dc0181e0 Move varargs information into CodeFlags 2020-04-02 09:02:18 -05:00
Noah
170719180a Apply review comments 2020-03-21 00:37:13 -05:00
Noah
7d6d5ff907 Fix syntax error tests 2020-03-21 00:35:36 -05:00
coolreader18
d5b9e6b93a Partially implement async generators 2020-03-21 00:33:46 -05:00
Noah
e9ff68c850 Improve compiler error creation 2020-03-13 23:26:07 -05:00
Noah
04606e9057 Make Location Copy and remove all location.clone()s 2020-03-13 21:49:10 -05:00
Jeong YunWon
867152880a positional only parameter support 2020-03-08 00:13:13 +09:00
Jeong YunWon
04c29f384e &str::to_string -> &str::to_owned for variables 2020-02-05 22:55:34 +09:00
Jeong YunWon
7860fc877d &str::to_string -> &str::to_owned for literals 2020-02-05 22:55:33 +09:00
Aviv Palivoda
de7f9efd54 Support expression in f-strings spec 2019-12-27 10:19:07 +02:00
Jeong YunWon
8adb8b5105 Fix clippy warnings 2019-12-21 18:49:48 +09: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
a51a3e0e4b Add a CompileContext 2019-11-07 00:04:51 -06:00
coolreader18
c39e0baab7 Add async for 2019-11-07 00:04:51 -06:00
Noah
19f62b97a3 Deduplicate async/normal with compilation code 2019-11-07 00:04:51 -06:00
coolreader18
ae825125a5 Add async with, reorganize how with blocks work 2019-11-07 00:04:51 -06:00
coolreader18
3638591cde Add coroutines, async/await functionality, and gen.close() 2019-11-07 00:04:50 -06:00
joshua1b
30ab196fdc Set docstring of function as None if not declared
In cpython, if there is no docstring declared in function definition,
the `__doc__` attribute of the function is None.
So this implements the behavior.

Fix #1523
2019-11-02 23:47:44 +09:00
coolreader18
0fd098569e Change FunctionOpArg to CodeFlags, stored in CodeObject 2019-10-14 20:20:52 +00:00
Jeong YunWon
f2b696a75b Add mode to ast::parse 2019-10-12 18:12:36 +09:00
Seo Sanghyeon
fe4f8237ad Raise TypeError for duplicate keyword arguments 2019-10-04 19:29:57 +09:00
Seo Sanghyeon
6c88f6af3d Optimize BuildMap bytecode emission 2019-10-03 00:03:08 +09:00
coolreader18
0c3482e03a Invert the inverted boolean 2019-09-28 00:41:41 -05:00
Noah
fee1b6f2c7 Only overwrite the locals in __build_class__ if it's a class 2019-09-28 00:41:41 -05:00
coolreader18
bff58fd626 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
b8726f03df Don't emit None, ReturnValue if the last statement in a function is a return 2019-09-17 08:04:11 +02:00
j30ng
df4be1f9ce Remove Enum Instruction::Unpack 2019-09-12 16:30:03 +09:00
j30ng
3b99c07a1e Format Code with rustfmt 2019-09-12 04:36:31 +09:00
j30ng
5ce3f2c056 Return SyntaxError on Invalid Star Expression 2019-09-12 04:04:27 +09:00
coolreader18
d7f99dc7b1 Fix class scopes by modifying symboltable 2019-09-07 01:29:11 -05:00
coolreader18
acce23b79b Fix class vs method scopes 2019-09-05 00:27:16 -05:00
Windel Bouwman
024cf5db04 Add symboltable scope for comprehensions. Add _ast module nodes for comprehensions. 2019-09-01 22:31:16 +02:00