* Add a chunk of generated JS to the beginning of this source node. * * @param aChunk A string snippet of generated JS code, another instance of * SourceNode, or an array where each member is one of those things.
(aChunk)
| 2128 | * SourceNode, or an array where each member is one of those things. |
| 2129 | */ |
| 2130 | prepend(aChunk) { |
| 2131 | if (Array.isArray(aChunk)) { |
| 2132 | for (let i = aChunk.length - 1; i >= 0; i--) { |
| 2133 | this.prepend(aChunk[i]); |
| 2134 | } |
| 2135 | } else if (aChunk[isSourceNode] || typeof aChunk === "string") { |
| 2136 | this.children.unshift(aChunk); |
| 2137 | } else { |
| 2138 | throw new TypeError( |
| 2139 | "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk |
| 2140 | ); |
| 2141 | } |
| 2142 | return this; |
| 2143 | } |
| 2144 | |
| 2145 | /** |
| 2146 | * Walk over the tree of JS snippets in this node and its children. The |
no test coverage detected