THEN
(* we cannot test for IsConst(Param) AND (GetSType(Param)=Char) as the type might not be assigned yet *)
MetaError1 ('base procedure {%EkHIGH} expects a variable or string constant as its parameter {%1d:rather than {%1d}} {%1asa}', Param)
- ELSIF IsUnbounded(Type)
+ ELSIF (Type # NulSym) AND IsUnbounded(Type)
THEN
BuildHighFromUnbounded (combinedtok)
ELSE
(*
BuildDesignatorArray - Builds the array referencing.
The purpose of this procedure is to work out
- whether the DesignatorArray is a static or
- dynamic array and to call the appropriate
+ whether the DesignatorArray is a constant string or
+ dynamic array/static array and to call the appropriate
BuildRoutine.
The Stack is expected to contain:
-
Entry Exit
===== ====
*)
PROCEDURE BuildDesignatorArray ;
+BEGIN
+ IF IsConst (OperandT (2)) AND IsConstString (OperandT (2))
+ THEN
+ MetaErrorT1 (OperandTtok (2),
+ '{%1Ead} is not an array, but a constant string. Hint use a string constant created with an array constructor',
+ OperandT (2)) ;
+ BuildDesignatorError ('bad array access')
+ ELSE
+ BuildDesignatorArrayStaticDynamic
+ END
+END BuildDesignatorArray ;
+
+
+(*
+ BuildDesignatorArrayStaticDynamic - Builds the array referencing.
+ The purpose of this procedure is to work out
+ whether the DesignatorArray is a static or
+ dynamic array and to call the appropriate
+ BuildRoutine.
+
+ The Stack is expected to contain:
+
+
+ Entry Exit
+ ===== ====
+
+ Ptr ->
+ +--------------+
+ | e | <- Ptr
+ |--------------| +------------+
+ | Sym | Type | | S | T |
+ |--------------| |------------|
+*)
+
+PROCEDURE BuildDesignatorArrayStaticDynamic ;
VAR
combinedTok,
arrayTok,
IF IsConst (OperandT (2))
THEN
type := GetDType (OperandT (2)) ;
- IF type = NulSym
- THEN
- InternalError ('constant type should have been resolved')
- ELSIF IsArray (type)
+ IF (type # NulSym) AND IsArray (type)
THEN
PopTtok (e, exprTok) ;
PopTFDtok (Sym, Type, dim, arrayTok) ;
IF (NOT IsVar (OperandT (2))) AND (NOT IsTemporary (OperandT (2)))
THEN
MetaErrorT1 (OperandTtok (2),
- 'can only access arrays using variables or formal parameters not {%1Ead}',
+ 'can only access arrays using constants, variables or formal parameters not {%1Ead}',
OperandT (2)) ;
BuildDesignatorError ('bad array access')
END ;
Sym) ;
BuildDesignatorError ('bad array access')
END
-END BuildDesignatorArray ;
+END BuildDesignatorArrayStaticDynamic ;
(*