[vala/wip/ricotz/lsp-rev: 2/4] WIP vala: Improve dealing with errornous nodes
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz/lsp-rev: 2/4] WIP vala: Improve dealing with errornous nodes
- Date: Tue, 18 Feb 2020 17:52:21 +0000 (UTC)
commit 25ec4a509bd451df3b6a9de00b8160adb8fcc4e3
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Feb 18 12:54:30 2020 +0100
WIP vala: Improve dealing with errornous nodes
vala/valaarraytype.vala | 4 +++-
vala/valabinaryexpression.vala | 2 +-
vala/valalambdaexpression.vala | 6 ++++--
vala/valamethodcall.vala | 6 ++++--
vala/valathrowstatement.vala | 3 +++
5 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index bb6dceb44..e41fb7904 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -91,7 +91,9 @@ public class Vala.ArrayType : ReferenceType {
}
public override Symbol? get_member (string member_name) {
- if (member_name == "length") {
+ if (error) {
+ // don't try anything
+ } else if (member_name == "length") {
return get_length_field ();
} else if (member_name == "move") {
return get_move_method ();
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 60c911677..1022060a8 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -328,7 +328,7 @@ public class Vala.BinaryExpression : Expression {
return false;
}
- if (operator != BinaryOperator.IN && right.value_type == null) {
+ if (right.value_type == null) {
Report.error (right.source_reference, "invalid right operand");
error = true;
return false;
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 4fb7f4564..5589640d1 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -233,7 +233,9 @@ public class Vala.LambdaExpression : Expression {
/* lambda expressions should be usable like MemberAccess of a method */
symbol_reference = method;
- method.check (context);
+ if (!method.check (context)) {
+ error = true;
+ }
value_type = new MethodType (method);
value_type.value_owned = target_type.value_owned;
@@ -249,7 +251,7 @@ public class Vala.LambdaExpression : Expression {
public override void get_used_variables (Collection<Variable> collection) {
// require captured variables to be initialized
- if (method.closure) {
+ if (!error && method.closure) {
method.get_captured_variables ((Collection<LocalVariable>) collection);
}
}
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 4a15a6cb4..d57945bf1 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -155,8 +155,10 @@ public class Vala.MethodCall : Expression {
} else if (mtype is ObjectType) {
// constructor
unowned Class cl = (Class) ((ObjectType) mtype).type_symbol;
- unowned Method m = cl.default_construction_method;
- m.get_error_types (collection, source_reference);
+ unowned Method? m = cl.default_construction_method;
+ if (m != null) {
+ m.get_error_types (collection, source_reference);
+ }
} else if (mtype is DelegateType) {
unowned Delegate d = ((DelegateType) mtype).delegate_symbol;
d.get_error_types (collection, source_reference);
diff --git a/vala/valathrowstatement.vala b/vala/valathrowstatement.vala
index 9349b1818..4ba347a9b 100644
--- a/vala/valathrowstatement.vala
+++ b/vala/valathrowstatement.vala
@@ -73,6 +73,9 @@ public class Vala.ThrowStatement : CodeNode, Statement {
}
public override void get_error_types (Collection<DataType> collection, SourceReference?
source_reference = null) {
+ if (error) {
+ return;
+ }
if (source_reference == null) {
source_reference = this.source_reference;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]