@jdeighan/coffee-utils 7.0.68 → 7.0.71
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 +9 -5
- package/src/call_stack.js +9 -4
package/package.json
CHANGED
package/src/call_stack.coffee
CHANGED
|
@@ -34,6 +34,12 @@ export class CallStack
|
|
|
34
34
|
|
|
35
35
|
# ........................................................................
|
|
36
36
|
|
|
37
|
+
indent: () ->
|
|
38
|
+
|
|
39
|
+
return ' '.repeat(@lStack.length)
|
|
40
|
+
|
|
41
|
+
# ........................................................................
|
|
42
|
+
|
|
37
43
|
enter: (funcName, lArgs=[], isLogged) ->
|
|
38
44
|
# --- funcName might be <object>.<method>
|
|
39
45
|
|
|
@@ -41,7 +47,7 @@ export class CallStack
|
|
|
41
47
|
assert isBoolean(isLogged), "missing isLogged"
|
|
42
48
|
|
|
43
49
|
if doDebugStack
|
|
44
|
-
LOG "[--> ENTER #{funcName}]"
|
|
50
|
+
LOG @indent() + "[--> ENTER #{funcName}]"
|
|
45
51
|
|
|
46
52
|
lMatches = funcName.match(///^
|
|
47
53
|
([A-Za-z_][A-Za-z0-9_]*)
|
|
@@ -93,14 +99,12 @@ export class CallStack
|
|
|
93
99
|
|
|
94
100
|
returnFrom: (fName) ->
|
|
95
101
|
|
|
96
|
-
if doDebugStack
|
|
97
|
-
LOG "[<-- BACK #{fName}]"
|
|
98
|
-
|
|
99
102
|
if @lStack.length == 0
|
|
100
103
|
LOG "ERROR: returnFrom('#{fName}') but stack is empty"
|
|
101
104
|
return
|
|
102
|
-
|
|
103
105
|
{fullName, isLogged} = @lStack.pop()
|
|
106
|
+
if doDebugStack
|
|
107
|
+
LOG @indent() + "[<-- BACK #{fName}]"
|
|
104
108
|
if (fullName != fName)
|
|
105
109
|
LOG "ERROR: returnFrom('#{fName}') but TOS is #{fullName}"
|
|
106
110
|
return
|
package/src/call_stack.js
CHANGED
|
@@ -39,6 +39,11 @@ export var CallStack = class CallStack {
|
|
|
39
39
|
this.lStack = [];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// ........................................................................
|
|
43
|
+
indent() {
|
|
44
|
+
return ' '.repeat(this.lStack.length);
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
// ........................................................................
|
|
43
48
|
enter(funcName, lArgs = [], isLogged) {
|
|
44
49
|
var _, hStackItem, ident1, ident2, lMatches;
|
|
@@ -46,7 +51,7 @@ export var CallStack = class CallStack {
|
|
|
46
51
|
assert(isArray(lArgs), "missing lArgs");
|
|
47
52
|
assert(isBoolean(isLogged), "missing isLogged");
|
|
48
53
|
if (doDebugStack) {
|
|
49
|
-
LOG(`[--> ENTER ${funcName}]`);
|
|
54
|
+
LOG(this.indent() + `[--> ENTER ${funcName}]`);
|
|
50
55
|
}
|
|
51
56
|
lMatches = funcName.match(/^([A-Za-z_][A-Za-z0-9_]*)(?:\.([A-Za-z_][A-Za-z0-9_]*))?$/);
|
|
52
57
|
assert(defined(lMatches), `Bad funcName: ${OL(funcName)}`);
|
|
@@ -97,14 +102,14 @@ export var CallStack = class CallStack {
|
|
|
97
102
|
// --- if stack is empty, log the error, but continue
|
|
98
103
|
returnFrom(fName) {
|
|
99
104
|
var fullName, isLogged;
|
|
100
|
-
if (doDebugStack) {
|
|
101
|
-
LOG(`[<-- BACK ${fName}]`);
|
|
102
|
-
}
|
|
103
105
|
if (this.lStack.length === 0) {
|
|
104
106
|
LOG(`ERROR: returnFrom('${fName}') but stack is empty`);
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
109
|
({fullName, isLogged} = this.lStack.pop());
|
|
110
|
+
if (doDebugStack) {
|
|
111
|
+
LOG(this.indent() + `[<-- BACK ${fName}]`);
|
|
112
|
+
}
|
|
108
113
|
if (fullName !== fName) {
|
|
109
114
|
LOG(`ERROR: returnFrom('${fName}') but TOS is ${fullName}`);
|
|
110
115
|
return;
|