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

Method ParseVariableDeclaration

sdk/angelscript/source/as_builder.cpp:1528–1560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1526}
1527
1528int asCBuilder::ParseVariableDeclaration(const char *decl, asSNameSpace *implicitNamespace, asCString &outName, asSNameSpace *&outNamespace, asCDataType &outDt)
1529{
1530 Reset();
1531
1532 asCScriptCode source;
1533 source.SetCode(TXT_VARIABLE_DECL, decl, true);
1534
1535 asCParser parser(this);
1536
1537 int r = parser.ParsePropertyDeclaration(&source);
1538 if( r < 0 )
1539 return asINVALID_DECLARATION;
1540
1541 asCScriptNode *node = parser.GetScriptNode();
1542
1543 // Determine the scope from declaration
1544 asCScriptNode *n = node->firstChild->next;
1545 // TODO: child funcdef: The parentType will be set if the scope is actually a type rather than a namespace
1546 outNamespace = GetNameSpaceFromNode(n, &source, implicitNamespace, &n);
1547 if( outNamespace == 0 )
1548 return asINVALID_DECLARATION;
1549
1550 // Find name
1551 outName.Assign(&source.code[n->tokenPos], n->tokenLength);
1552
1553 // Initialize a script variable object for registration
1554 outDt = CreateDataTypeFromNode(node->firstChild, &source, implicitNamespace);
1555
1556 if( numErrors > 0 || numWarnings > 0 )
1557 return asINVALID_DECLARATION;
1558
1559 return 0;
1560}
1561
1562// TODO: This should use SymbolLookupMember, which should be available in the TypeInfo class
1563int asCBuilder::CheckNameConflictMember(asCTypeInfo *t, const char *name, asCScriptNode *node, asCScriptCode *code, bool isProperty, bool isVirtualProperty)

Callers 2

Calls 4

SetCodeMethod · 0.80
GetScriptNodeMethod · 0.80
AssignMethod · 0.80

Tested by

no test coverage detected