| 646 | return res; |
| 647 | |
| 648 | function execParsedCode(parsed) { |
| 649 | let extra = ""; |
| 650 | parsed.map((st) => { |
| 651 | if (st.type === "VariableDeclaration") { |
| 652 | if (["const", "let"].indexOf(st.kind) < 0) return; |
| 653 | |
| 654 | const exCode = code.substring(st.start, st.end) + ";"; |
| 655 | extra += exCode; |
| 656 | } |
| 657 | }); |
| 658 | |
| 659 | if (extra) { |
| 660 | const script = tag("script"); |
| 661 | script.textContent = extra; |
| 662 | document.body.appendChild(script); |
| 663 | document.body.removeChild(script); |
| 664 | return exec(code); |
| 665 | } else { |
| 666 | return exec(code); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | function exec(code) { |
| 671 | let res = null; |