()
| 354 | } |
| 355 | |
| 356 | variables() { |
| 357 | if (!this._variables) { |
| 358 | this._variables = !this.rules ? {} : this.rules.reduce(function (/** @type {Object<string, Declaration>} */ hash, /** @type {Node} */ r) { |
| 359 | if (r instanceof Declaration && r.variable === true) { |
| 360 | hash[/** @type {string} */ (r.name)] = r; |
| 361 | } |
| 362 | // when evaluating variables in an import statement, imports have not been eval'd |
| 363 | // so we need to go inside import statements. |
| 364 | // guard against root being a string (in the case of inlined less) |
| 365 | if (r.type === 'Import' && /** @type {RuleNode} */ (r).root && /** @type {RuleNode & { root: Ruleset }} */ (r).root.variables) { |
| 366 | const vars = /** @type {RuleNode & { root: Ruleset }} */ (r).root.variables(); |
| 367 | for (const name in vars) { |
| 368 | if (Object.prototype.hasOwnProperty.call(vars, name)) { |
| 369 | hash[name] = /** @type {Declaration} */ (/** @type {RuleNode & { root: Ruleset }} */ (r).root.variable(name)); |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | return hash; |
| 374 | }, {}); |
| 375 | } |
| 376 | return this._variables; |
| 377 | } |
| 378 | |
| 379 | properties() { |
| 380 | if (!this._properties) { |
no test coverage detected