| | |
| | | |
| | | "use strict"; |
| | | |
| | | import { AST_Node } from "../ast.js"; |
| | | import { AST_Node, AST_Number, AST_UnaryPrefix } from "../ast.js"; |
| | | |
| | | function characters(str) { |
| | | return str.split(""); |
| | |
| | | if (!props.end) props.end = orig.end; |
| | | } |
| | | return new ctor(props); |
| | | } |
| | | |
| | | /** Makes a `void 0` expression. Use instead of AST_Undefined which may conflict |
| | | * with an existing variable called `undefined` */ |
| | | function make_void_0(orig) { |
| | | return make_node(AST_UnaryPrefix, orig, { |
| | | operator: "void", |
| | | expression: make_node(AST_Number, orig, { value: 0 }) |
| | | }); |
| | | } |
| | | |
| | | function push_uniq(array, el) { |
| | |
| | | HOP, |
| | | keep_name, |
| | | make_node, |
| | | make_void_0, |
| | | makePredicate, |
| | | map_add, |
| | | map_from_object, |