Changes in uspace/app/sbi/src/symbol.c [c5cb943d:051bc69a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/symbol.c
rc5cb943d r051bc69a 42 42 static stree_symbol_t *symbol_find_epoint_rec(stree_program_t *prog, 43 43 stree_ident_t *name, stree_csi_t *csi); 44 static stree_symbol_t *csimbr_to_symbol(stree_csimbr_t *csimbr); 44 45 static stree_ident_t *symbol_get_ident(stree_symbol_t *symbol); 45 46 … … 131 132 stree_csi_t *scope, stree_ident_t *name) 132 133 { 134 stree_symbol_t *base_csi_sym; 133 135 stree_csi_t *base_csi; 134 136 stree_symbol_t *symbol; … … 140 142 141 143 /* Try inherited members. */ 142 base_csi = symbol_get_base_class(prog, scope); 143 if (base_csi != NULL) 144 if (scope->base_csi_ref != NULL) { 145 base_csi_sym = symbol_xlookup_in_csi(prog, 146 csi_to_symbol(scope)->outer_csi, scope->base_csi_ref); 147 base_csi = symbol_to_csi(base_csi_sym); 148 assert(base_csi != NULL); 149 144 150 return symbol_search_csi(prog, base_csi, name); 151 } 145 152 146 153 /* No match */ … … 205 212 modm = list_node_data(node, stree_modm_t *); 206 213 207 /* Make compiler happy. */208 mbr_name = NULL;209 210 214 switch (modm->mc) { 211 215 case mc_csi: mbr_name = modm->u.csi->name; break; … … 213 217 } 214 218 215 /* The Clang static analyzer is just too picky. */216 assert(mbr_name != NULL);217 218 219 if (name->sid == mbr_name->sid) { 219 /* Make compiler happy. */220 symbol = NULL;221 222 220 /* Match */ 223 221 switch (modm->mc) { … … 233 231 node = list_next(&prog->module->members, node); 234 232 } 235 236 return NULL;237 }238 239 /** Get explicit base class for a CSI.240 *241 * Note that if there is no explicit base class (class is derived implicitly242 * from @c object, then @c NULL is returned.243 *244 * @param prog Program to look in245 * @param csi CSI246 *247 * @return Base class (CSI) or @c NULL if no explicit base class.248 */249 stree_csi_t *symbol_get_base_class(stree_program_t *prog, stree_csi_t *csi)250 {251 list_node_t *pred_n;252 stree_texpr_t *pred;253 stree_symbol_t *pred_sym;254 stree_csi_t *pred_csi;255 stree_csi_t *outer_csi;256 257 outer_csi = csi_to_symbol(csi)->outer_csi;258 259 pred_n = list_first(&csi->inherit);260 if (pred_n == NULL)261 return NULL;262 263 pred = list_node_data(pred_n, stree_texpr_t *);264 pred_sym = symbol_xlookup_in_csi(prog, outer_csi, pred);265 pred_csi = symbol_to_csi(pred_sym);266 assert(pred_csi != NULL); /* XXX! */267 268 if (pred_csi->cc == csi_class)269 return pred_csi;270 271 return NULL;272 }273 274 /** Get type expression referencing base class for a CSI.275 *276 * Note that if there is no explicit base class (class is derived implicitly277 * from @c object, then @c NULL is returned.278 *279 * @param prog Program to look in280 * @param csi CSI281 *282 * @return Type expression or @c NULL if no explicit base class.283 */284 stree_texpr_t *symbol_get_base_class_ref(stree_program_t *prog,285 stree_csi_t *csi)286 {287 list_node_t *pred_n;288 stree_texpr_t *pred;289 stree_symbol_t *pred_sym;290 stree_csi_t *pred_csi;291 stree_csi_t *outer_csi;292 293 outer_csi = csi_to_symbol(csi)->outer_csi;294 295 pred_n = list_first(&csi->inherit);296 if (pred_n == NULL)297 return NULL;298 299 pred = list_node_data(pred_n, stree_texpr_t *);300 pred_sym = symbol_xlookup_in_csi(prog, outer_csi, pred);301 pred_csi = symbol_to_csi(pred_sym);302 assert(pred_csi != NULL); /* XXX! */303 304 if (pred_csi->cc == csi_class)305 return pred;306 233 307 234 return NULL; … … 359 286 stree_csimbr_t *csimbr; 360 287 stree_symbol_t *entry, *etmp; 361 stree_symbol_t *fun_sym;362 288 363 289 entry = NULL; … … 379 305 break; 380 306 case csimbr_fun: 381 fun_sym = fun_to_symbol(csimbr->u.fun); 382 383 if (csimbr->u.fun->name->sid == name->sid && 384 stree_symbol_has_attr(fun_sym, sac_static)) { 307 if (csimbr->u.fun->name->sid == name->sid) { 385 308 if (entry != NULL) { 386 309 printf("Error: Duplicate entry point.\n"); 387 310 exit(1); 388 311 } 389 entry = fun_ sym;312 entry = fun_to_symbol(csimbr->u.fun); 390 313 } 391 314 default: … … 571 494 * @return Symbol 572 495 */ 573 st ree_symbol_t *csimbr_to_symbol(stree_csimbr_t *csimbr)496 static stree_symbol_t *csimbr_to_symbol(stree_csimbr_t *csimbr) 574 497 { 575 498 stree_symbol_t *symbol; … … 645 568 { 646 569 stree_ident_t *ident; 647 648 /* Make compiler happy. */649 ident = NULL;650 570 651 571 switch (symbol->sc) {
Note:
See TracChangeset
for help on using the changeset viewer.