Skip to content
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

Arrow parse #1051

Merged
merged 3 commits into from Jan 10, 2021
Merged

Arrow parse #1051

merged 3 commits into from Jan 10, 2021

Conversation

Lan2u
Copy link

@Lan2u Lan2u commented Jan 9, 2021

Fixes #1032
Fixes a bug in arrow function parsing which prevented the assignment of arrow functions with a single argument using parentheses (e.g. let foo = (a) => a )

Arrow functions with > 1 argument or arrow functions that don't use parentheses already parse correctly

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,497 78,497 0
Passed 24,548 24,557 +9
Ignored 15,585 15,585 0
Failed 38,364 38,355 -9
Panics 28 28 0
Conformance 31.27 31.28 +0.01%

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

Benchmark for 033786f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 315.8±20.33ns 297.9±19.15ns +6.01%
Arithmetic operations (Full) 190.7±12.91µs 210.0±8.89µs -9.19%
Array access (Execution) 5.4±0.30µs 5.3±0.33µs +1.89%
Array access (Full) 208.3±14.18µs 211.8±14.63µs -1.65%
Array creation (Execution) 2.8±0.11ms 2.5±0.16ms +12.00%
Array creation (Full) 2.8±0.15ms 2.7±0.15ms +3.70%
Array pop (Execution) 952.1±36.77µs 805.0±52.18µs +18.27%
Array pop (Full) 1206.7±72.91µs 1171.3±73.16µs +3.02%
Boolean Object Access (Execution) 4.3±0.21µs 4.2±0.27µs +2.38%
Boolean Object Access (Full) 199.1±12.65µs 204.1±12.37µs -2.45%
Clean js (Execution) 595.8±31.53µs 563.7±33.70µs +5.69%
Clean js (Full) 863.2±47.31µs 843.9±39.20µs +2.29%
Clean js (Parser) 116.7±29.77µs 29.0±1.82µs +302.41%
Create Realm 408.2±27.85ns 429.2±32.37ns -4.89%
Dynamic Object Property Access (Execution) 4.7±0.34µs 4.2±0.26µs +11.90%
Dynamic Object Property Access (Full) 212.8±13.05µs 199.3±12.88µs +6.77%
Expression (Parser) 6.0±0.39µs 5.9±0.41µs +1.69%
Fibonacci (Execution) 758.2±40.43µs 711.7±44.59µs +6.53%
Fibonacci (Full) 941.1±49.16µs 930.6±49.88µs +1.13%
For loop (Execution) 18.8±1.31µs 19.3±1.24µs -2.59%
For loop (Full) 258.8±6.92µs 222.5±13.75µs +16.31%
For loop (Parser) 14.4±0.76µs 14.4±0.90µs 0.00%
Goal Symbols (Parser) 10.3±0.52µs 9.5±0.62µs +8.42%
Hello World (Parser) 2.7±0.16µs 2.5±0.14µs +8.00%
Long file (Parser) 674.3±42.28ns 696.9±40.48ns -3.24%
Mini js (Execution) 546.1±24.85µs 513.4±33.37µs +6.37%
Mini js (Full) 833.0±49.64µs 750.2±41.52µs +11.04%
Mini js (Parser) 92.6±30.14µs 25.6±1.41µs +261.72%
Number Object Access (Execution) 3.4±0.20µs 3.4±0.21µs 0.00%
Number Object Access (Full) 195.0±11.96µs 207.0±12.82µs -5.80%
Object Creation (Execution) 4.2±0.10µs 3.6±0.21µs +16.67%
Object Creation (Full) 207.7±13.75µs 201.8±11.81µs +2.92%
RegExp (Execution) 8.9±0.34µs 8.0±0.53µs +11.25%
RegExp (Full) 212.1±13.78µs 219.0±13.61µs -3.15%
RegExp Literal (Execution) 10.1±0.45µs 9.1±0.61µs +10.99%
RegExp Literal (Full) 220.3±18.60µs 215.8±13.46µs +2.09%
RegExp Literal Creation (Execution) 9.1±0.33µs 7.8±0.46µs +16.67%
RegExp Literal Creation (Full) 210.7±13.28µs 211.3±12.02µs -0.28%
Static Object Property Access (Execution) 4.5±0.09µs 3.9±0.26µs +15.38%
Static Object Property Access (Full) 208.0±12.77µs 215.2±14.86µs -3.35%
String Object Access (Execution) 5.9±0.29µs 6.3±0.33µs -6.35%
String Object Access (Full) 205.0±12.67µs 221.2±10.72µs -7.32%
String comparison (Execution) 5.9±0.29µs 5.4±0.31µs +9.26%
String comparison (Full) 221.7±12.69µs 214.1±12.99µs +3.55%
String concatenation (Execution) 4.9±0.17µs 4.3±0.25µs +13.95%
String concatenation (Full) 197.6±12.24µs 211.7±12.98µs -6.66%
String copy (Execution) 3.5±0.20µs 3.3±0.22µs +6.06%
String copy (Full) 193.5±11.57µs 198.6±11.55µs -2.57%
Symbols (Execution) 2.8±0.17µs 2.8±0.17µs 0.00%
Symbols (Full) 206.4±9.29µs 191.2±12.23µs +7.95%

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

Looks very good, thanks! Could we add also a test to check for 3 arguments? Just in case.

Also a couple of prints left.

@Lan2u Lan2u marked this pull request as ready for review January 9, 2021 18:05
@codecov
Copy link

codecov bot commented Jan 9, 2021

Codecov Report

Merging #1051 (c3efb60) into master (c083c85) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1051   +/-   ##
=======================================
  Coverage   58.31%   58.31%           
=======================================
  Files         172      172           
  Lines       12007    12007           
=======================================
  Hits         7002     7002           
  Misses       5005     5005           
Impacted Files Coverage Δ
boa/src/syntax/parser/cursor/buffered_lexer/mod.rs 85.91% <ø> (ø)
...tax/parser/expression/assignment/arrow_function.rs 89.18% <ø> (ø)
boa/src/syntax/parser/expression/assignment/mod.rs 50.00% <100.00%> (ø)

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 c083c85...c3efb60. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

Benchmark for b4c6ed8

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 349.9±5.19ns 346.5±5.14ns +0.98%
Arithmetic operations (Full) 223.2±4.24µs 226.4±3.16µs -1.41%
Array access (Execution) 6.1±0.10µs 6.1±0.11µs 0.00%
Array access (Full) 246.5±5.79µs 243.6±2.90µs +1.19%
Array creation (Execution) 2.9±0.04ms 2.9±0.03ms 0.00%
Array creation (Full) 3.2±0.08ms 3.2±0.03ms 0.00%
Array pop (Execution) 947.8±16.46µs 925.5±11.14µs +2.41%
Array pop (Full) 1369.0±16.37µs 1369.3±16.71µs -0.02%
Boolean Object Access (Execution) 4.9±0.11µs 4.7±0.08µs +4.26%
Boolean Object Access (Full) 235.0±3.39µs 236.7±3.35µs -0.72%
Clean js (Execution) 657.1±10.75µs 658.8±9.24µs -0.26%
Clean js (Full) 943.3±21.59µs 932.6±14.36µs +1.15%
Clean js (Parser) 33.4±0.45µs 33.3±0.47µs +0.30%
Create Realm 473.8±5.51ns 479.6±8.90ns -1.21%
Dynamic Object Property Access (Execution) 4.9±0.07µs 5.0±0.07µs -2.00%
Dynamic Object Property Access (Full) 240.0±4.06µs 238.4±2.45µs +0.67%
Expression (Parser) 6.5±0.09µs 6.6±0.13µs -1.52%
Fibonacci (Execution) 829.6±9.88µs 824.4±10.79µs +0.63%
Fibonacci (Full) 1079.4±16.63µs 1078.6±16.34µs +0.07%
For loop (Execution) 22.3±0.36µs 22.1±0.70µs +0.90%
For loop (Full) 261.2±3.93µs 262.4±3.42µs -0.46%
For loop (Parser) 16.8±0.26µs 16.7±0.28µs +0.60%
Goal Symbols (Parser) 11.1±0.15µs 11.0±0.16µs +0.91%
Hello World (Parser) 3.0±0.04µs 2.9±0.05µs +3.45%
Long file (Parser) 780.1±9.25ns 765.1±9.31ns +1.96%
Mini js (Execution) 593.4±11.16µs 587.8±9.18µs +0.95%
Mini js (Full) 848.3±11.64µs 856.7±12.94µs -0.98%
Mini js (Parser) 29.6±0.61µs 29.3±0.41µs +1.02%
Number Object Access (Execution) 3.8±0.07µs 3.8±0.08µs 0.00%
Number Object Access (Full) 237.0±4.29µs 235.0±3.76µs +0.85%
Object Creation (Execution) 4.2±0.06µs 4.2±0.05µs 0.00%
Object Creation (Full) 235.4±3.67µs 236.9±4.73µs -0.63%
RegExp (Execution) 9.3±0.13µs 9.2±0.13µs +1.09%
RegExp (Full) 249.2±3.93µs 247.7±4.26µs +0.61%
RegExp Literal (Execution) 10.7±0.31µs 10.5±0.17µs +1.90%
RegExp Literal (Full) 245.7±3.71µs 244.5±3.40µs +0.49%
RegExp Literal Creation (Execution) 9.3±0.18µs 9.2±0.11µs +1.09%
RegExp Literal Creation (Full) 239.8±3.46µs 239.9±2.94µs -0.04%
Static Object Property Access (Execution) 4.5±0.06µs 4.5±0.08µs 0.00%
Static Object Property Access (Full) 236.0±3.23µs 237.9±2.96µs -0.80%
String Object Access (Execution) 6.7±0.10µs 6.6±0.07µs +1.52%
String Object Access (Full) 238.9±3.86µs 242.1±4.03µs -1.32%
String comparison (Execution) 6.3±0.08µs 6.3±0.12µs 0.00%
String comparison (Full) 243.4±4.52µs 244.8±5.51µs -0.57%
String concatenation (Execution) 5.1±0.09µs 5.0±0.09µs +2.00%
String concatenation (Full) 235.5±3.63µs 234.1±2.95µs +0.60%
String copy (Execution) 3.9±0.06µs 3.8±0.07µs +2.63%
String copy (Full) 228.7±3.34µs 230.4±3.10µs -0.74%
Symbols (Execution) 3.3±0.08µs 3.2±0.05µs +3.12%
Symbols (Full) 226.0±3.36µs 225.8±3.78µs +0.09%

@Lan2u Lan2u added bug Something isn't working lexer Issues surrounding the lexer parser Issues surrounding the parser labels Jan 9, 2021
@Razican Razican merged commit e2f9ecd into master Jan 10, 2021
@RageKnify RageKnify deleted the arrow_parse branch January 10, 2021 17:06
@RageKnify RageKnify added this to the v0.11.0 milestone Jan 10, 2021
@RageKnify RageKnify mentioned this pull request Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lexer Issues surrounding the lexer parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arrow Function Parsing fails
4 participants