bare-script 3.7.5 → 3.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,4 +152,4 @@ endfunction
152
152
 
153
153
 
154
154
  # Regex for splitting lines
155
- diffRegexLineSplit = regexNew(stringFromCharCode(13) + '?' + stringFromCharCode(10))
155
+ diffRegexLineSplit = regexNew('\r?\n')
@@ -393,7 +393,7 @@ endfunction
393
393
 
394
394
  function unittestReportScriptLines(codeLineElements, lines, color, noNewline):
395
395
  if lines:
396
- linesStr = arrayJoin(lines, stringFromCharCode(10)) + if(noNewline, '', stringFromCharCode(10))
396
+ linesStr = arrayJoin(lines, '\n') + if(noNewline, '', '\n')
397
397
  if !color:
398
398
  arrayPush(codeLineElements, {'text': linesStr})
399
399
  else:
package/lib/model.js CHANGED
@@ -361,7 +361,8 @@ export function lintScript(script) {
361
361
  const fnVarAssigns = {};
362
362
  const fnVarUses = {};
363
363
  const args = (statement.function.args ?? null);
364
- getVariableAssignmentsAndUses(statement.function.statements, fnVarAssigns, fnVarUses);
364
+ const fnStatements = statement.function.statements;
365
+ getVariableAssignmentsAndUses(fnStatements, fnVarAssigns, fnVarUses);
365
366
  for (const varName of Object.keys(fnVarAssigns)) {
366
367
  // Ignore re-assigned function arguments
367
368
  if (args !== null && args.indexOf(varName) !== -1) {
@@ -369,7 +370,7 @@ export function lintScript(script) {
369
370
  }
370
371
  if (varName in fnVarUses && fnVarUses[varName] <= fnVarAssigns[varName]) {
371
372
  lintScriptWarning(
372
- warnings, script, statement,
373
+ warnings, script, fnStatements[fnVarUses[varName]],
373
374
  `Variable "${varName}" of function "${statement.function.name}" used before assignment`
374
375
  );
375
376
  }
@@ -379,7 +380,7 @@ export function lintScript(script) {
379
380
  for (const varName of Object.keys(fnVarAssigns)) {
380
381
  if (!(varName in fnVarUses)) {
381
382
  lintScriptWarning(
382
- warnings, script, statement,
383
+ warnings, script, fnStatements[fnVarAssigns[varName]],
383
384
  `Unused variable "${varName}" defined in function "${statement.function.name}"`
384
385
  );
385
386
  }
@@ -410,7 +411,7 @@ export function lintScript(script) {
410
411
  // Iterate function statements
411
412
  const fnLabelsDefined = {};
412
413
  const fnLabelsUsed = {};
413
- for (const [ixFnStatement, fnStatement] of statement.function.statements.entries()) {
414
+ for (const [ixFnStatement, fnStatement] of fnStatements.entries()) {
414
415
  const [fnStatementKey] = Object.keys(fnStatement);
415
416
 
416
417
  // Function expression statement checks
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bare-script",
4
- "version": "3.7.5",
4
+ "version": "3.7.6",
5
5
  "description": "BareScript; a lightweight scripting and expression language",
6
6
  "keywords": [
7
7
  "expression",