@@ -9,6 +9,7 @@ import { getImportIdentifier } from './core/get-import-identifier';
99import { memoVariable } from './core/memo-variable' ;
1010import { signalVariable } from './core/signal-variable' ;
1111import type { State } from './core/types' ;
12+ import { UNDEFINED } from './constants' ;
1213
1314const REACTIVE_LABEL = '$' ;
1415
@@ -70,22 +71,12 @@ function transformDeclaratorFromVariableLabel(
7071) : t . VariableDeclarator [ ] {
7172 if ( labelName === 'signal' && t . isIdentifier ( declarator . id ) ) {
7273 return [
73- signalVariable (
74- state ,
75- path ,
76- declarator . id ,
77- declarator . init ?? t . identifier ( 'undefined' ) ,
78- ) ,
74+ signalVariable ( state , path , declarator . id , declarator . init ?? UNDEFINED ) ,
7975 ] ;
8076 }
8177 if ( labelName === 'memo' && t . isIdentifier ( declarator . id ) ) {
8278 return [
83- memoVariable (
84- state ,
85- path ,
86- declarator . id ,
87- declarator . init ?? t . identifier ( 'undefined' ) ,
88- ) ,
79+ memoVariable ( state , path , declarator . id , declarator . init ?? UNDEFINED ) ,
8980 ] ;
9081 }
9182 if ( labelName === 'deferred' && t . isIdentifier ( declarator . id ) ) {
@@ -94,7 +85,7 @@ function transformDeclaratorFromVariableLabel(
9485 state ,
9586 path ,
9687 declarator . id ,
97- declarator . init ?? t . identifier ( 'undefined' ) ,
88+ declarator . init ?? UNDEFINED ,
9889 ) ,
9990 ] ;
10091 }
@@ -111,12 +102,7 @@ function transformDeclaratorFromVariableLabel(
111102 path ,
112103 declarator . id ,
113104 getImportIdentifier ( state , path , 'children' , 'solid-js' ) ,
114- [
115- t . arrowFunctionExpression (
116- [ ] ,
117- declarator . init ?? t . identifier ( 'undefined' ) ,
118- ) ,
119- ] ,
105+ [ t . arrowFunctionExpression ( [ ] , declarator . init ?? UNDEFINED ) ] ,
120106 ) ,
121107 ] ;
122108 }
@@ -179,7 +165,7 @@ function transformCallbackLabel(
179165 const args : t . Expression [ ] = [ callback ] ;
180166 if ( named && nameOption ) {
181167 args . push (
182- t . identifier ( 'undefined' ) ,
168+ UNDEFINED ,
183169 t . objectExpression ( [
184170 t . objectProperty ( t . identifier ( 'name' ) , t . stringLiteral ( nameOption ) ) ,
185171 ] ) ,
0 commit comments