[vala/staging] codegen: Move some errors to semantic analyzer pass
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Move some errors to semantic analyzer pass
- Date: Sun, 17 Oct 2021 07:21:41 +0000 (UTC)
commit e71ae37140e2567074d5335229a1cdb80651acf0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Oct 17 09:15:58 2021 +0200
codegen: Move some errors to semantic analyzer pass
codegen/valaccodememberaccessmodule.vala | 9 ---------
vala/valamemberaccess.vala | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 4f0b6a97e..4eaee459b 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -113,20 +113,11 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
set_delegate_target (expr, delegate_target);
}
} else if (expr.symbol_reference is ArrayLengthField) {
- if (expr.value_type is ArrayType && !(expr.parent_node is ElementAccess)) {
- Report.error (expr.source_reference, "unsupported use of length field of
multi-dimensional array");
- }
set_cvalue (expr, get_array_length_cexpression (expr.inner, 1));
} else if (expr.symbol_reference is DelegateTargetField) {
- if (!((DelegateType) expr.inner.value_type).delegate_symbol.has_target) {
- Report.error (expr.source_reference, "unsupported use of target field of
delegate without target");
- }
CCodeExpression delegate_target_destroy_notify;
set_cvalue (expr, get_delegate_target_cexpression (expr.inner, out
delegate_target_destroy_notify));
} else if (expr.symbol_reference is DelegateDestroyField) {
- if (!((DelegateType) expr.inner.value_type).delegate_symbol.has_target) {
- Report.error (expr.source_reference, "unsupported use of destroy field of
delegate without target");
- }
CCodeExpression delegate_target_destroy_notify;
get_delegate_target_cexpression (expr.inner, out delegate_target_destroy_notify);
set_cvalue (expr, delegate_target_destroy_notify);
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index ef4bc22d2..a5432d614 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -1041,6 +1041,23 @@ public class Vala.MemberAccess : Expression {
value_type.check (context);
}
+ 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");
+ 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");
+ 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");
+ error = true;
+ }
+ }
+
// Provide some extra information for the code generator
if (!tainted_access) {
tainted_access = is_tainted ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]