( node: FunctionExpression, context: CodegenContext, )
| 932 | } |
| 933 | |
| 934 | function genFunctionExpression( |
| 935 | node: FunctionExpression, |
| 936 | context: CodegenContext, |
| 937 | ) { |
| 938 | const { push, indent, deindent } = context |
| 939 | const { params, returns, body, newline, isSlot } = node |
| 940 | if (isSlot) { |
| 941 | // wrap slot functions with owner context |
| 942 | push(`_${helperNameMap[WITH_CTX]}(`) |
| 943 | } |
| 944 | push(`(`, NewlineType.None, node) |
| 945 | if (isArray(params)) { |
| 946 | genNodeList(params, context) |
| 947 | } else if (params) { |
| 948 | genNode(params, context) |
| 949 | } |
| 950 | push(`) => `) |
| 951 | if (newline || body) { |
| 952 | push(`{`) |
| 953 | indent() |
| 954 | } |
| 955 | if (returns) { |
| 956 | if (newline) { |
| 957 | push(`return `) |
| 958 | } |
| 959 | if (isArray(returns)) { |
| 960 | genNodeListAsArray(returns, context) |
| 961 | } else { |
| 962 | genNode(returns, context) |
| 963 | } |
| 964 | } else if (body) { |
| 965 | genNode(body, context) |
| 966 | } |
| 967 | if (newline || body) { |
| 968 | deindent() |
| 969 | push(`}`) |
| 970 | } |
| 971 | if (isSlot) { |
| 972 | if (__COMPAT__ && node.isNonScopedSlot) { |
| 973 | push(`, undefined, true`) |
| 974 | } |
| 975 | push(`)`) |
| 976 | } |
| 977 | } |
| 978 | |
| 979 | function genConditionalExpression( |
| 980 | node: ConditionalExpression, |
no test coverage detected