@jdeighan/coffee-utils 4.1.14 → 4.1.18
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +4 -1
- package/src/call_stack.coffee +5 -2
- package/src/call_stack.js +6 -2
- package/src/debug_utils.coffee +1 -1
- package/src/debug_utils.js +1 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jdeighan/coffee-utils",
|
3
3
|
"type": "module",
|
4
|
-
"version": "4.1.
|
4
|
+
"version": "4.1.18",
|
5
5
|
"description": "A set of utility functions for CoffeeScript",
|
6
6
|
"main": "coffee_utils.js",
|
7
7
|
"exports": {
|
@@ -19,6 +19,9 @@
|
|
19
19
|
"engines": {
|
20
20
|
"node": ">=12.0.0"
|
21
21
|
},
|
22
|
+
"ava": {
|
23
|
+
"verbose": false
|
24
|
+
},
|
22
25
|
"scripts": {
|
23
26
|
"build": "cls && rm -f ./src/*.js && coffee -c ./src",
|
24
27
|
"old_pretest": "npm run build && rm -f ./test/*.js && rm -f ./test/*.coffee && cielo -fq ./test",
|
package/src/call_stack.coffee
CHANGED
@@ -22,8 +22,11 @@ export class CallStack
|
|
22
22
|
|
23
23
|
returnFrom: (fName) ->
|
24
24
|
|
25
|
+
if @lStack.length == 0
|
26
|
+
croak "returnFrom('#{fName}') but stack is empty"
|
25
27
|
{funcName, hInfo} = @lStack.pop()
|
26
28
|
if funcName != fName
|
29
|
+
@dump()
|
27
30
|
croak "returnFrom('#{fName}') but TOS is '#{funcName}'"
|
28
31
|
return hInfo
|
29
32
|
|
@@ -37,7 +40,7 @@ export class CallStack
|
|
37
40
|
|
38
41
|
dump: (label='CALL STACK') ->
|
39
42
|
|
40
|
-
log "#{label}:"
|
43
|
+
console.log "#{label}:"
|
41
44
|
for item, i in @lStack
|
42
|
-
log "#{i}: #{JSON.stringify(item)}"
|
45
|
+
console.log "#{i}: #{JSON.stringify(item)}"
|
43
46
|
return
|
package/src/call_stack.js
CHANGED
@@ -23,8 +23,12 @@ export var CallStack = class CallStack {
|
|
23
23
|
// ........................................................................
|
24
24
|
returnFrom(fName) {
|
25
25
|
var funcName, hInfo;
|
26
|
+
if (this.lStack.length === 0) {
|
27
|
+
croak(`returnFrom('${fName}') but stack is empty`);
|
28
|
+
}
|
26
29
|
({funcName, hInfo} = this.lStack.pop());
|
27
30
|
if (funcName !== fName) {
|
31
|
+
this.dump();
|
28
32
|
croak(`returnFrom('${fName}') but TOS is '${funcName}'`);
|
29
33
|
}
|
30
34
|
return hInfo;
|
@@ -38,11 +42,11 @@ export var CallStack = class CallStack {
|
|
38
42
|
// ........................................................................
|
39
43
|
dump(label = 'CALL STACK') {
|
40
44
|
var i, item, j, len, ref;
|
41
|
-
log(`${label}:`);
|
45
|
+
console.log(`${label}:`);
|
42
46
|
ref = this.lStack;
|
43
47
|
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
44
48
|
item = ref[i];
|
45
|
-
log(`${i}: ${JSON.stringify(item)}`);
|
49
|
+
console.log(`${i}: ${JSON.stringify(item)}`);
|
46
50
|
}
|
47
51
|
}
|
48
52
|
|
package/src/debug_utils.coffee
CHANGED
package/src/debug_utils.js
CHANGED
@@ -178,7 +178,7 @@ export var debug = function(...lArgs) {
|
|
178
178
|
curFunc = lMatches[1];
|
179
179
|
stack.call(curFunc, curEnv());
|
180
180
|
debugging = shouldDebug(curFunc, debugging);
|
181
|
-
} else if ((lMatches = str.match(/^\s*return
|
181
|
+
} else if ((lMatches = str.match(/^\s*return.+from\s+([A-Za-z_][A-Za-z0-9_\.]*)/))) {
|
182
182
|
returning = true;
|
183
183
|
curFunc = lMatches[1];
|
184
184
|
hInfo = stack.returnFrom(curFunc);
|