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

support enum members with values

2006-11-22  Jürg Billeter  <j@bitron.ch>

	* vala/parser.y, vala/valacodegenerator.vala: support enum members with
	  values

svn path=/trunk/; revision=180
parent 9cba17b8
2006-11-22 Jürg Billeter <j@bitron.ch>
* vala/parser.y, vala/valacodegenerator.vala: support enum members with
values
2006-11-22 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vala: add direct_hash and direct_equal
......
......@@ -2784,8 +2784,9 @@ enum_member_declaration
}
| opt_attributes IDENTIFIER ASSIGN expression
{
$$ = vala_enum_value_new ($2);
$$ = vala_enum_value_new_with_value ($2, $4);
g_free ($2);
g_object_unref ($4);
}
;
......
......@@ -911,7 +911,14 @@ public class Vala.CodeGenerator : CodeVisitor {
}
public override void visit_enum_value (EnumValue! ev) {
cenum.add_value (ev.get_cname (), null);
string val;
if (ev.value is LiteralExpression) {
var lit = ((LiteralExpression) ev.value).literal;
if (lit is IntegerLiteral) {
val = ((IntegerLiteral) lit).value;
}
}
cenum.add_value (ev.get_cname (), val);
}
public override void visit_end_callback (Callback! cb) {
......
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