1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Merge pull request #4895 from p01/Small_optimizations_1

Small optimizations 1
This commit is contained in:
Yury Delendik 2014-06-10 10:09:12 -05:00
commit b2d8e73d54
4 changed files with 109 additions and 107 deletions

View file

@ -758,19 +758,19 @@ var Lexer = (function LexerClosure() {
// command
var str = String.fromCharCode(ch);
var knownCommands = this.knownCommands;
var knownCommandFound = knownCommands && (str in knownCommands);
var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
// stop if known command is found and next character does not make
// the str a command
var possibleCommand = str + String.fromCharCode(ch);
if (knownCommandFound && !(possibleCommand in knownCommands)) {
if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
break;
}
if (str.length === 128) {
error('Command token too long: ' + str.length);
}
str = possibleCommand;
knownCommandFound = knownCommands && (str in knownCommands);
knownCommandFound = knownCommands && knownCommands[str] !== undefined;
}
if (str === 'true') {
return true;