@jdeighan/coffee-utils 4.1.15 → 4.1.16
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/call_stack.coffee +5 -2
- package/src/call_stack.js +6 -2
package/package.json
CHANGED
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
|
|