| 149 | } |
| 150 | |
| 151 | CppiaExpr *ScriptCallable::link(CppiaModule &inModule) |
| 152 | { |
| 153 | StackLayout *oldLayout = inModule.layout; |
| 154 | StackLayout layout(oldLayout); |
| 155 | inModule.layout = &layout; |
| 156 | data = &inModule; |
| 157 | |
| 158 | returnType = inModule.types[ returnTypeId ]->expressionType; |
| 159 | layout.returnType = returnType; |
| 160 | |
| 161 | for(int a=0;a<args.size();a++) |
| 162 | args[a].link(inModule, hasDefault[a]); |
| 163 | |
| 164 | for(int a=0;a<initVals.size();a++) |
| 165 | if (hasDefault[a]) |
| 166 | { |
| 167 | args[a].linkDefault(); |
| 168 | hasDefaults = true; |
| 169 | } |
| 170 | |
| 171 | body = body->link(inModule); |
| 172 | |
| 173 | captureVars.swap(layout.captureVars); |
| 174 | captureSize = layout.captureSize; |
| 175 | |
| 176 | #ifdef HXCPP_STACK_SCRIPTABLE |
| 177 | std::swap(varMap,layout.varMap); |
| 178 | position.scriptCallable = this; |
| 179 | #endif |
| 180 | |
| 181 | stackSize = layout.size; |
| 182 | inModule.layout = oldLayout; |
| 183 | |
| 184 | position.className = className; |
| 185 | position.functionName = functionName; |
| 186 | position.fileName = filename; |
| 187 | position.fullName = filename; |
| 188 | |
| 189 | #ifdef HXCPP_DEBUGGER |
| 190 | position.fileHash = Hash(0,filename); |
| 191 | int hash = Hash(0,className); |
| 192 | hash = Hash(hash,"."); |
| 193 | position.classFuncHash = Hash(hash,functionName); |
| 194 | #endif |
| 195 | |
| 196 | #ifdef CPPIA_JIT |
| 197 | //printf("Compile?\n"); |
| 198 | #endif |
| 199 | |
| 200 | return this; |
| 201 | } |
| 202 | |
| 203 | #ifdef HXCPP_STACK_SCRIPTABLE |
| 204 | void ScriptCallable::getScriptableVariables(unsigned char *inStack, Array<Dynamic> outNames) |
nothing calls this directly
no test coverage detected