- added readonly pointers. They need to be defined with 'readonly<classtype>'. These are significantly different from declaring a field readonly in that they do not disallow modification of the variable itself but what it points to. For the actor defaults this is necessary to prevent accidental modification. A readonly pointer is actually a different type than a regular pointer.
- fixed code generation for dynamic cast. It was missing the jump instruction after the compare.
This commit is contained in:
parent
ca878b5e6b
commit
24925c88a8
7 changed files with 47 additions and 20 deletions
|
|
@ -668,6 +668,7 @@ type_name(X) ::= type_name1(A).
|
|||
NEW_AST_NODE(BasicType, type, A);
|
||||
type->Type = (EZCCBuiltinType)A.Int;
|
||||
type->UserType = NULL;
|
||||
type->isconst = false;
|
||||
X = type;
|
||||
}
|
||||
type_name(X) ::= IDENTIFIER(A). /* User-defined type (struct, enum, or class) */
|
||||
|
|
@ -676,14 +677,27 @@ type_name(X) ::= IDENTIFIER(A). /* User-defined type (struct, enum, or class)
|
|||
NEW_AST_NODE(Identifier, id, A);
|
||||
type->Type = ZCC_UserType;
|
||||
type->UserType = id;
|
||||
type->isconst = false;
|
||||
id->Id = A.Name();
|
||||
X = type;
|
||||
}
|
||||
type_name(X) ::= READONLY LT IDENTIFIER(A) GT.
|
||||
{
|
||||
NEW_AST_NODE(BasicType, type, A);
|
||||
NEW_AST_NODE(Identifier, id, A);
|
||||
type->Type = ZCC_UserType;
|
||||
type->UserType = id;
|
||||
type->isconst = true;
|
||||
id->Id = A.Name();
|
||||
X = type;
|
||||
}
|
||||
|
||||
type_name(X) ::= DOT dottable_id(A).
|
||||
{
|
||||
NEW_AST_NODE(BasicType, type, A);
|
||||
type->Type = ZCC_UserType;
|
||||
type->UserType = A;
|
||||
type->isconst = false;
|
||||
X = type;
|
||||
}
|
||||
|
||||
|
|
@ -698,7 +712,7 @@ type_name(X) ::= DOT dottable_id(A).
|
|||
%type type_list {ZCC_Type *}
|
||||
%type type_list_or_void {ZCC_Type *}
|
||||
%type type_or_array {ZCC_Type *}
|
||||
%type class_restrictor {ZCC_Identifier *}
|
||||
%type class_restrictor {ZCC_Identifier *}
|
||||
%type array_size{ZCC_Expression *}
|
||||
%type array_size_expr{ZCC_Expression *}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue