comparison src/lwasm.c @ 94:83ba34ed11b3

Fixed problem with constant expressions evaluating to 0 when they shouldn't
author lost
date Sat, 17 Jan 2009 06:50:49 +0000
parents 34ca1c6e9550
children 81fc353d4d69
comparison
equal deleted inserted replaced
93:34ca1c6e9550 94:83ba34ed11b3
410 return -1; 410 return -1;
411 } 411 }
412 *inp = (char *)ep; 412 *inp = (char *)ep;
413 if (slot >= 0) 413 if (slot >= 0)
414 { 414 {
415 l -> exprends[slot] = ep; 415 l -> exprends[slot] = (char *)ep;
416 l -> exprvals[slot] = lwasm_expr_get_value(s); 416 l -> exprvals[slot] = lwasm_expr_get_value(s);
417 } 417 }
418 } 418 }
419 else if (l -> exprs[slot]) 419 else if (l -> exprs[slot])
420 { 420 {
425 if (as -> passnum == 2 && slot >= 0) 425 if (as -> passnum == 2 && slot >= 0)
426 *inp = l -> exprends[slot]; 426 *inp = l -> exprends[slot];
427 427
428 if (s && lwasm_expr_is_constant(s)) 428 if (s && lwasm_expr_is_constant(s))
429 { 429 {
430 *val = lwasm_expr_get_value(s);
430 lwasm_expr_stack_free(s); 431 lwasm_expr_stack_free(s);
431 l -> exprs[slot] = NULL; 432 l -> exprs[slot] = NULL;
432 s = NULL; 433 s = NULL;
434 return 0;
433 } 435 }
434 436
435 if (!s && slot >= 0) 437 if (!s && slot >= 0)
436 { 438 {
437 *val = l -> exprvals[slot]; 439 *val = l -> exprvals[slot];