Skip to content

Commit

Permalink
Добавлен флаг для образца в присваивании и пробрасывание контекста (#290
Browse files Browse the repository at this point in the history
)
  • Loading branch information
penachett committed Feb 26, 2021
1 parent 58d33af commit 8bc6e85
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/compiler/Checker.ref
Original file line number Diff line number Diff line change
Expand Up @@ -779,16 +779,16 @@ CheckFunctionBodyRec {

CheckSentenceRec {
(e.ScopeVars) t.LastSentence
= <CheckSentence e.ScopeVars t.LastSentence LastSentenceMarker> ;
= <CheckSentence e.ScopeVars t.LastSentence LastSentenceFlag> ;
(e.ScopeVars) t.Sentence e.Sentences
= <CheckSentence e.ScopeVars t.Sentence>
<CheckSentenceRec (e.ScopeVars) e.Sentences>;
}

CheckSentence {
e.ScopeVars ((e.Pattern) e.Assignments (e.Result) (e.Blocks))
e.ScopeVars ((e.Pattern) e.Assignments (e.Result) (e.Blocks)) e.Marker

= <CheckPattern (e.ScopeVars) e.Pattern>
= <CheckPattern (e.ScopeVars) (e.Pattern) e.Marker>
: (e.ScopeVars^) e.PatternFunctionsAndErrors

= <DoCheckAssignments (e.Assignments) (e.ScopeVars) /* нет ошибок */>
Expand Down Expand Up @@ -826,7 +826,7 @@ DoCheckAssignments {

= <CheckBlocks (e.ScopeVars) e.Blocks> : e.BlocksFunctionsAndErrors

= <CheckPattern (e.ScopeVars) e.Pattern>
= <CheckPattern (e.ScopeVars) (e.Pattern) AssignmentFlag>
: (e.ScopeVars^) e.PatternFunctionsAndErrors

= <DoCheckAssignments
Expand Down Expand Up @@ -869,13 +869,24 @@ FlatExpr {
}

CheckPattern {
(e.ScopeVars) e.Pattern
= <CheckPattern-WarnRepeated (e.ScopeVars) e.Pattern>
(e.ScopeVars) (e.Pattern) e.Flag
= <CheckPattern-WarnRepeated
(e.ScopeVars)
(e.Pattern)
<GetWarningIdByFlag e.Flag>
>
<CheckPattern-Flatten (e.ScopeVars) <FlatExpr e.Pattern>>;
}

CheckPattern-WarnRepeated {
e._ =;
(e.ScopeVars) (e.Pattern) s.WarningId = <Prout checking for warning repeated>;
(e._) (e._) = /* пусто */;
}

GetWarningIdByFlag {
LastSentenceFlag = RepeatedVariableMaybe;
AssignmentFlag = RepeatedVariable;
/* пусто */ = /* пусто */;
}

CheckPattern-Flatten {
Expand Down

0 comments on commit 8bc6e85

Please sign in to comment.