b.add_expression (it_expr);
}
b.add_else ();
- b.add_assignment (expression (notfirst), expression ("true"));
+ statements (@"$notfirst = true;");
b.close ();
if (stmt.condition != null && !always_true (stmt.condition)) {
- b.open_if (new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, stmt.condition, stmt.source_reference));
- b.add_break ();
- b.close ();
+ statements (@"if (!$(stmt.condition)) break;");
}
b.add_statement (stmt.body);
begin_replace_expression (expr);
var result = b.add_temp_declaration (expr.value_type);
- b.open_if (expr.condition);
- b.add_assignment (expression (result), expr.true_expression);
- b.add_else ();
- b.add_assignment (expression (result), expr.false_expression);
- b.close ();
+ statements (@"if ($(expr.condition)) {
+ $result = $(expr.true_expression);
+ } else {
+ $result = $(expr.false_expression);
+ }");
replacement = return_temp_access (result, expr.value_type, target_type, formal_target_type);
end_replace_expression (replacement);
return new Parser().parse_expression_string (str, source_reference);
}
+ public void statements (string str) {
+ new Parser().parse_statements_string (str, current_block, source_reference);
+ }
+
// only qualified types, will slightly simplify the work of SymbolResolver
public static Symbol? symbol_from_string (string symbol_string, Symbol? parent_symbol = null) {
Symbol sym = parent_symbol != null ? parent_symbol : CodeContext.get().root;
return b.expression (str);
}
+ public void statements (string str) {
+ b.statements (str);
+ }
+
public void check (CodeNode node) {
var sym = context.analyzer.get_current_symbol (node);
if (sym != null) {