[vala/staging] Use ErrorType-based collection for CodeNode.get_error_types()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] Use ErrorType-based collection for CodeNode.get_error_types()
- Date: Sat, 23 Oct 2021 13:51:19 +0000 (UTC)
commit 0751a9e3bf46fc830d3e7ca3d0cfd3ae48846e68
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Oct 23 15:27:12 2021 +0200
Use ErrorType-based collection for CodeNode.get_error_types()
codegen/valaccodemethodmodule.vala | 4 ++--
codegen/valagdbusclientmodule.vala | 7 +++----
codegen/valagerrormodule.vala | 14 +++++++-------
vala/valaassignment.vala | 2 +-
vala/valabinaryexpression.vala | 2 +-
vala/valablock.vala | 2 +-
vala/valacallabletype.vala | 4 ++--
vala/valacastexpression.vala | 2 +-
vala/valacodenode.vala | 4 ++--
vala/valacodewriter.vala | 4 ++--
vala/valaconditionalexpression.vala | 2 +-
vala/valaconstructor.vala | 6 +++---
vala/valacreationmethod.vala | 12 ++++++------
vala/valadeclarationstatement.vala | 2 +-
vala/valadelegate.vala | 14 +++++++-------
vala/valadelegatetype.vala | 8 ++++----
vala/valadestructor.vala | 6 +++---
vala/valaelementaccess.vala | 2 +-
vala/valaexpressionstatement.vala | 2 +-
vala/valaflowanalyzer.vala | 7 +++----
vala/valaforeachstatement.vala | 2 +-
vala/valagirparser.vala | 6 +++---
vala/valaifstatement.vala | 2 +-
vala/valalambdaexpression.vala | 4 ++--
vala/valaloopstatement.vala | 2 +-
vala/valamemberaccess.vala | 2 +-
vala/valamethod.vala | 30 +++++++++++++-----------------
vala/valamethodcall.vala | 2 +-
vala/valaobjectcreationexpression.vala | 2 +-
vala/valapointerindirection.vala | 2 +-
vala/valapropertyaccessor.vala | 6 +++---
vala/valareturnstatement.vala | 2 +-
vala/valastatementlist.vala | 2 +-
vala/valaswitchstatement.vala | 2 +-
vala/valathrowstatement.vala | 4 ++--
vala/valatrystatement.vala | 4 ++--
vala/valaunaryexpression.vala | 2 +-
vala/valawithstatement.vala | 2 +-
valadoc/symbolresolver.vala | 6 +++---
vapigen/valagidlparser.vala | 4 ++--
40 files changed, 94 insertions(+), 100 deletions(-)
---
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 840aa14bc..d4f9931ad 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -94,9 +94,9 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
}
if (m.has_error_type_parameter ()) {
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
m.get_error_types (error_types);
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
generate_type_declaration (error_type, decl_space);
}
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 697b08758..be102bf55 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -594,12 +594,11 @@ public class Vala.GDBusClientModule : GDBusModule {
}
// register errors
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
m.get_error_types (error_types);
foreach (var error_type in error_types) {
- var errtype = (ErrorType) error_type;
- if (errtype.error_domain != null) {
- ccode.add_expression (new CCodeIdentifier (get_ccode_upper_case_name
(errtype.error_domain)));
+ if (error_type.error_domain != null) {
+ ccode.add_expression (new CCodeIdentifier (get_ccode_upper_case_name
(error_type.error_domain)));
}
}
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index a559a4d00..40fee3920 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -203,21 +203,21 @@ public class Vala.GErrorModule : CCodeDelegateModule {
append_local_free (current_symbol, null, current_try);
}
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
node.get_error_types (error_types);
bool has_general_catch_clause = false;
if (!is_in_catch) {
- var handled_error_types = new ArrayList<DataType> ();
+ var handled_error_types = new ArrayList<ErrorType> ();
foreach (CatchClause clause in current_try.get_catch_clauses ()) {
// keep track of unhandled error types
- foreach (DataType node_error_type in error_types) {
+ foreach (var node_error_type in error_types) {
if (clause.error_type == null || node_error_type.compatible
(clause.error_type)) {
handled_error_types.add (node_error_type);
}
}
- foreach (DataType handled_error_type in handled_error_types) {
+ foreach (var handled_error_type in handled_error_types) {
error_types.remove (handled_error_type);
}
handled_error_types.clear ();
@@ -273,9 +273,9 @@ public class Vala.GErrorModule : CCodeDelegateModule {
// current method can fail, propagate error
CCodeBinaryExpression ccond = null;
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
current_method.get_error_types (error_types);
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
// If GLib.Error is allowed we propagate everything
if (error_type.equals (gerror_type)) {
ccond = null;
@@ -284,7 +284,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
// Check the allowed error domains to propagate
var domain_check = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY,
new CCodeMemberAccess.pointer
- (get_inner_error_cexpression (), "domain"), new CCodeIdentifier
(get_ccode_upper_case_name (((ErrorType) error_type).error_domain)));
+ (get_inner_error_cexpression (), "domain"), new CCodeIdentifier
(get_ccode_upper_case_name (error_type.error_domain)));
if (ccond == null) {
ccond = domain_check;
} else {
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 46f9445a4..bf369b883 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -105,7 +105,7 @@ public class Vala.Assignment : Expression {
return left.is_accessible (sym) && right.is_accessible (sym);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
left.get_error_types (collection, source_reference);
right.get_error_types (collection, source_reference);
}
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index d379927c0..401dc6daa 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -128,7 +128,7 @@ public class Vala.BinaryExpression : Expression {
return left.is_accessible (sym) && right.is_accessible (sym);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
left.get_error_types (collection, source_reference);
right.get_error_types (collection, source_reference);
}
diff --git a/vala/valablock.vala b/vala/valablock.vala
index e002909bf..47819f5b1 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -183,7 +183,7 @@ public class Vala.Block : Symbol, Statement {
return !error;
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
// use get_statements () instead of statement_list to not miss errors within StatementList
objects
foreach (Statement stmt in get_statements ()) {
stmt.get_error_types (collection, source_reference);
diff --git a/vala/valacallabletype.vala b/vala/valacallabletype.vala
index 6ea2349d0..cb584fb9e 100644
--- a/vala/valacallabletype.vala
+++ b/vala/valacallabletype.vala
@@ -126,13 +126,13 @@ public abstract class Vala.CallableType : DataType {
builder.append_c (')');
// Append error-types
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
callable_symbol.get_error_types (error_types);
if (error_types.size > 0) {
builder.append (" throws ");
bool first = true;
- foreach (DataType type in error_types) {
+ foreach (var type in error_types) {
if (!first) {
builder.append (", ");
} else {
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index 1d1dbb0f2..fccc1d191 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -132,7 +132,7 @@ public class Vala.CastExpression : Expression {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
inner.get_error_types (collection, source_reference);
}
diff --git a/vala/valacodenode.vala b/vala/valacodenode.vala
index 05ba53a0a..73a3ab417 100644
--- a/vala/valacodenode.vala
+++ b/vala/valacodenode.vala
@@ -63,7 +63,7 @@ public abstract class Vala.CodeNode {
*/
public bool tree_can_fail {
get {
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
get_error_types (error_types);
return error_types.size > 0;
}
@@ -409,7 +409,7 @@ public abstract class Vala.CodeNode {
public virtual void get_used_variables (Collection<Variable> collection) {
}
- public virtual void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public virtual void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
}
public static string get_temp_name () {
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index cb3bd998d..d73f341d7 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -731,7 +731,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_params (cb.get_parameters ());
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
cb.get_error_types (error_types);
write_error_domains (error_types);
@@ -849,7 +849,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_params (m.get_parameters ());
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
m.get_error_types (error_types);
write_error_domains (error_types);
diff --git a/vala/valaconditionalexpression.vala b/vala/valaconditionalexpression.vala
index c8bfdbce1..66bbfbaeb 100644
--- a/vala/valaconditionalexpression.vala
+++ b/vala/valaconditionalexpression.vala
@@ -104,7 +104,7 @@ public class Vala.ConditionalExpression : Expression {
return condition.is_accessible (sym) && true_expression.is_accessible (sym) &&
false_expression.is_accessible (sym);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
condition.get_error_types (collection, source_reference);
true_expression.get_error_types (collection, source_reference);
false_expression.get_error_types (collection, source_reference);
diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala
index 8c916f8a5..a83acee7e 100644
--- a/vala/valaconstructor.vala
+++ b/vala/valaconstructor.vala
@@ -79,10 +79,10 @@ public class Vala.Constructor : Subroutine {
}
if (body != null && !body.error) {
- var body_errors = new ArrayList<DataType> ();
+ var body_errors = new ArrayList<ErrorType> ();
body.get_error_types (body_errors);
- foreach (DataType body_error_type in body_errors) {
- if (!((ErrorType) body_error_type).dynamic_error) {
+ foreach (var body_error_type in body_errors) {
+ if (!body_error_type.dynamic_error) {
Report.warning (body_error_type.source_reference, "unhandled error
`%s'", body_error_type.to_string());
}
}
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 77b311f31..c47ea10e5 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -61,7 +61,7 @@ public class Vala.CreationMethod : Method {
}
if (error_types != null) {
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
error_type.accept (visitor);
}
}
@@ -143,7 +143,7 @@ public class Vala.CreationMethod : Method {
}
if (error_types != null) {
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
error_type.check (context);
// check whether error type is at least as accessible as the creation method
@@ -215,18 +215,18 @@ public class Vala.CreationMethod : Method {
// check that all errors that can be thrown in the method body are declared
if (body != null && !body.error) {
- var body_errors = new ArrayList<DataType> ();
+ var body_errors = new ArrayList<ErrorType> ();
body.get_error_types (body_errors);
- foreach (DataType body_error_type in body_errors) {
+ foreach (var body_error_type in body_errors) {
bool can_propagate_error = false;
if (error_types != null) {
- foreach (DataType method_error_type in error_types) {
+ foreach (var method_error_type in error_types) {
if (body_error_type.compatible (method_error_type)) {
can_propagate_error = true;
}
}
}
- if (!can_propagate_error && !((ErrorType) body_error_type).dynamic_error) {
+ if (!can_propagate_error && !body_error_type.dynamic_error) {
Report.warning (body_error_type.source_reference, "unhandled error
`%s'", body_error_type.to_string());
}
}
diff --git a/vala/valadeclarationstatement.vala b/vala/valadeclarationstatement.vala
index 30732b4a6..c6841ea2d 100644
--- a/vala/valadeclarationstatement.vala
+++ b/vala/valadeclarationstatement.vala
@@ -62,7 +62,7 @@ public class Vala.DeclarationStatement : CodeNode, Statement {
declaration.accept (visitor);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (source_reference == null) {
source_reference = this.source_reference;
}
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 249adcdfc..8bb318d43 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -206,7 +206,7 @@ public class Vala.Delegate : TypeSymbol, Callable {
return false;
}
- var method_error_types = new ArrayList<DataType> ();
+ var method_error_types = new ArrayList<ErrorType> ();
m.get_error_types (method_error_types);
// method must throw error if the delegate does
@@ -215,10 +215,10 @@ public class Vala.Delegate : TypeSymbol, Callable {
}
// method may throw less but not more errors than the delegate
- foreach (DataType method_error_type in method_error_types) {
+ foreach (var method_error_type in method_error_types) {
bool match = false;
if (error_types != null) {
- foreach (DataType delegate_error_type in error_types) {
+ foreach (var delegate_error_type in error_types) {
if (method_error_type.compatible (delegate_error_type)) {
match = true;
break;
@@ -250,7 +250,7 @@ public class Vala.Delegate : TypeSymbol, Callable {
}
if (error_types != null) {
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
error_type.accept (visitor);
}
}
@@ -272,15 +272,15 @@ public class Vala.Delegate : TypeSymbol, Callable {
error_type.parent_node = this;
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (error_types != null) {
foreach (var error_type in error_types) {
if (source_reference != null) {
- var type = error_type.copy ();
+ var type = (ErrorType) error_type.copy ();
type.source_reference = source_reference;
collection.add (type);
} else {
- collection.add (error_type);
+ collection.add ((ErrorType) error_type);
}
}
}
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 8b51f324c..33d9c5521 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -167,13 +167,13 @@ public class Vala.DelegateType : CallableType {
}
// target-delegate may throw less but not more errors than the delegate
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
delegate_symbol.get_error_types (error_types);
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
bool match = false;
- var delegate_error_types = new ArrayList<DataType> ();
+ var delegate_error_types = new ArrayList<ErrorType> ();
dt_target.delegate_symbol.get_error_types (delegate_error_types);
- foreach (DataType delegate_error_type in delegate_error_types) {
+ foreach (var delegate_error_type in delegate_error_types) {
if (error_type.compatible (delegate_error_type)) {
match = true;
break;
diff --git a/vala/valadestructor.vala b/vala/valadestructor.vala
index 2febe55d3..84a10280f 100644
--- a/vala/valadestructor.vala
+++ b/vala/valadestructor.vala
@@ -79,10 +79,10 @@ public class Vala.Destructor : Subroutine {
}
if (body != null && !body.error) {
- var body_errors = new ArrayList<DataType> ();
+ var body_errors = new ArrayList<ErrorType> ();
body.get_error_types (body_errors);
- foreach (DataType body_error_type in body_errors) {
- if (!((ErrorType) body_error_type).dynamic_error) {
+ foreach (var body_error_type in body_errors) {
+ if (!body_error_type.dynamic_error) {
Report.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..de050bc3b 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -127,7 +127,7 @@ public class Vala.ElementAccess : Expression {
return container.is_accessible (sym);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
container.get_error_types (collection, source_reference);
foreach (Expression e in indices) {
e.get_error_types (collection, source_reference);
diff --git a/vala/valaexpressionstatement.vala b/vala/valaexpressionstatement.vala
index ac435d081..ee521f623 100644
--- a/vala/valaexpressionstatement.vala
+++ b/vala/valaexpressionstatement.vala
@@ -87,7 +87,7 @@ public class Vala.ExpressionStatement : CodeNode, Statement {
return !error;
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
expression.get_error_types (collection, source_reference);
}
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index a5a8be993..bb4153d2a 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -908,11 +908,10 @@ public class Vala.FlowAnalyzer : CodeVisitor {
var last_block = current_block;
// exceptional control flow
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
node.get_error_types (error_types);
- foreach (DataType error_data_type in error_types) {
- unowned ErrorType? error_type = error_data_type as ErrorType;
- unowned Class? error_class = error_data_type.type_symbol as Class;
+ foreach (var error_type in error_types) {
+ unowned Class? error_class = error_type.type_symbol as Class;
current_block = last_block;
unreachable_reported = true;
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 3d8ce2ba9..ef957839d 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -413,7 +413,7 @@ public class Vala.ForeachStatement : Block {
return !error;
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (source_reference == null) {
source_reference = this.source_reference;
}
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 31b8ad4c6..94c9e2534 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3944,7 +3944,7 @@ public class Vala.GirParser : CodeVisitor {
deleg.add_parameter (param.copy ());
}
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
orig.get_error_types (error_types, alias.source_reference);
foreach (var error_type in error_types) {
deleg.add_error_type (error_type.copy ());
@@ -4448,9 +4448,9 @@ public class Vala.GirParser : CodeVisitor {
}
}
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
finish_method.get_error_types (error_types, method.source_reference);
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
method.add_error_type (error_type);
}
finish_method_node.processed = true;
diff --git a/vala/valaifstatement.vala b/vala/valaifstatement.vala
index bed1dfe9a..85b98eeec 100644
--- a/vala/valaifstatement.vala
+++ b/vala/valaifstatement.vala
@@ -102,7 +102,7 @@ public class Vala.IfStatement : CodeNode, Statement {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
condition.get_error_types (collection, source_reference);
true_statement.get_error_types (collection, source_reference);
if (false_statement != null) {
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index be33765f8..291e451a5 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -225,10 +225,10 @@ public class Vala.LambdaExpression : Expression {
return false;
}
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
cb.get_error_types (error_types);
foreach (var error_type in error_types) {
- method.add_error_type (error_type.copy ());
+ method.add_error_type ((ErrorType) error_type.copy ());
}
if (expression_body != null) {
diff --git a/vala/valaloopstatement.vala b/vala/valaloopstatement.vala
index e522fd1b0..b99172b21 100644
--- a/vala/valaloopstatement.vala
+++ b/vala/valaloopstatement.vala
@@ -45,7 +45,7 @@ public class Vala.LoopStatement : Loop, Statement {
body.accept (visitor);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
body.get_error_types (collection, source_reference);
}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 5be3fa0da..b1c53c64d 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -205,7 +205,7 @@ public class Vala.MemberAccess : Expression {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (inner != null) {
inner.get_error_types (collection, source_reference);
}
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index dc41e3d77..d40875d47 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -421,12 +421,12 @@ public class Vala.Method : Subroutine, Callable {
}
/* this method may throw less but not more errors than the base method */
- var base_method_errors = new ArrayList<DataType> ();
+ var base_method_errors = new ArrayList<ErrorType> ();
base_method.get_error_types (base_method_errors);
if (error_types != null) {
- foreach (DataType method_error_type in error_types) {
+ foreach (var method_error_type in error_types) {
bool match = false;
- foreach (DataType base_method_error_type in base_method_errors) {
+ foreach (var base_method_error_type in base_method_errors) {
if (method_error_type.compatible (base_method_error_type)) {
match = true;
break;
@@ -563,15 +563,15 @@ public class Vala.Method : Subroutine, Callable {
error_type.parent_node = this;
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (error_types != null) {
foreach (var error_type in error_types) {
if (source_reference != null) {
- var type = error_type.copy ();
+ var type = (ErrorType) error_type.copy ();
type.source_reference = source_reference;
collection.add (type);
} else {
- collection.add (error_type);
+ collection.add ((ErrorType) error_type);
}
}
}
@@ -1034,19 +1034,18 @@ public class Vala.Method : Subroutine, Callable {
// check that all errors that can be thrown in the method body are declared
if (body != null && !body.error) {
- var body_errors = new ArrayList<DataType> ();
+ var body_errors = new ArrayList<ErrorType> ();
body.get_error_types (body_errors);
- foreach (DataType body_error_type in body_errors) {
+ foreach (var body_error_type in body_errors) {
bool can_propagate_error = false;
if (error_types != null) {
- foreach (DataType method_error_type in error_types) {
+ foreach (var method_error_type in error_types) {
if (body_error_type.compatible (method_error_type)) {
can_propagate_error = true;
}
}
}
- bool is_dynamic_error = body_error_type is ErrorType && ((ErrorType)
body_error_type).dynamic_error;
- if (!can_propagate_error && !is_dynamic_error) {
+ if (!can_propagate_error && !body_error_type.dynamic_error) {
Report.warning (body_error_type.source_reference, "unhandled error
`%s'", body_error_type.to_string());
}
}
@@ -1061,13 +1060,10 @@ public class Vala.Method : Subroutine, Callable {
bool throws_gerror = false;
bool throws_gioerror = false;
bool throws_gdbuserror = false;
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
get_error_types (error_types);
- foreach (DataType error_type in error_types) {
- if (!(error_type is ErrorType)) {
- continue;
- }
- unowned ErrorDomain? error_domain = ((ErrorType)
error_type).error_domain;
+ foreach (var error_type in error_types) {
+ unowned ErrorDomain? error_domain = error_type.error_domain;
if (error_domain == null) {
throws_gerror = true;
break;
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index aff7db77a..0a714ffd4 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -142,7 +142,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
return call.is_accessible (sym);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (source_reference == null) {
source_reference = this.source_reference;
}
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index a6ce8a14f..0b668ea64 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -565,7 +565,7 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
return !error;
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (symbol_reference is Method) {
if (source_reference == null) {
source_reference = this.source_reference;
diff --git a/vala/valapointerindirection.vala b/vala/valapointerindirection.vala
index 5e14de7f6..86c441ff3 100644
--- a/vala/valapointerindirection.vala
+++ b/vala/valapointerindirection.vala
@@ -77,7 +77,7 @@ public class Vala.PointerIndirection : Expression {
return inner.is_accessible (sym);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
inner.get_error_types (collection, source_reference);
}
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 393284301..46d8604a3 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -245,10 +245,10 @@ public class Vala.PropertyAccessor : Subroutine {
}
if (body != null && !body.error) {
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
body.get_error_types (error_types);
- foreach (DataType body_error_type in error_types) {
- if (!((ErrorType) body_error_type).dynamic_error) {
+ foreach (var body_error_type in error_types) {
+ if (!body_error_type.dynamic_error) {
Report.warning (body_error_type.source_reference, "unhandled error
`%s'", body_error_type.to_string ());
}
}
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index 3873083ee..7a9f14c45 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -70,7 +70,7 @@ public class Vala.ReturnStatement : CodeNode, Statement {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (return_expression != null) {
return_expression.get_error_types (collection, source_reference);
}
diff --git a/vala/valastatementlist.vala b/vala/valastatementlist.vala
index b76b74cae..265cefcf5 100644
--- a/vala/valastatementlist.vala
+++ b/vala/valastatementlist.vala
@@ -48,7 +48,7 @@ public class Vala.StatementList : CodeNode, Statement {
list.insert (index, stmt);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
foreach (var stmt in list) {
stmt.get_error_types (collection, source_reference);
}
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index 31ef82622..ac44691c5 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -93,7 +93,7 @@ public class Vala.SwitchStatement : CodeNode, Statement {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
foreach (SwitchSection section in sections) {
section.get_error_types (collection, source_reference);
}
diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala
index 8a6e04be7..d8f03909b 100644
--- a/vala/valathrowstatement.vala
+++ b/vala/valathrowstatement.vala
@@ -72,14 +72,14 @@ public class Vala.ThrowStatement : CodeNode, Statement {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (error) {
return;
}
if (source_reference == null) {
source_reference = this.source_reference;
}
- var error_type = error_expression.value_type.copy ();
+ var error_type = (ErrorType) error_expression.value_type.copy ();
error_type.source_reference = source_reference;
collection.add (error_type);
}
diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala
index 7cbc78a27..ebec4dd53 100644
--- a/vala/valatrystatement.vala
+++ b/vala/valatrystatement.vala
@@ -104,8 +104,8 @@ public class Vala.TryStatement : CodeNode, Statement {
}
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
- var error_types = new ArrayList<DataType> ();
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
+ var error_types = new ArrayList<ErrorType> ();
body.get_error_types (error_types, source_reference);
foreach (CatchClause clause in catch_clauses) {
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index a725456fa..37f8788b0 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -128,7 +128,7 @@ public class Vala.UnaryExpression : Expression {
return st.is_integer_type ();
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
inner.get_error_types (collection, source_reference);
}
diff --git a/vala/valawithstatement.vala b/vala/valawithstatement.vala
index 52210284a..fd556583e 100644
--- a/vala/valawithstatement.vala
+++ b/vala/valawithstatement.vala
@@ -134,7 +134,7 @@ public class Vala.WithStatement : Block {
body.emit (codegen);
}
- public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ public override void get_error_types (Collection<ErrorType> collection, SourceReference?
source_reference = null) {
if (source_reference == null) {
source_reference = this.source_reference;
}
diff --git a/valadoc/symbolresolver.vala b/valadoc/symbolresolver.vala
index 20021c5fa..4d41c823c 100644
--- a/valadoc/symbolresolver.vala
+++ b/valadoc/symbolresolver.vala
@@ -38,10 +38,10 @@ public class Valadoc.SymbolResolver : Visitor {
}
private void resolve_thrown_list (Symbol symbol, Vala.Symbol vala_symbol) {
- var error_types = new Vala.ArrayList<Vala.DataType> ();
+ var error_types = new Vala.ArrayList<Vala.ErrorType> ();
vala_symbol.get_error_types (error_types);
- foreach (Vala.DataType type in error_types) {
- unowned Vala.ErrorDomain? vala_edom = ((Vala.ErrorType) type).error_domain;
+ foreach (var type in error_types) {
+ unowned Vala.ErrorDomain? vala_edom = type.error_domain;
Symbol? edom = symbol_map.get (vala_edom);
symbol.add_child (edom ?? glib_error);
}
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 007896ec4..87ef022e9 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -1827,9 +1827,9 @@ public class Vala.GIdlParser : CodeVisitor {
m.add_parameter (async_param);
}
}
- var error_types = new ArrayList<DataType> ();
+ var error_types = new ArrayList<ErrorType> ();
finish_method.get_error_types (error_types, m.source_reference);
- foreach (DataType error_type in error_types) {
+ foreach (var error_type in error_types) {
m.add_error_type (error_type);
}
finish_methods.add (finish_method);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]