Commit bcaee210 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

set accessibility for constants set return type in property set accessors

2006-09-02  Jürg Billeter  <j@bitron.ch>

	* vala/parser.y: set accessibility for constants
	* vala/valasemanticanalyzer.vala: set return type in property set
	  accessors to void
	* vala/valacodegenerator.vala: move public constants to header file
	* vala/valaclass.vala: don't create fields for properties in VAPI files
	* vala/valaconstant.vala: add access member

svn path=/trunk/; revision=116
parent 773382a1
2006-09-02 Jürg Billeter <j@bitron.ch>
* vala/parser.y: set accessibility for constants
* vala/valasemanticanalyzer.vala: set return type in property set
accessors to void
* vala/valacodegenerator.vala: move public constants to header file
* vala/valaclass.vala: don't create fields for properties in VAPI files
* vala/valaconstant.vala: add access member
2006-09-02 Jürg Billeter <j@bitron.ch>
* vapi/cairo.vala: mark Matrix as reference type
......
......@@ -2109,6 +2109,9 @@ constant_declaration
g_object_unref (src);
g_object_unref ($5);
g_object_unref ($6);
if ($3 != 0) {
$$->access = $3;
}
}
;
......
......@@ -174,7 +174,8 @@ public class Vala.Class : DataType {
public void add_property (Property! prop) {
properties.append (prop);
if (prop.set_accessor != null && prop.set_accessor.body == null) {
if (prop.set_accessor != null && prop.set_accessor.body == null &&
source_reference != null && !source_reference.file.pkg) {
/* automatic property accessor body generation */
var f = new Field ("_%s".printf (prop.name), prop.type_reference, null, prop.source_reference);
f.access = MemberAccessibility.PRIVATE;
......
......@@ -860,7 +860,12 @@ public class Vala.CodeGenerator : CodeVisitor {
}
cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("%s%s".printf (c.get_cname (), arr), (CCodeExpression) c.initializer.ccodenode));
cdecl.modifiers = CCodeModifiers.STATIC;
source_type_member_declaration.append (cdecl);
if (c.access == MemberAccessibility.PUBLIC) {
header_type_member_declaration.append (cdecl);
} else {
source_type_member_declaration.append (cdecl);
}
}
}
......
......@@ -41,6 +41,14 @@ public class Vala.Constant : CodeNode {
*/
public Expression initializer { get; set; }
/**
* Specifies the accessibility of this constant. Public accessibility
* doesn't limit access. Default accessibility limits access to this
* program or library. Private accessibility limits access to instances
* of the contained type.
*/
public MemberAccessibility access;
private string cname;
/**
......
......@@ -263,6 +263,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (acc.readable) {
current_return_type = prop.type_reference;
} else {
// void
current_return_type = new TypeReference ();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment