Commit 7d0195a6b337954bbc321858f14af9d9a1c6e488
1 parent
118f3ac4
Exists in
master
replace initialized variables (static arrays) with their values
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
fz/semantic.pl
@@ -47,11 +47,10 @@ sa_n(var(N,T,[],A), V, ST) :- !, | @@ -47,11 +47,10 @@ sa_n(var(N,T,[],A), V, ST) :- !, | ||
47 | V=var(N,T,[],AX), % new AST node becomes ST entry value | 47 | V=var(N,T,[],AX), % new AST node becomes ST entry value |
48 | st_insert(ST, N, V). | 48 | st_insert(ST, N, V). |
49 | 49 | ||
50 | -sa_n(var(N,T,I,A), NI, ST) :- % non-empty initializer | ||
51 | - sa_attribs(A, AX, ST), % should ignore this? | ||
52 | - sa_n_traverse(I, NI, ST), % parse initializer | ||
53 | - V=var(N,T,NI,AX), % new AST node becomes ST entry value | ||
54 | - st_insert(ST, N, V). | 50 | +sa_n(var(N,_T,I,_A), NI, ST) :- % non-empty initializer |
51 | + sa_n_traverse(I, NI, ST), % parse initializer (& ignore T and A), | ||
52 | + V=NI, % -- just NI, not var(N,T,NI,AX) -- | ||
53 | + st_insert(ST, N, V). % which becomes the ST entry value | ||
55 | 54 | ||
56 | 55 | ||
57 | sa_n(lit(E,array(T)), lit(NE, array(T)), ST) :- | 56 | sa_n(lit(E,array(T)), lit(NE, array(T)), ST) :- |
@@ -66,8 +65,9 @@ sa_n(id(N), V, ST) :- V=var(N,_,_,_), % type as yet unknown | @@ -66,8 +65,9 @@ sa_n(id(N), V, ST) :- V=var(N,_,_,_), % type as yet unknown | ||
66 | st_insert(ST, N, V). | 65 | st_insert(ST, N, V). |
67 | 66 | ||
68 | 67 | ||
69 | -sa_n(constraint(CE, AT), constraint(NCE, AT), ST) :- | 68 | +sa_n(constraint(CE, A), constraint(NCE, AX), ST) :- |
70 | CE=..[C|AS], | 69 | CE=..[C|AS], |
70 | + sa_attribs(A, AX, ST), | ||
71 | sa_n_traverse(AS, NAS, ST), | 71 | sa_n_traverse(AS, NAS, ST), |
72 | NCE=..[C|NAS]. | 72 | NCE=..[C|NAS]. |
73 | 73 |