File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
SuperAutoIsland.Frontend/src/blockly/utils Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ export function addMetaBlock(metadata: Metadata) {
140140 isReporter : metadata . isRule ,
141141 } ,
142142 ( block , generator ) => {
143- let argsCode = '{ ' ;
143+ let argsCode = '(() => { let a = {}; ' ;
144144 for ( let [ argName , argType ] of args ) {
145145 let value ;
146146 switch ( argType ) {
@@ -156,9 +156,17 @@ export function addMetaBlock(metadata: Metadata) {
156156 value = { TRUE : true , FALSE : false } [ value as "TRUE" | "FALSE" ] ;
157157 break ;
158158 }
159- argsCode += `${ argName } : ${ value } , ` ;
159+
160+ if ( argName . includes ( "." ) ) {
161+ const parts = argName . split ( "." ) ;
162+ for ( let i = 1 ; i < parts . length ; i ++ ) {
163+ const path = parts . slice ( 0 , i ) . join ( "." ) ;
164+ argsCode += `if (!a.${ path } ) a.${ path } = {};\n` ;
165+ }
166+ }
167+ argsCode += `a.${ argName } = ${ value } ;` ;
160168 }
161- argsCode += '} ' ;
169+ argsCode += 'return a; })() ' ;
162170
163171 if ( metadata . isRule ) {
164172 return [ `await getRuleState("${ metadata . id } ", ${ argsCode } )\n` , Order . MEMBER ] ;
You can’t perform that action at this time.
0 commit comments