(tag, props, children)
| 97 | } |
| 98 | |
| 99 | function createVNode(tag, props, children) { |
| 100 | // Never pass children=[[]]. |
| 101 | if (children.elements.length === 1 && t.isArrayExpression(children.elements[0]) && children.elements[0].elements.length === 0) { |
| 102 | children = children.elements[0]; |
| 103 | } |
| 104 | |
| 105 | if (inlineVNodes) { |
| 106 | return t.objectExpression([ |
| 107 | options.monomorphic && t.objectProperty(propertyName('type'), t.numericLiteral(1)), |
| 108 | t.objectProperty(propertyName('tag'), tag), |
| 109 | t.objectProperty(propertyName('props'), props), |
| 110 | t.objectProperty(propertyName('children'), children), |
| 111 | options.monomorphic && t.objectProperty(propertyName('text'), t.nullLiteral()) |
| 112 | ].filter(Boolean)); |
| 113 | } |
| 114 | |
| 115 | // Passing `{variableArity:false}` always produces `h(tag, props, children)` - where `children` is always an Array. |
| 116 | // Otherwise, the default is `h(tag, props, ...children)`. |
| 117 | if (options.variableArity !== false) { |
| 118 | children = children.elements; |
| 119 | } |
| 120 | |
| 121 | return t.callExpression(pragma, [tag, props].concat(children)); |
| 122 | } |
| 123 | |
| 124 | function spreadNode(args, state) { |
| 125 | if (args.length === 0) { |
no test coverage detected
searching dependent graphs…