Skip to content

Commit

Permalink
Проверка внесена в основной checker + добавлен маркер последнего пред…
Browse files Browse the repository at this point in the history
…ложения (#290)
  • Loading branch information
penachett committed Feb 26, 2021
1 parent 034630a commit 58d33af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 52 deletions.
45 changes: 0 additions & 45 deletions src/compiler/Checker-RepeatedVars.ref

This file was deleted.

23 changes: 16 additions & 7 deletions src/compiler/Checker.ref
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ $EXTERN ExtractVariables-Expr;
*$FROM Checker-Screening
$EXTERN CheckScreening;

*$FROM Checker-RepeatedVars
$EXTERN CheckRepeatedVars;

$ENTRY CheckProgram {
(e.WarningIds) t.ErrorList e.AST
= <Reduce
Expand Down Expand Up @@ -130,8 +127,7 @@ FindErrors {
(<CheckDeclarations (e.WarningIds) e.Declarations>)
<Map &CheckFunctionBody e.FunctionBodies>
>
<CheckScreening (e.WarningIds) (e.AST)>
<CheckRepeatedVars (e.WarningIds) (e.AST)>;
<CheckScreening (e.WarningIds) (e.AST)>;
}

CheckPseudofunctions {
Expand Down Expand Up @@ -775,12 +771,20 @@ CheckFunctionBody {

CheckFunctionBodyRec {
(e.ScopeVars) Sentences e.Sentences =
<Map (&CheckSentence e.ScopeVars) e.Sentences>;
<CheckSentenceRec (e.ScopeVars) e.Sentences>;

(e.ScopeVars) NativeBody e.Code =
/* пусто, нет ни имён функций, ни ошибок внутри */;
}

CheckSentenceRec {
(e.ScopeVars) t.LastSentence
= <CheckSentence e.ScopeVars t.LastSentence LastSentenceMarker> ;
(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))

Expand Down Expand Up @@ -866,7 +870,12 @@ FlatExpr {

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

CheckPattern-WarnRepeated {
e._ =;
}

CheckPattern-Flatten {
Expand Down

0 comments on commit 58d33af

Please sign in to comment.