@jdeighan/coffee-utils 6.0.3 → 6.0.4
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.
- package/package.json +1 -1
- package/src/call_stack.coffee +5 -4
- package/src/call_stack.js +6 -4
- package/src/debug_utils.coffee +3 -2
- package/src/debug_utils.js +4 -2
package/package.json
CHANGED
package/src/call_stack.coffee
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# call_stack.coffee
|
2
2
|
|
3
3
|
import {undef, croak} from '@jdeighan/coffee-utils'
|
4
|
-
import {log} from '@jdeighan/coffee-utils/log'
|
4
|
+
import {log, LOG} from '@jdeighan/coffee-utils/log'
|
5
5
|
|
6
6
|
# ---------------------------------------------------------------------------
|
7
7
|
|
@@ -23,11 +23,12 @@ export class CallStack
|
|
23
23
|
returnFrom: (fName) ->
|
24
24
|
|
25
25
|
if @lStack.length == 0
|
26
|
-
|
26
|
+
LOG "returnFrom('#{fName}') but stack is empty"
|
27
|
+
return undef
|
27
28
|
{funcName, hInfo} = @lStack.pop()
|
28
29
|
if funcName != fName
|
29
30
|
@dump()
|
30
|
-
|
31
|
+
LOG "returnFrom('#{fName}') but TOS is '#{funcName}'"
|
31
32
|
return hInfo
|
32
33
|
|
33
34
|
# ........................................................................
|
@@ -42,5 +43,5 @@ export class CallStack
|
|
42
43
|
|
43
44
|
console.log "#{label}:"
|
44
45
|
for item, i in @lStack
|
45
|
-
|
46
|
+
LOG "#{i}: #{JSON.stringify(item)}"
|
46
47
|
return
|
package/src/call_stack.js
CHANGED
@@ -6,7 +6,8 @@ import {
|
|
6
6
|
} from '@jdeighan/coffee-utils';
|
7
7
|
|
8
8
|
import {
|
9
|
-
log
|
9
|
+
log,
|
10
|
+
LOG
|
10
11
|
} from '@jdeighan/coffee-utils/log';
|
11
12
|
|
12
13
|
// ---------------------------------------------------------------------------
|
@@ -24,12 +25,13 @@ export var CallStack = class CallStack {
|
|
24
25
|
returnFrom(fName) {
|
25
26
|
var funcName, hInfo;
|
26
27
|
if (this.lStack.length === 0) {
|
27
|
-
|
28
|
+
LOG(`returnFrom('${fName}') but stack is empty`);
|
29
|
+
return undef;
|
28
30
|
}
|
29
31
|
({funcName, hInfo} = this.lStack.pop());
|
30
32
|
if (funcName !== fName) {
|
31
33
|
this.dump();
|
32
|
-
|
34
|
+
LOG(`returnFrom('${fName}') but TOS is '${funcName}'`);
|
33
35
|
}
|
34
36
|
return hInfo;
|
35
37
|
}
|
@@ -46,7 +48,7 @@ export var CallStack = class CallStack {
|
|
46
48
|
ref = this.lStack;
|
47
49
|
for (i = j = 0, len = ref.length; j < len; i = ++j) {
|
48
50
|
item = ref[i];
|
49
|
-
|
51
|
+
LOG(`${i}: ${JSON.stringify(item)}`);
|
50
52
|
}
|
51
53
|
}
|
52
54
|
|
package/src/debug_utils.coffee
CHANGED
@@ -150,7 +150,7 @@ export debug = (lArgs...) ->
|
|
150
150
|
returning = true
|
151
151
|
curFunc = lMatches[1]
|
152
152
|
hInfo = stack.returnFrom(curFunc)
|
153
|
-
if DEBUGDEBUG
|
153
|
+
if DEBUGDEBUG && hInfo
|
154
154
|
LOG "RETURN FROM #{curFunc}, debugging = #{hInfo.debugging}"
|
155
155
|
|
156
156
|
if shouldLogString(label)
|
@@ -179,7 +179,8 @@ export debug = (lArgs...) ->
|
|
179
179
|
if returning
|
180
180
|
if debugLevel > 0
|
181
181
|
debugLevel -= 1
|
182
|
-
|
182
|
+
if hInfo
|
183
|
+
setEnv(hInfo)
|
183
184
|
else if entering
|
184
185
|
if debugging
|
185
186
|
debugLevel += 1
|
package/src/debug_utils.js
CHANGED
@@ -176,7 +176,7 @@ export var debug = function(...lArgs) {
|
|
176
176
|
returning = true;
|
177
177
|
curFunc = lMatches[1];
|
178
178
|
hInfo = stack.returnFrom(curFunc);
|
179
|
-
if (DEBUGDEBUG) {
|
179
|
+
if (DEBUGDEBUG && hInfo) {
|
180
180
|
LOG(`RETURN FROM ${curFunc}, debugging = ${hInfo.debugging}`);
|
181
181
|
}
|
182
182
|
}
|
@@ -205,7 +205,9 @@ export var debug = function(...lArgs) {
|
|
205
205
|
if (debugLevel > 0) {
|
206
206
|
debugLevel -= 1;
|
207
207
|
}
|
208
|
-
|
208
|
+
if (hInfo) {
|
209
|
+
setEnv(hInfo);
|
210
|
+
}
|
209
211
|
} else if (entering) {
|
210
212
|
if (debugging) {
|
211
213
|
debugLevel += 1;
|