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:
Adam Sampson 2008-03-17 18:43:07 +00:00
parent 1fb6adb005
commit 17a1c0eef6
2 changed files with 10 additions and 2 deletions

View File

@ -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
View 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
: