Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 39e8406 in mainline


Ignore:
Timestamp:
2010-03-20T21:57:13Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
b535aeb
Parents:
6ba20a6b
Message:

Update SBI to rev. 128.

Location:
uspace/app/sbi
Files:
8 added
25 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/Makefile

    r6ba20a6b r39e8406  
    5151        src/stree.c \
    5252        src/strtab.c \
    53         src/symbol.c
     53        src/stype.c \
     54        src/stype_expr.c \
     55        src/symbol.c \
     56        src/tdata.c
    5457
    5558include ../Makefile.common
  • uspace/app/sbi/src/ancr.c

    r6ba20a6b r39e8406  
    174174        do {
    175175                node_sym = csi_to_symbol(node);
    176                 symbol_print_fqn(prog, node_sym);
     176                symbol_print_fqn(node_sym);
    177177                printf(", ");
    178178
     
    196196
    197197        node_sym = csi_to_symbol(node);
    198         symbol_print_fqn(prog, node_sym);
     198        symbol_print_fqn(node_sym);
    199199}
  • uspace/app/sbi/src/builtin.c

    r6ba20a6b r39e8406  
    4444static stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name);
    4545static void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name);
    46 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name);
     46static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name,
     47    stree_texpr_t *type);
     48
     49static stree_texpr_t *builtin_mktype_string_array(void);
    4750
    4851static void builtin_write_line(run_t *run);
     
    8689
    8790        bi_exec = builtin_declare_fun(csi, "Exec");
    88         builtin_fun_add_vararg(bi_exec, "args");
    89 }
    90 
    91 void builtin_run_proc(run_t *run, stree_symbol_t *proc_sym)
    92 {
     91        builtin_fun_add_vararg(bi_exec, "args",
     92            builtin_mktype_string_array());
     93}
     94
     95void builtin_run_proc(run_t *run, stree_proc_t *proc)
     96{
     97        stree_symbol_t *fun_sym;
     98
    9399#ifdef DEBUG_RUN_TRACE
    94100        printf("Run builtin procedure.\n");
    95101#endif
    96         if (proc_sym == bi_write_line) {
     102        fun_sym = proc->outer_symbol;
     103
     104        if (fun_sym == bi_write_line) {
    97105                builtin_write_line(run);
    98         } else if (proc_sym == bi_exec) {
     106        } else if (fun_sym == bi_exec) {
    99107                builtin_exec(run);
    100108        } else {
     
    109117        stree_fun_t *fun;
    110118        stree_csimbr_t *csimbr;
    111         stree_symbol_t *symbol;
     119        stree_symbol_t *fun_sym;
    112120
    113121        ident = stree_ident_new();
     
    116124        fun = stree_fun_new();
    117125        fun->name = ident;
    118         fun->body = NULL;
     126        fun->proc = stree_proc_new();
     127        fun->proc->body = NULL;
    119128        list_init(&fun->args);
    120129
     
    122131        csimbr->u.fun = fun;
    123132
    124         symbol = stree_symbol_new(sc_fun);
    125         symbol->u.fun = fun;
    126         symbol->outer_csi = csi;
    127         fun->symbol = symbol;
     133        fun_sym = stree_symbol_new(sc_fun);
     134        fun_sym->u.fun = fun;
     135        fun_sym->outer_csi = csi;
     136        fun->symbol = fun_sym;
     137        fun->proc->outer_symbol = fun_sym;
    128138
    129139        list_append(&csi->members, csimbr);
    130140
    131         return symbol;
     141        return fun_sym;
    132142}
    133143
     
    150160
    151161/** Add variadic formal parameter to function. */
    152 static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name)
     162static void builtin_fun_add_vararg(stree_symbol_t *fun_sym, const char *name,
     163    stree_texpr_t *type)
    153164{
    154165        stree_proc_arg_t *proc_arg;
     
    161172        proc_arg->name = stree_ident_new();
    162173        proc_arg->name->sid = strtab_get_sid(name);
    163         proc_arg->type = NULL; /* XXX */
     174        proc_arg->type = type;
    164175
    165176        fun->varg = proc_arg;
     177}
     178
     179/** Construct a @c string[] type expression. */
     180static stree_texpr_t *builtin_mktype_string_array(void)
     181{
     182        stree_texpr_t *tstring;
     183        stree_texpr_t *tsarray;
     184        stree_tliteral_t *tliteral;
     185        stree_tindex_t *tindex;
     186
     187        /* Construct @c string */
     188        tstring = stree_texpr_new(tc_tliteral);
     189        tliteral = stree_tliteral_new(tlc_string);
     190        tstring->u.tliteral = tliteral;
     191
     192        /* Construct the indexing node */
     193        tsarray = stree_texpr_new(tc_tindex);
     194        tindex = stree_tindex_new();
     195        tsarray->u.tindex = tindex;
     196
     197        tindex->base_type = tstring;
     198        tindex->n_args = 1;
     199        list_init(&tindex->args);
     200
     201        return tsarray;
    166202}
    167203
  • uspace/app/sbi/src/builtin.h

    r6ba20a6b r39e8406  
    3333
    3434void builtin_declare(stree_program_t *program);
    35 void builtin_run_proc(run_t *run, stree_symbol_t *proc_sym);
     35void builtin_run_proc(run_t *run, stree_proc_t *proc);
    3636
    3737#endif
  • uspace/app/sbi/src/debug.h

    r6ba20a6b r39e8406  
    3333//#define DEBUG_PARSE_TRACE
    3434
     35/** Uncomment this to get verbose debugging messagges during typing. */
     36//#define DEBUG_TYPE_TRACE
     37
    3538/** Uncomment this to get verbose debugging messages during execution. */
    3639//#define DEBUG_RUN_TRACE
  • uspace/app/sbi/src/list.c

    r6ba20a6b r39e8406  
    130130}
    131131
     132/** Change node data. */
     133void list_node_setdata(list_node_t *node, void *data)
     134{
     135        node->data = data;
     136}
     137
    132138/** Create new node. */
    133139static list_node_t *list_node_new(void *data)
  • uspace/app/sbi/src/list.h

    r6ba20a6b r39e8406  
    4444bool_t list_is_empty(list_t *list);
    4545
     46void list_node_setdata(list_node_t *node, void *data);
     47
    4648#define list_node_data(node, dtype) ((dtype)(node->data))
    4749
  • uspace/app/sbi/src/main.c

    r6ba20a6b r39e8406  
    3636#include "strtab.h"
    3737#include "stree.h"
     38#include "stype.h"
    3839#include "input.h"
    3940#include "lex.h"
     
    4950        parse_t parse;
    5051        stree_program_t *program;
     52        stype_t stype;
    5153        run_t run;
    5254        int rc;
     
    7880        ancr_module_process(program, parse.cur_mod);
    7981
     82        /* Type program. */
     83        stype.program = program;
     84        stype_module(&stype, program->module);
     85
    8086        /* Run program. */
    8187        run_init(&run);
  • uspace/app/sbi/src/mytypes.h

    r6ba20a6b r39e8406  
    5656#include "stree_t.h"
    5757#include "strtab_t.h"
     58#include "stype_t.h"
     59#include "tdata_t.h"
    5860
    5961#endif
  • uspace/app/sbi/src/p_type.c

    r6ba20a6b r39e8406  
    194194{
    195195        stree_tliteral_t *tliteral;
    196 
    197         tliteral = stree_tliteral_new();
     196        tliteral_class_t tlc;
    198197
    199198        switch (lcur_lc(parse)) {
    200199        case lc_int:
    201                 tliteral->tlc = tlc_int;
     200                tlc = tlc_int;
    202201                break;
    203202        case lc_string:
    204                 tliteral->tlc = tlc_string;
     203                tlc = tlc_string;
    205204                break;
    206205        default:
     
    210209        lskip(parse);
    211210
     211        tliteral = stree_tliteral_new(tlc);
    212212        return tliteral;
    213213}
  • uspace/app/sbi/src/parse.c

    r6ba20a6b r39e8406  
    3535#include <assert.h>
    3636#include <stdlib.h>
     37#include "debug.h"
    3738#include "lex.h"
    3839#include "list.h"
     
    133134        csi = stree_csi_new(cc);
    134135        csi->name = parse_ident(parse);
    135 /*
     136
     137#ifdef DEBUG_PARSE_TRACE
    136138        printf("parse_csi: csi=%p, csi->name = %p (%s)\n", csi, csi->name,
    137139            strtab_get_str(csi->name->sid));
    138 */
     140#endif
    139141        if (lcur_lc(parse) == lc_colon) {
    140142                /* Inheritance list */
     
    193195                symbol->outer_csi = outer_csi;
    194196                fun->symbol = symbol;
     197                fun->proc->outer_symbol = symbol;
    195198                break;
    196199        case lc_var:
     
    213216                symbol->outer_csi = outer_csi;
    214217                prop->symbol = symbol;
     218                if (prop->getter)
     219                        prop->getter->outer_symbol = symbol;
     220                if (prop->setter)
     221                        prop->setter->outer_symbol = symbol;
    215222                break;
    216223        default:
     
    235242        lmatch(parse, lc_lparen);
    236243
     244#ifdef DEBUG_PARSE_TRACE
     245        printf("Parsing function '%s'.\n", strtab_get_str(fun->name->sid));
     246#endif
     247
    237248        list_init(&fun->args);
    238249
     
    242253                while (b_true) {
    243254                        arg = parse_proc_arg(parse);
     255
    244256                        if (stree_arg_has_attr(arg, aac_packed)) {
    245257                                fun->varg = arg;
     
    266278
    267279        lmatch(parse, lc_is);
    268         fun->body = parse_block(parse);
     280        fun->proc = stree_proc_new();
     281        fun->proc->body = parse_block(parse);
    269282        lmatch(parse, lc_end);
    270283
     
    342355                        lskip(parse);
    343356                        lmatch(parse, lc_is);
    344                         if (prop->getter_body != NULL) {
     357                        if (prop->getter != NULL) {
    345358                                printf("Error: Duplicate getter.\n");
    346359                                exit(1);
    347360                        }
    348                         prop->getter_body = parse_block(parse);
     361
     362                        /* Create setter procedure */
     363                        prop->getter = stree_proc_new();
     364                        prop->getter->body = parse_block(parse);
     365
    349366                        lmatch(parse, lc_end);
    350367                        break;
    351368                case lc_set:
    352369                        lskip(parse);
    353                         prop->setter_arg_name = parse_ident(parse);
     370                        prop->setter_arg = stree_proc_arg_new();
     371                        prop->setter_arg->name = parse_ident(parse);
     372                        prop->setter_arg->type = prop->type;
    354373                        lmatch(parse, lc_is);
    355                         if (prop->setter_body != NULL) {
     374                        if (prop->setter != NULL) {
    356375                                printf("Error: Duplicate setter.\n");
    357376                                exit(1);
    358377                        }
    359                         prop->setter_body = parse_block(parse);
     378
     379                        /* Create setter procedure */
     380                        prop->setter = stree_proc_new();
     381                        prop->setter->body = parse_block(parse);
     382
    360383                        lmatch(parse, lc_end);
    361384                        break;
     
    390413        }
    391414
     415#ifdef DEBUG_PARSE_TRACE
     416        printf("Parsed arg attr, type=%p.\n", arg->type);
     417#endif
    392418        return arg;
    393419}
  • uspace/app/sbi/src/rdata.c

    r6ba20a6b r39e8406  
    243243}
    244244
    245 rdata_titem_t *rdata_titem_new(titem_class_t tic)
    246 {
    247         rdata_titem_t *titem;
    248 
    249         titem = calloc(1, sizeof(rdata_titem_t));
    250         if (titem == NULL) {
    251                 printf("Memory allocation failed.\n");
    252                 exit(1);
    253         }
    254 
    255         titem->tic = tic;
    256         return titem;
    257 }
    258 
    259 rdata_tarray_t *rdata_tarray_new(void)
    260 {
    261         rdata_tarray_t *tarray;
    262 
    263         tarray = calloc(1, sizeof(rdata_tarray_t));
    264         if (tarray == NULL) {
    265                 printf("Memory allocation failed.\n");
    266                 exit(1);
    267         }
    268 
    269         return tarray;
    270 }
    271 
    272 rdata_tcsi_t *rdata_tcsi_new(void)
    273 {
    274         rdata_tcsi_t *tcsi;
    275 
    276         tcsi = calloc(1, sizeof(rdata_tcsi_t));
    277         if (tcsi == NULL) {
    278                 printf("Memory allocation failed.\n");
    279                 exit(1);
    280         }
    281 
    282         return tcsi;
    283 }
    284 
    285 rdata_tprimitive_t *rdata_tprimitive_new(void)
    286 {
    287         rdata_tprimitive_t *tprimitive;
    288 
    289         tprimitive = calloc(1, sizeof(rdata_tprimitive_t));
    290         if (tprimitive == NULL) {
    291                 printf("Memory allocation failed.\n");
    292                 exit(1);
    293         }
    294 
    295         return tprimitive;
    296 }
    297 
    298245void rdata_array_alloc_element(rdata_array_t *array)
    299246{
     
    447394}
    448395
    449 /** Get item var-class.
    450  *
    451  * Get var-class of @a item, regardless whether it is a value or address.
    452  * (I.e. the var class of the value or variable at the given address).
    453  */
    454 var_class_t rdata_item_get_vc(rdata_item_t *item)
    455 {
    456         var_class_t vc;
    457 
    458         switch (item->ic) {
    459         case ic_value:
    460                 vc = item->u.value->var->vc;
    461                 break;
    462         case ic_address:
    463                 switch (item->u.address->ac) {
    464                 case ac_var:
    465                         vc = item->u.address->u.var_a->vref->vc;
    466                         break;
    467                 case ac_prop:
    468                         printf("Unimplemented: Get property address "
    469                             "varclass.\n");
    470                         exit(1);
    471                 default:
    472                         assert(b_false);
    473                 }
    474                 break;
    475         default:
    476                 assert(b_false);
    477         }
    478 
    479         return vc;
    480 }
    481 
    482 /** Determine if CSI @a a is derived from CSI described by type item @a tb. */
    483 bool_t rdata_is_csi_derived_from_ti(stree_csi_t *a, rdata_titem_t *tb)
    484 {
    485         bool_t res;
    486 
    487         switch (tb->tic) {
    488         case tic_tcsi:
    489                 res = stree_is_csi_derived_from_csi(a, tb->u.tcsi->csi);
    490                 break;
    491         default:
    492                 printf("Error: Base type is not a CSI.\n");
    493                 exit(1);
    494         }
    495 
    496         return res;
    497 }
    498 
    499396void rdata_item_print(rdata_item_t *item)
    500397{
  • uspace/app/sbi/src/rdata.h

    r6ba20a6b r39e8406  
    4848rdata_string_t *rdata_string_new(void);
    4949
    50 rdata_titem_t *rdata_titem_new(titem_class_t tic);
    51 rdata_tarray_t *rdata_tarray_new(void);
    52 rdata_tcsi_t *rdata_tcsi_new(void);
    53 rdata_tprimitive_t *rdata_tprimitive_new(void);
    54 
    5550void rdata_array_alloc_element(rdata_array_t *array);
    5651void rdata_var_copy(rdata_var_t *src, rdata_var_t **dest);
     
    5954void rdata_var_write(rdata_var_t *var, rdata_value_t *value);
    6055
    61 var_class_t rdata_item_get_vc(rdata_item_t *item);
    62 bool_t rdata_is_csi_derived_from_ti(stree_csi_t *a, rdata_titem_t *tb);
    63 
    6456void rdata_item_print(rdata_item_t *item);
    6557
  • uspace/app/sbi/src/rdata_t.h

    r6ba20a6b r39e8406  
    171171/** Property address.
    172172 *
    173  * When accessing part of a property that is non-scalar and mutable,
    174  * a read-modify-write (or get-modify-set) operation is necessary.
    175  * To accomodate this, the address item must hold a temporary copy of the
    176  * property value.
     173 * When an access or index operation is performed on a property, the getter
     174 * is run and the prefetched value is stored in @c tvalue. If the property
     175 * is a non-scalar value type (a struct), then we might want to point to
     176 * the proper @c var node inside it. @c tpos is used for this purpose.
     177 *
     178 * The assignment operator will modify @c tvalue and at the end the setter
     179 * is called to store @c tvalue back into the property.
    177180 */
    178181typedef struct {
     
    236239} rdata_item_t;
    237240
    238 /** Primitive type. */
    239 typedef struct {
    240 } rdata_tprimitive_t;
    241 
    242 /** Class, struct or interface type. */
    243 typedef struct {
    244         struct stree_csi *csi;
    245 } rdata_tcsi_t;
    246 
    247 /** Array type. */
    248 typedef struct {
    249         /** Base type item */
    250         struct rdata_titem *base_ti;
    251 
    252         /** Rank */
    253         int rank;
    254 
    255         /** Extents */
    256         list_t extents; /* of stree_expr_t */
    257 } rdata_tarray_t;
    258 
    259 /** Generic type. */
    260 typedef struct {
    261 } rdata_tgeneric_t;
    262 
    263 typedef enum {
    264         tic_tprimitive,
    265         tic_tcsi,
    266         tic_tarray,
    267         tic_tgeneric
    268 } titem_class_t;
    269 
    270 /** Type item, the result of evaluating a type expression. */
    271 typedef struct rdata_titem {
    272         titem_class_t tic;
    273 
    274         union {
    275                 rdata_tprimitive_t *tprimitive;
    276                 rdata_tcsi_t *tcsi;
    277                 rdata_tarray_t *tarray;
    278                 rdata_tgeneric_t *tgeneric;
    279         } u;
    280 } rdata_titem_t;
    281 
    282241#endif
  • uspace/app/sbi/src/run.c

    r6ba20a6b r39e8406  
    4343#include "strtab.h"
    4444#include "symbol.h"
     45#include "tdata.h"
    4546
    4647#include "run.h"
     
    5758
    5859static bool_t run_exc_match(run_t *run, stree_except_t *except_c);
     60static rdata_var_t *run_aprop_get_tpos(run_t *run, rdata_address_t *aprop);
    5961
    6062static void run_aprop_read(run_t *run, rdata_addr_prop_t *addr_prop,
     
    102104
    103105#ifdef DEBUG_RUN_TRACE
    104         printf("Found function '"); symbol_print_fqn(prog, main_fun_sym);
     106        printf("Found function '"); symbol_print_fqn(main_fun_sym);
    105107        printf("'.\n");
    106108#endif
     
    108110        /* Run function @c main. */
    109111        list_init(&main_args);
    110         run_proc_ar_create(run, NULL, main_fun_sym, main_fun->body, &proc_ar);
     112        run_proc_ar_create(run, NULL, main_fun->proc, &proc_ar);
    111113        run_proc_ar_set_args(run, proc_ar, &main_args);
    112114        run_proc(run, proc_ar, &res);
     
    123125void run_proc(run_t *run, run_proc_ar_t *proc_ar, rdata_item_t **res)
    124126{
    125         stree_symbol_t *proc_sym;
     127        stree_proc_t *proc;
    126128        list_node_t *node;
    127129
    128         proc_sym = proc_ar->proc_sym;
     130        proc = proc_ar->proc;
    129131
    130132#ifdef DEBUG_RUN_TRACE
    131133        printf("Start executing function '");
    132         symbol_print_fqn(run->program, proc_sym);
     134        symbol_print_fqn(proc_sym);
    133135        printf("'.\n");
    134136#endif
     
    137139
    138140        /* Run main procedure block. */
    139         if (proc_ar->proc_block != NULL) {
    140                 run_block(run, proc_ar->proc_block);
     141        if (proc->body != NULL) {
     142                run_block(run, proc->body);
    141143        } else {
    142                 builtin_run_proc(run, proc_sym);
     144                builtin_run_proc(run, proc);
    143145        }
    144146
     
    157159#ifdef DEBUG_RUN_TRACE
    158160        printf("Done executing procedure '");
    159         symbol_print_fqn(run->program, proc_sym);
     161        symbol_print_fqn(proc);
    160162        printf("'.\n");
    161163
     
    469471        rdata_var_t *payload_v;
    470472        rdata_object_t *payload_o;
    471         rdata_titem_t *etype;
     473        tdata_item_t *etype;
    472474
    473475        payload = run->thread_ar->exc_payload;
     
    491493#ifdef DEBUG_RUN_TRACE
    492494        printf("Active exception: '");
    493         symbol_print_fqn(run->program, payload_o->class_sym);
     495        symbol_print_fqn(payload_o->class_sym);
    494496        printf("'.\n");
    495497#endif
     
    498500
    499501        /* Evaluate type expression in except clause. */
    500         run_texpr(run, except_c->etype, &etype);
    501 
    502         return rdata_is_csi_derived_from_ti(payload_o->class_sym->u.csi,
     502        run_texpr(run->program, run_get_current_csi(run), except_c->etype,
     503            &etype);
     504
     505        return tdata_is_csi_derived_from_ti(payload_o->class_sym->u.csi,
    503506            etype);
    504507}
     
    556559
    557560        proc_ar = run_get_current_proc_ar(run);
    558         return proc_ar->proc_sym->outer_csi;
     561        return proc_ar->proc->outer_symbol->outer_csi;
    559562}
    560563
     
    606609
    607610/** Construct a function AR. */
    608 void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_symbol_t *proc_sym,
    609     stree_block_t *proc_block, run_proc_ar_t **rproc_ar)
     611void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_proc_t *proc,
     612    run_proc_ar_t **rproc_ar)
    610613{
    611614        run_proc_ar_t *proc_ar;
     
    617620        proc_ar = run_proc_ar_new();
    618621        proc_ar->obj = obj;
    619         proc_ar->proc_sym = proc_sym;
    620         proc_ar->proc_block = proc_block;
     622        proc_ar->proc = proc;
    621623        list_init(&proc_ar->block_ar);
    622624
     
    642644        list_t *args;
    643645        stree_proc_arg_t *varg;
     646        stree_symbol_t *outer_symbol;
    644647
    645648        run_block_ar_t *block_ar;
     
    655658        int n_vargs, idx;
    656659
     660        (void) run;
     661
    657662        /* AR should have been created with run_proc_ar_create(). */
    658         assert(proc_ar->proc_sym != NULL);
     663        assert(proc_ar->proc != NULL);
     664        outer_symbol = proc_ar->proc->outer_symbol;
    659665
    660666        /*
    661          * The procedure being activated should be a member function or
     667         * The procedure being activated should belong to a member function or
    662668         * property getter/setter.
    663669         */
    664         switch (proc_ar->proc_sym->sc) {
     670        switch (outer_symbol->sc) {
    665671        case sc_fun:
    666                 fun = symbol_to_fun(proc_ar->proc_sym);
     672                fun = symbol_to_fun(outer_symbol);
    667673                args = &fun->args;
    668674                varg = fun->varg;
    669675                break;
    670676        case sc_prop:
    671                 prop = symbol_to_prop(proc_ar->proc_sym);
     677                prop = symbol_to_prop(outer_symbol);
    672678                args = &prop->args;
    673679                varg = prop->varg;
     
    688694        while (parg_n != NULL) {
    689695                if (rarg_n == NULL) {
    690                         printf("Error: Too few arguments to function '");
    691                         symbol_print_fqn(run->program, proc_ar->proc_sym);
     696                        printf("Error: Too few arguments to '");
     697                        symbol_print_fqn(outer_symbol);
    692698                        printf("'.\n");
    693699                        exit(1);
     
    752758        /* Check for excess real parameters. */
    753759        if (rarg_n != NULL) {
    754                 printf("Error: Too many arguments to function '");
    755                 symbol_print_fqn(run->program, proc_ar->proc_sym);
     760                printf("Error: Too many arguments to '");
     761                symbol_print_fqn(outer_symbol);
    756762                printf("'.\n");
    757763                exit(1);
     
    775781
    776782        /* AR should have been created with run_proc_ar_create(). */
    777         assert(proc_ar->proc_sym != NULL);
    778 
    779         /* The procedure being activated should be a property setter. */
    780         prop = symbol_to_prop(proc_ar->proc_sym);
     783        assert(proc_ar->proc != NULL);
     784
     785        /* The procedure being activated should belong to a property setter. */
     786        prop = symbol_to_prop(proc_ar->proc->outer_symbol);
    781787        assert(prop != NULL);
     788        assert(proc_ar->proc == prop->setter);
    782789
    783790        /* Fetch first block activation record. */
     
    792799
    793800        /* Declare variable using name of formal argument. */
    794         intmap_set(&block_ar->vars, prop->setter_arg_name->sid, var);
     801        intmap_set(&block_ar->vars, prop->setter_arg->name->sid, var);
    795802}
    796803
     
    806813                printf(" * ");
    807814                proc_ar = list_node_data(node, run_proc_ar_t *);
    808                 symbol_print_fqn(run->program, proc_ar->proc_sym);
     815                symbol_print_fqn(proc_ar->proc->outer_symbol);
    809816                printf("\n");
    810817
     
    844851}
    845852
     853/** Get item var-class.
     854 *
     855 * Get var-class of @a item, regardless whether it is a value or address.
     856 * (I.e. the var class of the value or variable at the given address).
     857 */
     858var_class_t run_item_get_vc(run_t *run, rdata_item_t *item)
     859{
     860        var_class_t vc;
     861        rdata_var_t *tpos;
     862
     863        (void) run;
     864
     865        switch (item->ic) {
     866        case ic_value:
     867                vc = item->u.value->var->vc;
     868                break;
     869        case ic_address:
     870                switch (item->u.address->ac) {
     871                case ac_var:
     872                        vc = item->u.address->u.var_a->vref->vc;
     873                        break;
     874                case ac_prop:
     875                        /* Prefetch the value of the property. */
     876                        tpos = run_aprop_get_tpos(run, item->u.address);
     877                        vc = tpos->vc;
     878                        break;
     879                default:
     880                        assert(b_false);
     881                }
     882                break;
     883        default:
     884                assert(b_false);
     885        }
     886
     887        return vc;
     888}
     889
     890/** Get pointer to current var node in temporary copy in property address.
     891 *
     892 * A property address refers to a specific @c var node in a property.
     893 * This function will fetch a copy of the property value (by running
     894 * its getter) if there is not a temporary copy in the address yet.
     895 * It returns a pointer to the relevant @c var node in the temporary
     896 * copy.
     897 *
     898 * @param run   Runner object.
     899 * @param addr  Address of class @c ac_prop.
     900 * @param       Pointer to var node.
     901 */
     902static rdata_var_t *run_aprop_get_tpos(run_t *run, rdata_address_t *addr)
     903{
     904        rdata_item_t *ritem;
     905
     906        assert(addr->ac == ac_prop);
     907
     908        if (addr->u.prop_a->tvalue == NULL) {
     909                /* Fetch value of the property. */
     910                run_address_read(run, addr, &ritem);
     911                assert(ritem->ic == ic_value);
     912                addr->u.prop_a->tvalue = ritem->u.value;
     913                addr->u.prop_a->tpos = addr->u.prop_a->tvalue->var;
     914        }
     915
     916        return addr->u.prop_a->tpos;
     917}
    846918
    847919/** Read data from an address.
     
    894966
    895967        run_proc_ar_t *proc_ar;
     968
     969        rdata_var_t *cvar;
    896970
    897971#ifdef DEBUG_RUN_TRACE
     
    903977         */
    904978        if (addr_prop->tvalue != NULL) {
    905                 printf("Unimplemented: Property field access.\n");
    906                 exit(1);
     979                /* Copy the value */
     980                rdata_var_copy(addr_prop->tpos, &cvar);
     981                *ritem = rdata_item_new(ic_value);
     982                (*ritem)->u.value = rdata_value_new();
     983                (*ritem)->u.value->var = cvar;
     984                return;
    907985        }
    908986
     
    917995        assert(prop != NULL);
    918996
    919         if (prop->getter_body == NULL) {
     997        if (prop->getter == NULL) {
    920998                printf("Error: Property is not readable.\n");
    921999                exit(1);
     
    9231001
    9241002        /* Create procedure activation record. */
    925         run_proc_ar_create(run, obj, prop_sym, prop->getter_body, &proc_ar);
     1003        run_proc_ar_create(run, obj, prop->getter, &proc_ar);
    9261004
    9271005        /* Fill in arguments (indices). */
     
    9731051        assert(prop != NULL);
    9741052
    975         if (prop->setter_body == NULL) {
     1053        if (prop->setter == NULL) {
    9761054                printf("Error: Property is not writable.\n");
    9771055                exit(1);
     
    9821060
    9831061        /* Create procedure activation record. */
    984         run_proc_ar_create(run, obj, prop_sym, prop->setter_body, &proc_ar);
     1062        run_proc_ar_create(run, obj, prop->setter, &proc_ar);
    9851063
    9861064        /* Fill in arguments (indices). */
  • uspace/app/sbi/src/run.h

    r6ba20a6b r39e8406  
    4848void run_proc_ar_set_setter_arg(run_t *run, run_proc_ar_t *proc_ar,
    4949    rdata_item_t *arg_val);
    50 void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_symbol_t *proc_sym,
    51     stree_block_t *proc_block, run_proc_ar_t **rproc_ar);
     50void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_proc_t *proc,
     51    run_proc_ar_t **rproc_ar);
    5252
     53var_class_t run_item_get_vc(run_t *run, rdata_item_t *item);
    5354void run_cvt_value_item(run_t *run, rdata_item_t *item, rdata_item_t **ritem);
    5455void run_address_read(run_t *run, rdata_address_t *address,
  • uspace/app/sbi/src/run_expr.c

    r6ba20a6b r39e8406  
    4343#include "stree.h"
    4444#include "strtab.h"
     45#include "tdata.h"
    4546
    4647#include "run_expr.h"
     
    7273static void run_new(run_t *run, stree_new_t *new_op, rdata_item_t **res);
    7374static void run_new_array(run_t *run, stree_new_t *new_op,
    74     rdata_titem_t *titem, rdata_item_t **res);
     75    tdata_item_t *titem, rdata_item_t **res);
    7576static void run_new_object(run_t *run, stree_new_t *new_op,
    76     rdata_titem_t *titem, rdata_item_t **res);
     77    tdata_item_t *titem, rdata_item_t **res);
    7778
    7879static void run_access(run_t *run, stree_access_t *access, rdata_item_t **res);
     
    199200                assert(csi != NULL);
    200201        } else {
    201                 csi = proc_ar->proc_sym->outer_csi;
     202                csi = proc_ar->proc->outer_symbol->outer_csi;
    202203                obj = NULL;
    203204        }
     
    231232                        printf("Error: Cannot access non-static member "
    232233                            "function '");
    233                         symbol_print_fqn(run->program, sym);
     234                        symbol_print_fqn(sym);
    234235                        printf("' from nested CSI '");
    235                         symbol_print_fqn(run->program, csi_sym);
     236                        symbol_print_fqn(csi_sym);
    236237                        printf("'.\n");
    237238                        exit(1);
     
    267268                        printf("Error: Cannot access non-static member "
    268269                            "variable '");
    269                         symbol_print_fqn(run->program, sym);
     270                        symbol_print_fqn(sym);
    270271                        printf("' from nested CSI '");
    271                         symbol_print_fqn(run->program, csi_sym);
     272                        symbol_print_fqn(csi_sym);
    272273                        printf("'.\n");
    273274                        exit(1);
     
    632633static void run_new(run_t *run, stree_new_t *new_op, rdata_item_t **res)
    633634{
    634         rdata_titem_t *titem;
     635        tdata_item_t *titem;
    635636
    636637#ifdef DEBUG_RUN_TRACE
     
    638639#endif
    639640        /* Evaluate type expression */
    640         run_texpr(run, new_op->texpr, &titem);
     641        run_texpr(run->program, run_get_current_csi(run), new_op->texpr,
     642            &titem);
    641643
    642644        switch (titem->tic) {
     
    644646                run_new_array(run, new_op, titem, res);
    645647                break;
    646         case tic_tcsi:
     648        case tic_tobject:
    647649                run_new_object(run, new_op, titem, res);
    648650                break;
     
    656658/** Create new array. */
    657659static void run_new_array(run_t *run, stree_new_t *new_op,
    658     rdata_titem_t *titem, rdata_item_t **res)
    659 {
    660         rdata_tarray_t *tarray;
     660    tdata_item_t *titem, rdata_item_t **res)
     661{
     662        tdata_array_t *tarray;
    661663        rdata_array_t *array;
    662664        rdata_var_t *array_var;
     
    744746/** Create new object. */
    745747static void run_new_object(run_t *run, stree_new_t *new_op,
    746     rdata_titem_t *titem, rdata_item_t **res)
     748    tdata_item_t *titem, rdata_item_t **res)
    747749{
    748750        rdata_object_t *obj;
     
    764766
    765767        /* Lookup object CSI. */
    766         assert(titem->tic == tic_tcsi);
    767         csi = titem->u.tcsi->csi;
     768        assert(titem->tic == tic_tobject);
     769        csi = titem->u.tobject->csi;
    768770        csi_sym = csi_to_symbol(csi);
    769771
     
    823825        printf("Run access operation on pre-evaluated base.\n");
    824826#endif
    825         vc = rdata_item_get_vc(arg);
     827        vc = run_item_get_vc(run, arg);
    826828
    827829        switch (vc) {
     
    883885        if (member == NULL) {
    884886                printf("Error: CSI '");
    885                 symbol_print_fqn(run->program, deleg_v->sym);
     887                symbol_print_fqn(deleg_v->sym);
    886888                printf("' has no member named '%s'.\n",
    887889                    strtab_get_str(access->member_name->sid));
     
    936938        if (member == NULL) {
    937939                printf("Error: Object of class '");
    938                 symbol_print_fqn(run->program, object->class_sym);
     940                symbol_print_fqn(object->class_sym);
    939941                printf("' has no member named '%s'.\n",
    940942                    strtab_get_str(access->member_name->sid));
     
    10301032#ifdef DEBUG_RUN_TRACE
    10311033        printf("Call function '");
    1032         symbol_print_fqn(run->program, deleg_v->sym);
     1034        symbol_print_fqn(deleg_v->sym);
    10331035        printf("'\n");
    10341036#endif
     
    10501052
    10511053        /* Create procedure activation record. */
    1052         run_proc_ar_create(run, deleg_v->obj, deleg_v->sym, fun->body,
    1053             &proc_ar);
     1054        run_proc_ar_create(run, deleg_v->obj, fun->proc, &proc_ar);
    10541055
    10551056        /* Fill in argument values. */
     
    10801081        run_expr(run, index->base, &rbase);
    10811082
    1082         vc = rdata_item_get_vc(rbase);
     1083        vc = run_item_get_vc(run, rbase);
    10831084
    10841085        /* Implicitly dereference. */
     
    10891090        }
    10901091
    1091         vc = rdata_item_get_vc(base_i);
     1092        vc = run_item_get_vc(run, base_i);
    10921093
    10931094        /* Evaluate arguments (indices). */
     
    12241225        printf("Run object index operation.\n");
    12251226#endif
    1226         (void) run;
    12271227        (void) index;
    12281228
     
    12521252        indexer_sym = symbol_search_csi(run->program, obj_csi, indexer_ident);
    12531253
     1254        if (indexer_sym == NULL) {
     1255                printf("Error: Accessing object which does not have an "
     1256                    "indexer.\n");
     1257                exit(1);
     1258        }
     1259
    12541260        /* Construct delegate. */
    12551261        object_d = rdata_deleg_new();
  • uspace/app/sbi/src/run_t.h

    r6ba20a6b r39e8406  
    5454        struct rdata_var *obj;
    5555
    56         /** Definition of function or property being invoked */
    57         struct stree_symbol *proc_sym;
    58 
    59         /** Main block of procedure being invoked */
    60         struct stree_block *proc_block;
     56        /** Procedure being invoked */
     57        struct stree_proc *proc;
    6158
    6259        /** Block activation records */
  • uspace/app/sbi/src/run_texpr.c

    r6ba20a6b r39e8406  
    2929/** @file Evaluates type expressions. */
    3030
     31#include <assert.h>
    3132#include <stdlib.h>
    3233#include "list.h"
    3334#include "mytypes.h"
    34 #include "rdata.h"
    35 #include "run.h"
    3635#include "symbol.h"
     36#include "tdata.h"
    3737
    3838#include "run_texpr.h"
    3939
    40 static void run_taccess(run_t *run, stree_taccess_t *taccess,
    41     rdata_titem_t **res);
    42 static void run_tindex(run_t *run, stree_tindex_t *tindex,
    43     rdata_titem_t **res);
    44 static void run_tliteral(run_t *run, stree_tliteral_t *tliteral,
    45     rdata_titem_t **res);
    46 static void run_tnameref(run_t *run, stree_tnameref_t *tnameref,
    47     rdata_titem_t **res);
    48 
    49 void run_texpr(run_t *run, stree_texpr_t *texpr, rdata_titem_t **res)
     40static void run_taccess(stree_program_t *prog, stree_csi_t *ctx,
     41    stree_taccess_t *taccess, tdata_item_t **res);
     42static void run_tindex(stree_program_t *prog, stree_csi_t *ctx,
     43    stree_tindex_t *tindex, tdata_item_t **res);
     44static void run_tliteral(stree_program_t *prog, stree_csi_t *ctx,
     45    stree_tliteral_t *tliteral, tdata_item_t **res);
     46static void run_tnameref(stree_program_t *prog, stree_csi_t *ctx,
     47    stree_tnameref_t *tnameref, tdata_item_t **res);
     48
     49void run_texpr(stree_program_t *prog, stree_csi_t *ctx, stree_texpr_t *texpr,
     50    tdata_item_t **res)
    5051{
    5152        switch (texpr->tc) {
    5253        case tc_taccess:
    53                 run_taccess(run, texpr->u.taccess, res);
     54                run_taccess(prog, ctx, texpr->u.taccess, res);
    5455                break;
    5556        case tc_tindex:
    56                 run_tindex(run, texpr->u.tindex, res);
     57                run_tindex(prog, ctx, texpr->u.tindex, res);
    5758                break;
    5859        case tc_tliteral:
    59                 run_tliteral(run, texpr->u.tliteral, res);
     60                run_tliteral(prog, ctx, texpr->u.tliteral, res);
    6061                break;
    6162        case tc_tnameref:
    62                 run_tnameref(run, texpr->u.tnameref, res);
     63                run_tnameref(prog, ctx, texpr->u.tnameref, res);
    6364                break;
    6465        case tc_tapply:
     
    6970}
    7071
    71 static void run_taccess(run_t *run, stree_taccess_t *taccess,
    72     rdata_titem_t **res)
     72static void run_taccess(stree_program_t *prog, stree_csi_t *ctx,
     73    stree_taccess_t *taccess, tdata_item_t **res)
    7374{
    7475        stree_symbol_t *sym;
    75         rdata_titem_t *targ_i;
    76         rdata_titem_t *titem;
    77         rdata_tcsi_t *tcsi;
     76        tdata_item_t *targ_i;
     77        tdata_item_t *titem;
     78        tdata_object_t *tobject;
    7879        stree_csi_t *base_csi;
    7980
     
    8283#endif
    8384        /* Evaluate base type. */
    84         run_texpr(run, taccess->arg, &targ_i);
    85 
    86         if (targ_i->tic != tic_tcsi) {
    87                 printf("Error: Using '.' with type which is not CSI.\n");
     85        run_texpr(prog, ctx, taccess->arg, &targ_i);
     86
     87        if (targ_i->tic != tic_tobject) {
     88                printf("Error: Using '.' with type which is not an object.\n");
    8889                exit(1);
    8990        }
    9091
    9192        /* Get base CSI. */
    92         base_csi = targ_i->u.tcsi->csi;
    93 
    94         sym = symbol_lookup_in_csi(run->program, base_csi,
    95             taccess->member_name);
     93        base_csi = targ_i->u.tobject->csi;
     94
     95        sym = symbol_lookup_in_csi(prog, base_csi, taccess->member_name);
    9696        if (sym->sc != sc_csi) {
    9797                printf("Error: Symbol '");
    98                 symbol_print_fqn(run->program, sym);
     98                symbol_print_fqn(sym);
    9999                printf("' is not a CSI.\n");
    100100                exit(1);
     
    102102
    103103        /* Construct type item. */
    104         titem = rdata_titem_new(tic_tcsi);
    105         tcsi = rdata_tcsi_new();
    106         titem->u.tcsi = tcsi;
    107 
    108         tcsi->csi = sym->u.csi;
    109 
    110         *res = titem;
    111 }
    112 
    113 static void run_tindex(run_t *run, stree_tindex_t *tindex, rdata_titem_t **res)
    114 {
    115         rdata_titem_t *base_ti;
    116         rdata_titem_t *titem;
    117         rdata_tarray_t *tarray;
     104        titem = tdata_item_new(tic_tobject);
     105        tobject = tdata_object_new();
     106        titem->u.tobject = tobject;
     107
     108        tobject->static_ref = b_false;
     109        tobject->csi = sym->u.csi;
     110
     111        *res = titem;
     112}
     113
     114static void run_tindex(stree_program_t *prog, stree_csi_t *ctx,
     115    stree_tindex_t *tindex, tdata_item_t **res)
     116{
     117        tdata_item_t *base_ti;
     118        tdata_item_t *titem;
     119        tdata_array_t *tarray;
    118120        stree_expr_t *arg_expr;
    119121        list_node_t *arg_node;
     
    123125#endif
    124126        /* Evaluate base type. */
    125         run_texpr(run, tindex->base_type, &base_ti);
    126 
    127         /* Construct type item. */
    128         titem = rdata_titem_new(tic_tarray);
    129         tarray = rdata_tarray_new();
     127        run_texpr(prog, ctx, tindex->base_type, &base_ti);
     128
     129        /* Construct type item. */
     130        titem = tdata_item_new(tic_tarray);
     131        tarray = tdata_array_new();
    130132        titem->u.tarray = tarray;
    131133
     
    146148}
    147149
    148 static void run_tliteral(run_t *run, stree_tliteral_t *tliteral,
    149     rdata_titem_t **res)
    150 {
    151         rdata_titem_t *titem;
    152         rdata_tprimitive_t *tprimitive;
     150static void run_tliteral(stree_program_t *prog, stree_csi_t *ctx,
     151    stree_tliteral_t *tliteral, tdata_item_t **res)
     152{
     153        tdata_item_t *titem;
     154        tdata_primitive_t *tprimitive;
     155        tprimitive_class_t tpc;
    153156
    154157#ifdef DEBUG_RUN_TRACE
    155158        printf("Evaluating type literal.\n");
    156159#endif
    157 
    158         (void) run;
     160        (void) prog;
     161        (void) ctx;
    159162        (void) tliteral;
    160163
    161         /* Construct type item. */
    162         titem = rdata_titem_new(tic_tprimitive);
    163         tprimitive = rdata_tprimitive_new();
     164        switch (tliteral->tlc) {
     165        case tlc_int: tpc = tpc_int; break;
     166        case tlc_string: tpc = tpc_string; break;
     167        }
     168
     169        /* Construct type item. */
     170        titem = tdata_item_new(tic_tprimitive);
     171        tprimitive = tdata_primitive_new(tpc);
    164172        titem->u.tprimitive = tprimitive;
    165173
     
    167175}
    168176
    169 static void run_tnameref(run_t *run, stree_tnameref_t *tnameref,
    170     rdata_titem_t **res)
    171 {
    172         stree_csi_t *current_csi;
     177static void run_tnameref(stree_program_t *prog, stree_csi_t *ctx,
     178    stree_tnameref_t *tnameref, tdata_item_t **res)
     179{
    173180        stree_symbol_t *sym;
    174         rdata_titem_t *titem;
    175         rdata_tcsi_t *tcsi;
     181        tdata_item_t *titem;
     182        tdata_object_t *tobject;
    176183
    177184#ifdef DEBUG_RUN_TRACE
    178185        printf("Evaluating type name reference.\n");
    179186#endif
    180         current_csi = run_get_current_csi(run);
    181         sym = symbol_lookup_in_csi(run->program, current_csi, tnameref->name);
     187        sym = symbol_lookup_in_csi(prog, ctx, tnameref->name);
    182188
    183189        if (sym->sc != sc_csi) {
    184190                printf("Error: Symbol '");
    185                 symbol_print_fqn(run->program, sym);
     191                symbol_print_fqn(sym);
    186192                printf("' is not a CSI.\n");
    187193                exit(1);
     
    189195
    190196        /* Construct type item. */
    191         titem = rdata_titem_new(tic_tcsi);
    192         tcsi = rdata_tcsi_new();
    193         titem->u.tcsi = tcsi;
    194 
    195         tcsi->csi = sym->u.csi;
    196 
    197         *res = titem;
    198 }
     197        titem = tdata_item_new(tic_tobject);
     198        tobject = tdata_object_new();
     199        titem->u.tobject = tobject;
     200
     201        tobject->static_ref = b_false;
     202        tobject->csi = sym->u.csi;
     203
     204        *res = titem;
     205}
  • uspace/app/sbi/src/run_texpr.h

    r6ba20a6b r39e8406  
    3232#include "mytypes.h"
    3333
    34 void run_texpr(run_t *run, stree_texpr_t *texpr, rdata_titem_t **res);
     34void run_texpr(stree_program_t *prog, stree_csi_t *ctx, stree_texpr_t *texpr,
     35    tdata_item_t **res);
    3536
    3637#endif
  • uspace/app/sbi/src/stree.c

    r6ba20a6b r39e8406  
    136136}
    137137
     138stree_proc_t *stree_proc_new(void)
     139{
     140        stree_proc_t *proc;
     141
     142        proc = calloc(1, sizeof(stree_proc_t));
     143        if (proc == NULL) {
     144                printf("Memory allocation failed.\n");
     145                exit(1);
     146        }
     147
     148        return proc;
     149}
     150
    138151stree_proc_arg_t *stree_proc_arg_new(void)
    139152{
     
    507520}
    508521
    509 stree_tliteral_t *stree_tliteral_new(void)
     522stree_tliteral_t *stree_tliteral_new(tliteral_class_t tlc)
    510523{
    511524        stree_tliteral_t *tliteral;
     
    517530        }
    518531
     532        tliteral->tlc = tlc;
    519533        return tliteral;
    520534}
  • uspace/app/sbi/src/stree.h

    r6ba20a6b r39e8406  
    4040stree_prop_t *stree_prop_new(void);
    4141
     42stree_proc_t *stree_proc_new(void);
    4243stree_proc_arg_t *stree_proc_arg_new(void);
    4344stree_arg_attr_t *stree_arg_attr_new(arg_attr_class_t aac);
     
    7374stree_tapply_t *stree_tapply_new(void);
    7475stree_tindex_t *stree_tindex_new(void);
    75 stree_tliteral_t *stree_tliteral_new(void);
     76stree_tliteral_t *stree_tliteral_new(tliteral_class_t tlc);
    7677stree_tnameref_t *stree_tnameref_new(void);
    7778
  • uspace/app/sbi/src/stree_t.h

    r6ba20a6b r39e8406  
    8282/** Binary operation class */
    8383typedef enum {
    84         bo_period,
    85         bo_slash,
    86         bo_sbr,
    8784        bo_equal,
    8885        bo_notequal,
     
    178175        expr_class_t ec;
    179176
     177        struct tdata_item *titem;
     178
    180179        union {
    181180                stree_nameref_t *nameref;
     
    379378} stree_proc_arg_t;
    380379
     380/** Procedure
     381 *
     382 * Procedure is the common term for a getter, setter or function body.
     383 * A procedure can be invoked. However, the arguments are specified by
     384 * the containing symbol.
     385 */
     386typedef struct stree_proc {
     387        /** Symbol (function or property) containing the procedure */
     388        struct stree_symbol *outer_symbol;
     389
     390        /** Main block */
     391        stree_block_t *body;
     392} stree_proc_t;
     393
    381394/** Member function declaration */
    382 typedef struct {
     395typedef struct stree_fun {
    383396        /** Function name */
    384397        stree_ident_t *name;
     
    396409        stree_texpr_t *rtype;
    397410
    398         /** Function body */
    399         stree_block_t *body;
     411        /** Function implementation */
     412        stree_proc_t *proc;
    400413} stree_fun_t;
    401414
    402415/** Member variable declaration */
    403 typedef struct {
     416typedef struct stree_var {
    404417        stree_ident_t *name;
    405418        struct stree_symbol *symbol;
     
    408421
    409422/** Member property declaration */
    410 typedef struct {
     423typedef struct stree_prop {
    411424        stree_ident_t *name;
    412425        struct stree_symbol *symbol;
    413426        stree_texpr_t *type;
    414427
    415         stree_block_t *getter_body;
    416         stree_ident_t *setter_arg_name;
    417         stree_block_t *setter_body;
     428        stree_proc_t *getter;
     429
     430        stree_proc_t *setter;
     431        stree_proc_arg_t *setter_arg;
    418432
    419433        /** Formal parameters (for indexed properties) */
     
    425439
    426440/**
    427  * Fake identifier used with indexed properties. (Mostly for error messages.)
     441 * Fake identifiers used with symbols that do not really have one.
     442 * (Mostly for error messages.)
    428443 */
    429444#define INDEXER_IDENT "$indexer"
     
    504519} symbol_class_t;
    505520
    506 /** Symbol */
     521/** Symbol
     522 *
     523 * A symbol is a common superclass of different program elements that
     524 * allow us to refer to them, print their fully qualified names, etc.
     525 */
    507526typedef struct stree_symbol {
    508527        symbol_class_t sc;
  • uspace/app/sbi/src/symbol.c

    r6ba20a6b r39e8406  
    322322
    323323/** Print fully qualified name of symbol. */
    324 void symbol_print_fqn(stree_program_t *prog, stree_symbol_t *symbol)
     324void symbol_print_fqn(stree_symbol_t *symbol)
    325325{
    326326        stree_ident_t *name;
     
    329329        if (symbol->outer_csi != NULL) {
    330330                outer_sym = csi_to_symbol(symbol->outer_csi);
    331                 symbol_print_fqn(prog, outer_sym);
     331                symbol_print_fqn( outer_sym);
    332332                printf(".");
    333333        }
  • uspace/app/sbi/src/symbol.h

    r6ba20a6b r39e8406  
    4949stree_symbol_t *prop_to_symbol(stree_prop_t *prop);
    5050
    51 void symbol_print_fqn(stree_program_t *prog, stree_symbol_t *symbol);
     51void symbol_print_fqn(stree_symbol_t *symbol);
    5252
    5353#endif
Note: See TracChangeset for help on using the changeset viewer.