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

Replace unnecessary bind(this) and var self = this statements with arrow functions in src/core/evaluator.js #8355

Merged
merged 1 commit into from
May 1, 2017

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented May 1, 2017

Note that by using let instead of var in PartialEvaluator.setGState and TranslatedFont.loadType3Data, we can get rid of further bind usages since let is block-scoped.
Also, the fact that bind wasn't used in the Font case inside of setGState is actually a bug which has been present ever since PR #5205, where a closure was replaced by a standard loop.[1]


[1] I'm not aware of any bugs caused by this, but that is probably more a happy accident than anything else, since e.g. just removing the bind from the SMask case without using block-scoped variables causes test failures.

Edit: Slightly smaller diff with https://github.com/mozilla/pdf.js/pull/8355/files?w=1.

…h arrow functions in `src/core/evaluator.js`

Note that by using `let` instead of `var` in `PartialEvaluator.setGState` and `TranslatedFont.loadType3Data`, we can get rid of further `bind` usages since `let` is block-scoped.
Also, the fact that `bind` wasn't used in the `Font` case inside of `setGState` is actually a bug which has been present ever since PR 5205, where a closure was replaced by a standard loop.[1]

---
[1] I'm not aware of any bugs caused by this, but that is probably more a happy accident than anything else, since e.g. just removing the `bind` from the `SMask` case without using block-scoped variables causes test failures.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented May 1, 2017

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/ed32efdb84d7c80/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 1, 2017

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/aea05dced383f0a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 1, 2017

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/aea05dced383f0a/output.txt

Total script time: 20.96 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented May 1, 2017

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/ed32efdb84d7c80/output.txt

Total script time: 32.75 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@timvandermeij timvandermeij merged commit e18a08f into mozilla:master May 1, 2017
@timvandermeij
Copy link
Contributor

Nice work!

@Snuffleupagus Snuffleupagus deleted the evaluator-rm-bind branch May 1, 2017 22:15
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Replace unnecessary `bind(this)` and `var self = this` statements with arrow functions in `src/core/evaluator.js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants