if (current == TokenType.DOT || current == TokenType.HASH) {
if (is_glob) {
- Report.error (get_src (begin), "expected glob-style pattern");
+ scanner.source_file.context.report.log_error (get_src (begin), "expected glob-style pattern");
} else {
- Report.error (get_src (begin), "expected identifier");
+ scanner.source_file.context.report.log_error (get_src (begin), "expected identifier");
}
return null;
}
} else {
// relative pattern
if (current != TokenType.DOT) {
- Report.error (get_current_src (), "expected pattern or `.', got `%s'", current.to_string ());
+ scanner.source_file.context.report.log_error (get_current_src (), "expected pattern or `.', got `%s'", current.to_string ());
return null;
}
next ();
}
if (parent_metadata == null) {
- Report.error (get_current_src (), "cannot determinate parent metadata");
+ scanner.source_file.context.report.log_error (get_current_src (), "cannot determinate parent metadata");
return null;
}
while (current != TokenType.EOF && !has_space ()) {
if (current != TokenType.DOT) {
- Report.error (get_current_src (), "expected `.' got `%s'", current.to_string ());
+ scanner.source_file.context.report.log_error (get_current_src (), "expected `.' got `%s'", current.to_string ());
break;
}
next ();
next ();
var inner = parse_expression ();
if (inner == null) {
- Report.error (src, "expected expression after `-', got `%s'", current.to_string ());
+ scanner.source_file.context.report.log_error (src, "expected expression after `-', got `%s'", current.to_string ());
} else {
expr = new UnaryExpression (UnaryOperator.MINUS, inner, get_src (begin));
}
expr = new MemberAccess (null, get_string (), src);
while (next () == TokenType.DOT) {
if (next () != TokenType.IDENTIFIER) {
- Report.error (get_current_src (), "expected identifier got `%s'", current.to_string ());
+ scanner.source_file.context.report.log_error (get_current_src (), "expected identifier got `%s'", current.to_string ());
break;
}
expr = new MemberAccess (expr, get_string (), get_current_src ());
case TokenType.OPEN_PARENS:
// empty tuple => no expression
if (next () != TokenType.CLOSE_PARENS) {
- Report.error (get_current_src (), "expected `)', got `%s'", current.to_string ());
+ scanner.source_file.context.report.log_error (get_current_src (), "expected `)', got `%s'", current.to_string ());
break;
}
expr = new Tuple (src);
break;
default:
- Report.error (src, "expected literal or symbol got %s", current.to_string ());
+ scanner.source_file.context.report.log_error (src, "expected literal or symbol got %s", current.to_string ());
break;
}
next ();
if (node.new_symbol && !node.merged && !metadata.get_bool (ArgumentType.HIDDEN)) {
if (symbol.name == null || node.lookup (symbol.name) == null) {
- add_symbol_to_container (symbol, node.symbol);
+ add_symbol_to_container (parser.context, symbol, node.symbol);
}
}
}
do {
next ();
if (current_token == MarkupTokenType.EOF) {
- Report.error (get_current_src (), "unexpected end of file");
+ context.report.log_error (get_current_src (), "unexpected end of file");
return;
}
} while (current_token != MarkupTokenType.START_ELEMENT && reader.name != "repository");
void start_element (string name) {
if (current_token != MarkupTokenType.START_ELEMENT || reader.name != name) {
// error
- Report.error (get_current_src (), "expected start element of `%s'", name);
+ context.report.log_error (get_current_src (), "expected start element of `%s'", name);
}
}
const string GIR_VERSION = "1.2";
- static void add_symbol_to_container (Symbol container, Symbol sym) {
+ static void add_symbol_to_container (CodeContext context, Symbol container, Symbol sym) {
if (container is Class) {
unowned Class cl = (Class) container;
ed.add_method ((Method) sym);
}
} else {
- Report.error (sym.source_reference, "impossible to add `%s' to container `%s'", sym.name, container.name);
+ context.report.log_error (sym.source_reference, "impossible to add `%s' to container `%s'", sym.name, container.name);
}
}
sym = new UnresolvedSymbol (sym, s, source_reference);
}
if (sym == null) {
- Report.error (source_reference, "a symbol must be specified");
+ context.report.log_error (source_reference, "a symbol must be specified");
}
return sym;
}
GLib.MatchInfo match;
if (!type_from_string_regex.match (type_string, 0, out match)) {
- Report.error (source_reference, "unable to parse type");
+ context.report.log_error (source_reference, "unable to parse type");
return null;
}
}
return type;
} else {
- Report.error (source_reference, "invalid void type");
+ context.report.log_error (source_reference, "invalid void type");
return null;
}
}
if (ownership_data == "owned") {
if (owned_by_default) {
- Report.error (source_reference, "unexpected `owned' keyword");
+ context.report.log_error (source_reference, "unexpected `owned' keyword");
} else {
value_owned = true;
}
if (owned_by_default) {
value_owned = false;
} else {
- Report.error (source_reference, "unexpected `unowned' keyword");
+ context.report.log_error (source_reference, "unexpected `unowned' keyword");
return null;
}
}
void parse_repository () {
start_element ("repository");
if (reader.get_attribute ("version") != GIR_VERSION) {
- Report.error (get_current_src (), "unsupported GIR version %s (supported: %s)", reader.get_attribute ("version"), GIR_VERSION);
+ context.report.log_error (get_current_src (), "unsupported GIR version %s (supported: %s)", reader.get_attribute ("version"), GIR_VERSION);
return;
}
next ();
parse_c_include ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `repository'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `repository'", reader.name);
skip_element ();
}
}
} else if (current_token == MarkupTokenType.END_ELEMENT) {
level--;
} else if (current_token == MarkupTokenType.EOF) {
- Report.error (get_current_src (), "unexpected end of file");
+ context.report.log_error (get_current_src (), "unexpected end of file");
break;
}
next ();
skip_element ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `namespace'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `namespace'", reader.name);
skip_element ();
}
skip_element ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `%s'", reader.name, element_name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `%s'", reader.name, element_name);
skip_element ();
}
}
if (!has_member) {
- Report.error (get_current_src (), "%s `%s' has no members", element_name, current.name);
+ context.report.log_error (get_current_src (), "%s `%s' has no members", element_name, current.name);
}
if (common_prefix != null) {
string element_type = reader.name;
if (current_token != MarkupTokenType.START_ELEMENT || (element_type != "parameter" && element_type != "instance-parameter")) {
- Report.error (get_current_src (), "expected start element of `parameter' or `instance-parameter'");
+ context.report.log_error (get_current_src (), "expected start element of `parameter' or `instance-parameter'");
}
start_element (element_type);
var name = metadata.get_string (ArgumentType.NAME);
no_array_length = false;
array_null_terminated = false;
type = new InvalidType ();
- Report.error (get_current_src (), "empty type element");
+ context.report.log_error (get_current_src (), "empty type element");
}
// type arguments / element types
parse_union ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `record'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `record'", reader.name);
skip_element ();
}
parse_signal ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `class'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `class'", reader.name);
skip_element ();
}
parse_signal ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `interface'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `interface'", reader.name);
skip_element ();
}
s.set_attribute_double ("CCode", "instance_pos", instance_idx + 0.5);
}
} else {
- Report.error (get_current_src (), "instance_idx required when converting function to method");
+ context.report.log_error (get_current_src (), "instance_idx required when converting function to method");
}
}
parse_union ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `class'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `class'", reader.name);
skip_element ();
}
parse_field ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `transparent union'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `transparent union'", reader.name);
skip_element ();
}
parse_record ();
} else {
// error
- Report.error (get_current_src (), "unknown child element `%s' in `union'", reader.name);
+ context.report.log_error (get_current_src (), "unknown child element `%s' in `union'", reader.name);
skip_element ();
}
if (return_type is ArrayType && node.return_array_length_idx >= 0) {
if (node.return_array_length_idx >= parameters.size) {
- Report.error (return_type.source_reference, "invalid array length index");
+ context.report.log_error (return_type.source_reference, "invalid array length index");
} else {
parameters[node.return_array_length_idx].keep = false;
node.array_length_parameters.add (node.return_array_length_idx);
if (info.array_length_idx != -1) {
if ((info.array_length_idx) >= parameters.size) {
- Report.error (info.param.source_reference, "invalid array_length index");
+ context.report.log_error (info.param.source_reference, "invalid array_length index");
continue;
}
set_array_ccode (info.param, parameters[info.array_length_idx]);
if (info.closure_idx != -1) {
if ((info.closure_idx) >= parameters.size) {
- Report.error (info.param.source_reference, "invalid closure index");
+ context.report.log_error (info.param.source_reference, "invalid closure index");
continue;
}
if ("%g".printf (parameters[info.closure_idx].vala_idx) != "%g".printf (info.vala_idx + 0.1)) {
}
if (info.destroy_idx != -1) {
if (info.destroy_idx >= parameters.size) {
- Report.error (info.param.source_reference, "invalid destroy index");
+ context.report.log_error (info.param.source_reference, "invalid destroy index");
continue;
}
if ("%g".printf (parameters[info.destroy_idx].vala_idx) != "%g".printf (info.vala_idx + 0.2)) {
void process_virtual_method_field (Node node, Delegate d, UnresolvedSymbol gtype_struct_for) {
var gtype_node = resolve_node (node.parent, gtype_struct_for);
if (gtype_node == null || !(gtype_node.symbol is ObjectTypeSymbol)) {
- Report.error (gtype_struct_for.source_reference, "Unknown symbol `%s' for virtual method field `%s'", gtype_struct_for.to_string (), node.to_string ());
+ context.report.log_error (gtype_struct_for.source_reference, "Unknown symbol `%s' for virtual method field `%s'", gtype_struct_for.to_string (), node.to_string ());
}
var nodes = gtype_node.lookup_all (d.name);
if (nodes == null) {