Index: uspace/app/sbi/src/run.c
===================================================================
--- uspace/app/sbi/src/run.c	(revision d0febca9f86b5690d11fec7c645836a758567fe6)
+++ uspace/app/sbi/src/run.c	(revision 39e8406404efea86e341847c0720d5d65bed7959)
@@ -43,4 +43,5 @@
 #include "strtab.h"
 #include "symbol.h"
+#include "tdata.h"
 
 #include "run.h"
@@ -57,4 +58,5 @@
 
 static bool_t run_exc_match(run_t *run, stree_except_t *except_c);
+static rdata_var_t *run_aprop_get_tpos(run_t *run, rdata_address_t *aprop);
 
 static void run_aprop_read(run_t *run, rdata_addr_prop_t *addr_prop,
@@ -102,5 +104,5 @@
 
 #ifdef DEBUG_RUN_TRACE
-	printf("Found function '"); symbol_print_fqn(prog, main_fun_sym);
+	printf("Found function '"); symbol_print_fqn(main_fun_sym);
 	printf("'.\n");
 #endif
@@ -108,5 +110,5 @@
 	/* Run function @c main. */
 	list_init(&main_args);
-	run_proc_ar_create(run, NULL, main_fun_sym, main_fun->body, &proc_ar);
+	run_proc_ar_create(run, NULL, main_fun->proc, &proc_ar);
 	run_proc_ar_set_args(run, proc_ar, &main_args);
 	run_proc(run, proc_ar, &res);
@@ -123,12 +125,12 @@
 void run_proc(run_t *run, run_proc_ar_t *proc_ar, rdata_item_t **res)
 {
-	stree_symbol_t *proc_sym;
+	stree_proc_t *proc;
 	list_node_t *node;
 
-	proc_sym = proc_ar->proc_sym;
+	proc = proc_ar->proc;
 
 #ifdef DEBUG_RUN_TRACE
 	printf("Start executing function '");
-	symbol_print_fqn(run->program, proc_sym);
+	symbol_print_fqn(proc_sym);
 	printf("'.\n");
 #endif
@@ -137,8 +139,8 @@
 
 	/* Run main procedure block. */
-	if (proc_ar->proc_block != NULL) {
-		run_block(run, proc_ar->proc_block);
+	if (proc->body != NULL) {
+		run_block(run, proc->body);
 	} else {
-		builtin_run_proc(run, proc_sym);
+		builtin_run_proc(run, proc);
 	}
 
@@ -157,5 +159,5 @@
 #ifdef DEBUG_RUN_TRACE
 	printf("Done executing procedure '");
-	symbol_print_fqn(run->program, proc_sym);
+	symbol_print_fqn(proc);
 	printf("'.\n");
 
@@ -469,5 +471,5 @@
 	rdata_var_t *payload_v;
 	rdata_object_t *payload_o;
-	rdata_titem_t *etype;
+	tdata_item_t *etype;
 
 	payload = run->thread_ar->exc_payload;
@@ -491,5 +493,5 @@
 #ifdef DEBUG_RUN_TRACE
 	printf("Active exception: '");
-	symbol_print_fqn(run->program, payload_o->class_sym);
+	symbol_print_fqn(payload_o->class_sym);
 	printf("'.\n");
 #endif
@@ -498,7 +500,8 @@
 
 	/* Evaluate type expression in except clause. */
-	run_texpr(run, except_c->etype, &etype);
-
-	return rdata_is_csi_derived_from_ti(payload_o->class_sym->u.csi,
+	run_texpr(run->program, run_get_current_csi(run), except_c->etype,
+	    &etype);
+
+	return tdata_is_csi_derived_from_ti(payload_o->class_sym->u.csi,
 	    etype);
 }
@@ -556,5 +559,5 @@
 
 	proc_ar = run_get_current_proc_ar(run);
-	return proc_ar->proc_sym->outer_csi;
+	return proc_ar->proc->outer_symbol->outer_csi;
 }
 
@@ -606,6 +609,6 @@
 
 /** Construct a function AR. */
-void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_symbol_t *proc_sym,
-    stree_block_t *proc_block, run_proc_ar_t **rproc_ar)
+void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_proc_t *proc,
+    run_proc_ar_t **rproc_ar)
 {
 	run_proc_ar_t *proc_ar;
@@ -617,6 +620,5 @@
 	proc_ar = run_proc_ar_new();
 	proc_ar->obj = obj;
-	proc_ar->proc_sym = proc_sym;
-	proc_ar->proc_block = proc_block;
+	proc_ar->proc = proc;
 	list_init(&proc_ar->block_ar);
 
@@ -642,4 +644,5 @@
 	list_t *args;
 	stree_proc_arg_t *varg;
+	stree_symbol_t *outer_symbol;
 
 	run_block_ar_t *block_ar;
@@ -655,19 +658,22 @@
 	int n_vargs, idx;
 
+	(void) run;
+
 	/* AR should have been created with run_proc_ar_create(). */
-	assert(proc_ar->proc_sym != NULL);
+	assert(proc_ar->proc != NULL);
+	outer_symbol = proc_ar->proc->outer_symbol;
 
 	/*
-	 * The procedure being activated should be a member function or
+	 * The procedure being activated should belong to a member function or
 	 * property getter/setter.
 	 */
-	switch (proc_ar->proc_sym->sc) {
+	switch (outer_symbol->sc) {
 	case sc_fun:
-		fun = symbol_to_fun(proc_ar->proc_sym);
+		fun = symbol_to_fun(outer_symbol);
 		args = &fun->args;
 		varg = fun->varg;
 		break;
 	case sc_prop:
-		prop = symbol_to_prop(proc_ar->proc_sym);
+		prop = symbol_to_prop(outer_symbol);
 		args = &prop->args;
 		varg = prop->varg;
@@ -688,6 +694,6 @@
 	while (parg_n != NULL) {
 		if (rarg_n == NULL) {
-			printf("Error: Too few arguments to function '");
-			symbol_print_fqn(run->program, proc_ar->proc_sym);
+			printf("Error: Too few arguments to '");
+			symbol_print_fqn(outer_symbol);
 			printf("'.\n");
 			exit(1);
@@ -752,6 +758,6 @@
 	/* Check for excess real parameters. */
 	if (rarg_n != NULL) {
-		printf("Error: Too many arguments to function '");
-		symbol_print_fqn(run->program, proc_ar->proc_sym);
+		printf("Error: Too many arguments to '");
+		symbol_print_fqn(outer_symbol);
 		printf("'.\n");
 		exit(1);
@@ -775,9 +781,10 @@
 
 	/* AR should have been created with run_proc_ar_create(). */
-	assert(proc_ar->proc_sym != NULL);
-
-	/* The procedure being activated should be a property setter. */
-	prop = symbol_to_prop(proc_ar->proc_sym);
+	assert(proc_ar->proc != NULL);
+
+	/* The procedure being activated should belong to a property setter. */
+	prop = symbol_to_prop(proc_ar->proc->outer_symbol);
 	assert(prop != NULL);
+	assert(proc_ar->proc == prop->setter);
 
 	/* Fetch first block activation record. */
@@ -792,5 +799,5 @@
 
 	/* Declare variable using name of formal argument. */
-	intmap_set(&block_ar->vars, prop->setter_arg_name->sid, var);
+	intmap_set(&block_ar->vars, prop->setter_arg->name->sid, var);
 }
 
@@ -806,5 +813,5 @@
 		printf(" * ");
 		proc_ar = list_node_data(node, run_proc_ar_t *);
-		symbol_print_fqn(run->program, proc_ar->proc_sym);
+		symbol_print_fqn(proc_ar->proc->outer_symbol);
 		printf("\n");
 
@@ -844,4 +851,69 @@
 }
 
+/** Get item var-class.
+ *
+ * Get var-class of @a item, regardless whether it is a value or address.
+ * (I.e. the var class of the value or variable at the given address).
+ */
+var_class_t run_item_get_vc(run_t *run, rdata_item_t *item)
+{
+	var_class_t vc;
+	rdata_var_t *tpos;
+
+	(void) run;
+
+	switch (item->ic) {
+	case ic_value:
+		vc = item->u.value->var->vc;
+		break;
+	case ic_address:
+		switch (item->u.address->ac) {
+		case ac_var:
+			vc = item->u.address->u.var_a->vref->vc;
+			break;
+		case ac_prop:
+			/* Prefetch the value of the property. */
+			tpos = run_aprop_get_tpos(run, item->u.address);
+			vc = tpos->vc;
+			break;
+		default:
+			assert(b_false);
+		}
+		break;
+	default:
+		assert(b_false);
+	}
+
+	return vc;
+}
+
+/** Get pointer to current var node in temporary copy in property address.
+ *
+ * A property address refers to a specific @c var node in a property.
+ * This function will fetch a copy of the property value (by running
+ * its getter) if there is not a temporary copy in the address yet.
+ * It returns a pointer to the relevant @c var node in the temporary
+ * copy.
+ *
+ * @param run	Runner object.
+ * @param addr	Address of class @c ac_prop.
+ * @param	Pointer to var node.
+ */
+static rdata_var_t *run_aprop_get_tpos(run_t *run, rdata_address_t *addr)
+{
+	rdata_item_t *ritem;
+
+	assert(addr->ac == ac_prop);
+
+	if (addr->u.prop_a->tvalue == NULL) {
+		/* Fetch value of the property. */
+		run_address_read(run, addr, &ritem);
+		assert(ritem->ic == ic_value);
+		addr->u.prop_a->tvalue = ritem->u.value;
+		addr->u.prop_a->tpos = addr->u.prop_a->tvalue->var;
+	}
+
+	return addr->u.prop_a->tpos;
+}
 
 /** Read data from an address.
@@ -894,4 +966,6 @@
 
 	run_proc_ar_t *proc_ar;
+
+	rdata_var_t *cvar;
 
 #ifdef DEBUG_RUN_TRACE
@@ -903,6 +977,10 @@
 	 */
 	if (addr_prop->tvalue != NULL) {
-		printf("Unimplemented: Property field access.\n");
-		exit(1);
+		/* Copy the value */
+		rdata_var_copy(addr_prop->tpos, &cvar);
+		*ritem = rdata_item_new(ic_value);
+		(*ritem)->u.value = rdata_value_new();
+		(*ritem)->u.value->var = cvar;
+		return;
 	}
 
@@ -917,5 +995,5 @@
 	assert(prop != NULL);
 
-	if (prop->getter_body == NULL) {
+	if (prop->getter == NULL) {
 		printf("Error: Property is not readable.\n");
 		exit(1);
@@ -923,5 +1001,5 @@
 
 	/* Create procedure activation record. */
-	run_proc_ar_create(run, obj, prop_sym, prop->getter_body, &proc_ar);
+	run_proc_ar_create(run, obj, prop->getter, &proc_ar);
 
 	/* Fill in arguments (indices). */
@@ -973,5 +1051,5 @@
 	assert(prop != NULL);
 
-	if (prop->setter_body == NULL) {
+	if (prop->setter == NULL) {
 		printf("Error: Property is not writable.\n");
 		exit(1);
@@ -982,5 +1060,5 @@
 
 	/* Create procedure activation record. */
-	run_proc_ar_create(run, obj, prop_sym, prop->setter_body, &proc_ar);
+	run_proc_ar_create(run, obj, prop->setter, &proc_ar);
 
 	/* Fill in arguments (indices). */
