MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / walk_variant

Method walk_variant

src/simulate/data_walker.cpp:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 }
82
83 void DataWalker::walk_variant ( char * ps, TypeInfo * ti ) {
84 if ( canVisitVariant(ps,ti) ) {
85 beforeVariant(ps, ti);
86 if ( cancel() ) return;
87 if (ti->argCount != 0) {
88 int32_t fidx = *((int32_t *)ps);
89 DAS_ASSERTF(uint32_t(fidx)<ti->argCount,"invalid variant index");
90 int fieldOffset = getTypeBaseSize(Type::tInt);
91 TypeInfo * vi = ti->argTypes[fidx];
92 auto fa = getTypeAlign(ti) - 1;
93 fieldOffset = (fieldOffset + fa) & ~fa;
94 char * pf = ps + fieldOffset;
95 if ( cancel() ) return;
96 walk(pf, vi);
97 if ( cancel() ) return;
98 }
99 afterVariant(ps, ti);
100 }
101 }
102
103 void DataWalker::walk_array ( char * pa, uint32_t stride, uint64_t count, TypeInfo * ti ) {
104 if ( !canVisitArrayData(ti,count) ) return;

Callers

nothing calls this directly

Calls 7

canVisitVariantFunction · 0.85
beforeVariantFunction · 0.85
cancelFunction · 0.85
getTypeBaseSizeFunction · 0.85
getTypeAlignFunction · 0.85
walkFunction · 0.85
afterVariantFunction · 0.85

Tested by

no test coverage detected