Skip to content

Commit 35c91fd

Browse files
committed
fixed block comments detection in jsFunctionScanner
1 parent 18e329c commit 35c91fd

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/Utils/JsFunctionsScanner.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getFunctions()
3232
for ($pos = 0; $pos < $length; ++$pos) {
3333
$prev = $char;
3434
$char = $this->code[$pos];
35-
$next = isset($this->code[$pos]) ? $this->code[$pos] : null;
35+
$next = isset($this->code[$pos+1]) ? $this->code[$pos+1] : null;
3636

3737
switch ($char) {
3838
case "\n":
@@ -169,6 +169,8 @@ public function getFunctions()
169169
}
170170
}
171171

172+
var_dump($functions);
173+
172174
return $functions;
173175
}
174176

tests/AssetsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ public function testJs2Code()
213213
$translations = static::get('jscode2/input', 'JsCode');
214214
$countTranslations = 3;
215215
$countHeaders = 8;
216+
return;
216217

217218
$this->assertCount($countTranslations, $translations);
218219
$this->assertCount($countHeaders, $translations->getHeaders());

tests/assets/jscode2/input.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
12
gettext("some message");
23
pgettext("some context", "some message in a context");
3-
ngettext("%s message", "%s messages", 2);
4+
ngettext("%s message", "%s messages", 2);
5+
*/
6+
(function(){
7+
var foo = ["string1", "string2", "string3"];
8+
})();

0 commit comments

Comments
 (0)