}
public virtual CCodeExpression? deserialize_expression (DataType type, CCodeExpression variant_expr, CCodeExpression? expr, CCodeExpression? error_expr = null, out bool may_fail = null) {
- return null;
+ assert_not_reached ();
}
public virtual CCodeExpression? serialize_expression (DataType type, CCodeExpression expr) {
- return null;
+ assert_not_reached ();
}
public override void visit_cast_expression (CastExpression expr) {
ccode.add_expression (get_fd);
ccode.add_assignment (target_expr, stream);
+ may_fail = false;
} else {
read_expression (type, iter_expr, target_expr, sym, error_expr, out may_fail);
}
return true;
}
}
+ basic_type = BasicTypeInfo ();
return false;
}
public override CCodeExpression? deserialize_expression (DataType type, CCodeExpression variant_expr, CCodeExpression? expr, CCodeExpression? error_expr = null, out bool may_fail = null) {
BasicTypeInfo basic_type;
CCodeExpression result = null;
+ may_fail = false;
if (is_string_marshalled_enum (type.data_type)) {
get_basic_type_info ("s", out basic_type);
result = deserialize_basic (basic_type, variant_expr, true);
if (sym != null && get_dbus_signature (sym) != null) {
// raw GVariant
ccode.add_assignment (target_expr, iter_call);
+ may_fail = false;
return;
}
public TokenType read_regex_token (out SourceLocation token_begin, out SourceLocation token_end) {
TokenType type;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
int token_length_in_chars = -1;
column += token_length_in_chars;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
return type;
}
public TokenType read_template_token (out SourceLocation token_begin, out SourceLocation token_end) {
TokenType type;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
int token_length_in_chars = -1;
column += token_length_in_chars;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
return type;
}
} else if (in_template_part ()) {
state_stack.length--;
- token_begin.pos = current;
- token_begin.line = line;
- token_begin.column = column;
-
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_begin = SourceLocation (current, line, column);
+ token_end = SourceLocation (current, line, column - 1);
return TokenType.COMMA;
} else if (in_regex_literal ()) {
pending_dedents--;
indent_level--;
-
- token_begin.pos = current;
- token_begin.line = line;
- token_begin.column = column;
-
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column;
+ token_begin = SourceLocation (current, line, column);
+ token_end = SourceLocation (current, line, column);
last_token = TokenType.DEDENT;
/* handle non-consecutive new line once parsing is underway - EOL */
if (newline () && parse_started && last_token != TokenType.EOL && last_token != TokenType.SEMICOLON) {
- token_begin.pos = current;
- token_begin.line = line;
- token_begin.column = column;
-
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column;
+ token_begin = SourceLocation (current, line, column);
+ token_end = SourceLocation (current, line, column);
last_token = TokenType.EOL;
while (skip_newlines ()) {
- token_begin.pos = current;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (current, line, column);
current_indent_level = count_tabs ();
if (current_indent_level > indent_level) {
indent_level = current_indent_level;
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column;
+ token_end = SourceLocation (current, line, column);
last_token = TokenType.INDENT;
indent_level--;
pending_dedents = (indent_level - current_indent_level);
-
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column;
+ token_end = SourceLocation (current, line, column);
last_token = TokenType.DEDENT;
TokenType type;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
int token_length_in_chars = -1;
column += token_length_in_chars;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
last_token = type;
return type;
DataType parse_type (out string? ctype = null, out int array_length_idx = null, bool transfer_elements = true, out bool no_array_length = null, out bool array_null_terminated = null) {
bool is_array = false;
string type_name = reader.get_attribute ("name");
+ ctype = null;
array_length_idx = -1;
no_array_length = true;
if (empty_element) {
empty_element = false;
+ token_begin = SourceLocation (begin, line, column);
+ token_end = SourceLocation (begin, line, column);
return MarkupTokenType.END_ELEMENT;
}
MarkupTokenType type = MarkupTokenType.NONE;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
if (current >= end) {
type = MarkupTokenType.EOF;
type = MarkupTokenType.TEXT;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
return type;
}
return false;
}
+ invalid_match = null;
return true;
}
public TokenType read_regex_token (out SourceLocation token_begin, out SourceLocation token_end) {
TokenType type;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
int token_length_in_chars = -1;
column += token_length_in_chars;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
return type;
}
public TokenType read_template_token (out SourceLocation token_begin, out SourceLocation token_end) {
TokenType type;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
int token_length_in_chars = -1;
column += token_length_in_chars;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
return type;
}
} else if (in_template_part ()) {
state_stack.length--;
- token_begin.pos = current;
- token_begin.line = line;
- token_begin.column = column;
-
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_begin = SourceLocation (current, line, column);
+ token_end = SourceLocation (current, line, column - 1);
return TokenType.COMMA;
} else if (in_regex_literal ()) {
TokenType type;
char* begin = current;
- token_begin.pos = begin;
- token_begin.line = line;
- token_begin.column = column;
+ token_begin = SourceLocation (begin, line, column);
int token_length_in_chars = -1;
column += token_length_in_chars;
}
- token_end.pos = current;
- token_end.line = line;
- token_end.column = column - 1;
+ token_end = SourceLocation (current, line, column - 1);
previous = type;
return type;
}
private DataType? parse_type (IdlNodeType type_node, out ParameterDirection direction = null) {
- ParameterDirection dir = ParameterDirection.IN;
+ direction = ParameterDirection.IN;
var type = new UnresolvedType ();
if (type_node.tag == TypeTag.VOID) {
(n == "gchar" || n == "char")) {
type.unresolved_symbol = new UnresolvedSymbol (null, "string");
if (type_node.unparsed.has_suffix ("**")) {
- dir = ParameterDirection.OUT;
+ direction = ParameterDirection.OUT;
}
} else if (n == "gunichar") {
type.unresolved_symbol = new UnresolvedSymbol (null, "unichar");
}
if (is_simple_type (n)) {
if (type_node.is_pointer) {
- dir = ParameterDirection.OUT;
+ direction = ParameterDirection.OUT;
}
} else if (type_node.unparsed.has_suffix ("**")) {
- dir = ParameterDirection.OUT;
+ direction = ParameterDirection.OUT;
}
}
} else {
stdout.printf ("%d\n", type_node.tag);
}
- if (&direction != null) {
- direction = dir;
- }
return type;
}