2 * Copyright (c) 2010 Jiri Svoboda
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 /** @file Static type system representation. */
36 /** Class of primitive type. */
44 /** Special type for nil reference */
52 /** Primitive type. */
54 /** Class of primitive type */
55 tprimitive_class_t tpc
;
60 /** @c sn_static if expression is a static CSI reference */
64 struct stree_csi
*csi
;
66 /** (Real) type arguments */
67 list_t targs
; /* of tdata_item_t */
73 struct tdata_item
*base_ti
;
79 list_t extents
; /* of stree_expr_t */
82 /** Function signature type.
84 * This is a part of functional type or delegate type.
87 /** Types of fixed arguments. */
88 list_t arg_ti
; /* of tdata_item_t */
90 /** Type of variadic argument */
91 struct tdata_item
*varg_ti
;
94 struct tdata_item
*rtype
;
99 /** Delegate definition or @c NULL if anonymous delegate */
100 struct stree_deleg
*deleg
;
102 /** Delegate signature type */
103 tdata_fun_sig_t
*tsig
;
108 * Type for expression which reference an enum declaration. In run time
109 * enum type reference is represented by @c rdata_deleg_t. (Which is used
110 * for any symbol references).
113 /** Enum definition */
114 struct stree_enum
*enum_d
;
119 /** Enum definition */
120 struct stree_enum
*enum_d
;
123 /** Functional type. */
125 /** Delegate definition or @c NULL if anonymous delegate */
126 struct stree_deleg
*deleg
;
128 /** Function signature type */
129 tdata_fun_sig_t
*tsig
;
132 /** Type variable reference. */
134 /** Definition of type argument this variable is referencing. */
135 struct stree_targ
*targ
;
139 /** Primitive type item */
141 /** Object type item */
143 /** Array type item */
145 /** Delegate type item */
147 /** Enum-base type item */
149 /** Enum type item */
151 /** Function type item */
153 /** Type variable item */
155 /** Special error-recovery type item */
159 /** Type item, the result of evaluating a type expression. */
160 typedef struct tdata_item
{
164 tdata_primitive_t
*tprimitive
;
165 tdata_object_t
*tobject
;
166 tdata_array_t
*tarray
;
167 tdata_deleg_t
*tdeleg
;
168 tdata_ebase_t
*tebase
;
175 /** Type variable valuation (mapping of type argument names to values). */
177 /** Maps name SID to type item */
178 intmap_t tvv
; /* of tdata_item_t */