Skip to content

Commit

Permalink
Холодные функции после специализатора (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazdaywik committed Apr 12, 2020
1 parent 92456fc commit a5b0b5b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/compiler/Log-AST.ref
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ UndoubleEmtpyLines {

Element {
(Function s.Scope (e.Name) e.Body) = <Function (e.Name) s.Scope e.Body>;
(ColdFunction s.Scope (e.Name) e.Body)
= <ColdFunction (e.Name) s.Scope e.Body>;

(Enum GN-Entry e.Name) = ('$EENUM ' <DisplayName e.Name> ';');
(Enum GN-Local e.Name) = ('$ENUM ' <DisplayName e.Name> ';');
Expand Down Expand Up @@ -62,6 +64,16 @@ DoLongLine {


Function {
(e.Name) s.Scope e.Body
= <Function-Aux (<DisplayName e.Name>) s.Scope e.Body>;
}

ColdFunction {
(e.Name) s.Scope e.Body
= <Function-Aux ('* ' <DisplayName e.Name> ' *') s.Scope e.Body>;
}

Function-Aux {
(e.Name) s.Scope Sentences e.Sentences
= ()
(<Entry s.Scope> <DisplayName e.Name> ' {')
Expand Down
9 changes: 9 additions & 0 deletions src/compiler/OptTree-Drive.ref
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ DistinctFuncs {
e.B (Function s.ScopeClass (e.Name) e.Body1) e.M e.E
>;

e.B
(ColdFunction s.ScopeClass (e.Name) e.Body1)
e.M
(Function s.ScopeClass (e.Name) e.Body2)
e.E
= <DistinctFuncs
e.B (Function s.ScopeClass (e.Name) e.Body1) e.M e.E
>;

e.Other = e.Other
}

Expand Down
13 changes: 11 additions & 2 deletions src/compiler/OptTree-Spec.ref
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ SpecUnit {
>
: (e.SpecInfo^ (e.NewFunctions^)) e.Sentences^
= (e.SpecInfo (e.NewFunctions))
(Function s.ScopeClass t.Name Sentences e.Sentences);
(ColdFunction s.ScopeClass t.Name Sentences e.Sentences);

(e.SpecInfo (e.NewFunctions)) t.Other = (e.SpecInfo (e.NewFunctions)) t.Other;
}
Expand Down Expand Up @@ -701,7 +701,16 @@ Spec-PrepareConditions {
<OptTree-Spec-CleanupColdFunctions e.AST> == e.AST^
*/
$ENTRY OptTree-Spec-CleanupColdFunctions {
e.AST = e.AST;
e.AST
= <Map
{
(ColdFunction s.ScopeClass (e.Name) e.Body)
= (Function s.ScopeClass (e.Name) e.Body);

t.OtherItem = t.OtherItem;
}
e.AST
>;
}

/*
Expand Down

0 comments on commit a5b0b5b

Please sign in to comment.