vala r1944 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1944 - in trunk: . vala
- Date: Fri, 31 Oct 2008 09:37:07 +0000 (UTC)
Author: juergbi
Date: Fri Oct 31 09:37:07 2008
New Revision: 1944
URL: http://svn.gnome.org/viewvc/vala?rev=1944&view=rev
Log:
2008-10-31 JÃrg Billeter <j bitron ch>
* vala/valacodenode.vala:
* vala/valaformalparameter.vala:
* vala/valasemanticanalyzer.vala:
* vala/valasourcefile.vala:
Check parameters when checking arguments
Modified:
trunk/ChangeLog
trunk/vala/valacodenode.vala
trunk/vala/valaformalparameter.vala
trunk/vala/valasemanticanalyzer.vala
trunk/vala/valasourcefile.vala
Modified: trunk/vala/valacodenode.vala
==============================================================================
--- trunk/vala/valacodenode.vala (original)
+++ trunk/vala/valacodenode.vala Fri Oct 31 09:37:07 2008
@@ -64,6 +64,8 @@
}
}
+ public bool checked { get; set; }
+
/**
* Specifies whether a fatal error has been detected in this code node.
*/
@@ -76,7 +78,6 @@
get { return _error_types != null && _error_types.size > 0; }
}
- bool checked;
private Gee.List<DataType> _error_types;
private static Gee.List<DataType> _empty_type_list;
Modified: trunk/vala/valaformalparameter.vala
==============================================================================
--- trunk/vala/valaformalparameter.vala (original)
+++ trunk/vala/valaformalparameter.vala Fri Oct 31 09:37:07 2008
@@ -168,6 +168,20 @@
}
public override bool check (SemanticAnalyzer analyzer) {
+ if (checked) {
+ return !error;
+ }
+
+ checked = true;
+
+ var old_source_file = analyzer.current_source_file;
+ var old_symbol = analyzer.current_symbol;
+
+ if (source_reference != null) {
+ analyzer.current_source_file = source_reference.file;
+ }
+ analyzer.current_symbol = parent_symbol;
+
accept_children (analyzer);
if (analyzer.context.non_null && default_expression != null) {
@@ -192,7 +206,6 @@
if (!analyzer.is_type_accessible (this, parameter_type)) {
error = true;
Report.error (source_reference, "parameter type `%s` is less accessible than method `%s`".printf (parameter_type.to_string (), parent_symbol.get_full_name ()));
- return false;
}
}
@@ -201,7 +214,6 @@
if (!(parent_symbol is CreationMethod)) {
error = true;
Report.error (source_reference, "construct parameters are only allowed in type creation methods");
- return false;
}
var method_body = ((CreationMethod) parent_symbol).body;
@@ -211,7 +223,10 @@
method_body.add_statement (new ExpressionStatement (new Assignment (left, right), source_reference));
}
- return true;
+ analyzer.current_source_file = old_source_file;
+ analyzer.current_symbol = old_symbol;
+
+ return !error;
}
}
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Fri Oct 31 09:37:07 2008
@@ -31,7 +31,7 @@
public CodeContext context { get; set; }
Symbol root_symbol;
- Symbol current_symbol;
+ public Symbol current_symbol { get; set; }
public SourceFile current_source_file { get; set; }
DataType current_return_type;
Class current_class;
@@ -2186,6 +2186,10 @@
bool ellipsis = false;
int i = 0;
foreach (FormalParameter param in params) {
+ if (!param.check (this)) {
+ return false;
+ }
+
if (param.ellipsis) {
ellipsis = true;
break;
Modified: trunk/vala/valasourcefile.vala
==============================================================================
--- trunk/vala/valasourcefile.vala (original)
+++ trunk/vala/valasourcefile.vala Fri Oct 31 09:37:07 2008
@@ -265,6 +265,9 @@
* Adds the specified symbol to the list of symbols code in this source
* file depends on.
*
+ * TODO Move source and header file dependency analysis to
+ * code generator.
+ *
* @param sym a symbol
* @param dep_type type of dependency
*/
@@ -328,6 +331,9 @@
* Adds the symbols that define the specified type to the list of
* symbols code in this source file depends on.
*
+ * TODO Move source and header file dependency analysis to
+ * code generator.
+ *
* @param type a data type
* @param dep_type type of dependency
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]