Skip to content

Commit 80dca43

Browse files
committed
fix: There were crashes when running with some debugging enabled.
1 parent d02cd51 commit 80dca43

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/@css-blocks/glimmer/src/Analyzer.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export class GlimmerAnalyzer extends Analyzer<TEMPLATE_TYPE> {
105105

106106
// Fetch the block associated with this template. If no block file for this
107107
// component exists, does not exist, stop.
108+
this.debug("Analyzing template... resolving block ", dir, componentName);
108109
let block: Block | undefined = await this.resolveBlock(dir, componentName);
109110
if (!block) { return analysis; }
110111

@@ -125,15 +126,15 @@ export class GlimmerAnalyzer extends Analyzer<TEMPLATE_TYPE> {
125126
elementCount++;
126127
const atRootElement = (elementCount === 1);
127128
const element = elementAnalyzer.analyze(node, atRootElement);
128-
if (self.debug.enabled) self.debug(`{{${name}}} analyzed:`, element.class.forOptimizer(self.cssBlocksOptions).toString());
129+
if (self.debug.enabled) self.debug(`{{${node.path.original}}} analyzed:`, element.class.forOptimizer(self.cssBlocksOptions).toString());
129130
},
130131

131132
BlockStatement(node: AST.BlockStatement) {
132133
if (!isAnalyzedHelper(node)) { return; }
133134
elementCount++;
134135
const atRootElement = (elementCount === 1);
135136
const element = elementAnalyzer.analyze(node, atRootElement);
136-
if (self.debug.enabled) self.debug(`{{#${name}}} analyzed:`, element.class.forOptimizer(self.cssBlocksOptions).toString());
137+
if (self.debug.enabled) self.debug(`{{#${node.path.original}}} analyzed:`, element.class.forOptimizer(self.cssBlocksOptions).toString());
137138
},
138139

139140
ElementNode(node) {

packages/@css-blocks/glimmer/src/ElementAnalyzer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class ElementAnalyzer {
8686
if (!debug.enabled) return;
8787
let startTag = "";
8888
if (isElementNode(node)) {
89-
startTag = `<${node.tag} ${node.attributes.map(a => print(a)).join(" ")}>`;
89+
startTag = `<${node.tag} ${node.attributes.map(a => a.name).join(" ")}>`;
9090
debug(`Element ${startTag} is ${atRootElement ? "the root " : "a sub"}element at ${this.debugTemplateLocation(node)}`);
9191
}
9292
else {

0 commit comments

Comments
 (0)