Skip to content

Commit

Permalink
Merge pull request tedious#35 from tedivm/strict_bug
Browse files Browse the repository at this point in the history
Fixed "unclosed string" bugs for first line strings
  • Loading branch information
tedivm committed Apr 24, 2014
2 parents 4c49755 + 65097b3 commit 776750e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/JShrink/Minifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ protected function initialize($js, $options)
// comment error that can otherwise occur.
$this->input .= PHP_EOL;

$this->a = $this->getReal();
// Populate "a" with a new line, "b" with the first character, before
// entering the loop
$this->a = "\n";
$this->b = $this->getReal();
}

Expand Down Expand Up @@ -430,6 +432,7 @@ protected function getNext($string)
* When a javascript string is detected this function crawls for the end of
* it and saves the whole string.
*
* @throws \RuntimeException Unclosed strings will throw an error
*/
protected function saveString()
{
Expand Down Expand Up @@ -504,6 +507,8 @@ protected function saveString()
/**
* When a regular expression is detected this function crawls for the end of
* it and saves the whole regex.
*
* @throws \RuntimeException Unclosed regex will throw an error
*/
protected function saveRegex()
{
Expand Down
2 changes: 2 additions & 0 deletions tests/Resources/jshrink/input/strictmode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"use strict";
var foo=22;

0 comments on commit 776750e

Please sign in to comment.