(macroDefinitionAtom, macroUsageAtom)
| 17005 | return lastParticle |
| 17006 | } |
| 17007 | macroExpand(macroDefinitionAtom, macroUsageAtom) { |
| 17008 | const clone = this.clone() |
| 17009 | const defs = clone.findParticles(macroDefinitionAtom) |
| 17010 | const allUses = clone.findParticles(macroUsageAtom) |
| 17011 | const atomBreakSymbol = clone.atomBreakSymbol |
| 17012 | defs.forEach(def => { |
| 17013 | const macroName = def.getAtom(1) |
| 17014 | const uses = allUses.filter(particle => particle.hasAtom(1, macroName)) |
| 17015 | const params = def.getAtomsFrom(2) |
| 17016 | const replaceFn = str => { |
| 17017 | const paramValues = str.split(atomBreakSymbol).slice(2) |
| 17018 | let newParticle = def.subparticlesToString() |
| 17019 | params.forEach((param, index) => { |
| 17020 | newParticle = newParticle.replace(new RegExp(param, "g"), paramValues[index]) |
| 17021 | }) |
| 17022 | return newParticle |
| 17023 | } |
| 17024 | uses.forEach(particle => { |
| 17025 | particle.replaceParticle(replaceFn) |
| 17026 | }) |
| 17027 | def.destroy() |
| 17028 | }) |
| 17029 | return clone |
| 17030 | } |
| 17031 | setSubparticles(subparticles) { |
| 17032 | return this._setSubparticles(subparticles) |
| 17033 | } |
nothing calls this directly
no test coverage detected