MCPcopy Create free account
hub / github.com/carbonengine/trinity / AddStructDotPrefix

Function AddStructDotPrefix

shadercompiler/EffectCompilerMetal.cpp:203–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void AddStructDotPrefix( ASTNode* node, const std::set<Symbol*>& structMembers, Symbol* symbol )
204{
205 for( size_t i = 0, n = node->GetChildrenCount(); i < n; ++i )
206 {
207 ASTNode* childNode = node->GetChild( i );
208 if( !childNode )
209 {
210 continue;
211 }
212
213 if( childNode->GetNodeType() == NT_VAR_IDENTIFIER )
214 {
215 auto it = structMembers.find( childNode->GetSymbol() );
216 if( it != structMembers.end() )
217 {
218 ScannerToken token = {};
219 token.type = OP_DOT;
220
221 ASTNode* prefix = new ASTNode( NT_VAR_IDENTIFIER, childNode->GetLocation(), childNode->GetScope(), nullptr );
222 prefix->SetSymbol( symbol );
223
224 ASTNode* dotNode = new ASTNode( NT_POSTFIX_EXPRESSION, childNode->GetLocation(), childNode->GetScope(), &token );
225 dotNode->AddChild( prefix );
226 dotNode->AddChild( childNode );
227 dotNode->SetType( childNode->GetType() );
228
229 node->ReplaceChild( i, dotNode );
230 }
231 }
232
233 AddStructDotPrefix( childNode, structMembers, symbol );
234 }
235}
236
237void AddFunctionArgument( ASTNode* parent, const Symbol* functionSymbol, Symbol* arg )
238{

Callers 1

PatchGlobalsInFunctionsFunction · 0.85

Calls 11

GetChildrenCountMethod · 0.80
GetNodeTypeMethod · 0.80
GetSymbolMethod · 0.80
GetScopeMethod · 0.80
SetSymbolMethod · 0.80
AddChildMethod · 0.80
ReplaceChildMethod · 0.80
GetChildMethod · 0.45
endMethod · 0.45
SetTypeMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected