| 955 | |
| 956 | #ifndef AS_NO_COMPILER |
| 957 | void asCBuilder::RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns) |
| 958 | { |
| 959 | node = node->firstChild; |
| 960 | while( node ) |
| 961 | { |
| 962 | asCScriptNode *next = node->next; |
| 963 | if( node->nodeType == snNamespace ) |
| 964 | { |
| 965 | // Determine the name of the namespace |
| 966 | asCString nsName; |
| 967 | nsName.Assign(&script->code[node->firstChild->tokenPos], node->firstChild->tokenLength); |
| 968 | if( ns->name != "" ) |
| 969 | nsName = ns->name + "::" + nsName; |
| 970 | |
| 971 | // Declare the namespace, then add the entities |
| 972 | asSNameSpace *nsChild = engine->AddNameSpace(nsName.AddressOf()); |
| 973 | RegisterNonTypesFromScript(node->lastChild, script, nsChild); |
| 974 | } |
| 975 | else |
| 976 | { |
| 977 | node->DisconnectParent(); |
| 978 | if( node->nodeType == snFunction ) |
| 979 | RegisterScriptFunctionFromNode(node, script, 0, false, true, ns); |
| 980 | else if( node->nodeType == snDeclaration ) |
| 981 | RegisterGlobalVar(node, script, ns); |
| 982 | else if( node->nodeType == snVirtualProperty ) |
| 983 | RegisterVirtualProperty(node, script, 0, false, true, ns); |
| 984 | else if( node->nodeType == snImport ) |
| 985 | RegisterImportedFunction(module->GetNextImportedFunctionId(), node, script, ns); |
| 986 | else |
| 987 | { |
| 988 | // Unused script node |
| 989 | int r, c; |
| 990 | script->ConvertPosToRowCol(node->tokenPos, &r, &c); |
| 991 | |
| 992 | WriteWarning(script->name, TXT_UNUSED_SCRIPT_NODE, r, c); |
| 993 | |
| 994 | node->Destroy(engine); |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | node = next; |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | void asCBuilder::CompileFunctions() |
| 1003 | { |
nothing calls this directly
no test coverage detected