Compare commits

..

No commits in common. "master" and "v1.5.1" have entirely different histories.

1 changed files with 7 additions and 13 deletions

View File

@ -31,12 +31,12 @@ class JSM
$this->args_parser = new JSM_ArgsParser(); $this->args_parser = new JSM_ArgsParser();
} }
function getRootFile() : string function getRootFile()
{ {
return $this->file; return $this->file;
} }
static function getModule($file) : JSM_Module function getModule($file)
{ {
if(isset(self::$modules[$file])) if(isset(self::$modules[$file]))
return self::$modules[$file]; return self::$modules[$file];
@ -523,12 +523,7 @@ class JSM
private function _extractScriptDefs(string $file, string $txt) : string private function _extractScriptDefs(string $file, string $txt) : string
{ {
$strpos = strpos($txt, 'def'); if(strpos($txt, 'def') === false)
if($strpos === false)
return $txt;
//let's extra check if newline symbols preceed 'def'
if($strpos > 0 && !($txt[$strpos-1] === "\n" || $txt[$strpos-1] === "\r"))
return $txt; return $txt;
//NOTE: make it more robust //NOTE: make it more robust
@ -683,23 +678,22 @@ class JSM
class JSM_Module class JSM_Module
{ {
var string $file = ''; var $file = '';
var $defs = array(); var $defs = array();
//NOTE: all includes (even those included from other modules)
var $includes = array(); var $includes = array();
var $node = null; var $node = null;
function __construct(string $file) function __construct($file)
{ {
$this->file = $file; $this->file = $file;
} }
function getIncludes() : array function getIncludes()
{ {
return $this->includes; return $this->includes;
} }
function getFile() : string function getFile()
{ {
return $this->file; return $this->file;
} }