Skip to content

Add interactive shell to WASM demo #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 10, 2019

Conversation

palaviv
Copy link
Contributor

@palaviv palaviv commented Mar 9, 2019

interactive

@codecov-io
Copy link

codecov-io commented Mar 9, 2019

Codecov Report

Merging #643 into master will increase coverage by 0.21%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #643      +/-   ##
==========================================
+ Coverage   40.81%   41.02%   +0.21%     
==========================================
  Files          76       77       +1     
  Lines       17345    17558     +213     
  Branches     4474     4516      +42     
==========================================
+ Hits         7079     7204     +125     
- Misses       8366     8446      +80     
- Partials     1900     1908       +8
Impacted Files Coverage Δ
vm/src/obj/objmemory.rs 23.07% <0%> (-6.93%) ⬇️
vm/src/obj/objgenerator.rs 40.57% <0%> (-3.87%) ⬇️
vm/src/import.rs 43.2% <0%> (-2.85%) ⬇️
vm/src/obj/objfunction.rs 35.86% <0%> (-2.76%) ⬇️
vm/src/pyobject.rs 58.38% <0%> (-2.55%) ⬇️
src/main.rs 15% <0%> (-0.86%) ⬇️
vm/src/obj/objframe.rs 30.23% <0%> (-0.72%) ⬇️
vm/src/vm.rs 53.75% <0%> (-0.7%) ⬇️
vm/src/obj/objcode.rs 31.57% <0%> (-0.38%) ⬇️
vm/src/obj/objdict.rs 43.88% <0%> (-0.35%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 010969f...f27cb5b. Read the comment docs.

@windelbouwman
Copy link
Contributor

Hi @palaviv , very cool stuff! Surprisingly simple change to achieve this!

@palaviv
Copy link
Contributor Author

palaviv commented Mar 9, 2019

Seems like adding the backspace and : support was easier then I thought 😄

Copy link
Member

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! I've made some suggestions but other than that it's good to go!

term.on("data", (data) => {
const code = data.charCodeAt(0);
if (code == 13) { // CR
if (input[input.length - 1] == ':') {
Copy link
Member

@coolreader18 coolreader18 Mar 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use .trimEnd() here in case of spaces at the end of a line? Also, there might be a function that has multiple lines in its body, so it'd be good to keep a boolean of whether or not we're in a block and if so wait to end input until there's an empty line, a la CPython:

>>>>> def a():
.....     print('1')
.....     print('2')
..... 
>>>>>

Copy link
Contributor Author

@palaviv palaviv Mar 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to do this in a different PR. We currently don't support this in the REPL as well... (#626)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@windelbouwman windelbouwman merged commit ded7acc into RustPython:master Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants