summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Espinosa <esodan@gmail.com>2021-12-31 10:29:58 -0600
committerDaniel Espinosa <esodan@gmail.com>2022-01-03 17:51:33 -0600
commita45e828295b16f2db8ca260cac78388af0aeb401 (patch)
tree2ecb39938bf09fb5d3aa57a0801aa987c0ac2494
parentfa8287ca4e53baab57ebe6c360a4738886a4d859 (diff)
downloadvala-a45e828295b16f2db8ca260cac78388af0aeb401.tar.gz
Report: replace static methods when context is available
Report has instance methods in order to log error and warnings, so in order to avoid static ones when instance CodeContext is available, this work replace static with instance methods
-rw-r--r--vala/valaarraytype.vala10
-rw-r--r--vala/valaassignment.vala30
-rw-r--r--vala/valabaseaccess.vala12
-rw-r--r--vala/valabinaryexpression.vala38
-rw-r--r--vala/valacastexpression.vala10
-rw-r--r--vala/valaclass.vala38
-rw-r--r--vala/valaconditionalexpression.vala4
-rw-r--r--vala/valaconstant.vala14
-rw-r--r--vala/valacreationmethod.vala18
-rw-r--r--vala/valadatatype.vala6
-rw-r--r--vala/valadelegate.vala6
-rw-r--r--vala/valadelegatetype.vala2
-rw-r--r--vala/valadeletestatement.vala2
-rw-r--r--vala/valadestructor.vala2
-rw-r--r--vala/valaelementaccess.vala14
-rw-r--r--vala/valaenum.vala2
-rw-r--r--vala/valaenumvalue.vala2
-rw-r--r--vala/valaerrordomain.vala4
-rw-r--r--vala/valaexpression.vala10
-rw-r--r--vala/valaexpressionstatement.vala2
-rw-r--r--vala/valafield.vala32
-rw-r--r--vala/valaforeachstatement.vala28
-rw-r--r--vala/valagirparser.vala26
-rw-r--r--vala/valaifstatement.vala2
-rw-r--r--vala/valainitializerlist.vala10
-rw-r--r--vala/valainterface.vala16
-rw-r--r--vala/valalambdaexpression.vala8
-rw-r--r--vala/valalocalvariable.vala26
-rw-r--r--vala/valamemberaccess.vala56
-rw-r--r--vala/valamemberinitializer.vala10
-rw-r--r--vala/valamethod.vala74
-rw-r--r--vala/valamethodcall.vala44
-rw-r--r--vala/valanamespace.vala10
-rw-r--r--vala/valaobjectcreationexpression.vala30
-rw-r--r--vala/valaparameter.vala18
-rw-r--r--vala/valapointerindirection.vala6
-rw-r--r--vala/valapostfixexpression.vala10
-rw-r--r--vala/valaproperty.vala30
-rw-r--r--vala/valapropertyaccessor.vala12
-rw-r--r--vala/valareferencetransferexpression.vala6
-rw-r--r--vala/valaregexliteral.vala2
-rw-r--r--vala/valareturnstatement.vala14
-rw-r--r--vala/valasignal.vala10
-rw-r--r--vala/valasliceexpression.vala10
-rw-r--r--vala/valastruct.vala16
-rw-r--r--vala/valaswitchstatement.vala4
-rw-r--r--vala/valathrowstatement.vala6
-rw-r--r--vala/valatrystatement.vala2
-rw-r--r--vala/valatuple.vala2
-rw-r--r--vala/valatypecheck.vala6
-rw-r--r--vala/valatypeofexpression.vala4
-rw-r--r--vala/valaunaryexpression.vala20
-rw-r--r--vala/valaunlockstatement.vala6
-rw-r--r--vala/valawithstatement.vala2
-rw-r--r--vala/valayieldstatement.vala2
55 files changed, 393 insertions, 393 deletions
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 55847d5db..7f9728275 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -284,7 +284,7 @@ public class Vala.ArrayType : ReferenceType {
public override bool check (CodeContext context) {
if (invalid_syntax) {
- Report.error (source_reference, "syntax error, no expression allowed between array brackets");
+ context.report.log_error (source_reference, "syntax error, no expression allowed between array brackets");
error = true;
return false;
}
@@ -295,20 +295,20 @@ public class Vala.ArrayType : ReferenceType {
if (length.value_type == null || !(length.value_type is IntegerType || length.value_type is EnumValueType)
|| !length.is_constant ()) {
error = true;
- Report.error (length.source_reference, "Expression of constant integer type expected");
+ context.report.log_error (length.source_reference, "Expression of constant integer type expected");
return false;
}
}
if (element_type is ArrayType) {
error = true;
- Report.error (source_reference, "Stacked arrays are not supported");
+ context.report.log_error (source_reference, "Stacked arrays are not supported");
return false;
} else if (element_type is DelegateType) {
var delegate_type = (DelegateType) element_type;
if (delegate_type.delegate_symbol.has_target) {
error = true;
- Report.error (source_reference, "Delegates with target are not supported as array element type");
+ context.report.log_error (source_reference, "Delegates with target are not supported as array element type");
return false;
}
}
@@ -320,7 +320,7 @@ public class Vala.ArrayType : ReferenceType {
length_type.check (context);
if (!(length_type is IntegerType) || length_type.nullable) {
error = true;
- Report.error (length_type.source_reference, "Expected integer type as length type of array");
+ context.report.log_error (length_type.source_reference, "Expected integer type as length type of array");
return false;
}
}
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 8c0948ef3..672303256 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -163,12 +163,12 @@ public class Vala.Assignment : Expression {
if ((!(ma.symbol_reference is DynamicProperty) && ma.value_type == null) ||
(ma.inner == null && ma.member_name == "this" && context.analyzer.is_in_instance_method ())) {
error = true;
- Report.error (source_reference, "unsupported lvalue in assignment");
+ context.report.log_error (source_reference, "unsupported lvalue in assignment");
return false;
}
if (ma.prototype_access) {
error = true;
- Report.error (source_reference, "Access to instance member `%s' denied", ma.symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to instance member `%s' denied", ma.symbol_reference.get_full_name ());
return false;
}
@@ -180,7 +180,7 @@ public class Vala.Assignment : Expression {
if (ma.symbol_reference.get_attribute ("GtkChild") != null) {
error = true;
- Report.error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", ma.symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", ma.symbol_reference.get_full_name ());
return false;
}
@@ -197,7 +197,7 @@ public class Vala.Assignment : Expression {
if (ea.container.value_type.type_symbol == context.analyzer.string_type.type_symbol) {
error = true;
- Report.error (ea.source_reference, "strings are immutable");
+ context.report.log_error (ea.source_reference, "strings are immutable");
return false;
} else if (ea.container.value_type.get_member ("set") is Method) {
var set_call = new MethodCall (new MemberAccess (ea.container, "set", source_reference), source_reference);
@@ -214,11 +214,11 @@ public class Vala.Assignment : Expression {
right.target_type = left.value_type.copy ();
} else if (left is Literal) {
error = true;
- Report.error (source_reference, "Literals are immutable");
+ context.report.log_error (source_reference, "Literals are immutable");
return false;
} else {
error = true;
- Report.error (source_reference, "unsupported lvalue in assignment");
+ context.report.log_error (source_reference, "unsupported lvalue in assignment");
return false;
}
@@ -252,7 +252,7 @@ public class Vala.Assignment : Expression {
case AssignmentOperator.SHIFT_RIGHT: bop = BinaryOperator.SHIFT_RIGHT; break;
default:
error = true;
- Report.error (source_reference, "internal error: unsupported assignment operator");
+ context.report.log_error (source_reference, "internal error: unsupported assignment operator");
return false;
}
@@ -278,7 +278,7 @@ public class Vala.Assignment : Expression {
}
} else if (ma.symbol_reference is ArrayLengthField && ((ArrayType) ma.inner.value_type).inline_allocated) {
error = true;
- Report.error (source_reference, "`length' field of fixed length arrays is read-only");
+ context.report.log_error (source_reference, "`length' field of fixed length arrays is read-only");
return false;
} else if (ma.symbol_reference is Variable && right.value_type is MethodType) {
unowned Variable variable = (Variable) ma.symbol_reference;
@@ -289,17 +289,17 @@ public class Vala.Assignment : Expression {
unowned Method m = (Method) right.symbol_reference;
unowned Delegate cb = ((DelegateType) variable.variable_type).delegate_symbol;
error = true;
- Report.error (source_reference, "Declaration of method `%s' is not compatible with delegate `%s'", m.get_full_name (), cb.get_full_name ());
+ context.report.log_error (source_reference, "Declaration of method `%s' is not compatible with delegate `%s'", m.get_full_name (), cb.get_full_name ());
return false;
}
} else {
error = true;
- Report.error (source_reference, "Assignment: Invalid assignment attempt");
+ context.report.log_error (source_reference, "Assignment: Invalid assignment attempt");
return false;
}
} else if (ma.symbol_reference is Variable && right.value_type == null) {
error = true;
- Report.error (source_reference, "Assignment: Invalid assignment attempt");
+ context.report.log_error (source_reference, "Assignment: Invalid assignment attempt");
return false;
} else if (ma.symbol_reference is Variable) {
unowned Variable variable = (Variable) ma.symbol_reference;
@@ -318,7 +318,7 @@ public class Vala.Assignment : Expression {
if (!right.value_type.compatible (left.value_type)) {
error = true;
- Report.error (source_reference, "Assignment: Cannot convert from `%s' to `%s'", right.value_type.to_string (), left.value_type.to_string ());
+ context.report.log_error (source_reference, "Assignment: Cannot convert from `%s' to `%s'", right.value_type.to_string (), left.value_type.to_string ());
return false;
} else if (left.value_type is EnumValueType && right.value_type is IntegerType
&& (!(right is IntegerLiteral) || ((IntegerLiteral) right).value != "0")) {
@@ -332,7 +332,7 @@ public class Vala.Assignment : Expression {
if (!(left.value_type is PointerType) && !left.value_type.value_owned) {
/* lhs doesn't own the value */
error = true;
- Report.error (source_reference, "Invalid assignment from owned expression to unowned variable");
+ context.report.log_error (source_reference, "Invalid assignment from owned expression to unowned variable");
}
} else if (left.value_type.value_owned) {
/* lhs wants to own the value
@@ -366,7 +366,7 @@ public class Vala.Assignment : Expression {
if (!right.value_type.compatible (left.value_type)) {
error = true;
- Report.error (source_reference, "Assignment: Cannot convert from `%s' to `%s'", right.value_type.to_string (), left.value_type.to_string ());
+ context.report.log_error (source_reference, "Assignment: Cannot convert from `%s' to `%s'", right.value_type.to_string (), left.value_type.to_string ());
return false;
}
@@ -387,7 +387,7 @@ public class Vala.Assignment : Expression {
if (!(element_type is PointerType) && !element_type.value_owned) {
/* lhs doesn't own the value */
error = true;
- Report.error (source_reference, "Invalid assignment from owned expression to unowned variable");
+ context.report.log_error (source_reference, "Invalid assignment from owned expression to unowned variable");
return false;
}
} else if (left.value_type.value_owned) {
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index 14258af14..657c66dd7 100644
--- a/vala/valabaseaccess.vala
+++ b/vala/valabaseaccess.vala
@@ -58,35 +58,35 @@ public class Vala.BaseAccess : Expression {
if (!context.analyzer.is_in_instance_method ()) {
error = true;
- Report.error (source_reference, "Base access invalid outside of instance methods");
+ context.report.log_error (source_reference, "Base access invalid outside of instance methods");
return false;
}
if (context.analyzer.current_class == null) {
if (context.analyzer.current_struct == null) {
error = true;
- Report.error (source_reference, "Base access invalid outside of class and struct");
+ context.report.log_error (source_reference, "Base access invalid outside of class and struct");
return false;
} else if (context.analyzer.current_struct.base_type == null) {
error = true;
- Report.error (source_reference, "Base access invalid without base type");
+ context.report.log_error (source_reference, "Base access invalid without base type");
return false;
}
value_type = context.analyzer.current_struct.base_type;
} else if (context.analyzer.current_class.base_class == null) {
error = true;
- Report.error (source_reference, "Base access invalid without base class");
+ context.report.log_error (source_reference, "Base access invalid without base class");
return false;
} else if (context.analyzer.current_class.is_compact && context.analyzer.current_method != null
&& !(context.analyzer.current_method is CreationMethod)
&& (context.analyzer.current_method.overrides || context.analyzer.current_method.is_virtual)) {
error = true;
- Report.error (source_reference, "Base access invalid in virtual overridden method of compact class");
+ context.report.log_error (source_reference, "Base access invalid in virtual overridden method of compact class");
return false;
} else if (context.analyzer.current_class.is_compact && context.analyzer.current_property_accessor != null
&& (context.analyzer.current_property_accessor.prop.overrides || context.analyzer.current_property_accessor.prop.is_virtual)) {
error = true;
- Report.error (source_reference, "Base access invalid in virtual overridden property of compact class");
+ context.report.log_error (source_reference, "Base access invalid in virtual overridden property of compact class");
return false;
} else {
foreach (var base_type in context.analyzer.current_class.get_base_types ()) {
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 6545e1cff..24aded2c1 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -328,25 +328,25 @@ public class Vala.BinaryExpression : Expression {
}
if (left.value_type == null) {
- Report.error (left.source_reference, "invalid left operand");
+ context.report.log_error (left.source_reference, "invalid left operand");
error = true;
return false;
}
if (operator != BinaryOperator.IN && right.value_type == null) {
- Report.error (right.source_reference, "invalid right operand");
+ context.report.log_error (right.source_reference, "invalid right operand");
error = true;
return false;
}
if (left.value_type is FieldPrototype || left.value_type is PropertyPrototype) {
error = true;
- Report.error (left.source_reference, "Access to instance member `%s' denied", left.symbol_reference.get_full_name ());
+ context.report.log_error (left.source_reference, "Access to instance member `%s' denied", left.symbol_reference.get_full_name ());
return false;
}
if (right.value_type is FieldPrototype || right.value_type is PropertyPrototype) {
error = true;
- Report.error (right.source_reference, "Access to instance member `%s' denied", right.symbol_reference.get_full_name ());
+ context.report.log_error (right.source_reference, "Access to instance member `%s' denied", right.symbol_reference.get_full_name ());
return false;
}
@@ -363,7 +363,7 @@ public class Vala.BinaryExpression : Expression {
|| left is NullLiteral || right is NullLiteral) {
// operands cannot be null
error = true;
- Report.error (source_reference, "Operands must be strings");
+ context.report.log_error (source_reference, "Operands must be strings");
return false;
}
@@ -383,11 +383,11 @@ public class Vala.BinaryExpression : Expression {
if (array_type.inline_allocated) {
error = true;
- Report.error (source_reference, "Array concatenation not supported for fixed length arrays");
+ context.report.log_error (source_reference, "Array concatenation not supported for fixed length arrays");
}
if (right.value_type == null || !right.value_type.compatible (array_type.element_type)) {
error = true;
- Report.error (source_reference, "Incompatible operand");
+ context.report.log_error (source_reference, "Incompatible operand");
return false;
}
@@ -410,7 +410,7 @@ public class Vala.BinaryExpression : Expression {
unowned PointerType pointer_type = (PointerType) left.value_type;
if (pointer_type.base_type is VoidType) {
error = true;
- Report.error (source_reference, "Pointer arithmetic not supported for `void*'");
+ context.report.log_error (source_reference, "Pointer arithmetic not supported for `void*'");
return false;
}
@@ -436,7 +436,7 @@ public class Vala.BinaryExpression : Expression {
if (value_type == null) {
error = true;
- Report.error (source_reference, "Arithmetic operation not supported for types `%s' and `%s'", left.value_type.to_string (), right.value_type.to_string ());
+ context.report.log_error (source_reference, "Arithmetic operation not supported for types `%s' and `%s'", left.value_type.to_string (), right.value_type.to_string ());
return false;
}
break;
@@ -450,7 +450,7 @@ public class Vala.BinaryExpression : Expression {
if (value_type == null) {
error = true;
- Report.error (source_reference, "Arithmetic operation not supported for types `%s' and `%s'", left.value_type.to_string (), right.value_type.to_string ());
+ context.report.log_error (source_reference, "Arithmetic operation not supported for types `%s' and `%s'", left.value_type.to_string (), right.value_type.to_string ());
return false;
}
break;
@@ -475,7 +475,7 @@ public class Vala.BinaryExpression : Expression {
if (resulting_type == null) {
error = true;
- Report.error (source_reference, "Relational operation not supported for types `%s' and `%s'", left.value_type.to_string (), right.value_type.to_string ());
+ context.report.log_error (source_reference, "Relational operation not supported for types `%s' and `%s'", left.value_type.to_string (), right.value_type.to_string ());
return false;
}
@@ -517,7 +517,7 @@ public class Vala.BinaryExpression : Expression {
if (!right.value_type.compatible (left.value_type)
&& !left.value_type.compatible (right.value_type)) {
- Report.error (source_reference, "Equality operation: `%s' and `%s' are incompatible", right.value_type.to_string (), left.value_type.to_string ());
+ context.report.log_error (source_reference, "Equality operation: `%s' and `%s' are incompatible", right.value_type.to_string (), left.value_type.to_string ());
error = true;
return false;
}
@@ -562,7 +562,7 @@ public class Vala.BinaryExpression : Expression {
case BinaryOperator.OR:
if (!left.value_type.compatible (context.analyzer.bool_type) || !right.value_type.compatible (context.analyzer.bool_type)) {
error = true;
- Report.error (source_reference, "Operands must be boolean");
+ context.report.log_error (source_reference, "Operands must be boolean");
}
left.target_type.nullable = false;
right.target_type.nullable = false;
@@ -578,28 +578,28 @@ public class Vala.BinaryExpression : Expression {
if (left.value_type.type_symbol is Enum && right.value_type.type_symbol is Enum
&& left.value_type.type_symbol != right.value_type.type_symbol) {
error = true;
- Report.error (source_reference, "Cannot look for `%s' in `%s'", left.value_type.to_string (), right.value_type.to_string ());
+ context.report.log_error (source_reference, "Cannot look for `%s' in `%s'", left.value_type.to_string (), right.value_type.to_string ());
}
} else if (right.value_type is ArrayType) {
if (!left.value_type.compatible (((ArrayType) right.value_type).element_type)) {
error = true;
- Report.error (source_reference, "Cannot look for `%s' in `%s'", left.value_type.to_string (), right.value_type.to_string ());
+ context.report.log_error (source_reference, "Cannot look for `%s' in `%s'", left.value_type.to_string (), right.value_type.to_string ());
}
} else {
// otherwise require a bool contains () method
var contains_method = right.value_type.get_member ("contains") as Method;
if (contains_method == null) {
- Report.error (source_reference, "`%s' does not have a `contains' method", right.value_type.to_string ());
+ context.report.log_error (source_reference, "`%s' does not have a `contains' method", right.value_type.to_string ());
error = true;
return false;
}
if (contains_method.get_parameters ().size != 1) {
- Report.error (source_reference, "`%s' must have one parameter", contains_method.get_full_name ());
+ context.report.log_error (source_reference, "`%s' must have one parameter", contains_method.get_full_name ());
error = true;
return false;
}
if (!contains_method.return_type.compatible (context.analyzer.bool_type)) {
- Report.error (source_reference, "`%s' must return a boolean value", contains_method.get_full_name ());
+ context.report.log_error (source_reference, "`%s' must return a boolean value", contains_method.get_full_name ());
error = true;
return false;
}
@@ -614,7 +614,7 @@ public class Vala.BinaryExpression : Expression {
break;
default:
error = true;
- Report.error (source_reference, "internal error: unsupported binary operator");
+ context.report.log_error (source_reference, "internal error: unsupported binary operator");
return false;
}
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 5d0783e41..b58e088e3 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -149,7 +149,7 @@ public class Vala.CastExpression : Expression {
}
if (inner.value_type == null) {
- Report.error (source_reference, "Invalid cast expression");
+ context.report.log_error (source_reference, "Invalid cast expression");
error = true;
return false;
}
@@ -165,7 +165,7 @@ public class Vala.CastExpression : Expression {
// FIXME: check whether cast is allowed
if (type_reference is VoidType) {
- Report.error (source_reference, "Casting to `void' is not allowed");
+ context.report.log_error (source_reference, "Casting to `void' is not allowed");
error = true;
return false;
}
@@ -175,7 +175,7 @@ public class Vala.CastExpression : Expression {
if (!type_reference.is_real_struct_type () && inner.value_type.is_real_struct_type ()
&& (context.profile != Profile.GOBJECT || !(is_gvariant (context, inner.value_type) || is_gvalue (context, inner.value_type)))) {
error = true;
- Report.error (source_reference, "Casting of struct `%s' to `%s' is not allowed", inner.value_type.to_qualified_string (), type_reference.to_qualified_string ());
+ context.report.log_error (source_reference, "Casting of struct `%s' to `%s' is not allowed", inner.value_type.to_qualified_string (), type_reference.to_qualified_string ());
}
}
@@ -222,7 +222,7 @@ public class Vala.CastExpression : Expression {
value_type.value_owned = true;
if (value_type.get_type_signature () == null) {
error = true;
- Report.error (source_reference, "Casting of `GLib.Variant' to `%s' is not supported", value_type.to_qualified_string ());
+ context.report.log_error (source_reference, "Casting of `GLib.Variant' to `%s' is not supported", value_type.to_qualified_string ());
}
}
@@ -232,7 +232,7 @@ public class Vala.CastExpression : Expression {
value_type.value_owned = false;
if (value_type.nullable && value_type.type_symbol != null && !value_type.type_symbol.is_reference_type ()) {
error = true;
- Report.error (source_reference, "Casting of `GLib.Value' to `%s' is not supported", value_type.to_qualified_string ());
+ context.report.log_error (source_reference, "Casting of `GLib.Value' to `%s' is not supported", value_type.to_qualified_string ());
}
}
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 436a6b3cf..96492656c 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -548,14 +548,14 @@ public class Vala.Class : ObjectTypeSymbol {
if (!(base_type_reference is ObjectType)) {
error = true;
- Report.error (source_reference, "base type `%s' of class `%s' is not an object type", base_type_reference.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "base type `%s' of class `%s' is not an object type", base_type_reference.to_string (), get_full_name ());
return false;
}
// check whether base type is at least as accessible as the class
if (!base_type_reference.is_accessible (this)) {
error = true;
- Report.error (source_reference, "base type `%s' is less accessible than class `%s'", base_type_reference.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "base type `%s' is less accessible than class `%s'", base_type_reference.to_string (), get_full_name ());
return false;
}
@@ -577,12 +577,12 @@ public class Vala.Class : ObjectTypeSymbol {
if (base_class != null && base_class.is_singleton) {
error = true;
- Report.error (source_reference, "`%s' cannot inherit from SingleInstance class `%s'", get_full_name (), base_class.get_full_name ());
+ context.report.log_error (source_reference, "`%s' cannot inherit from SingleInstance class `%s'", get_full_name (), base_class.get_full_name ());
}
if (is_singleton && !is_subtype_of (context.analyzer.object_type)) {
error = true;
- Report.error (source_reference, "SingleInstance class `%s' requires inheritance from `GLib.Object'", get_full_name ());
+ context.report.log_error (source_reference, "SingleInstance class `%s' requires inheritance from `GLib.Object'", get_full_name ());
}
/* singleton classes require an instance constructor */
@@ -594,18 +594,18 @@ public class Vala.Class : ObjectTypeSymbol {
if (base_class != null && base_class.is_sealed) {
error = true;
- Report.error (source_reference, "`%s' cannot inherit from sealed class `%s'", get_full_name (), base_class.get_full_name ());
+ context.report.log_error (source_reference, "`%s' cannot inherit from sealed class `%s'", get_full_name (), base_class.get_full_name ());
}
if (is_sealed) {
if (is_compact) {
error = true;
- Report.error (source_reference, "Sealed class `%s' cannot be compact", get_full_name ());
+ context.report.log_error (source_reference, "Sealed class `%s' cannot be compact", get_full_name ());
return false;
}
if (is_abstract) {
error = true;
- Report.error (source_reference, "Sealed class `%s' cannot be abstract", get_full_name ());
+ context.report.log_error (source_reference, "Sealed class `%s' cannot be abstract", get_full_name ());
return false;
}
}
@@ -619,15 +619,15 @@ public class Vala.Class : ObjectTypeSymbol {
if (is_compact && f.binding != MemberBinding.STATIC) {
//FIXME Should external bindings follow this too?
if (!external_package && !is_opaque && f.access == SymbolAccessibility.PRIVATE) {
- Report.error (f.source_reference, "private fields are only supported in opaque compact classes, use [Compact (opaque = true)]");
+ context.report.log_error (f.source_reference, "private fields are only supported in opaque compact classes, use [Compact (opaque = true)]");
error = true;
}
if (!external_package && is_opaque && (f.access == SymbolAccessibility.PUBLIC || f.access == SymbolAccessibility.PROTECTED)) {
- Report.error (f.source_reference, "fields in opaque compact classes must be private or internal");
+ context.report.log_error (f.source_reference, "fields in opaque compact classes must be private or internal");
error = true;
}
if (f.binding == MemberBinding.CLASS) {
- Report.error (f.source_reference, "class fields are not supported in compact classes");
+ context.report.log_error (f.source_reference, "class fields are not supported in compact classes");
error = true;
}
}
@@ -646,7 +646,7 @@ public class Vala.Class : ObjectTypeSymbol {
foreach (Property prop in get_properties ()) {
if (prop.get_attribute ("NoAccessorMethod") != null && !is_subtype_of (context.analyzer.object_type)) {
error = true;
- Report.error (prop.source_reference, "NoAccessorMethod is only allowed for properties in classes derived from GLib.Object");
+ context.report.log_error (prop.source_reference, "NoAccessorMethod is only allowed for properties in classes derived from GLib.Object");
return false;
}
prop.check (context);
@@ -701,7 +701,7 @@ public class Vala.Class : ObjectTypeSymbol {
foreach (DataType base_type in get_base_types ()) {
if (base_type.type_symbol is Interface) {
error = true;
- Report.error (source_reference, "compact classes `%s' may not implement interfaces", get_full_name ());
+ context.report.log_error (source_reference, "compact classes `%s' may not implement interfaces", get_full_name ());
}
}
@@ -709,7 +709,7 @@ public class Vala.Class : ObjectTypeSymbol {
foreach (Field f in get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
error = true;
- Report.error (source_reference, "derived compact classes may not have instance fields");
+ context.report.log_error (source_reference, "derived compact classes may not have instance fields");
break;
}
}
@@ -745,7 +745,7 @@ public class Vala.Class : ObjectTypeSymbol {
}
}
error_string += ") are not met";
- Report.error (source_reference, error_string);
+ context.report.log_error (source_reference, error_string);
}
/* VAPI classes don't have to specify overridden methods */
@@ -789,7 +789,7 @@ public class Vala.Class : ObjectTypeSymbol {
}
if (!implemented) {
error = true;
- Report.error (source_reference, "`%s' does not implement interface method `%s'", get_full_name (), m.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not implement interface method `%s'", get_full_name (), m.get_full_name ());
}
}
}
@@ -809,14 +809,14 @@ public class Vala.Class : ObjectTypeSymbol {
// No check at all for "new" classified properties, really?
if (!base_prop.hides && !base_prop.compatible (prop, out invalid_match)) {
error = true;
- Report.error (source_reference, "Type and/or accessors of inherited properties `%s' and `%s' do not match: %s.", prop.get_full_name (), base_prop.get_full_name (), invalid_match);
+ context.report.log_error (source_reference, "Type and/or accessors of inherited properties `%s' and `%s' do not match: %s.", prop.get_full_name (), base_prop.get_full_name (), invalid_match);
}
// property is used as interface implementation, so it is not unused
sym.version.check (context, source_reference);
sym.used = true;
} else {
error = true;
- Report.error (source_reference, "`%s' does not implement interface property `%s'", get_full_name (), prop.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not implement interface property `%s'", get_full_name (), prop.get_full_name ());
}
}
}
@@ -832,7 +832,7 @@ public class Vala.Class : ObjectTypeSymbol {
var override_method = SemanticAnalyzer.symbol_lookup_inherited (this, base_method.name) as Method;
if (override_method == null || !override_method.overrides) {
error = true;
- Report.error (source_reference, "`%s' does not implement abstract method `%s'", get_full_name (), base_method.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not implement abstract method `%s'", get_full_name (), base_method.get_full_name ());
}
}
}
@@ -841,7 +841,7 @@ public class Vala.Class : ObjectTypeSymbol {
var override_property = SemanticAnalyzer.symbol_lookup_inherited (this, base_property.name) as Property;
if (override_property == null || !override_property.overrides) {
error = true;
- Report.error (source_reference, "`%s' does not implement abstract property `%s'", get_full_name (), base_property.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not implement abstract property `%s'", get_full_name (), base_property.get_full_name ());
}
}
}
diff --git a/vala/valaconditionalexpression.vala b/vala/valaconditionalexpression.vala
index c8bfdbce1..bb1f7f1dc 100644
--- a/vala/valaconditionalexpression.vala
+++ b/vala/valaconditionalexpression.vala
@@ -146,7 +146,7 @@ public class Vala.ConditionalExpression : Expression {
checked = true;
if (!(context.analyzer.current_symbol is Block)) {
- Report.error (source_reference, "Conditional expressions may only be used in blocks");
+ context.report.log_error (source_reference, "Conditional expressions may only be used in blocks");
error = true;
return false;
}
@@ -195,7 +195,7 @@ public class Vala.ConditionalExpression : Expression {
} else {
error = true;
var source_reference = new SourceReference (true_expression.source_reference.file, true_expression.source_reference.begin, false_expression.source_reference.end);
- Report.error (source_reference, "Cannot resolve target type from `%s' and `%s'", true_expression.value_type.to_prototype_string (), false_expression.value_type.to_prototype_string ());
+ context.report.log_error (source_reference, "Cannot resolve target type from `%s' and `%s'", true_expression.value_type.to_prototype_string (), false_expression.value_type.to_prototype_string ());
return false;
}
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index c9b1bfbfd..0b6820fea 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -117,14 +117,14 @@ public class Vala.Constant : Symbol {
if (!check_const_type (type_reference, context)) {
error = true;
- Report.error (source_reference, "`%s' not supported as type for constants", type_reference.to_string ());
+ context.report.log_error (source_reference, "`%s' not supported as type for constants", type_reference.to_string ());
return false;
}
// check whether constant type is at least as accessible as the constant
if (!type_reference.is_accessible (this)) {
error = true;
- Report.error (source_reference, "constant type `%s' is less accessible than constant `%s'", type_reference.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "constant type `%s' is less accessible than constant `%s'", type_reference.to_string (), get_full_name ());
}
if (!external) {
@@ -132,7 +132,7 @@ public class Vala.Constant : Symbol {
// constants from fast-vapi files are special
if (source_type != SourceFileType.FAST) {
error = true;
- Report.error (source_reference, "A const field requires a value to be provided");
+ context.report.log_error (source_reference, "A const field requires a value to be provided");
}
} else {
value.target_type = type_reference;
@@ -144,7 +144,7 @@ public class Vala.Constant : Symbol {
if (!value.value_type.compatible (type_reference)) {
error = true;
- Report.error (source_reference, "Cannot convert from `%s' to `%s'", value.value_type.to_string (), type_reference.to_string ());
+ context.report.log_error (source_reference, "Cannot convert from `%s' to `%s'", value.value_type.to_string (), type_reference.to_string ());
return false;
}
@@ -165,20 +165,20 @@ public class Vala.Constant : Symbol {
if (!value.is_constant ()) {
error = true;
- Report.error (value.source_reference, "Value must be constant");
+ context.report.log_error (value.source_reference, "Value must be constant");
return false;
}
// check whether initializer is at least as accessible as the constant
if (!value.is_accessible (this)) {
error = true;
- Report.error (value.source_reference, "value is less accessible than constant `%s'", get_full_name ());
+ context.report.log_error (value.source_reference, "value is less accessible than constant `%s'", get_full_name ());
}
}
} else {
if (value != null) {
error = true;
- Report.error (source_reference, "External constants cannot use values");
+ context.report.log_error (source_reference, "External constants cannot use values");
}
}
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 2ff5033bc..9e79045e8 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -88,7 +88,7 @@ public class Vala.CreationMethod : Method {
if (class_name != null && class_name != parent_symbol.name) {
// class_name is null for constructors generated by GIdlParser
- Report.error (source_reference, "missing return type in method `%s.%s´", context.analyzer.current_symbol.get_full_name (), class_name);
+ context.report.log_error (source_reference, "missing return type in method `%s.%s´", context.analyzer.current_symbol.get_full_name (), class_name);
error = true;
return false;
}
@@ -99,7 +99,7 @@ public class Vala.CreationMethod : Method {
if (coroutine && !external_package && !context.has_package ("gio-2.0")) {
error = true;
- Report.error (source_reference, "gio-2.0 package required for async constructors");
+ context.report.log_error (source_reference, "gio-2.0 package required for async constructors");
return false;
}
@@ -118,7 +118,7 @@ public class Vala.CreationMethod : Method {
}
if (i == 0 && param.ellipsis && body != null) {
error = true;
- Report.error (param.source_reference, "Named parameter required before `...'");
+ context.report.log_error (param.source_reference, "Named parameter required before `...'");
}
i++;
@@ -126,7 +126,7 @@ public class Vala.CreationMethod : Method {
if (param.params_array && body != null) {
if (params_array_var != null) {
error = true;
- Report.error (param.source_reference, "Only one params-array parameter is allowed");
+ context.report.log_error (param.source_reference, "Only one params-array parameter is allowed");
continue;
}
if (!context.experimental) {
@@ -137,11 +137,11 @@ public class Vala.CreationMethod : Method {
type.value_owned = true;
if (type.element_type.is_real_struct_type () && !type.element_type.nullable) {
error = true;
- Report.error (param.source_reference, "Only nullable struct elements are supported in params-array");
+ context.report.log_error (param.source_reference, "Only nullable struct elements are supported in params-array");
}
if (type.length != null) {
error = true;
- Report.error (param.source_reference, "Passing length to params-array is not supported yet");
+ context.report.log_error (param.source_reference, "Passing length to params-array is not supported yet");
}
params_array_var = new LocalVariable (type, param.name, null, param.source_reference);
body.insert_statement (0, new DeclarationStatement (params_array_var, param.source_reference));
@@ -155,7 +155,7 @@ public class Vala.CreationMethod : Method {
// check whether error type is at least as accessible as the creation method
if (!error_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "error type `%s' is less accessible than creation method `%s'", error_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "error type `%s' is less accessible than creation method `%s'", error_type.to_string (), get_full_name ());
return false;
}
}
@@ -192,9 +192,9 @@ public class Vala.CreationMethod : Method {
context.analyzer.insert_block = old_insert_block;
} else if (cl.base_class.default_construction_method == null
|| cl.base_class.default_construction_method.access == SymbolAccessibility.PRIVATE) {
- Report.error (source_reference, "unable to chain up to private base constructor");
+ context.report.log_error (source_reference, "unable to chain up to private base constructor");
} else if (cl.base_class.default_construction_method.get_required_arguments () > 0) {
- Report.error (source_reference, "unable to chain up to base constructor requiring arguments");
+ context.report.log_error (source_reference, "unable to chain up to base constructor requiring arguments");
} else {
var old_insert_block = context.analyzer.insert_block;
context.analyzer.current_symbol = body;
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 9f612fa17..6c435116d 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -683,7 +683,7 @@ public abstract class Vala.DataType : CodeNode {
} else if (type_symbol is Delegate) {
expected_n_type_args = ((Delegate) type_symbol).get_type_parameters ().size;
} else if (n_type_args > 0) {
- Report.error (source_reference, "`%s' does not support type arguments", type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not support type arguments", type_symbol.get_full_name ());
error = true;
return false;
} else {
@@ -693,11 +693,11 @@ public abstract class Vala.DataType : CodeNode {
if ((!allow_none || n_type_args > 0) && n_type_args < expected_n_type_args) {
error = true;
- Report.error (source_reference, "too few type arguments for `%s'", type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "too few type arguments for `%s'", type_symbol.get_full_name ());
return false;
} else if ((!allow_none || n_type_args > 0) && n_type_args > expected_n_type_args) {
error = true;
- Report.error (source_reference, "too many type arguments for `%s'", type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "too many type arguments for `%s'", type_symbol.get_full_name ());
return false;
}
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index eeaabcb69..5d3dbe322 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -322,7 +322,7 @@ public class Vala.Delegate : TypeSymbol, Callable {
if (return_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
error = true;
- Report.error (source_reference, "`%s' not supported as return type", return_type.type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "`%s' not supported as return type", return_type.type_symbol.get_full_name ());
return false;
}
@@ -336,14 +336,14 @@ public class Vala.Delegate : TypeSymbol, Callable {
foreach (DataType error_type in error_types) {
if (!(error_type is ErrorType)) {
error = true;
- Report.error (error_type.source_reference, "`%s' is not an error type", error_type.to_string ());
+ context.report.log_error (error_type.source_reference, "`%s' is not an error type", error_type.to_string ());
}
error_type.check (context);
// check whether error type is at least as accessible as the delegate
if (!error_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "error type `%s' is less accessible than delegate `%s'", error_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "error type `%s' is less accessible than delegate `%s'", error_type.to_string (), get_full_name ());
return false;
}
}
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 8b51f324c..e8c071829 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -91,7 +91,7 @@ public class Vala.DelegateType : CallableType {
public override bool check (CodeContext context) {
if (is_called_once && !value_owned) {
- Report.warning (source_reference, "delegates with scope=\"async\" must be owned");
+ context.report.log_warning (source_reference, "delegates with scope=\"async\" must be owned");
}
if (!delegate_symbol.check (context)) {
diff --git a/vala/valadeletestatement.vala b/vala/valadeletestatement.vala
index f0a39f7c7..b1734e099 100644
--- a/vala/valadeletestatement.vala
+++ b/vala/valadeletestatement.vala
@@ -73,7 +73,7 @@ public class Vala.DeleteStatement : CodeNode, Statement {
if (!(expression.value_type is PointerType) && !(expression.value_type is ArrayType)) {
error = true;
- Report.error (source_reference, "delete operator not supported for `%s'", expression.value_type.to_string ());
+ context.report.log_error (source_reference, "delete operator not supported for `%s'", expression.value_type.to_string ());
}
return !error;
diff --git a/vala/valadestructor.vala b/vala/valadestructor.vala
index 2febe55d3..6825b28b9 100644
--- a/vala/valadestructor.vala
+++ b/vala/valadestructor.vala
@@ -83,7 +83,7 @@ public class Vala.Destructor : Subroutine {
body.get_error_types (body_errors);
foreach (DataType body_error_type in body_errors) {
if (!((ErrorType) body_error_type).dynamic_error) {
- Report.warning (body_error_type.source_reference, "unhandled error `%s'", body_error_type.to_string());
+ context.report.log_warning (body_error_type.source_reference, "unhandled error `%s'", body_error_type.to_string());
}
}
}
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index ce6281870..ada4fceb5 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -154,7 +154,7 @@ public class Vala.ElementAccess : Expression {
if (container.value_type == null) {
error = true;
- Report.error (container.source_reference, "Invalid container expression");
+ context.report.log_error (container.source_reference, "Invalid container expression");
return false;
}
@@ -162,7 +162,7 @@ public class Vala.ElementAccess : Expression {
// signal detail access
if (get_indices ().size != 1) {
error = true;
- Report.error (source_reference, "Element access with more than one dimension is not supported for signals");
+ context.report.log_error (source_reference, "Element access with more than one dimension is not supported for signals");
return false;
}
@@ -172,7 +172,7 @@ public class Vala.ElementAccess : Expression {
if (detail_expr.value_type is NullType || !detail_expr.value_type.compatible (context.analyzer.string_type)) {
error = true;
- Report.error (detail_expr.source_reference, "only string details are supported");
+ context.report.log_error (detail_expr.source_reference, "only string details are supported");
return false;
}
}
@@ -208,10 +208,10 @@ public class Vala.ElementAccess : Expression {
if (array_type.rank < get_indices ().size) {
error = true;
- Report.error (source_reference, "%d extra indices for element access", get_indices ().size - array_type.rank);
+ context.report.log_error (source_reference, "%d extra indices for element access", get_indices ().size - array_type.rank);
} else if (array_type.rank > get_indices ().size) {
error = true;
- Report.error (source_reference, "%d missing indices for element access", array_type.rank - get_indices ().size);
+ context.report.log_error (source_reference, "%d missing indices for element access", array_type.rank - get_indices ().size);
}
} else if (pointer_type != null && !pointer_type.base_type.is_reference_type_or_type_parameter ()) {
value_type = pointer_type.base_type.copy ();
@@ -242,7 +242,7 @@ public class Vala.ElementAccess : Expression {
}
error = true;
- Report.error (source_reference, "The expression `%s' does not denote an array", container.value_type.to_string ());
+ context.report.log_error (source_reference, "The expression `%s' does not denote an array", container.value_type.to_string ());
return false;
}
@@ -257,7 +257,7 @@ public class Vala.ElementAccess : Expression {
/* check if the index is of type integer */
if (!(e.value_type is IntegerType || e.value_type is EnumValueType)) {
error = true;
- Report.error (e.source_reference, "Expression of integer type expected");
+ context.report.log_error (e.source_reference, "Expression of integer type expected");
}
}
}
diff --git a/vala/valaenum.vala b/vala/valaenum.vala
index 2d403157d..1c39eb45e 100644
--- a/vala/valaenum.vala
+++ b/vala/valaenum.vala
@@ -167,7 +167,7 @@ public class Vala.Enum : TypeSymbol {
context.analyzer.current_symbol = this;
if (values.size <= 0) {
- Report.error (source_reference, "Enum `%s' requires at least one value", get_full_name ());
+ context.report.log_error (source_reference, "Enum `%s' requires at least one value", get_full_name ());
error = true;
return false;
}
diff --git a/vala/valaenumvalue.vala b/vala/valaenumvalue.vala
index be3fcc52e..3d4dbdbb8 100644
--- a/vala/valaenumvalue.vala
+++ b/vala/valaenumvalue.vala
@@ -77,7 +77,7 @@ public class Vala.EnumValue : Constant {
// check whether initializer is at least as accessible as the enum value
if (!value.is_accessible (this)) {
error = true;
- Report.error (value.source_reference, "value is less accessible than enum `%s'", parent_symbol.get_full_name ());
+ context.report.log_error (value.source_reference, "value is less accessible than enum `%s'", parent_symbol.get_full_name ());
}
}
diff --git a/vala/valaerrordomain.vala b/vala/valaerrordomain.vala
index 889d0b8ab..65a97c6f2 100644
--- a/vala/valaerrordomain.vala
+++ b/vala/valaerrordomain.vala
@@ -115,7 +115,7 @@ public class Vala.ErrorDomain : TypeSymbol {
checked = true;
if (codes.size <= 0) {
- Report.error (source_reference, "Error domain `%s' requires at least one code", get_full_name ());
+ context.report.log_error (source_reference, "Error domain `%s' requires at least one code", get_full_name ());
error = true;
return false;
}
@@ -129,7 +129,7 @@ public class Vala.ErrorDomain : TypeSymbol {
if (external_package) {
Report.warning (m.source_reference, "Instance methods are not supported in error domains yet");
} else {
- Report.error (m.source_reference, "Instance methods are not supported in error domains yet");
+ context.report.log_error (m.source_reference, "Instance methods are not supported in error domains yet");
}
error = true;
}
diff --git a/vala/valaexpression.vala b/vala/valaexpression.vala
index e46d875d6..9a9a9b44c 100644
--- a/vala/valaexpression.vala
+++ b/vala/valaexpression.vala
@@ -159,14 +159,14 @@ public abstract class Vala.Expression : CodeNode {
}
if (inner.value_type == null) {
- Report.error (inner.source_reference, "invalid inner expression");
+ context.report.log_error (inner.source_reference, "invalid inner expression");
return false;
}
// declare the inner expression as a local variable to check for null
var inner_type = inner.value_type.copy ();
if (context.experimental_non_null && !inner_type.nullable) {
- Report.warning (inner.source_reference, "inner expression is never null");
+ context.report.log_warning (inner.source_reference, "inner expression is never null");
// make it nullable, otherwise the null check will not compile in non-null mode
inner_type.nullable = true;
}
@@ -211,7 +211,7 @@ public abstract class Vala.Expression : CodeNode {
}
if (non_null_expr.value_type == null) {
- Report.error (source_reference, "invalid null-safe expression");
+ context.report.log_error (source_reference, "invalid null-safe expression");
error = true;
return false;
}
@@ -243,7 +243,7 @@ public abstract class Vala.Expression : CodeNode {
unowned Block? parent_block = parent_stmt != null ? parent_stmt.parent_node as Block : null;
if (parent_stmt == null || parent_block == null) {
- Report.error (source_reference, "void method call not allowed here");
+ context.report.log_error (source_reference, "void method call not allowed here");
error = true;
return false;
}
@@ -290,7 +290,7 @@ public abstract class Vala.Expression : CodeNode {
// ownership can be transferred transitively
result_access.lvalue = true;
} else {
- Report.error (source_reference, "null-safe expression not supported as lvalue");
+ context.report.log_error (source_reference, "null-safe expression not supported as lvalue");
error = true;
return false;
}
diff --git a/vala/valaexpressionstatement.vala b/vala/valaexpressionstatement.vala
index ac435d081..91c307195 100644
--- a/vala/valaexpressionstatement.vala
+++ b/vala/valaexpressionstatement.vala
@@ -79,7 +79,7 @@ public class Vala.ExpressionStatement : CodeNode, Statement {
error = true;
return false;
} else if (expression is Literal) {
- Report.error (source_reference, "Literal expression not allowed as statement");
+ context.report.log_error (source_reference, "Literal expression not allowed as statement");
error = true;
return false;
}
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 566a68b12..197939955 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -94,18 +94,18 @@ public class Vala.Field : Variable, Lockable {
if (variable_type is VoidType) {
error = true;
- Report.error (source_reference, "'void' not supported as field type");
+ context.report.log_error (source_reference, "'void' not supported as field type");
return false;
}
if (variable_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
error = true;
- Report.error (source_reference, "`%s' not supported as field type", variable_type.type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "`%s' not supported as field type", variable_type.type_symbol.get_full_name ());
return false;
}
if (get_attribute ("GtkChild") != null && variable_type.value_owned) {
- Report.warning (source_reference, "[GtkChild] fields must be declared as `unowned'");
+ context.report.log_warning (source_reference, "[GtkChild] fields must be declared as `unowned'");
variable_type.value_owned = false;
}
@@ -122,20 +122,20 @@ public class Vala.Field : Variable, Lockable {
// check whether field type is at least as accessible as the field
if (!variable_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "field type `%s' is less accessible than field `%s'", variable_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "field type `%s' is less accessible than field `%s'", variable_type.to_string (), get_full_name ());
return false;
}
unowned ArrayType? variable_array_type = variable_type as ArrayType;
if (variable_array_type != null && variable_array_type.inline_allocated
&& initializer is ArrayCreationExpression && ((ArrayCreationExpression) initializer).initializer_list == null) {
- Report.warning (source_reference, "Inline allocated arrays don't require an explicit instantiation");
+ context.report.log_warning (source_reference, "Inline allocated arrays don't require an explicit instantiation");
initializer = null;
}
if (variable_array_type != null && variable_array_type.inline_allocated
&& !variable_array_type.fixed_length) {
- Report.error (source_reference, "Inline allocated array as field requires to have fixed length");
+ context.report.log_error (source_reference, "Inline allocated array as field requires to have fixed length");
}
if (initializer != null) {
@@ -157,13 +157,13 @@ public class Vala.Field : Variable, Lockable {
if (initializer.value_type == null) {
error = true;
- Report.error (source_reference, "expression type not allowed as initializer");
+ context.report.log_error (source_reference, "expression type not allowed as initializer");
return false;
}
if (!initializer.value_type.compatible (variable_type)) {
error = true;
- Report.error (source_reference, "Cannot convert from `%s' to `%s'", initializer.value_type.to_string (), variable_type.to_string ());
+ context.report.log_error (source_reference, "Cannot convert from `%s' to `%s'", initializer.value_type.to_string (), variable_type.to_string ());
return false;
}
@@ -175,7 +175,7 @@ public class Vala.Field : Variable, Lockable {
if (variable_array_type != null && variable_array_type.inline_allocated && !(initializer.value_type is ArrayType)) {
error = true;
- Report.error (source_reference, "only arrays are allowed as initializer for arrays with fixed length");
+ context.report.log_error (source_reference, "only arrays are allowed as initializer for arrays with fixed length");
return false;
}
@@ -184,40 +184,40 @@ public class Vala.Field : Variable, Lockable {
if (!(variable_type is PointerType) && !variable_type.value_owned) {
/* lhs doesn't own the value */
error = true;
- Report.error (source_reference, "Invalid assignment from owned expression to unowned variable");
+ context.report.log_error (source_reference, "Invalid assignment from owned expression to unowned variable");
return false;
}
}
if (parent_symbol is Namespace && !initializer.is_constant ()) {
error = true;
- Report.error (source_reference, "Non-constant field initializers not supported in this context");
+ context.report.log_error (source_reference, "Non-constant field initializers not supported in this context");
return false;
}
if (parent_symbol is Namespace && initializer.is_constant () && initializer.is_non_null ()) {
if (variable_type.is_disposable () && variable_type.value_owned) {
error = true;
- Report.error (source_reference, "Owned namespace fields can only be initialized in a function or method");
+ context.report.log_error (source_reference, "Owned namespace fields can only be initialized in a function or method");
return false;
}
}
if (binding == MemberBinding.STATIC && parent_symbol is Class && ((Class)parent_symbol).is_compact && !initializer.is_constant ()) {
error = true;
- Report.error (source_reference, "Static fields in compact classes cannot have non-constant initializers");
+ context.report.log_error (source_reference, "Static fields in compact classes cannot have non-constant initializers");
return false;
}
if (external) {
error = true;
- Report.error (source_reference, "External fields cannot use initializers");
+ context.report.log_error (source_reference, "External fields cannot use initializers");
}
}
if (binding == MemberBinding.INSTANCE && parent_symbol is Interface) {
error = true;
- Report.error (source_reference, "Interfaces may not have instance fields");
+ context.report.log_error (source_reference, "Interfaces may not have instance fields");
return false;
}
@@ -231,7 +231,7 @@ public class Vala.Field : Variable, Lockable {
}
if (!external_package && !hides && get_hidden_member () != null) {
- Report.warning (source_reference, "%s hides inherited field `%s'. Use the `new' keyword if hiding was intentional", get_full_name (), get_hidden_member ().get_full_name ());
+ context.report.log_warning (source_reference, "%s hides inherited field `%s'. Use the `new' keyword if hiding was intentional", get_full_name (), get_hidden_member ().get_full_name ());
}
context.analyzer.current_source_file = old_source_file;
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 3d8ce2ba9..1e7f83088 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -165,7 +165,7 @@ public class Vala.ForeachStatement : Block {
error = true;
return false;
} else if (collection.value_type == null) {
- Report.error (collection.source_reference, "invalid collection expression");
+ context.report.log_error (collection.source_reference, "invalid collection expression");
error = true;
return false;
}
@@ -184,7 +184,7 @@ public class Vala.ForeachStatement : Block {
|| collection_type.compatible (context.analyzer.gslist_type) || collection_type.compatible (context.analyzer.genericarray_type))) {
if (collection_type.get_type_arguments ().size != 1) {
error = true;
- Report.error (collection.source_reference, "missing type argument for collection");
+ context.report.log_error (collection.source_reference, "missing type argument for collection");
return false;
}
@@ -239,18 +239,18 @@ public class Vala.ForeachStatement : Block {
var iterator_method = collection_type.get_member ("iterator") as Method;
if (iterator_method == null) {
- Report.error (collection.source_reference, "`%s' does not have an `iterator' method", collection_type.to_string ());
+ context.report.log_error (collection.source_reference, "`%s' does not have an `iterator' method", collection_type.to_string ());
error = true;
return false;
}
if (iterator_method.get_parameters ().size != 0) {
- Report.error (collection.source_reference, "`%s' must not have any parameters", iterator_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must not have any parameters", iterator_method.get_full_name ());
error = true;
return false;
}
var iterator_type = iterator_method.return_type.get_actual_type (collection_type, null, this);
if (iterator_type is VoidType) {
- Report.error (collection.source_reference, "`%s' must return an iterator", iterator_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must return an iterator", iterator_method.get_full_name ());
error = true;
return false;
}
@@ -262,13 +262,13 @@ public class Vala.ForeachStatement : Block {
var next_method = iterator_type.get_member ("next") as Method;
if (next_value_method != null) {
if (next_value_method.get_parameters ().size != 0) {
- Report.error (collection.source_reference, "`%s' must not have any parameters", next_value_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must not have any parameters", next_value_method.get_full_name ());
error = true;
return false;
}
var element_type = next_value_method.return_type.get_actual_type (iterator_type, null, this);
if (!element_type.nullable) {
- Report.error (collection.source_reference, "return type of `%s' must be nullable", next_value_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "return type of `%s' must be nullable", next_value_method.get_full_name ());
error = true;
return false;
}
@@ -286,29 +286,29 @@ public class Vala.ForeachStatement : Block {
add_statement (loop);
} else if (next_method != null) {
if (next_method.get_parameters ().size != 0) {
- Report.error (collection.source_reference, "`%s' must not have any parameters", next_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must not have any parameters", next_method.get_full_name ());
error = true;
return false;
}
if (!next_method.return_type.compatible (context.analyzer.bool_type)) {
- Report.error (collection.source_reference, "`%s' must return a boolean value", next_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must return a boolean value", next_method.get_full_name ());
error = true;
return false;
}
var get_method = iterator_type.get_member ("get") as Method;
if (get_method == null) {
- Report.error (collection.source_reference, "`%s' does not have a `get' method", iterator_type.to_string ());
+ context.report.log_error (collection.source_reference, "`%s' does not have a `get' method", iterator_type.to_string ());
error = true;
return false;
}
if (get_method.get_parameters ().size != 0) {
- Report.error (collection.source_reference, "`%s' must not have any parameters", get_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must not have any parameters", get_method.get_full_name ());
error = true;
return false;
}
var element_type = get_method.return_type.get_actual_type (iterator_type, null, this);
if (element_type is VoidType) {
- Report.error (collection.source_reference, "`%s' must return an element", get_method.get_full_name ());
+ context.report.log_error (collection.source_reference, "`%s' must return an element", get_method.get_full_name ());
error = true;
return false;
}
@@ -324,7 +324,7 @@ public class Vala.ForeachStatement : Block {
var get_call = new MethodCall (new MemberAccess (new MemberAccess.simple ("_%s_it".printf (variable_name), source_reference), "get", source_reference), source_reference);
body.insert_statement (0, new DeclarationStatement (new LocalVariable (type_reference, variable_name, get_call, source_reference), source_reference));
} else {
- Report.error (collection.source_reference, "`%s' does not have a `next_value' or `next' method", iterator_type.to_string ());
+ context.report.log_error (collection.source_reference, "`%s' does not have a `next_value' or `next' method", iterator_type.to_string ());
error = true;
return false;
}
@@ -376,7 +376,7 @@ public class Vala.ForeachStatement : Block {
}
} else if (!element_type.compatible (type_reference)) {
error = true;
- Report.error (source_reference, "Foreach: Cannot convert from `%s' to `%s'", element_type.to_string (), type_reference.to_string ());
+ context.report.log_error (source_reference, "Foreach: Cannot convert from `%s' to `%s'", element_type.to_string (), type_reference.to_string ());
return false;
}
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index cf952d72c..39d4d4cdd 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -476,7 +476,7 @@ public class Vala.GirParser : CodeVisitor {
}
var arg_type = ArgumentType.from_string (id);
if (arg_type == null) {
- Report.warning (get_src (begin, old_end), "unknown argument `%s'", id);
+ scanner.source_file.context.report.log_warning (get_src (begin, old_end), "unknown argument `%s'", id);
continue;
}
@@ -935,7 +935,7 @@ public class Vala.GirParser : CodeVisitor {
// assume method is getter
merged = true;
} else {
- Report.warning (symbol.source_reference, "Field `%s' conflicts with method of the same name", get_full_name ());
+ parser.context.report.log_warning (symbol.source_reference, "Field `%s' conflicts with method of the same name", get_full_name ());
}
} else if (sym is Signal) {
node.process (parser);
@@ -947,7 +947,7 @@ public class Vala.GirParser : CodeVisitor {
}
parser.assume_parameter_names (sig, m, false);
if (m.get_parameters().size != sig.get_parameters().size) {
- Report.warning (symbol.source_reference, "Signal `%s' conflicts with method of the same name", get_full_name ());
+ parser.context.report.log_warning (symbol.source_reference, "Signal `%s' conflicts with method of the same name", get_full_name ());
}
merged = true;
} else if (sym is Method && !(sym is CreationMethod) && node != this) {
@@ -969,12 +969,12 @@ public class Vala.GirParser : CodeVisitor {
}
if (!different_invoker) {
if (attr != null) {
- Report.warning (symbol.source_reference, "Virtual method `%s' conflicts with method of the same name", get_full_name ());
+ parser.context.report.log_warning (symbol.source_reference, "Virtual method `%s' conflicts with method of the same name", get_full_name ());
}
node.merged = true;
}
} else if (m.is_class_member ()) {
- Report.warning (symbol.source_reference, "Class method `%s' conflicts with method of the same name", get_full_name ());
+ parser.context.report.log_warning (symbol.source_reference, "Class method `%s' conflicts with method of the same name", get_full_name ());
node.merged = true;
}
}
@@ -1008,7 +1008,7 @@ public class Vala.GirParser : CodeVisitor {
// properties take precedence
node.processed = true;
node.merged = true;
- Report.warning (symbol.source_reference, "Signal `%s' conflicts with property of the same name", get_full_name ());
+ parser.context.report.log_warning (symbol.source_reference, "Signal `%s' conflicts with property of the same name", get_full_name ());
} else if (node.symbol is Method) {
// getter in C, but not in Vala
node.merged = true;
@@ -1514,7 +1514,7 @@ public class Vala.GirParser : CodeVisitor {
void end_element (string name) {
while (current_token != MarkupTokenType.END_ELEMENT || reader.name != name) {
- Report.warning (get_current_src (), "expected end element of `%s'", name);
+ context.report.log_warning (get_current_src (), "expected end element of `%s'", name);
skip_element ();
}
next ();
@@ -2595,7 +2595,7 @@ public class Vala.GirParser : CodeVisitor {
if (name == null) {
name = default_name;
} else if (name.contains ("-")) {
- Report.warning (get_current_src (), "parameter name contains hyphen");
+ context.report.log_warning (get_current_src (), "parameter name contains hyphen");
name = name.replace ("-", "_");
}
string direction = null;
@@ -3782,7 +3782,7 @@ public class Vala.GirParser : CodeVisitor {
}
if (metadata.args.size == 0 && metadata.children.size == 0) {
- Report.warning (metadata.source_reference, "empty metadata");
+ context.report.log_warning (metadata.source_reference, "empty metadata");
return;
}
@@ -3790,13 +3790,13 @@ public class Vala.GirParser : CodeVisitor {
var arg = metadata.args[arg_type];
if (!arg.used) {
// if metadata is used and argument is not, then it's a unexpected argument
- Report.warning (arg.source_reference, "argument never used");
+ context.report.log_warning (arg.source_reference, "argument never used");
}
}
foreach (var child in metadata.children) {
if (!child.used) {
- Report.warning (child.source_reference, "metadata never used");
+ context.report.log_warning (child.source_reference, "metadata never used");
} else {
report_unused_metadata (child);
}
@@ -3964,7 +3964,7 @@ public class Vala.GirParser : CodeVisitor {
alias.symbol = deleg;
} else if (type_sym != null) {
- Report.warning (alias.source_reference, "alias `%s' for `%s' is not supported", alias.get_full_name (), type_sym.get_full_name ());
+ context.report.log_warning (alias.source_reference, "alias `%s' for `%s' is not supported", alias.get_full_name (), type_sym.get_full_name ());
alias.symbol = type_sym;
alias.merged = true;
}
@@ -4379,7 +4379,7 @@ public class Vala.GirParser : CodeVisitor {
param.direction = ParameterDirection.IN;
param.variable_type.nullable = false;
param.variable_type = new PointerType (param.variable_type);
- Report.warning (param.source_reference, "Synchronous out-parameters are not supported in async methods");
+ context.report.log_warning (param.source_reference, "Synchronous out-parameters are not supported in async methods");
}
}
diff --git a/vala/valaifstatement.vala b/vala/valaifstatement.vala
index bed1dfe9a..c123f32c0 100644
--- a/vala/valaifstatement.vala
+++ b/vala/valaifstatement.vala
@@ -134,7 +134,7 @@ public class Vala.IfStatement : CodeNode, Statement {
if (condition.value_type == null || !condition.value_type.compatible (context.analyzer.bool_type)) {
error = true;
- Report.error (condition.source_reference, "Condition must be boolean");
+ context.report.log_error (condition.source_reference, "Condition must be boolean");
return false;
}
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index 87165439d..767fad322 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -139,7 +139,7 @@ public class Vala.InitializerList : Expression {
if (target_type == null) {
error = true;
- Report.error (source_reference, "initializer list used for unknown type");
+ context.report.log_error (source_reference, "initializer list used for unknown type");
return false;
} else if (target_type.error) {
error = true;
@@ -222,7 +222,7 @@ public class Vala.InitializerList : Expression {
while (field == null) {
if (!field_it.next ()) {
error = true;
- Report.error (e.source_reference, "too many expressions in initializer list for `%s'", target_type.to_string ());
+ context.report.log_error (e.source_reference, "too many expressions in initializer list for `%s'", target_type.to_string ());
return false;
}
field = field_it.get ();
@@ -250,7 +250,7 @@ public class Vala.InitializerList : Expression {
}
} else {
error = true;
- Report.error (source_reference, "initializer list used for `%s', which is neither array nor struct", target_type.to_string ());
+ context.report.log_error (source_reference, "initializer list used for `%s', which is neither array nor struct", target_type.to_string ());
return false;
}
@@ -267,7 +267,7 @@ public class Vala.InitializerList : Expression {
foreach (Expression e in get_initializers ()) {
if (e.value_type == null) {
error = true;
- Report.error (e.source_reference, "expression type not allowed as initializer");
+ context.report.log_error (e.source_reference, "expression type not allowed as initializer");
continue;
}
@@ -279,7 +279,7 @@ public class Vala.InitializerList : Expression {
} else if (!e.value_type.compatible (e.target_type)) {
error = true;
e.error = true;
- Report.error (e.source_reference, "Expected initializer of type `%s' but got `%s'", e.target_type.to_string (), e.value_type.to_string ());
+ context.report.log_error (e.source_reference, "Expected initializer of type `%s' but got `%s'", e.target_type.to_string (), e.value_type.to_string ());
}
}
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 92e5da154..b465ecad5 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -174,7 +174,7 @@ public class Vala.Interface : ObjectTypeSymbol {
// check whether prerequisite is at least as accessible as the interface
if (!prerequisite_reference.is_accessible (this)) {
error = true;
- Report.error (source_reference, "prerequisite `%s' is less accessible than interface `%s'", prerequisite_reference.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "prerequisite `%s' is less accessible than interface `%s'", prerequisite_reference.to_string (), get_full_name ());
return false;
}
}
@@ -184,7 +184,7 @@ public class Vala.Interface : ObjectTypeSymbol {
foreach (DataType prereq in get_prerequisites ()) {
if (!(prereq is ObjectType)) {
error = true;
- Report.error (source_reference, "Prerequisite `%s' of interface `%s' is not a class or interface", prereq.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "Prerequisite `%s' of interface `%s' is not a class or interface", prereq.to_string (), get_full_name ());
return false;
}
@@ -192,7 +192,7 @@ public class Vala.Interface : ObjectTypeSymbol {
if (prereq.type_symbol is Class) {
if (prereq_class != null) {
error = true;
- Report.error (source_reference, "%s: Interfaces cannot have multiple instantiable prerequisites (`%s' and `%s')", get_full_name (), prereq.type_symbol.get_full_name (), prereq_class.get_full_name ());
+ context.report.log_error (source_reference, "%s: Interfaces cannot have multiple instantiable prerequisites (`%s' and `%s')", get_full_name (), prereq.type_symbol.get_full_name (), prereq_class.get_full_name ());
return false;
}
@@ -288,7 +288,7 @@ public class Vala.Interface : ObjectTypeSymbol {
foreach (Symbol sym in virtuals) {
int ordering = sym.get_attribute_integer ("CCode", "ordering", -1);
if (ordering < -1) {
- Report.error (sym.source_reference, "%s: Invalid ordering", sym.get_full_name ());
+ context.report.log_error (sym.source_reference, "%s: Invalid ordering", sym.get_full_name ());
// Mark state as invalid
error = true;
ordered_seen = true;
@@ -297,12 +297,12 @@ public class Vala.Interface : ObjectTypeSymbol {
}
bool ordered = ordering != -1;
if (ordered && unordered_seen && !ordered_seen) {
- Report.error (sym.source_reference, "%s: Cannot mix ordered and unordered virtuals", sym.get_full_name ());
+ context.report.log_error (sym.source_reference, "%s: Cannot mix ordered and unordered virtuals", sym.get_full_name ());
error = true;
}
ordered_seen = ordered_seen || ordered;
if (!ordered && !unordered_seen && ordered_seen) {
- Report.error (sym.source_reference, "%s: Cannot mix ordered and unordered virtuals", sym.get_full_name ());
+ context.report.log_error (sym.source_reference, "%s: Cannot mix ordered and unordered virtuals", sym.get_full_name ());
error = true;
}
unordered_seen = unordered_seen || !ordered;
@@ -310,7 +310,7 @@ public class Vala.Interface : ObjectTypeSymbol {
if (ordered) {
Symbol? prev = positions[ordering];
if (prev != null) {
- Report.error (sym.source_reference, "%s: Duplicate ordering (previous virtual with the same position is %s)", sym.get_full_name (), prev.name);
+ context.report.log_error (sym.source_reference, "%s: Duplicate ordering (previous virtual with the same position is %s)", sym.get_full_name (), prev.name);
error = true;
}
positions[ordering] = sym;
@@ -321,7 +321,7 @@ public class Vala.Interface : ObjectTypeSymbol {
for (int i = 0; i < virtuals.size; i++) {
Symbol? sym = positions[i];
if (sym == null) {
- Report.error (source_reference, "%s: Gap in ordering in position %d", get_full_name (), i);
+ context.report.log_error (source_reference, "%s: Gap in ordering in position %d", get_full_name (), i);
error = true;
}
if (!error) {
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index be33765f8..327bfb958 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -142,9 +142,9 @@ public class Vala.LambdaExpression : Expression {
if (!(target_type is DelegateType)) {
error = true;
if (target_type != null) {
- Report.error (source_reference, "Cannot convert lambda expression to `%s'", target_type.to_string ());
+ context.report.log_error (source_reference, "Cannot convert lambda expression to `%s'", target_type.to_string ());
} else {
- Report.error (source_reference, "lambda expression not allowed in this context");
+ context.report.log_error (source_reference, "lambda expression not allowed in this context");
}
return false;
}
@@ -210,7 +210,7 @@ public class Vala.LambdaExpression : Expression {
if (lambda_param.direction != cb_param.direction) {
error = true;
- Report.error (lambda_param.source_reference, "direction of parameter `%s' is incompatible with the target delegate", lambda_param.name);
+ context.report.log_error (lambda_param.source_reference, "direction of parameter `%s' is incompatible with the target delegate", lambda_param.name);
}
lambda_param.variable_type = cb_param.variable_type.get_actual_type (target_type, null, this);
@@ -221,7 +221,7 @@ public class Vala.LambdaExpression : Expression {
if (lambda_param_it.next ()) {
/* lambda expressions may not expect more parameters */
error = true;
- Report.error (source_reference, "lambda expression: too many parameters");
+ context.report.log_error (source_reference, "lambda expression: too many parameters");
return false;
}
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index e2a5c92c2..4335a61fe 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -99,7 +99,7 @@ public class Vala.LocalVariable : Variable {
if (!(variable_type is VarType)) {
if (variable_type is VoidType) {
error = true;
- Report.error (source_reference, "'void' not supported as variable type");
+ context.report.log_error (source_reference, "'void' not supported as variable type");
} else if (!variable_type.check (context)) {
error = true;
}
@@ -124,7 +124,7 @@ public class Vala.LocalVariable : Variable {
error = true;
} else if (initializer.value_type is VoidType) {
error = true;
- Report.error (initializer.source_reference, "'void' not supported as initializer type");
+ context.report.log_error (initializer.source_reference, "'void' not supported as initializer type");
}
}
@@ -140,17 +140,17 @@ public class Vala.LocalVariable : Variable {
if (initializer == null) {
error = true;
- Report.error (source_reference, "var declaration not allowed without initializer");
+ context.report.log_error (source_reference, "var declaration not allowed without initializer");
return false;
}
if (initializer.value_type == null) {
error = true;
- Report.error (source_reference, "var declaration not allowed with non-typed initializer");
+ context.report.log_error (source_reference, "var declaration not allowed with non-typed initializer");
return false;
}
if (initializer.value_type is FieldPrototype || initializer.value_type is PropertyPrototype) {
error = true;
- Report.error (initializer.source_reference, "Access to instance member `%s' denied", initializer.symbol_reference.get_full_name ());
+ context.report.log_error (initializer.source_reference, "Access to instance member `%s' denied", initializer.symbol_reference.get_full_name ());
return false;
}
@@ -184,14 +184,14 @@ public class Vala.LocalVariable : Variable {
if (variable_array_type != null && variable_array_type.inline_allocated
&& variable_array_type.length == null && !(initializer is ArrayCreationExpression)) {
error = true;
- Report.error (source_reference, "Inline allocated array requires either a given length or an initializer");
+ context.report.log_error (source_reference, "Inline allocated array requires either a given length or an initializer");
}
if (initializer != null && !initializer.error) {
if (initializer.value_type is MethodType) {
if (!(initializer is MemberAccess) && !(initializer is LambdaExpression)) {
error = true;
- Report.error (source_reference, "expression type not allowed as initializer");
+ context.report.log_error (source_reference, "expression type not allowed as initializer");
return false;
}
@@ -201,23 +201,23 @@ public class Vala.LocalVariable : Variable {
unowned Method m = (Method) initializer.symbol_reference;
unowned Delegate cb = ((DelegateType) variable_type).delegate_symbol;
error = true;
- Report.error (source_reference, "Declaration of method `%s' is not compatible with delegate `%s'", m.get_full_name (), cb.get_full_name ());
+ context.report.log_error (source_reference, "Declaration of method `%s' is not compatible with delegate `%s'", m.get_full_name (), cb.get_full_name ());
return false;
}
} else {
error = true;
- Report.error (source_reference, "expression type not allowed as initializer");
+ context.report.log_error (source_reference, "expression type not allowed as initializer");
return false;
}
} else if (initializer.value_type == null) {
error = true;
- Report.error (source_reference, "expression type not allowed as initializer");
+ context.report.log_error (source_reference, "expression type not allowed as initializer");
return false;
}
if (!initializer.value_type.compatible (variable_type)) {
error = true;
- Report.error (source_reference, "Assignment: Cannot convert from `%s' to `%s'", initializer.value_type.to_string (), variable_type.to_string ());
+ context.report.log_error (source_reference, "Assignment: Cannot convert from `%s' to `%s'", initializer.value_type.to_string (), variable_type.to_string ());
return false;
} else if (variable_type is EnumValueType && initializer.value_type is IntegerType
&& (!(initializer is IntegerLiteral) || ((IntegerLiteral) initializer).value != "0")) {
@@ -233,7 +233,7 @@ public class Vala.LocalVariable : Variable {
if (variable_array_type != null && variable_array_type.inline_allocated && initializer.value_type is ArrayType == false) {
error = true;
- Report.error (source_reference, "only arrays are allowed as initializer for arrays with fixed length");
+ context.report.log_error (source_reference, "only arrays are allowed as initializer for arrays with fixed length");
return false;
}
@@ -242,7 +242,7 @@ public class Vala.LocalVariable : Variable {
if (!(variable_type is PointerType) && !variable_type.value_owned) {
/* lhs doesn't own the value */
error = true;
- Report.error (source_reference, "Invalid assignment from owned expression to unowned variable");
+ context.report.log_error (source_reference, "Invalid assignment from owned expression to unowned variable");
return false;
}
}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index c8b3b267b..d0a3098f5 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -247,7 +247,7 @@ public class Vala.MemberAccess : Expression {
if (member_name == "this") {
if (!context.analyzer.is_in_instance_method ()) {
error = true;
- Report.error (source_reference, "This access invalid outside of instance methods");
+ context.report.log_error (source_reference, "This access invalid outside of instance methods");
return false;
}
}
@@ -351,7 +351,7 @@ public class Vala.MemberAccess : Expression {
if (local_sym != null) {
if (symbol_reference != null && symbol_reference != local_sym) {
error = true;
- Report.error (source_reference, "`%s' is an ambiguous reference between `%s' and `%s'", member_name, symbol_reference.get_full_name (), local_sym.get_full_name ());
+ context.report.log_error (source_reference, "`%s' is an ambiguous reference between `%s' and `%s'", member_name, symbol_reference.get_full_name (), local_sym.get_full_name ());
return false;
}
@@ -394,7 +394,7 @@ public class Vala.MemberAccess : Expression {
unowned MemberAccess ma = (MemberAccess) inner;
if (ma.prototype_access) {
error = true;
- Report.error (source_reference, "Access to instance member `%s' denied", inner.symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to instance member `%s' denied", inner.symbol_reference.get_full_name ());
return false;
}
}
@@ -490,9 +490,9 @@ public class Vala.MemberAccess : Expression {
if (arg == null || !arg.check (context) || !(arg.symbol_reference is Method)) {
error = true;
if (s.handler is LambdaExpression) {
- Report.error (s.handler.source_reference, "Lambdas are not allowed for dynamic signals");
+ context.report.log_error (s.handler.source_reference, "Lambdas are not allowed for dynamic signals");
} else {
- Report.error (s.handler.source_reference, "Cannot infer call signature for dynamic signal `%s' from given expression", s.get_full_name ());
+ context.report.log_error (s.handler.source_reference, "Cannot infer call signature for dynamic signal `%s' from given expression", s.get_full_name ());
}
}
}
@@ -501,7 +501,7 @@ public class Vala.MemberAccess : Expression {
symbol_reference = s;
} else if (ma.member_name == "disconnect") {
error = true;
- Report.error (ma.source_reference, "Use SignalHandler.disconnect() to disconnect from dynamic signal");
+ context.report.log_error (ma.source_reference, "Use SignalHandler.disconnect() to disconnect from dynamic signal");
}
}
if (symbol_reference == null) {
@@ -530,15 +530,15 @@ public class Vala.MemberAccess : Expression {
// require the real type with its original value_owned attritubte
var inner_type = context.analyzer.get_value_type_for_symbol (inner.symbol_reference, true) as ArrayType;
if (inner_type != null && inner_type.inline_allocated) {
- Report.error (source_reference, "`resize' is not supported for arrays with fixed length");
+ context.report.log_error (source_reference, "`resize' is not supported for arrays with fixed length");
error = true;
} else if (inner_type != null && !inner_type.value_owned) {
- Report.error (source_reference, "`resize' is not allowed for unowned array references");
+ context.report.log_error (source_reference, "`resize' is not allowed for unowned array references");
error = true;
}
} else if (inner.symbol_reference is Constant) {
// disallow resize() for const array
- Report.error (source_reference, "`resize' is not allowed for constant arrays");
+ context.report.log_error (source_reference, "`resize' is not allowed for constant arrays");
error = true;
}
}
@@ -581,7 +581,7 @@ public class Vala.MemberAccess : Expression {
visited_types_string += " or `%s'".printf (type.to_string ());
}
- Report.error (source_reference, "The name `%s' does not exist in the context of `%s'%s%s", member_name, base_type_name, base_type_package, visited_types_string);
+ context.report.log_error (source_reference, "The name `%s' does not exist in the context of `%s'%s%s", member_name, base_type_name, base_type_package, visited_types_string);
value_type = new InvalidType ();
return false;
} else if (symbol_reference.error) {
@@ -606,7 +606,7 @@ public class Vala.MemberAccess : Expression {
symbol_reference = sig.emitter;
} else {
error = true;
- Report.error (source_reference, "Signal `%s' requires emitter in this context", symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Signal `%s' requires emitter in this context", symbol_reference.get_full_name ());
return false;
}
}
@@ -645,7 +645,7 @@ public class Vala.MemberAccess : Expression {
if (local.variable_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
error = true;
- Report.error (source_reference, "Capturing `va_list' variable `%s' is not allowed", local.get_full_name ());
+ context.report.log_error (source_reference, "Capturing `va_list' variable `%s' is not allowed", local.get_full_name ());
}
}
} else if (member is Parameter) {
@@ -668,11 +668,11 @@ public class Vala.MemberAccess : Expression {
if (param.direction != ParameterDirection.IN) {
error = true;
- Report.error (source_reference, "Cannot capture reference or output parameter `%s'", param.get_full_name ());
+ context.report.log_error (source_reference, "Cannot capture reference or output parameter `%s'", param.get_full_name ());
}
if (param.variable_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
error = true;
- Report.error (source_reference, "Capturing `va_list' parameter `%s' is not allowed", param.get_full_name ());
+ context.report.log_error (source_reference, "Capturing `va_list' parameter `%s' is not allowed", param.get_full_name ());
}
} else {
unowned PropertyAccessor? acc = param.parent_symbol.parent_symbol as PropertyAccessor;
@@ -710,7 +710,7 @@ public class Vala.MemberAccess : Expression {
unowned Block? block = c.parent_symbol as Block;
if (block != null && SemanticAnalyzer.find_parent_method_or_property_accessor (block) != context.analyzer.current_method_or_property_accessor) {
error = true;
- Report.error (source_reference, "internal error: accessing local constants of outer methods is not supported yet");
+ context.report.log_error (source_reference, "internal error: accessing local constants of outer methods is not supported yet");
return false;
}
} else if (member is Method) {
@@ -732,7 +732,7 @@ public class Vala.MemberAccess : Expression {
}
if (!is_valid_access) {
error = true;
- Report.error (source_reference, "Access to async callback `%s' not allowed in this context", m.get_full_name ());
+ context.report.log_error (source_reference, "Access to async callback `%s' not allowed in this context", m.get_full_name ());
return false;
}
@@ -818,22 +818,22 @@ public class Vala.MemberAccess : Expression {
if (lvalue) {
if (prop.set_accessor == null) {
error = true;
- Report.error (source_reference, "Property `%s' is read-only", prop.get_full_name ());
+ context.report.log_error (source_reference, "Property `%s' is read-only", prop.get_full_name ());
return false;
} else if (!prop.set_accessor.writable && prop.set_accessor.construction) {
if (context.analyzer.find_current_method () is CreationMethod) {
error = true;
- Report.error (source_reference, "Cannot assign to construct-only properties, use Object (property: value) constructor chain up");
+ context.report.log_error (source_reference, "Cannot assign to construct-only properties, use Object (property: value) constructor chain up");
return false;
} else if (context.analyzer.is_in_constructor ()) {
if (!context.analyzer.current_type_symbol.is_subtype_of ((TypeSymbol) prop.parent_symbol)) {
error = true;
- Report.error (source_reference, "Cannot assign to construct-only property `%s' in `construct' of `%s'", prop.get_full_name (), context.analyzer.current_type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "Cannot assign to construct-only property `%s' in `construct' of `%s'", prop.get_full_name (), context.analyzer.current_type_symbol.get_full_name ());
return false;
}
} else {
error = true;
- Report.error (source_reference, "Cannot assign to construct-only property in this context");
+ context.report.log_error (source_reference, "Cannot assign to construct-only property in this context");
return false;
}
}
@@ -846,7 +846,7 @@ public class Vala.MemberAccess : Expression {
} else {
if (prop.get_accessor == null) {
error = true;
- Report.error (source_reference, "Property `%s' is write-only", prop.get_full_name ());
+ context.report.log_error (source_reference, "Property `%s' is write-only", prop.get_full_name ());
return false;
}
if (prop.access == SymbolAccessibility.PUBLIC) {
@@ -905,7 +905,7 @@ public class Vala.MemberAccess : Expression {
if (!in_subtype) {
error = true;
- Report.error (source_reference, "Access to protected member `%s' denied", member.get_full_name ());
+ context.report.log_error (source_reference, "Access to protected member `%s' denied", member.get_full_name ());
return false;
}
} else if (access == SymbolAccessibility.PRIVATE) {
@@ -921,7 +921,7 @@ public class Vala.MemberAccess : Expression {
if (!in_target_type) {
error = true;
- Report.error (source_reference, "Access to private member `%s' denied", member.get_full_name ());
+ context.report.log_error (source_reference, "Access to private member `%s' denied", member.get_full_name ());
return false;
}
}
@@ -939,7 +939,7 @@ public class Vala.MemberAccess : Expression {
if (object_type != null && object_type.object_type_symbol.has_type_parameters ()
&& !instance_type.has_type_arguments ()) {
error = true;
- Report.error (inner.source_reference, "missing generic type arguments");
+ context.report.log_error (inner.source_reference, "missing generic type arguments");
return false;
}
}
@@ -999,7 +999,7 @@ public class Vala.MemberAccess : Expression {
if (context.experimental_non_null && instance && inner.value_type.nullable &&
!(inner.value_type is PointerType) && !(inner.value_type is GenericType) &&
!(inner.value_type is ArrayType)) {
- Report.error (source_reference, "Access to instance member `%s' from nullable reference denied", symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to instance member `%s' from nullable reference denied", symbol_reference.get_full_name ());
}
unowned Method? m = symbol_reference as Method;
@@ -1050,17 +1050,17 @@ public class Vala.MemberAccess : Expression {
if (symbol_reference is ArrayLengthField) {
if (inner.value_type is ArrayType && ((ArrayType) inner.value_type).rank > 1 && !(parent_node is ElementAccess)) {
- Report.error (source_reference, "unsupported use of length field of multi-dimensional array");
+ context.report.log_error (source_reference, "unsupported use of length field of multi-dimensional array");
error = true;
}
} else if (symbol_reference is DelegateTargetField) {
if (!((DelegateType) inner.value_type).delegate_symbol.has_target) {
- Report.error (source_reference, "unsupported use of target field of delegate without target");
+ context.report.log_error (source_reference, "unsupported use of target field of delegate without target");
error = true;
}
} else if (symbol_reference is DelegateDestroyField) {
if (!((DelegateType) inner.value_type).delegate_symbol.has_target) {
- Report.error (source_reference, "unsupported use of destroy field of delegate without target");
+ context.report.log_error (source_reference, "unsupported use of destroy field of delegate without target");
error = true;
}
}
diff --git a/vala/valamemberinitializer.vala b/vala/valamemberinitializer.vala
index 3f693120e..6ce60739a 100644
--- a/vala/valamemberinitializer.vala
+++ b/vala/valamemberinitializer.vala
@@ -77,7 +77,7 @@ public class Vala.MemberInitializer : Expression {
unowned ObjectCreationExpression? oce = parent_node as ObjectCreationExpression;
if (oce == null) {
error = true;
- Report.error (source_reference, "internal: Invalid member initializer");
+ context.report.log_error (source_reference, "internal: Invalid member initializer");
return false;
}
@@ -86,12 +86,12 @@ public class Vala.MemberInitializer : Expression {
symbol_reference = SemanticAnalyzer.symbol_lookup_inherited (type.type_symbol, name);
if (!(symbol_reference is Field || symbol_reference is Property)) {
error = true;
- Report.error (source_reference, "Invalid member `%s' in `%s'", name, type.type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "Invalid member `%s' in `%s'", name, type.type_symbol.get_full_name ());
return false;
}
if (symbol_reference.access != SymbolAccessibility.PUBLIC) {
error = true;
- Report.error (source_reference, "Access to private member `%s' denied", symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to private member `%s' denied", symbol_reference.get_full_name ());
return false;
}
DataType member_type = null;
@@ -103,7 +103,7 @@ public class Vala.MemberInitializer : Expression {
member_type = prop.property_type;
if (prop.set_accessor == null || !prop.set_accessor.writable) {
error = true;
- Report.error (source_reference, "Property `%s' is read-only", prop.get_full_name ());
+ context.report.log_error (source_reference, "Property `%s' is read-only", prop.get_full_name ());
return false;
}
}
@@ -117,7 +117,7 @@ public class Vala.MemberInitializer : Expression {
if (initializer.value_type == null || !initializer.value_type.compatible (initializer.target_type)) {
error = true;
- Report.error (source_reference, "Invalid type for member `%s'", name);
+ context.report.log_error (source_reference, "Invalid type for member `%s'", name);
return false;
}
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 27e417291..cc78bbd7e 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -749,25 +749,25 @@ public class Vala.Method : Subroutine, Callable {
unowned Class cl = (Class) parent_symbol;
if (cl.is_compact && cl.base_class != null) {
error = true;
- Report.error (source_reference, "Abstract and virtual methods may not be declared in derived compact classes");
+ context.report.log_error (source_reference, "Abstract and virtual methods may not be declared in derived compact classes");
return false;
}
if (cl.is_opaque) {
error = true;
- Report.error (source_reference, "Abstract and virtual methods may not be declared in opaque compact classes");
+ context.report.log_error (source_reference, "Abstract and virtual methods may not be declared in opaque compact classes");
return false;
}
}
if (is_variadic () && (is_abstract || is_virtual)) {
error = true;
- Report.error (source_reference, "Abstract and virtual methods may not be variadic. Use a `va_list' parameter instead of `...' or params-array.");
+ context.report.log_error (source_reference, "Abstract and virtual methods may not be variadic. Use a `va_list' parameter instead of `...' or params-array.");
return false;
}
if (get_attribute ("NoWrapper") != null && !(is_abstract || is_virtual)) {
error = true;
- Report.error (source_reference, "[NoWrapper] methods must be declared abstract or virtual");
+ context.report.log_error (source_reference, "[NoWrapper] methods must be declared abstract or virtual");
return false;
}
@@ -776,51 +776,51 @@ public class Vala.Method : Subroutine, Callable {
unowned Class cl = (Class) parent_symbol;
if (!cl.is_abstract) {
error = true;
- Report.error (source_reference, "Abstract methods may not be declared in non-abstract classes");
+ context.report.log_error (source_reference, "Abstract methods may not be declared in non-abstract classes");
return false;
}
} else if (!(parent_symbol is Interface)) {
error = true;
- Report.error (source_reference, "Abstract methods may not be declared outside of classes and interfaces");
+ context.report.log_error (source_reference, "Abstract methods may not be declared outside of classes and interfaces");
return false;
}
} else if (is_virtual) {
if (!(parent_symbol is Class) && !(parent_symbol is Interface)) {
error = true;
- Report.error (source_reference, "Virtual methods may not be declared outside of classes and interfaces");
+ context.report.log_error (source_reference, "Virtual methods may not be declared outside of classes and interfaces");
return false;
}
} else if (overrides) {
if (!(parent_symbol is Class)) {
error = true;
- Report.error (source_reference, "Methods may not be overridden outside of classes");
+ context.report.log_error (source_reference, "Methods may not be overridden outside of classes");
return false;
}
} else if (access == SymbolAccessibility.PROTECTED) {
if (!(parent_symbol is Class) && !(parent_symbol is Interface)) {
error = true;
- Report.error (source_reference, "Protected methods may not be declared outside of classes and interfaces");
+ context.report.log_error (source_reference, "Protected methods may not be declared outside of classes and interfaces");
return false;
}
}
if (is_abstract && body != null) {
error = true;
- Report.error (source_reference, "Abstract methods cannot have bodies");
+ context.report.log_error (source_reference, "Abstract methods cannot have bodies");
} else if ((is_abstract || is_virtual) && is_extern) {
error = true;
- Report.error (source_reference, "Extern methods cannot be abstract or virtual");
+ context.report.log_error (source_reference, "Extern methods cannot be abstract or virtual");
} else if (is_extern && body != null) {
error = true;
- Report.error (source_reference, "Extern methods cannot have bodies");
+ context.report.log_error (source_reference, "Extern methods cannot have bodies");
} else if (!is_abstract && !external && source_type == SourceFileType.SOURCE && body == null) {
error = true;
- Report.error (source_reference, "Non-abstract, non-extern methods must have bodies");
+ context.report.log_error (source_reference, "Non-abstract, non-extern methods must have bodies");
}
if (coroutine && !external_package && !context.has_package ("gio-2.0")) {
error = true;
- Report.error (source_reference, "gio-2.0 package required for async methods");
+ context.report.log_error (source_reference, "gio-2.0 package required for async methods");
return false;
}
@@ -840,7 +840,7 @@ public class Vala.Method : Subroutine, Callable {
if (return_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
error = true;
- Report.error (source_reference, "`%s' not supported as return type", return_type.type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "`%s' not supported as return type", return_type.type_symbol.get_full_name ());
return false;
}
@@ -852,12 +852,12 @@ public class Vala.Method : Subroutine, Callable {
if (parameters.size == 1 && parameters[0].ellipsis && body != null && binding != MemberBinding.INSTANCE) {
// accept just `...' for external methods and instance methods
error = true;
- Report.error (parameters[0].source_reference, "Named parameter required before `...'");
+ context.report.log_error (parameters[0].source_reference, "Named parameter required before `...'");
}
if (get_attribute ("Print") != null && (parameters.size != 1 || parameters[0].variable_type.type_symbol != context.analyzer.string_type.type_symbol)) {
error = true;
- Report.error (source_reference, "[Print] methods must have exactly one parameter of type `string'");
+ context.report.log_error (source_reference, "[Print] methods must have exactly one parameter of type `string'");
}
var optional_param = false;
@@ -870,11 +870,11 @@ public class Vala.Method : Subroutine, Callable {
}
if (coroutine && param.direction == ParameterDirection.REF) {
error = true;
- Report.error (param.source_reference, "Reference parameters are not supported for async methods");
+ context.report.log_error (param.source_reference, "Reference parameters are not supported for async methods");
}
if (!external_package && coroutine && (param.ellipsis || param.params_array || param.variable_type.type_symbol == context.analyzer.va_list_type.type_symbol)) {
error = true;
- Report.error (param.source_reference, "Variadic parameters are not supported for async methods");
+ context.report.log_error (param.source_reference, "Variadic parameters are not supported for async methods");
return false;
}
// TODO: begin and end parameters must be checked separately for coroutines
@@ -889,12 +889,12 @@ public class Vala.Method : Subroutine, Callable {
// Disallow parameter after params array or ellipsis
if (params_array_param) {
- Report.error (param.source_reference, "parameter follows params-array parameter");
+ context.report.log_error (param.source_reference, "parameter follows params-array parameter");
} else if (param.params_array) {
params_array_param = true;
}
if (ellipsis_param) {
- Report.error (param.source_reference, "parameter follows ellipsis parameter");
+ context.report.log_error (param.source_reference, "parameter follows ellipsis parameter");
} else if (param.ellipsis) {
ellipsis_param = true;
}
@@ -903,7 +903,7 @@ public class Vala.Method : Subroutine, Callable {
if (param.params_array && body != null) {
if (params_array_var != null) {
error = true;
- Report.error (param.source_reference, "Only one params-array parameter is allowed");
+ context.report.log_error (param.source_reference, "Only one params-array parameter is allowed");
continue;
}
if (!context.experimental) {
@@ -914,11 +914,11 @@ public class Vala.Method : Subroutine, Callable {
type.value_owned = true;
if (type.element_type.is_real_struct_type () && !type.element_type.nullable) {
error = true;
- Report.error (param.source_reference, "Only nullable struct elements are supported in params-array");
+ context.report.log_error (param.source_reference, "Only nullable struct elements are supported in params-array");
}
if (type.length != null) {
error = true;
- Report.error (param.source_reference, "Passing length to params-array is not supported yet");
+ context.report.log_error (param.source_reference, "Passing length to params-array is not supported yet");
}
params_array_var = new LocalVariable (type, param.name, null, param.source_reference);
body.insert_statement (0, new DeclarationStatement (params_array_var, param.source_reference));
@@ -934,7 +934,7 @@ public class Vala.Method : Subroutine, Callable {
requires_pointer = true;
} else if (requires_pointer) {
error = true;
- Report.error (param.source_reference, "Synchronous out-parameters are not supported in async methods");
+ context.report.log_error (param.source_reference, "Synchronous out-parameters are not supported in async methods");
}
}
}
@@ -943,14 +943,14 @@ public class Vala.Method : Subroutine, Callable {
foreach (DataType error_type in error_types) {
if (!(error_type is ErrorType)) {
error = true;
- Report.error (error_type.source_reference, "`%s' is not an error type", error_type.to_string ());
+ context.report.log_error (error_type.source_reference, "`%s' is not an error type", error_type.to_string ());
}
error_type.check (context);
// check whether error type is at least as accessible as the method
if (!error_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "error type `%s' is less accessible than method `%s'", error_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "error type `%s' is less accessible than method `%s'", error_type.to_string (), get_full_name ());
return false;
}
}
@@ -980,10 +980,10 @@ public class Vala.Method : Subroutine, Callable {
Report.warning (source_reference, "`override' not required to implement `abstract' interface method `%s'", base_interface_method.get_full_name ());
overrides = false;
} else if (overrides && base_method == null && base_interface_method == null) {
- Report.error (source_reference, "`%s': no suitable method found to override", get_full_name ());
+ context.report.log_error (source_reference, "`%s': no suitable method found to override", get_full_name ());
} else if ((is_abstract || is_virtual || overrides) && access == SymbolAccessibility.PRIVATE) {
error = true;
- Report.error (source_reference, "Private member `%s' cannot be marked as override, virtual, or abstract", get_full_name ());
+ context.report.log_error (source_reference, "Private member `%s' cannot be marked as override, virtual, or abstract", get_full_name ());
return false;
}
@@ -994,7 +994,7 @@ public class Vala.Method : Subroutine, Callable {
m.checked = true;
m.error = true;
error = true;
- Report.error (source_reference, "`%s' already contains an implementation for `%s'", cl.get_full_name (), base_interface_method.get_full_name ());
+ context.report.log_error (source_reference, "`%s' already contains an implementation for `%s'", cl.get_full_name (), base_interface_method.get_full_name ());
Report.notice (m.source_reference, "previous implementation of `%s' was here", base_interface_method.get_full_name ());
return false;
}
@@ -1011,7 +1011,7 @@ public class Vala.Method : Subroutine, Callable {
// check whether return type is at least as accessible as the method
if (!return_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "return type `%s' is less accessible than method `%s'", return_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "return type `%s' is less accessible than method `%s'", return_type.to_string (), get_full_name ());
return false;
}
@@ -1024,7 +1024,7 @@ public class Vala.Method : Subroutine, Callable {
if (!precondition.value_type.compatible (context.analyzer.bool_type)) {
error = true;
- Report.error (precondition.source_reference, "Precondition must be boolean");
+ context.report.log_error (precondition.source_reference, "Precondition must be boolean");
return false;
}
}
@@ -1038,7 +1038,7 @@ public class Vala.Method : Subroutine, Callable {
if (!postcondition.value_type.compatible (context.analyzer.bool_type)) {
error = true;
- Report.error (postcondition.source_reference, "Postcondition must be boolean");
+ context.report.log_error (postcondition.source_reference, "Postcondition must be boolean");
return false;
}
}
@@ -1099,7 +1099,7 @@ public class Vala.Method : Subroutine, Callable {
if (is_possible_entry_point (context)) {
if (context.entry_point != null) {
error = true;
- Report.error (source_reference, "program already has an entry point `%s'", context.entry_point.get_full_name ());
+ context.report.log_error (source_reference, "program already has an entry point `%s'", context.entry_point.get_full_name ());
return false;
}
entry_point = true;
@@ -1107,17 +1107,17 @@ public class Vala.Method : Subroutine, Callable {
if (tree_can_fail) {
error = true;
- Report.error (source_reference, "\"main\" method cannot throw errors");
+ context.report.log_error (source_reference, "\"main\" method cannot throw errors");
}
if (is_inline) {
error = true;
- Report.error (source_reference, "\"main\" method cannot be inline");
+ context.report.log_error (source_reference, "\"main\" method cannot be inline");
}
if (coroutine) {
error = true;
- Report.error (source_reference, "\"main\" method cannot be async");
+ context.report.log_error (source_reference, "\"main\" method cannot be async");
}
}
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 70ad8fb6a..9c3779a19 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -197,7 +197,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
unowned MemberAccess ma = (MemberAccess) call;
if (ma.prototype_access) {
error = true;
- Report.error (source_reference, "Access to instance member `%s' denied", call.symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to instance member `%s' denied", call.symbol_reference.get_full_name ());
return false;
}
@@ -265,11 +265,11 @@ public class Vala.MethodCall : Expression, CallableExpression {
unowned CreationMethod? cm = context.analyzer.find_current_method () as CreationMethod;
if (cm == null) {
error = true;
- Report.error (source_reference, "invocation not supported in this context");
+ context.report.log_error (source_reference, "invocation not supported in this context");
return false;
} else if (cm.chain_up) {
error = true;
- Report.error (source_reference, "Multiple constructor calls in the same constructor are not permitted");
+ context.report.log_error (source_reference, "Multiple constructor calls in the same constructor are not permitted");
return false;
}
cm.chain_up = true;
@@ -279,25 +279,25 @@ public class Vala.MethodCall : Expression, CallableExpression {
base_cm = cl.default_construction_method;
if (base_cm == null) {
error = true;
- Report.error (source_reference, "chain up to `%s' not supported", cl.get_full_name ());
+ context.report.log_error (source_reference, "chain up to `%s' not supported", cl.get_full_name ());
return false;
} else if (!base_cm.has_construct_function) {
error = true;
- Report.error (source_reference, "chain up to `%s' not supported", base_cm.get_full_name ());
+ context.report.log_error (source_reference, "chain up to `%s' not supported", base_cm.get_full_name ());
return false;
}
} else if (call.symbol_reference is CreationMethod && call.symbol_reference.parent_symbol is Class) {
base_cm = (CreationMethod) call.symbol_reference;
if (!base_cm.has_construct_function) {
error = true;
- Report.error (source_reference, "chain up to `%s' not supported", base_cm.get_full_name ());
+ context.report.log_error (source_reference, "chain up to `%s' not supported", base_cm.get_full_name ());
return false;
}
} else if (gobject_chainup) {
unowned Class? cl = cm.parent_symbol as Class;
if (cl == null || !cl.is_subtype_of (context.analyzer.object_type)) {
error = true;
- Report.error (source_reference, "chain up to `GLib.Object' not supported");
+ context.report.log_error (source_reference, "chain up to `GLib.Object' not supported");
return false;
}
call.value_type = new ObjectType (context.analyzer.object_type, source_reference);
@@ -313,7 +313,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
unowned Struct? st = call.symbol_reference as Struct;
if (st != null && st.default_construction_method == null && (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ())) {
error = true;
- Report.error (source_reference, "invocation not supported in this context");
+ context.report.log_error (source_reference, "invocation not supported in this context");
return false;
}
@@ -330,24 +330,24 @@ public class Vala.MethodCall : Expression, CallableExpression {
return true;
} else if (!is_chainup && call is MemberAccess && call.symbol_reference is CreationMethod) {
error = true;
- Report.error (source_reference, "use `new' operator to create new objects");
+ context.report.log_error (source_reference, "use `new' operator to create new objects");
return false;
}
if (!is_chainup && mtype is ObjectType) {
// prevent funny stuff like (new Object ()) ()
error = true;
- Report.error (source_reference, "invocation not supported in this context");
+ context.report.log_error (source_reference, "invocation not supported in this context");
return false;
} else if (mtype != null && mtype.is_invokable ()) {
// call ok, expression is invokable
} else if (call.symbol_reference is Class) {
error = true;
- Report.error (source_reference, "use `new' operator to create new objects");
+ context.report.log_error (source_reference, "use `new' operator to create new objects");
return false;
} else {
error = true;
- Report.error (source_reference, "invocation not supported in this context");
+ context.report.log_error (source_reference, "invocation not supported in this context");
return false;
}
@@ -374,7 +374,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
}
} else if (ma.member_name == "begin" || ma.member_name == "end") {
error = true;
- Report.error (ma.source_reference, "use of `%s' not allowed in yield statement", ma.member_name);
+ context.report.log_error (ma.source_reference, "use of `%s' not allowed in yield statement", ma.member_name);
}
}
@@ -382,11 +382,11 @@ public class Vala.MethodCall : Expression, CallableExpression {
int n_type_args = ma.get_type_arguments ().size;
if (n_type_args > 0 && n_type_args < n_type_params) {
error = true;
- Report.error (ma.source_reference, "too few type arguments");
+ context.report.log_error (ma.source_reference, "too few type arguments");
return false;
} else if (n_type_args > 0 && n_type_args > n_type_params) {
error = true;
- Report.error (ma.source_reference, "too many type arguments");
+ context.report.log_error (ma.source_reference, "too many type arguments");
return false;
}
}
@@ -508,7 +508,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
// A void method invocation can be in the initializer or
// iterator of a for statement
error = true;
- Report.error (source_reference, "invocation of void method not allowed as expression");
+ context.report.log_error (source_reference, "invocation of void method not allowed as expression");
return false;
}
}
@@ -519,11 +519,11 @@ public class Vala.MethodCall : Expression, CallableExpression {
if (is_yield_expression) {
if (!(mtype is MethodType) || !((MethodType) mtype).method_symbol.coroutine) {
error = true;
- Report.error (source_reference, "yield expression requires async method");
+ context.report.log_error (source_reference, "yield expression requires async method");
}
if (context.analyzer.current_method == null || !context.analyzer.current_method.coroutine) {
error = true;
- Report.error (source_reference, "yield expression not available outside async method");
+ context.report.log_error (source_reference, "yield expression not available outside async method");
}
}
@@ -538,7 +538,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
unowned Property? prop = inner.symbol_reference as Property;
if (prop != null && (prop.set_accessor == null || !prop.set_accessor.writable)) {
error = true;
- Report.error (inner.source_reference, "Property `%s' is read-only", prop.get_full_name ());
+ context.report.log_error (inner.source_reference, "Property `%s' is read-only", prop.get_full_name ());
}
}
// avoid passing possible null to ref_sink_function without checking
@@ -550,7 +550,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
if (sig != null && m.name == "disconnect") {
if (!argument_list.is_empty && argument_list[0] is LambdaExpression) {
error = true;
- Report.error (source_reference, "Cannot disconnect lambda expression from signal");
+ context.report.log_error (source_reference, "Cannot disconnect lambda expression from signal");
return false;
}
}
@@ -603,7 +603,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
if (type_arg == null) {
error = true;
- Report.error (ma.source_reference, "cannot infer generic type argument for type parameter `%s'", type_param.get_full_name ());
+ context.report.log_error (ma.source_reference, "cannot infer generic type argument for type parameter `%s'", type_param.get_full_name ());
return false;
}
@@ -668,7 +668,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
} else if (!(context.analyzer.current_symbol is Block)) {
// can't handle errors in field initializers
error = true;
- Report.error (source_reference, "Field initializers must not throw errors");
+ context.report.log_error (source_reference, "Field initializers must not throw errors");
} else {
// store parent_node as we need to replace the expression in the old parent node later on
var old_parent_node = parent_node;
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 73b0d314e..9308b5821 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -481,11 +481,11 @@ public class Vala.Namespace : Symbol {
foreach (Field f in fields) {
if (f.binding == MemberBinding.INSTANCE) {
- Report.error (f.source_reference, "instance fields are not allowed outside of data types");
+ context.report.log_error (f.source_reference, "instance fields are not allowed outside of data types");
f.error = true;
error = true;
} else if (f.binding == MemberBinding.CLASS) {
- Report.error (f.source_reference, "class fields are not allowed outside of classes");
+ context.report.log_error (f.source_reference, "class fields are not allowed outside of classes");
f.error = true;
error = true;
}
@@ -493,16 +493,16 @@ public class Vala.Namespace : Symbol {
foreach (Method m in methods) {
if (m is CreationMethod) {
- Report.error (m.source_reference, "construction methods may only be declared within classes and structs");
+ context.report.log_error (m.source_reference, "construction methods may only be declared within classes and structs");
m.error = true;
error = true;
}
if (m.binding == MemberBinding.INSTANCE) {
- Report.error (m.source_reference, "instance methods are not allowed outside of data types");
+ context.report.log_error (m.source_reference, "instance methods are not allowed outside of data types");
m.error = true;
error = true;
} else if (m.binding == MemberBinding.CLASS) {
- Report.error (m.source_reference, "class methods are not allowed outside of classes");
+ context.report.log_error (m.source_reference, "class methods are not allowed outside of classes");
m.error = true;
error = true;
}
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index dc2bd8f6c..04c595234 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -195,7 +195,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (type_reference == null) {
if (member_name == null) {
error = true;
- Report.error (source_reference, "Incomplete object creation expression");
+ context.report.log_error (source_reference, "Incomplete object creation expression");
return false;
}
@@ -215,7 +215,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
var constructor = (Method) constructor_sym;
if (!(constructor_sym is CreationMethod)) {
error = true;
- Report.error (source_reference, "`%s' is not a creation method", constructor.get_full_name ());
+ context.report.log_error (source_reference, "`%s' is not a creation method", constructor.get_full_name ());
return false;
}
@@ -244,7 +244,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
symbol_reference = type_sym;
} else {
error = true;
- Report.error (source_reference, "`%s' is not a class, struct, or error code", type_sym.get_full_name ());
+ context.report.log_error (source_reference, "`%s' is not a class, struct, or error code", type_sym.get_full_name ());
return false;
}
@@ -263,14 +263,14 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (struct_creation) {
error = true;
- Report.error (source_reference, "syntax error, use `new' to create new objects");
+ context.report.log_error (source_reference, "syntax error, use `new' to create new objects");
return false;
}
if (cl.is_abstract) {
value_type = null;
error = true;
- Report.error (source_reference, "Can't create instance of abstract class `%s'", cl.get_full_name ());
+ context.report.log_error (source_reference, "Can't create instance of abstract class `%s'", cl.get_full_name ());
return false;
}
@@ -279,7 +279,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (symbol_reference == null) {
error = true;
- Report.error (source_reference, "`%s' does not have a default constructor", cl.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not have a default constructor", cl.get_full_name ());
return false;
}
@@ -300,7 +300,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (!in_target_type) {
error = true;
- Report.error (source_reference, "Access to non-public constructor `%s' denied", symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to non-public constructor `%s' denied", symbol_reference.get_full_name ());
return false;
}
}
@@ -327,7 +327,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (context.profile == Profile.GOBJECT && st.is_simple_type () && symbol_reference == null && object_initializer.size == 0) {
error = true;
- Report.error (source_reference, "`%s' does not have a default constructor", st.get_full_name ());
+ context.report.log_error (source_reference, "`%s' does not have a default constructor", st.get_full_name ());
return false;
}
}
@@ -341,7 +341,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (symbol_reference == null && argument_list.size != 0) {
value_type = null;
error = true;
- Report.error (source_reference, "No arguments allowed when constructing type `%s'", type.get_full_name ());
+ context.report.log_error (source_reference, "No arguments allowed when constructing type `%s'", type.get_full_name ());
return false;
}
@@ -351,16 +351,16 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (is_yield_expression) {
if (!m.coroutine) {
error = true;
- Report.error (source_reference, "yield expression requires async method");
+ context.report.log_error (source_reference, "yield expression requires async method");
}
if (context.analyzer.current_method == null || !context.analyzer.current_method.coroutine) {
error = true;
- Report.error (source_reference, "yield expression not available outside async method");
+ context.report.log_error (source_reference, "yield expression not available outside async method");
}
} else if (m is CreationMethod) {
if (m.coroutine) {
error = true;
- Report.error (source_reference, "missing `yield' before async creation expression");
+ context.report.log_error (source_reference, "missing `yield' before async creation expression");
}
}
@@ -457,14 +457,14 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
if (argument_list.size == 0) {
error = true;
- Report.error (source_reference, "Too few arguments, errors need at least 1 argument");
+ context.report.log_error (source_reference, "Too few arguments, errors need at least 1 argument");
} else {
Iterator<Expression> arg_it = argument_list.iterator ();
arg_it.next ();
var ex = arg_it.get ();
if (ex.value_type == null || !ex.value_type.compatible (context.analyzer.string_type)) {
error = true;
- Report.error (source_reference, "Invalid type for argument 1");
+ context.report.log_error (source_reference, "Invalid type for argument 1");
}
var format_literal = StringLiteral.get_format_literal (ex);
@@ -535,7 +535,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
// simple statements, no side effects after method call
} else if (!(context.analyzer.current_symbol is Block)) {
// can't handle errors in field initializers
- Report.error (source_reference, "Field initializers must not throw errors");
+ context.report.log_error (source_reference, "Field initializers must not throw errors");
} else {
// store parent_node as we need to replace the expression in the old parent node later on
var old_parent_node = parent_node;
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 656188848..82b761c61 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -143,7 +143,7 @@ public class Vala.Parameter : Variable {
if (variable_type != null) {
if (variable_type is VoidType) {
error = true;
- Report.error (source_reference, "'void' not supported as parameter type");
+ context.report.log_error (source_reference, "'void' not supported as parameter type");
return false;
}
variable_type.check (context);
@@ -155,11 +155,11 @@ public class Vala.Parameter : Variable {
if (params_array) {
if (!(variable_type is ArrayType)) {
error = true;
- Report.error (source_reference, "parameter array expected");
+ context.report.log_error (source_reference, "parameter array expected");
return false;
} else if (((ArrayType) variable_type).rank != 1) {
error = true;
- Report.error (source_reference, "multi-dimensional parameter array not allowed");
+ context.report.log_error (source_reference, "multi-dimensional parameter array not allowed");
return false;
}
}
@@ -181,7 +181,7 @@ public class Vala.Parameter : Variable {
if (variable_array_type != null && variable_array_type.inline_allocated
&& !variable_array_type.fixed_length) {
error = true;
- Report.error (source_reference, "Inline allocated array as parameter requires to have fixed length");
+ context.report.log_error (source_reference, "Inline allocated array as parameter requires to have fixed length");
}
}
@@ -192,16 +192,16 @@ public class Vala.Parameter : Variable {
Report.warning (source_reference, "`null' incompatible with parameter type `%s'", variable_type.to_string ());
} else if (!(initializer is NullLiteral) && direction == ParameterDirection.OUT) {
error = true;
- Report.error (source_reference, "only `null' is allowed as default value for out parameters");
+ context.report.log_error (source_reference, "only `null' is allowed as default value for out parameters");
} else if (direction == ParameterDirection.IN && !initializer.value_type.compatible (variable_type)) {
error = true;
- Report.error (initializer.source_reference, "Cannot convert from `%s' to `%s'", initializer.value_type.to_string (), variable_type.to_string ());
+ context.report.log_error (initializer.source_reference, "Cannot convert from `%s' to `%s'", initializer.value_type.to_string (), variable_type.to_string ());
} else if (direction == ParameterDirection.REF) {
error = true;
- Report.error (source_reference, "default value not allowed for ref parameter");
+ context.report.log_error (source_reference, "default value not allowed for ref parameter");
} else if (!initializer.is_accessible (this)) {
error = true;
- Report.error (initializer.source_reference, "default value is less accessible than method `%s'", parent_symbol.get_full_name ());
+ context.report.log_error (initializer.source_reference, "default value is less accessible than method `%s'", parent_symbol.get_full_name ());
}
}
@@ -218,7 +218,7 @@ public class Vala.Parameter : Variable {
// check whether parameter type is at least as accessible as the method
if (!variable_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "parameter type `%s' is less accessible than method `%s'", variable_type.to_string (), parent_symbol.get_full_name ());
+ context.report.log_error (source_reference, "parameter type `%s' is less accessible than method `%s'", variable_type.to_string (), parent_symbol.get_full_name ());
}
}
diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala
index 5e14de7f6..05fc63462 100644
--- a/vala/valapointerindirection.vala
+++ b/vala/valapointerindirection.vala
@@ -93,21 +93,21 @@ public class Vala.PointerIndirection : Expression {
}
if (inner.value_type == null) {
error = true;
- Report.error (source_reference, "internal error: unknown type of inner expression");
+ context.report.log_error (source_reference, "internal error: unknown type of inner expression");
return false;
}
if (inner.value_type is PointerType) {
var pointer_type = (PointerType) inner.value_type;
if (pointer_type.base_type is ReferenceType || pointer_type.base_type is VoidType) {
error = true;
- Report.error (source_reference, "Pointer indirection not supported for this expression");
+ context.report.log_error (source_reference, "Pointer indirection not supported for this expression");
return false;
}
value_type = pointer_type.base_type;
value_type.value_owned = false;
} else {
error = true;
- Report.error (source_reference, "Pointer indirection not supported for this expression");
+ context.report.log_error (source_reference, "Pointer indirection not supported for this expression");
return false;
}
diff --git a/vala/valapostfixexpression.vala b/vala/valapostfixexpression.vala
index 24fa709b2..ad1cb709a 100644
--- a/vala/valapostfixexpression.vala
+++ b/vala/valapostfixexpression.vala
@@ -112,7 +112,7 @@ public class Vala.PostfixExpression : Expression {
if (!(inner.value_type is IntegerType) && !(inner.value_type is FloatingType) && !(inner.value_type is PointerType)) {
error = true;
- Report.error (source_reference, "unsupported lvalue in postfix expression");
+ context.report.log_error (source_reference, "unsupported lvalue in postfix expression");
return false;
}
@@ -121,7 +121,7 @@ public class Vala.PostfixExpression : Expression {
if (ma.prototype_access) {
error = true;
- Report.error (source_reference, "Access to instance member `%s' denied", ma.symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Access to instance member `%s' denied", ma.symbol_reference.get_full_name ());
return false;
}
@@ -134,12 +134,12 @@ public class Vala.PostfixExpression : Expression {
unowned ElementAccess ea = (ElementAccess) inner;
if (!(ea.container.value_type is ArrayType)) {
error = true;
- Report.error (source_reference, "unsupported lvalue in postfix expression");
+ context.report.log_error (source_reference, "unsupported lvalue in postfix expression");
return false;
}
} else {
error = true;
- Report.error (source_reference, "unsupported lvalue in postfix expression");
+ context.report.log_error (source_reference, "unsupported lvalue in postfix expression");
return false;
}
@@ -151,7 +151,7 @@ public class Vala.PostfixExpression : Expression {
if (prop.set_accessor == null || !prop.set_accessor.writable) {
ma.error = true;
- Report.error (ma.source_reference, "Property `%s' is read-only", prop.get_full_name ());
+ context.report.log_error (ma.source_reference, "Property `%s' is read-only", prop.get_full_name ());
return false;
}
}
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index fac24d53d..6d95a452f 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -417,7 +417,7 @@ public class Vala.Property : Symbol, Lockable {
&& ((ObjectTypeSymbol) parent_symbol).is_subtype_of (context.analyzer.object_type)) {
if (!is_valid_name (name)) {
error = true;
- Report.error (source_reference, "Name `%s' is not valid for a GLib.Object property", name);
+ context.report.log_error (source_reference, "Name `%s' is not valid for a GLib.Object property", name);
}
}
@@ -429,12 +429,12 @@ public class Vala.Property : Symbol, Lockable {
var cl = (Class) parent_symbol;
if (cl.is_compact && cl.base_class != null) {
error = true;
- Report.error (source_reference, "Abstract and virtual properties may not be declared in derived compact classes");
+ context.report.log_error (source_reference, "Abstract and virtual properties may not be declared in derived compact classes");
return false;
}
if (cl.is_opaque) {
error = true;
- Report.error (source_reference, "Abstract and virtual properties may not be declared in opaque compact classes");
+ context.report.log_error (source_reference, "Abstract and virtual properties may not be declared in opaque compact classes");
return false;
}
}
@@ -444,30 +444,30 @@ public class Vala.Property : Symbol, Lockable {
var cl = (Class) parent_symbol;
if (!cl.is_abstract) {
error = true;
- Report.error (source_reference, "Abstract properties may not be declared in non-abstract classes");
+ context.report.log_error (source_reference, "Abstract properties may not be declared in non-abstract classes");
return false;
}
} else if (!(parent_symbol is Interface)) {
error = true;
- Report.error (source_reference, "Abstract properties may not be declared outside of classes and interfaces");
+ context.report.log_error (source_reference, "Abstract properties may not be declared outside of classes and interfaces");
return false;
}
} else if (is_virtual) {
if (!(parent_symbol is Class) && !(parent_symbol is Interface)) {
error = true;
- Report.error (source_reference, "Virtual properties may not be declared outside of classes and interfaces");
+ context.report.log_error (source_reference, "Virtual properties may not be declared outside of classes and interfaces");
return false;
}
} else if (overrides) {
if (!(parent_symbol is Class)) {
error = true;
- Report.error (source_reference, "Properties may not be overridden outside of classes");
+ context.report.log_error (source_reference, "Properties may not be overridden outside of classes");
return false;
}
} else if (access == SymbolAccessibility.PROTECTED) {
if (!(parent_symbol is Class) && !(parent_symbol is Interface)) {
error = true;
- Report.error (source_reference, "Protected properties may not be declared outside of classes and interfaces");
+ context.report.log_error (source_reference, "Protected properties may not be declared outside of classes and interfaces");
return false;
}
}
@@ -482,7 +482,7 @@ public class Vala.Property : Symbol, Lockable {
if (property_type is VoidType) {
error = true;
- Report.error (source_reference, "'void' not supported as property type");
+ context.report.log_error (source_reference, "'void' not supported as property type");
return false;
}
@@ -497,7 +497,7 @@ public class Vala.Property : Symbol, Lockable {
if (get_accessor == null && set_accessor == null) {
error = true;
- Report.error (source_reference, "Property `%s' must have a `get' accessor and/or a `set' mutator", get_full_name ());
+ context.report.log_error (source_reference, "Property `%s' must have a `get' accessor and/or a `set' mutator", get_full_name ());
return false;
}
@@ -512,7 +512,7 @@ public class Vala.Property : Symbol, Lockable {
}
if (initializer != null && field == null && !is_abstract) {
- Report.error (source_reference, "Property `%s' with custom `get' accessor and/or `set' mutator cannot have `default' value", get_full_name ());
+ context.report.log_error (source_reference, "Property `%s' with custom `get' accessor and/or `set' mutator cannot have `default' value", get_full_name ());
}
if (initializer != null) {
@@ -522,11 +522,11 @@ public class Vala.Property : Symbol, Lockable {
// check whether property type is at least as accessible as the property
if (!property_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "property type `%s' is less accessible than property `%s'", property_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "property type `%s' is less accessible than property `%s'", property_type.to_string (), get_full_name ());
}
if (overrides && base_property == null && base_interface_property == null) {
- Report.error (source_reference, "%s: no suitable property found to override", get_full_name ());
+ context.report.log_error (source_reference, "%s: no suitable property found to override", get_full_name ());
}
if (!external_package && !overrides && !hides && get_hidden_member () != null) {
@@ -537,13 +537,13 @@ public class Vala.Property : Symbol, Lockable {
if (set_accessor != null && set_accessor.construction) {
if (access != SymbolAccessibility.PUBLIC) {
error = true;
- Report.error (source_reference, "%s: construct properties must be public", get_full_name ());
+ context.report.log_error (source_reference, "%s: construct properties must be public", get_full_name ());
}
}
if (initializer != null && !initializer.error && initializer.value_type != null && !(initializer.value_type.compatible (property_type))) {
error = true;
- Report.error (initializer.source_reference, "Expected initializer of type `%s' but got `%s'", property_type.to_string (), initializer.value_type.to_string ());
+ context.report.log_error (initializer.source_reference, "Expected initializer of type `%s' but got `%s'", property_type.to_string (), initializer.value_type.to_string ());
}
context.analyzer.current_source_file = old_source_file;
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 393284301..a4123fd14 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -175,7 +175,7 @@ public class Vala.PropertyAccessor : Subroutine {
// Hopefully good as is
} else if (!value_type.value_owned && source_reference.file.file_type == SourceFileType.SOURCE) {
error = true;
- Report.error (source_reference, "unowned return value for getter of property `%s' not supported without accessor", prop.get_full_name ());
+ context.report.log_error (source_reference, "unowned return value for getter of property `%s' not supported without accessor", prop.get_full_name ());
}
} else if (value_type.value_owned && (source_reference == null || source_reference.file == null)) {
if (value_type is DelegateType || value_type is PointerType || (value_type is ValueType && !value_type.nullable)) {
@@ -207,17 +207,17 @@ public class Vala.PropertyAccessor : Subroutine {
if ((prop.is_abstract || prop.is_virtual || prop.overrides) && access == SymbolAccessibility.PRIVATE) {
error = true;
- Report.error (source_reference, "Property `%s' with private accessor cannot be marked as abstract, virtual or override", prop.get_full_name ());
+ context.report.log_error (source_reference, "Property `%s' with private accessor cannot be marked as abstract, virtual or override", prop.get_full_name ());
return false;
}
if (context.profile == Profile.POSIX && construction) {
error = true;
- Report.error (source_reference, "`construct' is not supported in POSIX profile");
+ context.report.log_error (source_reference, "`construct' is not supported in POSIX profile");
return false;
} else if (construction && !((TypeSymbol) prop.parent_symbol).is_subtype_of (context.analyzer.object_type)) {
error = true;
- Report.error (source_reference, "construct properties require `GLib.Object'");
+ context.report.log_error (source_reference, "construct properties require `GLib.Object'");
return false;
} else if (construction && !context.analyzer.is_gobject_property (prop)) {
//TODO Report an error for external property too
@@ -225,14 +225,14 @@ public class Vala.PropertyAccessor : Subroutine {
Report.warning (source_reference, "construct properties not supported for specified property type");
} else {
error = true;
- Report.error (source_reference, "construct properties not supported for specified property type");
+ context.report.log_error (source_reference, "construct properties not supported for specified property type");
return false;
}
}
if (body != null && prop.is_abstract) {
error = true;
- Report.error (source_reference, "Accessor of abstract property `%s' cannot have body", prop.get_full_name ());
+ context.report.log_error (source_reference, "Accessor of abstract property `%s' cannot have body", prop.get_full_name ());
return false;
}
diff --git a/vala/valareferencetransferexpression.vala b/vala/valareferencetransferexpression.vala
index e2ae4b3c8..46eed9091 100644
--- a/vala/valareferencetransferexpression.vala
+++ b/vala/valareferencetransferexpression.vala
@@ -96,13 +96,13 @@ public class Vala.ReferenceTransferExpression : Expression {
if (!(inner is MemberAccess || inner is ElementAccess)) {
error = true;
- Report.error (source_reference, "Reference transfer not supported for this expression");
+ context.report.log_error (source_reference, "Reference transfer not supported for this expression");
return false;
}
if (inner.value_type is ArrayType && ((ArrayType) inner.value_type).inline_allocated) {
error = true;
- Report.error (source_reference, "Ownership of inline-allocated array cannot be transferred");
+ context.report.log_error (source_reference, "Ownership of inline-allocated array cannot be transferred");
return false;
}
@@ -111,7 +111,7 @@ public class Vala.ReferenceTransferExpression : Expression {
&& !(inner.value_type is PointerType)
&& !is_owned_delegate) {
error = true;
- Report.error (source_reference, "No reference to be transferred");
+ context.report.log_error (source_reference, "No reference to be transferred");
return false;
}
diff --git a/vala/valaregexliteral.vala b/vala/valaregexliteral.vala
index 512143b05..c5391a18e 100644
--- a/vala/valaregexliteral.vala
+++ b/vala/valaregexliteral.vala
@@ -74,7 +74,7 @@ public class Vala.RegexLiteral : Literal {
if (regex != null) { /* Regex is valid. */ }
} catch (RegexError err) {
error = true;
- Report.error (source_reference, "Invalid regular expression `%s'.", value);
+ context.report.log_error (source_reference, "Invalid regular expression `%s'.", value);
return false;
}
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index 3873083ee..ad17f31cc 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -85,21 +85,21 @@ public class Vala.ReturnStatement : CodeNode, Statement {
if (context.analyzer.current_return_type == null) {
error = true;
- Report.error (source_reference, "Return not allowed in this context");
+ context.report.log_error (source_reference, "Return not allowed in this context");
return false;
}
if (return_expression == null) {
if (!(context.analyzer.current_return_type is VoidType)) {
error = true;
- Report.error (source_reference, "Return without value in non-void function");
+ context.report.log_error (source_reference, "Return without value in non-void function");
}
return !error;
}
if (context.analyzer.current_return_type is VoidType) {
error = true;
- Report.error (source_reference, "Return with value in void function");
+ context.report.log_error (source_reference, "Return with value in void function");
return false;
}
@@ -113,20 +113,20 @@ public class Vala.ReturnStatement : CodeNode, Statement {
if (return_expression.value_type == null) {
error = true;
- Report.error (source_reference, "Invalid expression in return value");
+ context.report.log_error (source_reference, "Invalid expression in return value");
return false;
}
if (!return_expression.value_type.compatible (context.analyzer.current_return_type)) {
error = true;
- Report.error (source_reference, "Return: Cannot convert from `%s' to `%s'", return_expression.value_type.to_string (), context.analyzer.current_return_type.to_string ());
+ context.report.log_error (source_reference, "Return: Cannot convert from `%s' to `%s'", return_expression.value_type.to_string (), context.analyzer.current_return_type.to_string ());
return false;
}
if (return_expression.value_type.is_disposable () &&
!context.analyzer.current_return_type.value_owned) {
error = true;
- Report.error (source_reference, "Return value transfers ownership but method return type hasn't been declared to transfer ownership");
+ context.report.log_error (source_reference, "Return value transfers ownership but method return type hasn't been declared to transfer ownership");
return false;
}
@@ -134,7 +134,7 @@ public class Vala.ReturnStatement : CodeNode, Statement {
if (local != null && local.variable_type.is_disposable () &&
!context.analyzer.current_return_type.value_owned) {
error = true;
- Report.error (source_reference, "Local variable with strong reference used as return value and method return type has not been declared to transfer ownership");
+ context.report.log_error (source_reference, "Local variable with strong reference used as return value and method return type has not been declared to transfer ownership");
return false;
}
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index ffd5a760a..e7c901634 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -187,7 +187,7 @@ public class Vala.Signal : Symbol, Callable {
unowned Class? parent_cl = parent_symbol as Class;
if (parent_cl != null && parent_cl.is_compact) {
error = true;
- Report.error (source_reference, "Signals are not supported in compact classes");
+ context.report.log_error (source_reference, "Signals are not supported in compact classes");
return false;
}
@@ -195,7 +195,7 @@ public class Vala.Signal : Symbol, Callable {
foreach (DataType base_type in parent_cl.get_base_types ()) {
if (SemanticAnalyzer.symbol_lookup_inherited (base_type.type_symbol, name) is Signal) {
error = true;
- Report.error (source_reference, "Signals with the same name as a signal in a base type are not supported");
+ context.report.log_error (source_reference, "Signals with the same name as a signal in a base type are not supported");
return false;
}
}
@@ -209,13 +209,13 @@ public class Vala.Signal : Symbol, Callable {
if (return_type.type_symbol == context.analyzer.va_list_type.type_symbol) {
error = true;
- Report.error (source_reference, "`%s' not supported as return type", return_type.type_symbol.get_full_name ());
+ context.report.log_error (source_reference, "`%s' not supported as return type", return_type.type_symbol.get_full_name ());
return false;
}
foreach (Parameter param in parameters) {
if (param.ellipsis) {
- Report.error (param.source_reference, "Signals with variable argument lists are not supported");
+ context.report.log_error (param.source_reference, "Signals with variable argument lists are not supported");
return false;
}
@@ -276,7 +276,7 @@ public class Vala.Signal : Symbol, Callable {
if (!external_package && !hides && get_hidden_member () != null) {
- Report.warning (source_reference, "%s hides inherited signal `%s'. Use the `new' keyword if hiding was intentional", get_full_name (), get_hidden_member ().get_full_name ());
+ context.report.log_warning (source_reference, "%s hides inherited signal `%s'. Use the `new' keyword if hiding was intentional", get_full_name (), get_hidden_member ().get_full_name ());
}
return !error;
diff --git a/vala/valasliceexpression.vala b/vala/valasliceexpression.vala
index 42c056c1e..a03d16ea4 100644
--- a/vala/valasliceexpression.vala
+++ b/vala/valasliceexpression.vala
@@ -144,13 +144,13 @@ public class Vala.SliceExpression : Expression {
if (container.value_type == null) {
error = true;
- Report.error (container.source_reference, "Invalid container expression");
+ context.report.log_error (container.source_reference, "Invalid container expression");
return false;
}
if (lvalue) {
error = true;
- Report.error (container.source_reference, "Slice expressions cannot be used as lvalue");
+ context.report.log_error (container.source_reference, "Slice expressions cannot be used as lvalue");
return false;
}
@@ -169,11 +169,11 @@ public class Vala.SliceExpression : Expression {
/* check if the index is of type integer */
if (!(start.value_type is IntegerType || start.value_type is EnumValueType)) {
error = true;
- Report.error (start.source_reference, "Expression of integer type expected");
+ context.report.log_error (start.source_reference, "Expression of integer type expected");
}
if (!(stop.value_type is IntegerType || stop.value_type is EnumValueType)) {
error = true;
- Report.error (stop.source_reference, "Expression of integer type expected");
+ context.report.log_error (stop.source_reference, "Expression of integer type expected");
}
} else {
var slice_method = container.value_type.get_member ("slice") as Method;
@@ -187,7 +187,7 @@ public class Vala.SliceExpression : Expression {
}
error = true;
- Report.error (source_reference, "The expression `%s' does not denote an array", container.value_type.to_string ());
+ context.report.log_error (source_reference, "The expression `%s' does not denote an array", container.value_type.to_string ());
}
return !error;
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 5cce4b24b..a05125a83 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -507,14 +507,14 @@ public class Vala.Struct : TypeSymbol {
if (!(base_type is ValueType)) {
error = true;
- Report.error (source_reference, "The base type `%s' of struct `%s' is not a struct", base_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "The base type `%s' of struct `%s' is not a struct", base_type.to_string (), get_full_name ());
return false;
}
// check whether base type is at least as accessible as the struct
if (!base_type.is_accessible (this)) {
error = true;
- Report.error (source_reference, "base type `%s' is less accessible than struct `%s'", base_type.to_string (), get_full_name ());
+ context.report.log_error (source_reference, "base type `%s' is less accessible than struct `%s'", base_type.to_string (), get_full_name ());
}
}
@@ -527,13 +527,13 @@ public class Vala.Struct : TypeSymbol {
if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (context, f.variable_type)) {
error = true;
- Report.error (f.source_reference, "Recursive value types are not allowed");
+ context.report.log_error (f.source_reference, "Recursive value types are not allowed");
return false;
}
if (f.binding == MemberBinding.INSTANCE && f.initializer != null) {
error = true;
- Report.error (f.source_reference, "Instance field initializers not supported");
+ context.report.log_error (f.source_reference, "Instance field initializers not supported");
return false;
}
@@ -541,7 +541,7 @@ public class Vala.Struct : TypeSymbol {
// for backing property fields a dedicated error will be reported later
if (!(f in property_fields) && !(f.initializer.value_type is NullType) && f.variable_type.is_disposable () && f.variable_type.value_owned) {
error = true;
- Report.error (f.initializer.source_reference, "Owned static struct fields can only be initialized in a function or method");
+ context.report.log_error (f.initializer.source_reference, "Owned static struct fields can only be initialized in a function or method");
}
}
}
@@ -561,7 +561,7 @@ public class Vala.Struct : TypeSymbol {
unowned Field? field = prop.field;
if (field != null && field.initializer != null && !(field.initializer.value_type is NullType) && field.variable_type.is_disposable () && field.variable_type.value_owned) {
error = true;
- Report.error (field.initializer.source_reference, "Owned static struct properties can only be initialized in a function or method");
+ context.report.log_error (field.initializer.source_reference, "Owned static struct properties can only be initialized in a function or method");
}
}
}
@@ -579,10 +579,10 @@ public class Vala.Struct : TypeSymbol {
}
if (base_type == null && !has_instance_field && !is_boolean_type () && !is_integer_type () && !is_floating_type ()) {
error = true;
- Report.error (source_reference, "struct `%s' cannot be empty", get_full_name ());
+ context.report.log_error (source_reference, "struct `%s' cannot be empty", get_full_name ());
} else if (base_type != null && has_instance_field) {
error = true;
- Report.error (source_reference, "derived struct `%s' may not have instance fields", get_full_name ());
+ context.report.log_error (source_reference, "derived struct `%s' may not have instance fields", get_full_name ());
}
}
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index 31ef82622..c31ae566b 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -115,7 +115,7 @@ public class Vala.SwitchStatement : CodeNode, Statement {
(!(expression.value_type is IntegerType) &&
!(expression.value_type is EnumValueType) &&
!expression.value_type.compatible (context.analyzer.string_type))) {
- Report.error (expression.source_reference, "Integer or string expression expected");
+ context.report.log_error (expression.source_reference, "Integer or string expression expected");
error = true;
return false;
}
@@ -142,7 +142,7 @@ public class Vala.SwitchStatement : CodeNode, Statement {
if (value != null && !labelset.add (value)) {
error = true;
- Report.error (label.expression.source_reference, "Switch statement already contains this label");
+ context.report.log_error (label.expression.source_reference, "Switch statement already contains this label");
}
}
}
diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala
index 8a6e04be7..ff7327d5b 100644
--- a/vala/valathrowstatement.vala
+++ b/vala/valathrowstatement.vala
@@ -92,7 +92,7 @@ public class Vala.ThrowStatement : CodeNode, Statement {
checked = true;
if (context.profile == Profile.POSIX) {
- Report.error (source_reference, "`throws' is not supported in POSIX profile");
+ context.report.log_error (source_reference, "`throws' is not supported in POSIX profile");
error = true;
return false;
}
@@ -107,13 +107,13 @@ public class Vala.ThrowStatement : CodeNode, Statement {
}
if (error_expression.value_type == null) {
- Report.error (error_expression.source_reference, "invalid error expression");
+ context.report.log_error (error_expression.source_reference, "invalid error expression");
error = true;
return false;
}
if (context.profile == Profile.GOBJECT && !(error_expression.value_type is ErrorType)) {
- Report.error (error_expression.source_reference, "`%s' is not an error type", error_expression.value_type.to_string ());
+ context.report.log_error (error_expression.source_reference, "`%s' is not an error type", error_expression.value_type.to_string ());
error = true;
return false;
}
diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala
index 7cbc78a27..df3ae7c62 100644
--- a/vala/valatrystatement.vala
+++ b/vala/valatrystatement.vala
@@ -137,7 +137,7 @@ public class Vala.TryStatement : CodeNode, Statement {
checked = true;
if (context.profile == Profile.POSIX) {
- Report.error (source_reference, "`try' is not supported in POSIX profile");
+ context.report.log_error (source_reference, "`try' is not supported in POSIX profile");
error = true;
return false;
}
diff --git a/vala/valatuple.vala b/vala/valatuple.vala
index 9064a1db8..0ffd4330b 100644
--- a/vala/valatuple.vala
+++ b/vala/valatuple.vala
@@ -73,7 +73,7 @@ public class Vala.Tuple : Expression {
checked = true;
- Report.error (source_reference, "tuples are not supported");
+ context.report.log_error (source_reference, "tuples are not supported");
error = true;
return false;
}
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index 848b4f457..a7a55dea9 100644
--- a/vala/valatypecheck.vala
+++ b/vala/valatypecheck.vala
@@ -105,7 +105,7 @@ public class Vala.TypeCheck : Expression {
type_reference.check (context);
if (expression.value_type == null) {
- Report.error (expression.source_reference, "invalid left operand");
+ context.report.log_error (expression.source_reference, "invalid left operand");
error = true;
return false;
}
@@ -117,13 +117,13 @@ public class Vala.TypeCheck : Expression {
}
if (type_reference is ErrorType && !(expression.value_type is ErrorType)) {
- Report.error (expression.source_reference, "`%s' must be an error", expression.to_string ());
+ context.report.log_error (expression.source_reference, "`%s' must be an error", expression.to_string ());
error = true;
return false;
}
if (context.profile == Profile.GOBJECT && type_reference.has_type_arguments ()) {
- Report.warning (_data_type.source_reference, "Type argument list has no effect");
+ context.report.log_warning (_data_type.source_reference, "Type argument list has no effect");
}
value_type = context.analyzer.bool_type;
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index 2449b6086..8bda3c815 100644
--- a/vala/valatypeofexpression.vala
+++ b/vala/valatypeofexpression.vala
@@ -83,11 +83,11 @@ public class Vala.TypeofExpression : Expression {
value_type = context.analyzer.type_type;
if (context.profile == Profile.GOBJECT && type_reference.has_type_arguments ()) {
- Report.warning (_data_type.source_reference, "Type argument list without effect");
+ context.report.log_warning (_data_type.source_reference, "Type argument list without effect");
}
if (_data_type is ArrayType && ((ArrayType) _data_type).element_type.type_symbol != context.analyzer.string_type.type_symbol) {
- Report.warning (_data_type.source_reference, "Arrays do not have a `GLib.Type', with the exception of `string[]'");
+ context.report.log_warning (_data_type.source_reference, "Arrays do not have a `GLib.Type', with the exception of `string[]'");
}
return !error;
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index a725456fa..10b7f5584 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -152,13 +152,13 @@ public class Vala.UnaryExpression : Expression {
return false;
} else if (inner.value_type == null) {
error = true;
- Report.error (inner.source_reference, "Invalid inner operand");
+ context.report.log_error (inner.source_reference, "Invalid inner operand");
return false;
}
if (inner.value_type is FieldPrototype || inner.value_type is PropertyPrototype) {
error = true;
- Report.error (inner.source_reference, "Access to instance member `%s' denied", inner.symbol_reference.get_full_name ());
+ context.report.log_error (inner.source_reference, "Access to instance member `%s' denied", inner.symbol_reference.get_full_name ());
return false;
}
@@ -168,7 +168,7 @@ public class Vala.UnaryExpression : Expression {
// integer or floating point type
if (!is_numeric_type (inner.value_type)) {
error = true;
- Report.error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
+ context.report.log_error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
return false;
}
@@ -178,7 +178,7 @@ public class Vala.UnaryExpression : Expression {
// boolean type
if (inner.value_type.nullable || !inner.value_type.compatible (context.analyzer.bool_type)) {
error = true;
- Report.error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
+ context.report.log_error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
return false;
}
@@ -188,7 +188,7 @@ public class Vala.UnaryExpression : Expression {
// integer type
if (!is_integer_type (inner.value_type) && !(inner.value_type is EnumValueType)) {
error = true;
- Report.error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
+ context.report.log_error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
return false;
}
@@ -199,13 +199,13 @@ public class Vala.UnaryExpression : Expression {
// integer type
if (!is_integer_type (inner.value_type)) {
error = true;
- Report.error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
+ context.report.log_error (source_reference, "Operator not supported for `%s'", inner.value_type.to_string ());
return false;
}
if (!(inner is MemberAccess)) {
error = true;
- Report.error (source_reference, "Prefix operators not supported for this expression");
+ context.report.log_error (source_reference, "Prefix operators not supported for this expression");
return false;
}
@@ -221,18 +221,18 @@ public class Vala.UnaryExpression : Expression {
value_type = inner.value_type;
} else {
error = true;
- Report.error (source_reference, "ref and out method arguments can only be used with fields, parameters, local variables, and array element access");
+ context.report.log_error (source_reference, "ref and out method arguments can only be used with fields, parameters, local variables, and array element access");
return false;
}
if (inner.symbol_reference != null && inner.symbol_reference.get_attribute ("GtkChild") != null) {
error = true;
- Report.error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", inner.symbol_reference.get_full_name ());
+ context.report.log_error (source_reference, "Assignment of [GtkChild] `%s' is not allowed", inner.symbol_reference.get_full_name ());
return false;
}
break;
default:
error = true;
- Report.error (source_reference, "internal error: unsupported unary operator");
+ context.report.log_error (source_reference, "internal error: unsupported unary operator");
return false;
}
diff --git a/vala/valaunlockstatement.vala b/vala/valaunlockstatement.vala
index 84a6a3fbf..bb9e9175f 100644
--- a/vala/valaunlockstatement.vala
+++ b/vala/valaunlockstatement.vala
@@ -69,7 +69,7 @@ public class Vala.UnlockStatement : CodeNode, Statement {
if (!(resource is MemberAccess && resource.symbol_reference is Lockable)) {
error = true;
resource.error = true;
- Report.error (resource.source_reference, "Expression is either not a member access or does not denote a lockable member");
+ context.report.log_error (resource.source_reference, "Expression is either not a member access or does not denote a lockable member");
return false;
}
@@ -77,7 +77,7 @@ public class Vala.UnlockStatement : CodeNode, Statement {
if (resource.symbol_reference.parent_symbol != context.analyzer.current_class) {
error = true;
resource.error = true;
- Report.error (resource.source_reference, "Only members of the current class are lockable");
+ context.report.log_error (resource.source_reference, "Only members of the current class are lockable");
return false;
}
@@ -85,7 +85,7 @@ public class Vala.UnlockStatement : CodeNode, Statement {
if (context.analyzer.current_class.is_compact) {
error = true;
resource.error = true;
- Report.error (resource.source_reference, "Only members of the non-compact classes are lockable");
+ context.report.log_error (resource.source_reference, "Only members of the non-compact classes are lockable");
return false;
}
diff --git a/vala/valawithstatement.vala b/vala/valawithstatement.vala
index 52210284a..bf14a9a6a 100644
--- a/vala/valawithstatement.vala
+++ b/vala/valawithstatement.vala
@@ -99,7 +99,7 @@ public class Vala.WithStatement : Block {
if (!is_object_or_value_type (expression.value_type)) {
error = true;
- Report.error (expression.source_reference, "with statement expects an object or basic type");
+ context.report.log_error (expression.source_reference, "with statement expects an object or basic type");
return false;
}
diff --git a/vala/valayieldstatement.vala b/vala/valayieldstatement.vala
index 7148f3b74..75e1a5d75 100644
--- a/vala/valayieldstatement.vala
+++ b/vala/valayieldstatement.vala
@@ -43,7 +43,7 @@ public class Vala.YieldStatement : CodeNode, Statement {
if (context.analyzer.current_method == null || !context.analyzer.current_method.coroutine) {
error = true;
- Report.error (source_reference, "yield statement not available outside async method");
+ context.report.log_error (source_reference, "yield statement not available outside async method");
}
return !error;