MCPcopy Create free account
hub / github.com/anjo76/angelscript / ExchangeVar

Method ExchangeVar

sdk/angelscript/source/as_bytecode.cpp:194–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void asCByteCode::ExchangeVar(int oldOffset, int newOffset)
195{
196 asASSERT(oldOffset != 0);
197
198 asCByteInstruction *curr = first;
199 while( curr )
200 {
201 // Verify all ops that use variables
202 if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG )
203 {
204 if( curr->wArg[0] == oldOffset )
205 curr->wArg[0] = (short)newOffset;
206 if( curr->wArg[1] == oldOffset )
207 curr->wArg[1] = (short)newOffset;
208 if( curr->wArg[2] == oldOffset )
209 curr->wArg[2] = (short)newOffset;
210 }
211 else if( asBCInfo[curr->op].type == asBCTYPE_rW_ARG ||
212 asBCInfo[curr->op].type == asBCTYPE_wW_ARG ||
213 asBCInfo[curr->op].type == asBCTYPE_wW_W_ARG ||
214 asBCInfo[curr->op].type == asBCTYPE_rW_DW_ARG ||
215 asBCInfo[curr->op].type == asBCTYPE_wW_DW_ARG ||
216 asBCInfo[curr->op].type == asBCTYPE_wW_QW_ARG ||
217 asBCInfo[curr->op].type == asBCTYPE_rW_W_DW_ARG ||
218 asBCInfo[curr->op].type == asBCTYPE_rW_DW_DW_ARG )
219 {
220 if( curr->wArg[0] == oldOffset )
221 curr->wArg[0] = (short)newOffset;
222 }
223 else if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG ||
224 asBCInfo[curr->op].type == asBCTYPE_rW_rW_ARG )
225 {
226 if( curr->wArg[0] == oldOffset )
227 curr->wArg[0] = (short)newOffset;
228 if( curr->wArg[1] == oldOffset )
229 curr->wArg[1] = (short)newOffset;
230 }
231
232 curr = curr->next;
233 }
234}
235
236void asCByteCode::AddPath(asCArray<asCByteInstruction *> &paths, asCByteInstruction *instr, int stackSize)
237{

Callers 4

MakeFunctionCallMethod · 0.80
CompileOperatorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected