void report_parse_error (ParseError e) {
var begin = get_location ();
next ();
- Report.error (get_src (begin), "syntax error, %s", e.message);
+ context.report.log_error (get_src (begin), "syntax error, %s", e.message);
}
inline bool expect (TokenType type) throws ParseError {
// FIXME validate and unescape here and just pass unichar to CharacterLiteral
var lit = new CharacterLiteral (get_last_string (), get_src (begin));
if (lit.error) {
- Report.error (lit.source_reference, "invalid character literal");
+ context.report.log_error (lit.source_reference, "invalid character literal");
}
return lit;
case TokenType.REGEX_LITERAL:
value_owned = false;
} else if (accept (TokenType.WEAK)) {
if (!can_weak_ref && !context.deprecated) {
- Report.warning (get_src (begin), "deprecated syntax, use `unowned` modifier");
+ context.report.log_warning (get_src (begin), "deprecated syntax, use `unowned` modifier");
}
value_owned = false;
}
unowned MethodCall? call = expr as MethodCall;
unowned ObjectCreationExpression? object_creation = expr as ObjectCreationExpression;
if (call == null && object_creation == null) {
- Report.error (expr.source_reference, "syntax error, expected method call");
+ context.report.log_error (expr.source_reference, "syntax error, expected method call");
throw new ParseError.SYNTAX ("expected method call");
}
if (!accept (TokenType.DEDENT)) {
// only report error if it's not a secondary error
if (context.report.get_errors () == 0) {
- Report.error (get_current_src (), "tab indentation is incorrect");
+ context.report.log_error (get_current_src (), "tab indentation is incorrect");
}
}
if (attributes != null) {
foreach (Attribute attr in (List<Attribute>) attributes) {
if (node.get_attribute (attr.name) != null) {
- Report.error (attr.source_reference, "duplicate attribute `%s'", attr.name);
+ context.report.log_error (attr.source_reference, "duplicate attribute `%s'", attr.name);
}
node.attributes.append (attr);
}
if (!accept (TokenType.DEDENT)) {
// only report error if it's not a secondary error
if (context.report.get_errors () == 0) {
- Report.error (get_current_src (), "expected dedent");
+ context.report.log_error (get_current_src (), "expected dedent");
}
}
}
} else if (sym is Constant) {
ns.add_constant ((Constant) sym);
} else {
- Report.error (sym.source_reference, "unexpected declaration in namespace");
+ context.report.log_error (sym.source_reference, "unexpected declaration in namespace");
}
}
} else if (sym is Destructor) {
cl.add_destructor ((Destructor) sym);
} else {
- Report.error (sym.source_reference, "unexpected declaration in class");
+ context.report.log_error (sym.source_reference, "unexpected declaration in class");
}
}
set_attributes (c, attrs);
if (ModifierFlags.STATIC in flags) {
- Report.warning (c.source_reference, "the modifier `static' is not applicable to constants");
+ context.report.log_warning (c.source_reference, "the modifier `static' is not applicable to constants");
}
return c;
var f = new Field (id, type, null, get_src (begin), comment);
if (ModifierFlags.ABSTRACT in flags || ModifierFlags.VIRTUAL in flags || ModifierFlags.OVERRIDE in flags) {
- Report.error (f.source_reference, "abstract, virtual, and override modifiers are not applicable to fields");
+ context.report.log_error (f.source_reference, "abstract, virtual, and override modifiers are not applicable to fields");
}
if (ModifierFlags.PRIVATE in flags) {
}
if (ModifierFlags.ASYNC in flags) {
- Report.error (prop.source_reference, "async properties are not supported yet");
+ context.report.log_error (prop.source_reference, "async properties are not supported yet");
}
if (accept (TokenType.ASSIGN)) {
} else if (sym is Property) {
st.add_property ((Property) sym);
} else {
- Report.error (sym.source_reference, "unexpected declaration in struct");
+ context.report.log_error (sym.source_reference, "unexpected declaration in struct");
}
}
} else if (sym is Property) {
iface.add_property ((Property) sym);
} else {
- Report.error (sym.source_reference, "unexpected declaration in interface");
+ context.report.log_error (sym.source_reference, "unexpected declaration in interface");
}
}