• R/O
  • SSH
  • HTTPS

eircompile: Commit


Commit MetaInfo

Revisión98 (tree)
Tiempo2022-04-20 02:33:28
Autorquiret

Log Message

- fixed the sub-graph notification on edge removal or replacement upon connected node movement or destruction using the new Eir SDK feature "eir::containNotify(Add-)RemoveTie"

Cambiar Resumen

Diferencia incremental

--- commonlangs/include/commonlangs/cos.h (revision 97)
+++ commonlangs/include/commonlangs/cos.h (revision 98)
@@ -341,6 +341,7 @@
341341 return false;
342342 }
343343
344+protected:
344345 // Reachability node replacement.
345346 virtual void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept
346347 {
@@ -348,6 +349,7 @@
348349 return;
349350 }
350351
352+public:
351353 // Reference counting for runtime keep-alive.
352354 inline void AddStackRef( void ) noexcept
353355 {
@@ -600,19 +602,27 @@
600602 return statements.Find( n );
601603 }
602604
605+protected:
603606 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
604607 {
605608 if ( with == nullptr )
606609 {
607- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, statements );
610+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
611+ eir::containNotifyRemoveTie( statements, std::bind( &Program::OnRemoveStatement, this, std::placeholders::_1 ) )
612+ );
608613 }
609614 else
610615 {
611- eir::replaceInContainer <COSNode*> ( what, with, statements );
616+ eir::replaceInContainer <COSNode*> ( what, with,
617+ eir::containNotifyAddRemoveTie(
618+ statements,
619+ std::bind( &Program::OnAddStatement, this, std::placeholders::_1 ),
620+ std::bind( &Program::OnRemoveStatement, this, std::placeholders::_1 )
621+ )
622+ );
612623 }
613624 }
614625
615-protected:
616626 cosCommonVector <COSNode*> statements;
617627 public:
618628 inline void AddStatement( COSNode *node )
@@ -698,15 +708,22 @@
698708 return ( n == this->op );
699709 }
700710
711+protected:
701712 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
702713 {
703714 if ( this->op == what )
704715 {
716+ this->OnUnsetOperation( what );
717+
705718 this->op = with;
719+
720+ if ( with != nullptr )
721+ {
722+ this->OnSetOperation( with );
723+ }
706724 }
707725 }
708726
709-protected:
710727 COSNode *op;
711728 public:
712729 inline void SetOperation( COSNode *op )
@@ -808,19 +825,33 @@
808825 return ( n == this->left || n == this->right );
809826 }
810827
828+protected:
811829 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
812830 {
813831 if ( this->left == what )
814832 {
833+ this->OnUnsetLeft( what );
834+
815835 this->left = with;
836+
837+ if ( with != nullptr )
838+ {
839+ this->OnSetLeft( with );
840+ }
816841 }
817842 if ( this->right == what )
818843 {
844+ this->OnUnsetRight( what );
845+
819846 this->right = with;
847+
848+ if ( with != nullptr )
849+ {
850+ this->OnSetRight( with );
851+ }
820852 }
821853 }
822854
823-protected:
824855 COSNode *left;
825856 COSNode *right;
826857 public:
@@ -1039,19 +1070,33 @@
10391070 return eir::isInContainer( n, what, params );
10401071 }
10411072
1073+protected:
10421074 void ReplaceConnection_Reach( COSNode *rwhat, COSNode *rwith ) noexcept final override
10431075 {
10441076 if ( rwith == nullptr )
10451077 {
1046- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( rwhat, what, params );
1078+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( rwhat,
1079+ eir::containNotifyRemoveTie( what, std::bind( &FunctionCallOperation::OnUnsetNode, this, std::placeholders::_1 ) ),
1080+ eir::containNotifyRemoveTie( params, std::bind( &FunctionCallOperation::OnRemoveParam, this, std::placeholders::_1 ) )
1081+ );
10471082 }
10481083 else
10491084 {
1050- eir::replaceInContainer <COSNode*> ( rwhat, rwith, what, params );
1085+ eir::replaceInContainer <COSNode*> ( rwhat, rwith,
1086+ eir::containNotifyAddRemoveTie(
1087+ what,
1088+ std::bind( &FunctionCallOperation::OnSetNode, this, std::placeholders::_1 ),
1089+ std::bind( &FunctionCallOperation::OnUnsetNode, this, std::placeholders::_1 )
1090+ ),
1091+ eir::containNotifyAddRemoveTie(
1092+ params,
1093+ std::bind( &FunctionCallOperation::OnAddParam, this, std::placeholders::_1 ),
1094+ std::bind( &FunctionCallOperation::OnRemoveParam, this, std::placeholders::_1 )
1095+ )
1096+ );
10511097 }
10521098 }
10531099
1054-protected:
10551100 COSNode *what;
10561101 cosCommonVector <COSNode*> params;
10571102 public:
@@ -1149,19 +1194,45 @@
11491194 return eir::isInContainer( n, what, items );
11501195 }
11511196
1197+protected:
11521198 void ReplaceConnection_Reach( COSNode *rwhat, COSNode *rwith ) noexcept final override
11531199 {
1200+ // TODO: solve this edge-update-notification template more beautifully, by allowing the eir::replaceInContainer
1201+ // and eir::removeFromContainer functions to call these functions on-demand if we pass a special (container, on-set, on-unset)
1202+ // tuple to either.
1203+
11541204 if ( rwith == nullptr )
11551205 {
1156- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( rwhat, what, items );
1206+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( rwhat,
1207+ eir::containNotifyAddRemoveTie(
1208+ what,
1209+ std::bind( &ArrayInitOperation::OnSetNode, this, std::placeholders::_1 ),
1210+ std::bind( &ArrayInitOperation::OnUnsetNode, this, std::placeholders::_1 )
1211+ ),
1212+ eir::containNotifyAddRemoveTie(
1213+ items,
1214+ std::bind( &ArrayInitOperation::OnAddItem, this, std::placeholders::_1 ),
1215+ std::bind( &ArrayInitOperation::OnRemoveItem, this, std::placeholders::_1 )
1216+ )
1217+ );
11571218 }
11581219 else
11591220 {
1160- eir::replaceInContainer <COSNode*> ( rwhat, rwith, what, items );
1221+ eir::replaceInContainer <COSNode*> ( rwhat, rwith,
1222+ eir::containNotifyAddRemoveTie(
1223+ what,
1224+ std::bind( &ArrayInitOperation::OnSetNode, this, std::placeholders::_1 ),
1225+ std::bind( &ArrayInitOperation::OnUnsetNode, this, std::placeholders::_1 )
1226+ ),
1227+ eir::containNotifyAddRemoveTie(
1228+ items,
1229+ std::bind( &ArrayInitOperation::OnAddItem, this, std::placeholders::_1 ),
1230+ std::bind( &ArrayInitOperation::OnRemoveItem, this, std::placeholders::_1 )
1231+ )
1232+ );
11611233 }
11621234 }
11631235
1164-protected:
11651236 COSNode *what;
11661237 cosCommonVector <COSNode*> items;
11671238 public:
@@ -1260,19 +1331,33 @@
12601331 return eir::isInContainer( n, type, params );
12611332 }
12621333
1334+protected:
12631335 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
12641336 {
12651337 if ( with == nullptr )
12661338 {
1267- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, type, params );
1339+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
1340+ eir::containNotifyRemoveTie( type, std::bind( &NewOperation::OnUnsetType, this, std::placeholders::_1 ) ),
1341+ eir::containNotifyRemoveTie( params, std::bind( &NewOperation::OnRemoveParam, this, std::placeholders::_1 ) )
1342+ );
12681343 }
12691344 else
12701345 {
1271- eir::replaceInContainer <COSNode*> ( what, with, type, params );
1346+ eir::replaceInContainer <COSNode*> ( what, with,
1347+ eir::containNotifyAddRemoveTie(
1348+ type,
1349+ std::bind( &NewOperation::OnSetType, this, std::placeholders::_1 ),
1350+ std::bind( &NewOperation::OnUnsetType, this, std::placeholders::_1 )
1351+ ),
1352+ eir::containNotifyAddRemoveTie(
1353+ params,
1354+ std::bind( &NewOperation::OnAddParam, this, std::placeholders::_1 ),
1355+ std::bind( &NewOperation::OnRemoveParam, this, std::placeholders::_1 )
1356+ )
1357+ );
12721358 }
12731359 }
12741360
1275-protected:
12761361 COSNode *type;
12771362 cosCommonVector <COSNode*> params;
12781363 public:
@@ -1371,19 +1456,33 @@
13711456 return eir::isInContainer( n, what, with );
13721457 }
13731458
1459+protected:
13741460 void ReplaceConnection_Reach( COSNode *rwhat, COSNode *rwith ) noexcept final override
13751461 {
13761462 if ( this->what == rwhat )
13771463 {
1464+ this->OnUnsetWhat( rwhat );
1465+
13781466 this->what = rwith;
1467+
1468+ if ( rwith != nullptr )
1469+ {
1470+ this->OnSetWhat( rwith );
1471+ }
13791472 }
13801473 if ( this->with == rwhat )
13811474 {
1475+ this->OnUnsetWith( rwhat );
1476+
13821477 this->with = rwith;
1478+
1479+ if ( rwith != nullptr )
1480+ {
1481+ this->OnSetWith( rwith );
1482+ }
13831483 }
13841484 }
13851485
1386-protected:
13871486 COSNode *what;
13881487 COSNode *with;
13891488 public:
@@ -1467,19 +1566,33 @@
14671566 return eir::isInContainer( n, totype, castobj );
14681567 }
14691568
1569+protected:
14701570 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
14711571 {
14721572 if ( this->totype == what )
14731573 {
1574+ this->OnUnsetToType( what );
1575+
14741576 this->totype = with;
1577+
1578+ if ( with != nullptr )
1579+ {
1580+ this->OnSetToType( with );
1581+ }
14751582 }
14761583 if ( this->castobj == what )
14771584 {
1585+ this->OnUnsetCastObject( what );
1586+
14781587 this->castobj = with;
1588+
1589+ if ( with != nullptr )
1590+ {
1591+ this->OnSetCastObject( with );
1592+ }
14791593 }
14801594 }
14811595
1482-protected:
14831596 COSNode *totype;
14841597 COSNode *castobj;
14851598 public:
@@ -1559,19 +1672,33 @@
15591672 return eir::isInContainer( n, templ, tparams );
15601673 }
15611674
1675+protected:
15621676 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
15631677 {
15641678 if ( with == nullptr )
15651679 {
1566- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, templ, tparams );
1680+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
1681+ eir::containNotifyRemoveTie( templ, std::bind( &TemplateInstantiationOperation::OnUnsetTemplate, this, std::placeholders::_1 ) ),
1682+ eir::containNotifyRemoveTie( tparams, std::bind( &TemplateInstantiationOperation::OnRemoveParam, this, std::placeholders::_1 ) )
1683+ );
15671684 }
15681685 else
15691686 {
1570- eir::replaceInContainer <COSNode*> ( what, with, templ, tparams );
1687+ eir::replaceInContainer <COSNode*> ( what, with,
1688+ eir::containNotifyAddRemoveTie(
1689+ templ,
1690+ std::bind( &TemplateInstantiationOperation::OnSetTemplate, this, std::placeholders::_1 ),
1691+ std::bind( &TemplateInstantiationOperation::OnUnsetTemplate, this, std::placeholders::_1 )
1692+ ),
1693+ eir::containNotifyAddRemoveTie(
1694+ tparams,
1695+ std::bind( &TemplateInstantiationOperation::OnAddParam, this, std::placeholders::_1 ),
1696+ std::bind( &TemplateInstantiationOperation::OnRemoveParam, this, std::placeholders::_1 )
1697+ )
1698+ );
15711699 }
15721700 }
15731701
1574-protected:
15751702 COSNode *templ;
15761703 cosCommonVector <COSNode*> tparams;
15771704 public:
@@ -1673,23 +1800,44 @@
16731800 return eir::isInContainer( n, condition, true_branch, false_branch );
16741801 }
16751802
1803+protected:
16761804 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
16771805 {
16781806 if ( this->condition == what )
16791807 {
1808+ this->OnUnsetCondition( what );
1809+
16801810 this->condition = with;
1811+
1812+ if ( with != nullptr )
1813+ {
1814+ this->OnSetCondition( with );
1815+ }
16811816 }
16821817 if ( this->true_branch == what )
16831818 {
1819+ this->OnUnsetTrueBranch( what );
1820+
16841821 this->true_branch = with;
1822+
1823+ if ( with != nullptr )
1824+ {
1825+ this->OnSetTrueBranch( with );
1826+ }
16851827 }
16861828 if ( this->false_branch == what )
16871829 {
1830+ this->OnUnsetFalseBranch( what );
1831+
16881832 this->false_branch = with;
1833+
1834+ if ( with != nullptr )
1835+ {
1836+ this->OnSetFalseBranch( with );
1837+ }
16891838 }
16901839 }
16911840
1692-protected:
16931841 COSNode *condition;
16941842 COSNode *true_branch;
16951843 COSNode *false_branch;
@@ -1788,19 +1936,33 @@
17881936 return eir::isInContainer( n, condition, exec );
17891937 }
17901938
1939+protected:
17911940 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
17921941 {
17931942 if ( this->condition == what )
17941943 {
1944+ this->OnUnsetCondition( what );
1945+
17951946 this->condition = with;
1947+
1948+ if ( with != nullptr )
1949+ {
1950+ this->OnSetCondition( with );
1951+ }
17961952 }
17971953 if ( this->exec == what )
17981954 {
1955+ this->OnUnsetExec( what );
1956+
17991957 this->exec = with;
1958+
1959+ if ( with != nullptr )
1960+ {
1961+ this->OnSetExec( with );
1962+ }
18001963 }
18011964 }
18021965
1803-protected:
18041966 COSNode *condition;
18051967 COSNode *exec;
18061968 public:
@@ -1884,27 +2046,55 @@
18842046 return eir::isInContainer( n, init, condition, iteration, exec );
18852047 }
18862048
2049+protected:
18872050 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
18882051 {
18892052 if ( this->init == what )
18902053 {
2054+ this->OnUnsetInit( what );
2055+
18912056 this->init = with;
2057+
2058+ if ( with != nullptr )
2059+ {
2060+ this->OnSetInit( with );
2061+ }
18922062 }
18932063 if ( this->condition == what )
18942064 {
2065+ this->OnUnsetCondition( what );
2066+
18952067 this->condition = with;
2068+
2069+ if ( with != nullptr )
2070+ {
2071+ this->OnSetCondition( with );
2072+ }
18962073 }
18972074 if ( this->iteration == what )
18982075 {
2076+ this->OnUnsetIteration( what );
2077+
18992078 this->iteration = with;
2079+
2080+ if ( with != nullptr )
2081+ {
2082+ this->OnSetIteration( with );
2083+ }
19002084 }
19012085 if ( this->exec == what )
19022086 {
2087+ this->OnUnsetExec( what );
2088+
19032089 this->exec = with;
2090+
2091+ if ( with != nullptr )
2092+ {
2093+ this->OnSetExec( with );
2094+ }
19042095 }
19052096 }
19062097
1907-protected:
19082098 COSNode *init;
19092099 COSNode *condition;
19102100 COSNode *iteration;
@@ -2033,15 +2223,22 @@
20332223 return ( n == this->op );
20342224 }
20352225
2226+protected:
20362227 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
20372228 {
20382229 if ( this->op == what )
20392230 {
2231+ this->OnUnsetNode( what );
2232+
20402233 this->op = with;
2234+
2235+ if ( with != nullptr )
2236+ {
2237+ this->OnSetNode( with );
2238+ }
20412239 }
20422240 }
20432241
2044-protected:
20452242 COSNode *op;
20462243 public:
20472244 inline void SetNode( COSNode *newop )
@@ -2109,23 +2306,44 @@
21092306 return eir::isInContainer( n, name, type, initializer );
21102307 }
21112308
2309+protected:
21122310 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
21132311 {
21142312 if ( this->name == what )
21152313 {
2314+ this->OnUnsetName( what );
2315+
21162316 this->name = with;
2317+
2318+ if ( with != nullptr )
2319+ {
2320+ this->OnSetName( with );
2321+ }
21172322 }
21182323 if ( this->type == what )
21192324 {
2325+ this->OnUnsetType( what );
2326+
21202327 this->type = with;
2328+
2329+ if ( with != nullptr )
2330+ {
2331+ this->OnSetType( with );
2332+ }
21212333 }
21222334 if ( this->initializer == what )
21232335 {
2336+ this->OnUnsetInitializer( what );
2337+
21242338 this->initializer = with;
2339+
2340+ if ( with != nullptr )
2341+ {
2342+ this->OnSetInitializer( with );
2343+ }
21252344 }
21262345 }
21272346
2128-protected:
21292347 COSNode *name;
21302348 COSNode *type;
21312349 COSNode *initializer;
@@ -2219,22 +2437,30 @@
22192437 return eir::isInContainer( n, decls );
22202438 }
22212439
2440+protected:
22222441 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
22232442 {
22242443 if ( with == nullptr )
22252444 {
2226- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, decls );
2445+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
2446+ eir::containNotifyRemoveTie( decls, std::bind( &MultiDeclarationStatement::OnRemoveDeclaration, this, std::placeholders::_1 ) )
2447+ );
22272448 }
22282449 else
22292450 {
22302451 if ( DeclarationStatement *decl_with = dynamic_cast <DeclarationStatement*> ( with ) )
22312452 {
2232- eir::replaceInContainer <COSNode*> ( what, decl_with, decls );
2453+ eir::replaceInContainer <COSNode*> ( what, decl_with,
2454+ eir::containNotifyAddRemoveTie(
2455+ decls,
2456+ std::bind( &MultiDeclarationStatement::OnAddDeclaration, this, std::placeholders::_1 ),
2457+ std::bind( &MultiDeclarationStatement::OnRemoveDeclaration, this, std::placeholders::_1 )
2458+ )
2459+ );
22332460 }
22342461 }
22352462 }
22362463
2237-protected:
22382464 cosCommonVector <DeclarationStatement*> decls;
22392465 public:
22402466 inline void AddDeclaration( DeclarationStatement *newdecl )
@@ -2314,19 +2540,33 @@
23142540 return eir::isInContainer( n, srctype, dsttype );
23152541 }
23162542
2543+protected:
23172544 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
23182545 {
23192546 if ( this->srctype == what )
23202547 {
2548+ this->OnUnsetSrcType( what );
2549+
23212550 this->srctype = with;
2551+
2552+ if ( with != nullptr )
2553+ {
2554+ this->OnSetSrcType( with );
2555+ }
23222556 }
23232557 if ( this->dsttype == what )
23242558 {
2559+ this->OnUnsetDstType( what );
2560+
23252561 this->dsttype = with;
2562+
2563+ if ( with != nullptr )
2564+ {
2565+ this->OnSetDstType( with );
2566+ }
23262567 }
23272568 }
23282569
2329-protected:
23302570 COSNode *srctype;
23312571 COSNode *dsttype;
23322572 public:
@@ -2398,22 +2638,30 @@
23982638 return eir::isInContainer( n, defs );
23992639 }
24002640
2641+protected:
24012642 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
24022643 {
24032644 if ( with == nullptr )
24042645 {
2405- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, defs );
2646+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
2647+ eir::containNotifyRemoveTie( defs, std::bind( &MultiTypedefStatement::OnRemoveTypedef, this, std::placeholders::_1 ) )
2648+ );
24062649 }
24072650 else
24082651 {
24092652 if ( TypedefStatement *tdef_with = dynamic_cast <TypedefStatement*> ( with ) )
24102653 {
2411- eir::replaceInContainer <COSNode*> ( what, tdef_with, defs );
2654+ eir::replaceInContainer <COSNode*> ( what, tdef_with,
2655+ eir::containNotifyAddRemoveTie(
2656+ defs,
2657+ std::bind( &MultiTypedefStatement::OnAddTypedef, this, std::placeholders::_1 ),
2658+ std::bind( &MultiTypedefStatement::OnRemoveTypedef, this, std::placeholders::_1 )
2659+ )
2660+ );
24122661 }
24132662 }
24142663 }
24152664
2416-protected:
24172665 cosCommonVector <TypedefStatement*> defs;
24182666 public:
24192667 inline void AddTypedef( TypedefStatement *newtypedef )
@@ -2486,19 +2734,27 @@
24862734 return eir::isInContainer( n, statements );
24872735 }
24882736
2737+protected:
24892738 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
24902739 {
24912740 if ( with == nullptr )
24922741 {
2493- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, statements );
2742+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
2743+ eir::containNotifyRemoveTie( statements, std::bind( &BlockStatement::OnRemoveStatement, this, std::placeholders::_1 ) )
2744+ );
24942745 }
24952746 else
24962747 {
2497- eir::replaceInContainer <COSNode*> ( what, with, statements );
2748+ eir::replaceInContainer <COSNode*> ( what, with,
2749+ eir::containNotifyAddRemoveTie(
2750+ statements,
2751+ std::bind( &BlockStatement::OnAddStatement, this, std::placeholders::_1 ),
2752+ std::bind( &BlockStatement::OnRemoveStatement, this, std::placeholders::_1 )
2753+ )
2754+ );
24982755 }
24992756 }
25002757
2501-protected:
25022758 cosCommonVector <COSNode*> statements;
25032759 public:
25042760 inline void AddStatement( COSNode *stmt )
@@ -2579,15 +2835,22 @@
25792835 return ( n == this->op );
25802836 }
25812837
2838+protected:
25822839 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
25832840 {
25842841 if ( this->op == what )
25852842 {
2843+ this->OnUnsetNode( what );
2844+
25862845 this->op = with;
2846+
2847+ if ( with != nullptr )
2848+ {
2849+ this->OnSetNode( with );
2850+ }
25872851 }
25882852 }
25892853
2590-protected:
25912854 COSNode *op;
25922855 public:
25932856 inline void SetNode( COSNode *newop )
@@ -2645,19 +2908,33 @@
26452908 return eir::isInContainer( n, caught_decl, catch_body );
26462909 }
26472910
2911+protected:
26482912 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
26492913 {
26502914 if ( this->caught_decl == what )
26512915 {
2916+ this->OnUnsetCaughtDecl( what );
2917+
26522918 this->caught_decl = with;
2919+
2920+ if ( with != nullptr )
2921+ {
2922+ this->OnSetCaughtDecl( with );
2923+ }
26532924 }
26542925 if ( this->catch_body == what )
26552926 {
2927+ this->OnUnsetCatchBody( what );
2928+
26562929 this->catch_body = with;
2930+
2931+ if ( with != nullptr )
2932+ {
2933+ this->OnSetCatchBody( with );
2934+ }
26572935 }
26582936 }
26592937
2660-protected:
26612938 COSNode *caught_decl;
26622939 COSNode *catch_body;
26632940 public:
@@ -2735,27 +3012,40 @@
27353012 return eir::isInContainer( n, try_body, errors );
27363013 }
27373014
3015+protected:
27383016 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
27393017 {
27403018 if ( with == nullptr )
27413019 {
2742- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, try_body, errors );
3020+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
3021+ eir::containNotifyRemoveTie( try_body, std::bind( &TryStatement::OnUnsetTryBody, this, std::placeholders::_1 ) ),
3022+ eir::containNotifyRemoveTie( errors, std::bind( &TryStatement::OnRemoveError, this, std::placeholders::_1 ) )
3023+ );
27433024 }
27443025 else
27453026 {
27463027 if ( CatchStatement *catch_with = dynamic_cast <CatchStatement*> ( with ) )
27473028 {
2748- eir::replaceInContainer <COSNode*> ( what, catch_with, errors );
3029+ eir::replaceInContainer <COSNode*> ( what, catch_with,
3030+ eir::containNotifyAddRemoveTie(
3031+ errors,
3032+ std::bind( &TryStatement::OnAddError, this, std::placeholders::_1 ),
3033+ std::bind( &TryStatement::OnRemoveError, this, std::placeholders::_1 )
3034+ )
3035+ );
27493036 }
27503037
27513038 if ( this->try_body == what )
27523039 {
3040+ this->OnUnsetTryBody( what );
3041+
27533042 this->try_body = with;
3043+
3044+ this->OnSetTryBody( with );
27543045 }
27553046 }
27563047 }
27573048
2758-protected:
27593049 COSNode *try_body;
27603050 cosCommonVector <CatchStatement*> errors;
27613051 public:
@@ -2855,19 +3145,33 @@
28553145 return eir::isInContainer( n, name, body );
28563146 }
28573147
3148+protected:
28583149 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
28593150 {
28603151 if ( this->name == what )
28613152 {
3153+ this->OnUnsetName( what );
3154+
28623155 this->name = with;
3156+
3157+ if ( with != nullptr )
3158+ {
3159+ this->OnSetName( with );
3160+ }
28633161 }
28643162 if ( this->body == what )
28653163 {
3164+ this->OnUnsetBody( what );
3165+
28663166 this->body = with;
3167+
3168+ if ( with != nullptr )
3169+ {
3170+ this->OnSetBody( with );
3171+ }
28673172 }
28683173 }
28693174
2870-protected:
28713175 COSNode *name;
28723176 COSNode *body;
28733177 public:
@@ -2945,19 +3249,33 @@
29453249 return eir::isInContainer( n, params, body );
29463250 }
29473251
3252+protected:
29483253 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
29493254 {
29503255 if ( with == nullptr )
29513256 {
2952- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, params, body );
3257+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
3258+ eir::containNotifyRemoveTie( params, std::bind( &ConstructorDefinition::OnRemoveParam, this, std::placeholders::_1 ) ),
3259+ eir::containNotifyRemoveTie( body, std::bind( &ConstructorDefinition::OnUnsetBody, this, std::placeholders::_1 ) )
3260+ );
29533261 }
29543262 else
29553263 {
2956- eir::replaceInContainer <COSNode*> ( what, with, params, body );
3264+ eir::replaceInContainer <COSNode*> ( what, with,
3265+ eir::containNotifyAddRemoveTie(
3266+ params,
3267+ std::bind( &ConstructorDefinition::OnAddParam, this, std::placeholders::_1 ),
3268+ std::bind( &ConstructorDefinition::OnRemoveParam, this, std::placeholders::_1 )
3269+ ),
3270+ eir::containNotifyAddRemoveTie(
3271+ body,
3272+ std::bind( &ConstructorDefinition::OnSetBody, this, std::placeholders::_1 ),
3273+ std::bind( &ConstructorDefinition::OnUnsetBody, this, std::placeholders::_1 )
3274+ )
3275+ );
29573276 }
29583277 }
29593278
2960-protected:
29613279 cosCommonVector <COSNode*> params;
29623280 COSNode *body;
29633281 public:
@@ -3058,15 +3376,22 @@
30583376 return ( n == this->body );
30593377 }
30603378
3379+protected:
30613380 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
30623381 {
30633382 if ( this->body == what )
30643383 {
3384+ this->OnUnsetBody( what );
3385+
30653386 this->body = with;
3387+
3388+ if ( with != nullptr )
3389+ {
3390+ this->OnSetBody( with );
3391+ }
30663392 }
30673393 }
30683394
3069-protected:
30703395 COSNode *body;
30713396 public:
30723397 inline void SetBody( COSNode *newbody )
@@ -3324,15 +3649,22 @@
33243649 return ( n == this->spec );
33253650 }
33263651
3652+protected:
33273653 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept override
33283654 {
33293655 if ( this->spec == what )
33303656 {
3657+ this->OnUnsetSpec( what );
3658+
33313659 this->spec = with;
3660+
3661+ if ( with != nullptr )
3662+ {
3663+ this->OnSetSpec( with );
3664+ }
33323665 }
33333666 }
33343667
3335-protected:
33363668 COSNode *spec;
33373669 public:
33383670 inline void SetSpec( COSNode *newspec )
@@ -3396,6 +3728,7 @@
33963728 return TypeSpecifier::IsNodeConnectedTo_Reach( n ) || ( this->array_size_op == n );
33973729 }
33983730
3731+protected:
33993732 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
34003733 {
34013734 TypeSpecifier::ReplaceConnection_Reach( what, with );
@@ -3402,11 +3735,17 @@
34023735
34033736 if ( this->array_size_op == what )
34043737 {
3738+ this->OnUnsetArraySizeOp( what );
3739+
34053740 this->array_size_op = with;
3741+
3742+ if ( with != nullptr )
3743+ {
3744+ this->OnSetArraySizeOp( with );
3745+ }
34063746 }
34073747 }
34083748
3409-protected:
34103749 COSNode *array_size_op;
34113750 public:
34123751 inline void SetArraySizeOp( COSNode *newsizeop )
@@ -3457,19 +3796,27 @@
34573796 return eir::isInContainer( n, params );
34583797 }
34593798
3799+protected:
34603800 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
34613801 {
34623802 if ( with == nullptr )
34633803 {
3464- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, params );
3804+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
3805+ eir::containNotifyRemoveTie( params, std::bind( &CurlyPack::OnRemoveParam, this, std::placeholders::_1 ) )
3806+ );
34653807 }
34663808 else
34673809 {
3468- eir::replaceInContainer <COSNode*> ( what, with, params );
3810+ eir::replaceInContainer <COSNode*> ( what, with,
3811+ eir::containNotifyAddRemoveTie(
3812+ params,
3813+ std::bind( &CurlyPack::OnAddParam, this, std::placeholders::_1 ),
3814+ std::bind( &CurlyPack::OnRemoveParam, this, std::placeholders::_1 )
3815+ )
3816+ );
34693817 }
34703818 }
34713819
3472-protected:
34733820 cosCommonVector <COSNode*> params;
34743821 public:
34753822 inline void AddParam( COSNode *newparam )
@@ -3542,19 +3889,30 @@
35423889 return eir::isInContainer( n, items );
35433890 }
35443891
3892+protected:
35453893 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
35463894 {
35473895 if ( with == nullptr )
35483896 {
3549- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, items );
3897+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
3898+ eir::containNotifyRemoveTie(
3899+ items,
3900+ std::bind( &ArrayDefinition::OnRemoveItem, this, std::placeholders::_1 )
3901+ )
3902+ );
35503903 }
35513904 else
35523905 {
3553- eir::replaceInContainer <COSNode*> ( what, with, items );
3906+ eir::replaceInContainer <COSNode*> ( what, with,
3907+ eir::containNotifyAddRemoveTie(
3908+ items,
3909+ std::bind( &ArrayDefinition::OnAddItem, this, std::placeholders::_1 ),
3910+ std::bind( &ArrayDefinition::OnRemoveItem, this, std::placeholders::_1 )
3911+ )
3912+ );
35543913 }
35553914 }
35563915
3557-protected:
35583916 cosCommonVector <COSNode*> items;
35593917 public:
35603918 inline void AddItem( COSNode *newitem )
@@ -3644,19 +4002,33 @@
36444002 return eir::isInContainer( n, return_type, params );
36454003 }
36464004
4005+protected:
36474006 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
36484007 {
36494008 if ( with == nullptr )
36504009 {
3651- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, return_type, params );
4010+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
4011+ eir::containNotifyRemoveTie( return_type, std::bind( &FuncsigDefinition::OnUnsetReturnType, this, std::placeholders::_1 ) ),
4012+ eir::containNotifyRemoveTie( params, std::bind( &FuncsigDefinition::OnRemoveParam, this, std::placeholders::_1 ) )
4013+ );
36524014 }
36534015 else
36544016 {
3655- eir::replaceInContainer <COSNode*> ( what, with, return_type, params );
4017+ eir::replaceInContainer <COSNode*> ( what, with,
4018+ eir::containNotifyAddRemoveTie(
4019+ return_type,
4020+ std::bind( &FuncsigDefinition::OnSetReturnType, this, std::placeholders::_1 ),
4021+ std::bind( &FuncsigDefinition::OnUnsetReturnType, this, std::placeholders::_1 )
4022+ ),
4023+ eir::containNotifyAddRemoveTie(
4024+ params,
4025+ std::bind( &FuncsigDefinition::OnAddParam, this, std::placeholders::_1 ),
4026+ std::bind( &FuncsigDefinition::OnRemoveParam, this, std::placeholders::_1 )
4027+ )
4028+ );
36564029 }
36574030 }
36584031
3659-protected:
36604032 COSNode *return_type;
36614033 cosCommonVector <COSNode*> params;
36624034 public:
@@ -3756,19 +4128,33 @@
37564128 return eir::isInContainer( n, name, toinclude );
37574129 }
37584130
4131+protected:
37594132 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
37604133 {
37614134 if ( this->name == what )
37624135 {
4136+ this->OnUnsetName( what );
4137+
37634138 this->name = with;
4139+
4140+ if ( with != nullptr )
4141+ {
4142+ this->OnSetName( with );
4143+ }
37644144 }
37654145 if ( this->toinclude == what )
37664146 {
4147+ this->OnUnsetToInclude( what );
4148+
37674149 this->toinclude = with;
4150+
4151+ if ( with != nullptr )
4152+ {
4153+ this->OnSetToInclude( with );
4154+ }
37684155 }
37694156 }
37704157
3771-protected:
37724158 COSNode *name;
37734159 COSNode *toinclude;
37744160 public:
@@ -3848,15 +4234,22 @@
38484234 return ( n == this->nsname );
38494235 }
38504236
4237+protected:
38514238 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
38524239 {
38534240 if ( this->nsname == what )
38544241 {
4242+ this->OnUnsetName( what );
4243+
38554244 this->nsname = with;
4245+
4246+ if ( with != nullptr )
4247+ {
4248+ this->OnSetName( with );
4249+ }
38564250 }
38574251 }
38584252
3859-protected:
38604253 COSNode *nsname;
38614254 public:
38624255 inline void SetName( COSNode *newnsname )
@@ -3947,15 +4340,30 @@
39474340 return eir::isInContainer( n, name, itemrefs );
39484341 }
39494342
4343+protected:
39504344 void ReplaceConnection_Reach( COSNode *what, COSNode *with ) noexcept final override
39514345 {
39524346 if ( with == nullptr )
39534347 {
3954- eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what, name, itemrefs );
4348+ eir::removeFromContainer <COSNode*, eir::eUniqueVectorRemovalPolicy::REPLACE_WITH_DEFAULT> ( what,
4349+ eir::containNotifyRemoveTie( name, std::bind( &EnumDefinition::OnUnsetName, this, std::placeholders::_1 ) ),
4350+ eir::containNotifyRemoveTie( itemrefs, std::bind( &EnumDefinition::OnRemoveItemNode, this, std::placeholders::_1 ) )
4351+ );
39554352 }
39564353 else
39574354 {
3958- eir::replaceInContainer <COSNode*> ( what, with, name, itemrefs );
4355+ eir::replaceInContainer <COSNode*> ( what, with,
4356+ eir::containNotifyAddRemoveTie(
4357+ name,
4358+ std::bind( &EnumDefinition::OnSetName, this, std::placeholders::_1 ),
4359+ std::bind( &EnumDefinition::OnUnsetName, this, std::placeholders::_1 )
4360+ ),
4361+ eir::containNotifyAddRemoveTie(
4362+ itemrefs,
4363+ std::bind( &EnumDefinition::OnAddItemNode, this, std::placeholders::_1 ),
4364+ std::bind( &EnumDefinition::OnRemoveItemNode, this, std::placeholders::_1 )
4365+ )
4366+ );
39594367 }
39604368
39614369 size_t idx = 0;
@@ -3985,7 +4393,6 @@
39854393 }
39864394 }
39874395
3988-protected:
39894396 COSNode *name;
39904397 cosCommonVector <item> items;
39914398
@@ -4023,7 +4430,14 @@
40234430
40244431 try
40254432 {
4026- this->OnAddItem( i );
4433+ if ( i.key )
4434+ {
4435+ this->OnAddItemNode( i.key );
4436+ }
4437+ if ( i.value )
4438+ {
4439+ this->OnAddItemNode( i.value );
4440+ }
40274441
40284442 COSObjects *sys = this->sys;
40294443
@@ -4069,11 +4483,11 @@
40694483 {
40704484 return;
40714485 }
4072- virtual void OnAddItem( const item& i )
4486+ virtual void OnAddItemNode( COSNode *n )
40734487 {
40744488 return;
40754489 }
4076- virtual void OnRemoveItem( const item& i )
4490+ virtual void OnRemoveItemNode( COSNode *n )
40774491 {
40784492 return;
40794493 }
Show on old repository browser