| 2207 | } |
| 2208 | |
| 2209 | ASTNode* NewStructMember( ParserState& state, Symbol* sourceSymbol ) |
| 2210 | { |
| 2211 | auto symbol = state.GetSymbolTable().AddSymbol( state.AllocateNameWithPrefix( sourceSymbol->name ) ); |
| 2212 | auto nameDecl = state.NewNode( NT_NAME_DECLARATION ); |
| 2213 | symbol->definition = nameDecl; |
| 2214 | symbol->type = sourceSymbol->type; |
| 2215 | symbol->interpolationModifier = sourceSymbol->interpolationModifier; |
| 2216 | symbol->semantic = sourceSymbol->semantic; |
| 2217 | nameDecl->SetSymbol( symbol ); |
| 2218 | nameDecl->SetType( sourceSymbol->type ); |
| 2219 | |
| 2220 | auto member = state.NewNode( NT_STRUCT_MEMBER ); |
| 2221 | member->AddChild( nameDecl ); |
| 2222 | member->SetType( sourceSymbol->type ); |
| 2223 | return member; |
| 2224 | } |
| 2225 | |
| 2226 | // Collects fields from nested structures and copies them int a flat structure |
| 2227 | // In the process gathers access expressions for source struct fields (in the form blah.foo.bar...) |