mirror of https://github.com/tbklang/tlang.git
Fixed `getStatements()` for Module container type to be stable. Not having it so caused bad affects and re-ordering that should have NOT happened
This commit is contained in:
parent
7fe3ea342c
commit
b39fea5e10
|
@ -37,14 +37,21 @@ public class Module : Entity, Container
|
|||
{
|
||||
/* Re-ordered by lowest wieght first */
|
||||
Statement[] stmntsRed;
|
||||
import gogga;
|
||||
|
||||
bool wCmp(Statement lhs, Statement rhs)
|
||||
{
|
||||
gprintln("LHS:"~lhs.toString());
|
||||
gprintln("RHS:"~rhs.toString());
|
||||
return lhs.weight < rhs.weight;
|
||||
}
|
||||
import std.algorithm.sorting;
|
||||
stmntsRed = sort!(wCmp)(statements).release;
|
||||
import std.algorithm.mutation : SwapStrategy;
|
||||
stmntsRed = sort!(wCmp, SwapStrategy.stable)(statements).release;
|
||||
|
||||
|
||||
gprintln(statements);
|
||||
|
||||
|
||||
return stmntsRed;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
module typeChecking3;
|
||||
|
||||
|
||||
|
||||
int p = 21;
|
||||
p=2+p;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
module typeChecking3;
|
||||
|
||||
|
||||
|
||||
int p = 21;
|
||||
p=2+p;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue