File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,32 @@ bool Scratch3Reader::load()
118118 block->addField (field);
119119 }
120120
121+ // mutation
122+ if (blockInfo.contains (" mutation" )) {
123+ auto mutation = blockInfo[" mutation" ];
124+ if (mutation.contains (" hasnext" ))
125+ block->setMutationHasNext (jsonToValue (mutation[" hasnext" ]).toBool ());
126+ BlockPrototype *prototype = block->mutationPrototype ();
127+ if (mutation.contains (" proccode" ))
128+ prototype->setProcCode (mutation[" proccode" ].get <std::string>());
129+ if (mutation.contains (" argumentids" )) {
130+ std::vector<std::string> argIDs;
131+ auto argIDsJson = json::parse (mutation[" argumentids" ].get <std::string>());
132+ for (auto arg : argIDsJson)
133+ argIDs.push_back (arg.get <std::string>());
134+ prototype->setArgumentIds (argIDs);
135+ }
136+ if (mutation.contains (" argumentnames" )) {
137+ std::vector<std::string> argNames;
138+ auto argNamesJson = json::parse (mutation[" argumentnames" ].get <std::string>());
139+ for (auto arg : argNamesJson)
140+ argNames.push_back (arg.get <std::string>());
141+ prototype->setArgumentNames (argNames);
142+ }
143+ if (mutation.contains (" warp" ))
144+ prototype->setWarp (jsonToValue (mutation[" warp" ]).toBool ());
145+ }
146+
121147 // shadow
122148 block->setShadow (blockInfo[" shadow" ]);
123149
You can’t perform that action at this time.
0 commit comments