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

Method Build

sdk/angelscript/source/as_module.cpp:260–334  ·  view source on GitHub ↗

interface

Source from the content-addressed store, hash-verified

258
259// interface
260int asCModule::Build()
261{
262#ifdef AS_NO_COMPILER
263 return asNOT_SUPPORTED;
264#else
265 TimeIt("asCModule::Build");
266
267 // Don't allow the module to be rebuilt if there are still
268 // external references that will need the previous code
269 // TODO: interface: The asIScriptModule must have a method for querying if the module is used
270 if( HasExternalReferences(false) )
271 {
272 m_engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_MODULE_IS_IN_USE);
273 return asMODULE_IS_IN_USE;
274 }
275
276 // Only one thread may build at one time
277 // TODO: It should be possible to have multiple threads perform compilations
278 int r = m_engine->RequestBuild();
279 if( r < 0 )
280 return r;
281
282 m_engine->PrepareEngine();
283 if( m_engine->configFailed )
284 {
285 m_engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_INVALID_CONFIGURATION);
286 m_engine->BuildCompleted();
287 return asINVALID_CONFIGURATION;
288 }
289
290 InternalReset();
291
292 if( !m_builder )
293 {
294 m_engine->BuildCompleted();
295 return asSUCCESS;
296 }
297
298 // Compile the script
299 r = m_builder->Build();
300 asDELETE(m_builder,asCBuilder);
301 m_builder = 0;
302
303 if( r < 0 )
304 {
305 // Reset module again
306 InternalReset();
307
308 m_engine->BuildCompleted();
309 return r;
310 }
311
312 JITCompile();
313
314 m_engine->PrepareEngine();
315
316#ifdef AS_DEBUG
317 // Verify that there are no unwanted gaps in the scriptFunctions array.

Callers 15

CompileScriptFunction · 0.45
CompileScriptFunction · 0.45
CompileScriptFunction · 0.45
CompileScriptFunction · 0.45
TestFunction · 0.45
TestMultipleInheritance2Function · 0.45
TestFunction · 0.45
TestFunction · 0.45
test_compiler.cppFile · 0.45
Test3Function · 0.45
Test4Function · 0.45
Test5Function · 0.45

Calls 6

WriteMessageMethod · 0.80
RequestBuildMethod · 0.80
PrepareEngineMethod · 0.80
BuildCompletedMethod · 0.80
GetLengthMethod · 0.45
ExistsMethod · 0.45

Tested by 15

TestFunction · 0.36
TestMultipleInheritance2Function · 0.36
TestFunction · 0.36
TestFunction · 0.36
Test3Function · 0.36
Test4Function · 0.36
Test5Function · 0.36
Test6Function · 0.36
Test7Function · 0.36
Test8Function · 0.36
Test9Function · 0.36
TestRetRefFunction · 0.36