@@ -1233,73 +1233,42 @@ local compilerSwitch = util.switch()
12331233 return
12341234 end
12351235
1236- --- @type vm.node , boolean
1237- local variableNode , needCompile
1238-
1239- do
1240- local localInfo = vm .getVariableInfo (source )
1241- if localInfo then
1242- local lastCacheNode = vm .getNode (localInfo )
1243- if lastCacheNode then
1244- variableNode = lastCacheNode
1245- else
1246- needCompile = true
1247- variableNode = vm .createNode ()
1248- vm .setNode (localInfo , variableNode , true )
1249- end
1250- else
1251- local parentNode = vm .compileNode (source .node )
1252- if not parentNode .fields then
1253- parentNode .fields = {}
1254- end
1255- variableNode = parentNode .fields [key ]
1256- if not variableNode then
1257- needCompile = true
1258- variableNode = vm .createNode ()
1259- parentNode .fields [key ] = variableNode
1236+ if type (key ) == ' table' then
1237+ --- @cast key vm.node
1238+ local uri = guide .getUri (source )
1239+ local value = vm .getTableValue (uri , vm .compileNode (source .node ), key )
1240+ if value then
1241+ vm .setNode (source , value )
1242+ end
1243+ for k in key :eachObject () do
1244+ if k .type == ' global' and k .cate == ' type' then
1245+ --- @cast k vm.global
1246+ vm .compileByParentNode (source .node , k , function (src )
1247+ vm .setNode (source , vm .compileNode (src ))
1248+ if src .value then
1249+ vm .setNode (source , vm .compileNode (src .value ))
1250+ end
1251+ end )
12601252 end
12611253 end
1262- end
1263-
1264- if needCompile then
1265- if type (key ) == ' table' then
1266- --- @cast key vm.node
1267- local uri = guide .getUri (source )
1268- local value = vm .getTableValue (uri , vm .compileNode (source .node ), key )
1269- if value then
1270- variableNode :merge (value )
1271- end
1272- for k in key :eachObject () do
1273- if k .type == ' global' and k .cate == ' type' then
1274- --- @cast k vm.global
1275- vm .compileByParentNode (source .node , k , function (src )
1276- variableNode :merge (vm .compileNode (src ))
1277- if src .value then
1278- variableNode :merge (vm .compileNode (src .value ))
1279- end
1280- end )
1281- end
1282- end
1283- else
1284- --- @cast key string
1285- vm .compileByParentNode (source .node , key , function (src )
1286- if src .value then
1287- if bindDocs (src ) then
1288- variableNode :merge (vm .compileNode (src ))
1289- elseif src .value .type ~= ' nil' then
1290- variableNode :merge (vm .compileNode (src .value ))
1291- local node = vm .getNode (src )
1292- if node then
1293- variableNode :merge (node )
1294- end
1254+ else
1255+ --- @cast key string
1256+ vm .compileByParentNode (source .node , key , function (src )
1257+ if src .value then
1258+ if bindDocs (src ) then
1259+ vm .setNode (source , vm .compileNode (src ))
1260+ elseif src .value .type ~= ' nil' then
1261+ vm .setNode (source , vm .compileNode (src .value ))
1262+ local node = vm .getNode (src )
1263+ if node then
1264+ vm .setNode (source , node )
12951265 end
1296- else
1297- variableNode :merge (vm .compileNode (src ))
12981266 end
1299- end )
1300- end
1267+ else
1268+ vm .setNode (source , vm .compileNode (src ))
1269+ end
1270+ end )
13011271 end
1302- vm .setNode (source , variableNode )
13031272 end )
13041273 : case ' setglobal'
13051274 : call (function (source )
0 commit comments