vala r976 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r976 - in trunk: . vala
- Date: Tue, 5 Feb 2008 18:59:17 +0000 (GMT)
Author: juergbi
Date: Tue Feb 5 18:59:17 2008
New Revision: 976
URL: http://svn.gnome.org/viewvc/vala?rev=976&view=rev
Log:
2008-02-05 Juerg Billeter <j bitron ch>
* vala/valacfgbuilder.vala, vala/valapropertyaccessor.vala: build
control flow graph for property accessors
Modified:
trunk/ChangeLog
trunk/vala/valacfgbuilder.vala
trunk/vala/valapropertyaccessor.vala
Modified: trunk/vala/valacfgbuilder.vala
==============================================================================
--- trunk/vala/valacfgbuilder.vala (original)
+++ trunk/vala/valacfgbuilder.vala Tue Feb 5 18:59:17 2008
@@ -63,7 +63,6 @@
private CodeContext context;
private BasicBlock current_block;
private bool unreachable_reported;
- private Method current_method;
private Gee.List<JumpTarget> jump_stack = new ArrayList<JumpTarget> ();
public CFGBuilder () {
@@ -111,9 +110,6 @@
return;
}
- var old_method = current_method;
- current_method = m;
-
m.entry_block = new BasicBlock.entry ();
m.exit_block = new BasicBlock.exit ();
@@ -136,8 +132,39 @@
current_block.connect (m.exit_block);
}
+ }
+
+ public override void visit_property (Property! prop) {
+ prop.accept_children (this);
+ }
+
+ public override void visit_property_accessor (PropertyAccessor! acc) {
+ if (acc.body == null) {
+ return;
+ }
+
+ acc.entry_block = new BasicBlock.entry ();
+ acc.exit_block = new BasicBlock.exit ();
+
+ current_block = new BasicBlock ();
+ acc.entry_block.connect (current_block);
- current_method = old_method;
+ jump_stack.add (new JumpTarget.return_target (acc.exit_block));
+
+ acc.accept_children (this);
+
+ jump_stack.remove_at (jump_stack.size - 1);
+
+ if (current_block != null) {
+ // end of property accessor body reachable
+
+ if (acc.readable) {
+ Report.error (acc.source_reference, "missing return statement at end of property getter body");
+ acc.error = true;
+ }
+
+ current_block.connect (acc.exit_block);
+ }
}
public override void visit_block (Block! b) {
Modified: trunk/vala/valapropertyaccessor.vala
==============================================================================
--- trunk/vala/valapropertyaccessor.vala (original)
+++ trunk/vala/valapropertyaccessor.vala Tue Feb 5 18:59:17 2008
@@ -1,6 +1,6 @@
/* valapropertyaccessor.vala
*
- * Copyright (C) 2006-2007 JÃrg Billeter
+ * Copyright (C) 2006-2008 JÃrg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -51,7 +51,11 @@
* The accessor body.
*/
public Block body { get; set; }
-
+
+ public BasicBlock entry_block { get; set; }
+
+ public BasicBlock exit_block { get; set; }
+
/**
* Represents the generated value parameter in a set accessor.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]