Clean up INITIAL a bit and add a test case.
There's no need for INITIALs to be early-constant-folded, since -- unlike VALs -- they can't be used in later constant folding.
This commit is contained in:
parent
1fb6adb005
commit
17a1c0eef6
|
@ -1318,8 +1318,8 @@ initialIsAbbrev
|
|||
e <- expressionOfType t
|
||||
sColon
|
||||
eol
|
||||
(e', _, _) <- constantFold e
|
||||
return $ A.Specification m n $ A.IsExpr m A.Original t e'
|
||||
return $ A.Specification m n $ A.IsExpr m A.Original t e
|
||||
<?> "INITIAL IS abbreviation"
|
||||
|
||||
isAbbrev :: OccParser A.Name -> OccParser A.Variable -> OccParser A.Specification
|
||||
isAbbrev newName oldVar
|
||||
|
|
8
testcases/initial.occ
Normal file
8
testcases/initial.occ
Normal file
|
@ -0,0 +1,8 @@
|
|||
PROC P ()
|
||||
INITIAL INT x IS 1234:
|
||||
INITIAL []BYTE cs IS "hello, world":
|
||||
SEQ
|
||||
SEQ i = 0 FOR SIZE cs
|
||||
cs[i] := 'A'
|
||||
x := x + 1
|
||||
:
|
Loading…
Reference in New Issue
Block a user