@@ -135,6 +135,7 @@ package ExpOrigin
135135 constant Type SUBEXPRESSION = intBitLShift(1 , 16 ); // Part of a larger expression.
136136 constant Type CONNECT = intBitLShift(1 , 17 ); // Part of connect argument.
137137 constant Type NOEVENT = intBitLShift(1 , 18 ); // Part of noEvent argument.
138+ constant Type ASSERT = intBitLShift(1 , 19 ); // Part of assert argument.
138139
139140 // Combined flags:
140141 constant Type EQ_SUBEXPRESSION = intBitOr(EQUATION , SUBEXPRESSION );
@@ -2402,9 +2403,11 @@ algorithm
24022403 case Equation . ASSERT ()
24032404 algorithm
24042405 info := ElementSource . getInfo(eq. source);
2405- e1 := typeOperatorArg(eq. condition, Type . BOOLEAN (), origin, "assert" , "condition" , 1 , info);
2406- e2 := typeOperatorArg(eq. message, Type . STRING (), origin, "assert" , "message" , 2 , info);
2407- e3 := typeOperatorArg(eq. level, NFBuiltin . ASSERTIONLEVEL_TYPE , origin, "assert" , "level" , 3 , info);
2406+ next_origin := ExpOrigin . setFlag(origin, ExpOrigin . ASSERT );
2407+ e1 := typeOperatorArg(eq. condition, Type . BOOLEAN (),
2408+ ExpOrigin . setFlag(next_origin, ExpOrigin . CONDITION ), "assert" , "condition" , 1 , info);
2409+ e2 := typeOperatorArg(eq. message, Type . STRING (), next_origin, "assert" , "message" , 2 , info);
2410+ e3 := typeOperatorArg(eq. level, NFBuiltin . ASSERTIONLEVEL_TYPE , next_origin, "assert" , "level" , 3 , info);
24082411 then
24092412 Equation . ASSERT (e1, e2, e3, eq. source);
24102413
@@ -2562,7 +2565,7 @@ algorithm
25622565 list< tuple< Expression , list< Statement >>> tybrs;
25632566 InstNode iterator;
25642567 MatchKind mk;
2565- Integer next_origin;
2568+ ExpOrigin . Type next_origin, cond_origin ;
25662569 SourceInfo info;
25672570
25682571 case Statement . ASSIGNMENT ()
@@ -2602,11 +2605,14 @@ algorithm
26022605
26032606 case Statement . IF ()
26042607 algorithm
2608+ next_origin := ExpOrigin . setFlag(origin, ExpOrigin . IF );
2609+ cond_origin := ExpOrigin . setFlag(next_origin, ExpOrigin . CONDITION );
2610+
26052611 tybrs := list(
26062612 match br case (cond, body)
26072613 algorithm
2608- e1 := typeCondition(cond, origin , st. source, Error . IF_CONDITION_TYPE_ERROR );
2609- sts1 := list(typeStatement(bst, origin ) for bst in body);
2614+ e1 := typeCondition(cond, cond_origin , st. source, Error . IF_CONDITION_TYPE_ERROR );
2615+ sts1 := list(typeStatement(bst, next_origin ) for bst in body);
26102616 then (e1, sts1);
26112617 end match
26122618 for br in st. branches);
@@ -2631,9 +2637,11 @@ algorithm
26312637 case Statement . ASSERT ()
26322638 algorithm
26332639 info := ElementSource . getInfo(st. source);
2634- e1 := typeOperatorArg(st. condition, Type . BOOLEAN (), origin, "assert" , "condition" , 1 , info);
2635- e2 := typeOperatorArg(st. message, Type . STRING (), origin, "assert" , "message" , 2 , info);
2636- e3 := typeOperatorArg(st. level, NFBuiltin . ASSERTIONLEVEL_TYPE , origin, "assert" , "level" , 3 , info);
2640+ next_origin := ExpOrigin . setFlag(origin, ExpOrigin . ASSERT );
2641+ e1 := typeOperatorArg(st. condition, Type . BOOLEAN (),
2642+ ExpOrigin . setFlag(next_origin, ExpOrigin . CONDITION ), "assert" , "condition" , 1 , info);
2643+ e2 := typeOperatorArg(st. message, Type . STRING (), next_origin, "assert" , "message" , 2 , info);
2644+ e3 := typeOperatorArg(st. level, NFBuiltin . ASSERTIONLEVEL_TYPE , next_origin, "assert" , "level" , 3 , info);
26372645 then
26382646 Statement . ASSERT (e1, e2, e3, st. source);
26392647
@@ -2718,12 +2726,13 @@ protected
27182726 list< Equation > eql;
27192727 Variability accum_var = Variability . CONSTANT , var ;
27202728 list< Equation . Branch > bl = {}, bl2 = {};
2721- Integer next_origin = origin;
2729+ ExpOrigin . Type next_origin = ExpOrigin . setFlag(origin, ExpOrigin . IF );
2730+ ExpOrigin . Type cond_origin = ExpOrigin . setFlag(next_origin, ExpOrigin . CONDITION );
27222731algorithm
27232732 // Type the conditions of all the branches.
27242733 for b in branches loop
27252734 Equation . Branch . BRANCH (cond, _, eql) := b;
2726- (cond, var ) := typeCondition(cond, origin , source, Error . IF_CONDITION_TYPE_ERROR );
2735+ (cond, var ) := typeCondition(cond, cond_origin , source, Error . IF_CONDITION_TYPE_ERROR );
27272736
27282737 if var > Variability . PARAMETER or isNonExpandableExp(cond) then
27292738 // If the condition doesn't fulfill the requirements for allowing
0 commit comments