[vala/switch-to-gir: 9/24] Fix handling external for several symbols in semantic analyzer



commit 1c8340b2724a6d1ea7e9880109cb1e844cba3634
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Nov 16 10:22:27 2010 +0100

    Fix handling external for several symbols in semantic analyzer

 vala/valaclass.vala            |    4 ++--
 vala/valafield.vala            |    2 +-
 vala/valamethod.vala           |    4 ++--
 vala/valaparser.vala           |    3 +++
 vala/valapropertyaccessor.vala |    2 +-
 5 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 0ba8032..50b9c6c 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -1165,8 +1165,8 @@ public class Vala.Class : ObjectTypeSymbol {
 			Report.error (source_reference, error_string);
 		}
 
-		/* VAPI classes don't have to specify overridden methods */
-		if (source_type == SourceFileType.SOURCE) {
+		/* External classes don't have to specify overridden methods */
+		if (!external) {
 			/* all abstract symbols defined in base types have to be at least defined (or implemented) also in this type */
 			foreach (DataType base_type in get_base_types ()) {
 				if (base_type.data_type is Interface) {
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 6bf4868..24d6a8b 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -333,7 +333,7 @@ public class Vala.Field : Variable, Lockable {
 			}
 		}
 
-		if (!external_package && !hides && get_hidden_member () != null) {
+		if (!external && !hides && get_hidden_member () != null) {
 			Report.warning (source_reference, "%s hides inherited field `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ()));
 		}
 
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index bc301f5..ec8b79d 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -824,7 +824,7 @@ public class Vala.Method : Subroutine {
 			Report.error (source_reference, "Extern methods cannot be abstract or virtual");
 		} else if (external && body != null) {
 			Report.error (source_reference, "Extern methods cannot have bodies");
-		} else if (!is_abstract && !external && source_type == SourceFileType.SOURCE && body == null) {
+		} else if (!is_abstract && !external && body == null) {
 			Report.error (source_reference, "Non-abstract, non-extern methods must have bodies");
 		}
 
@@ -915,7 +915,7 @@ public class Vala.Method : Subroutine {
 			return false;
 		}
 
-		if (!external_package && !overrides && !hides && get_hidden_member () != null) {
+		if (!external && !overrides && !hides && get_hidden_member () != null) {
 			Report.warning (source_reference, "%s hides inherited method `%s'. Use the `new' keyword if hiding was intentional".printf (get_full_name (), get_hidden_member ().get_full_name ()));
 		}
 
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index d37b8e8..d2d7304 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2841,6 +2841,9 @@ public class Vala.Parser : CodeVisitor {
 		if (ModifierFlags.NEW in flags) {
 			sig.hides = true;
 		}
+		if (ModifierFlags.EXTERN in flags || scanner.source_file.file_type == SourceFileType.PACKAGE) {
+			sig.external = true;
+		}
 		expect (TokenType.OPEN_PARENS);
 		if (current () != TokenType.CLOSE_PARENS) {
 			do {
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index fbec601..919cf87 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -167,7 +167,7 @@ public class Vala.PropertyAccessor : Subroutine {
 
 		context.analyzer.current_symbol = this;
 
-		if (prop.source_type == SourceFileType.SOURCE) {
+		if (!prop.external) {
 			if (body == null && !prop.interface_only && !prop.is_abstract) {
 				/* no accessor body specified, insert default body */
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]