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

add get_bool method for boolean values print message when detecting option

2006-12-23  Jürg Billeter  <j@bitron.ch>

	* vala/valaattribute.vala: add get_bool method for boolean values
	* compiler/valacompiler.vala: print message when detecting option errors

svn path=/trunk/; revision=184
parent 18a2c7fc
2006-12-23 Jürg Billeter <j@bitron.ch>
* vala/valaattribute.vala: add get_bool method for boolean values
* compiler/valacompiler.vala: print message when detecting option errors
2006-12-10 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vala: add message logging functions
......
......@@ -221,6 +221,8 @@ class Vala.Compiler {
opt_context.parse (out args, out err);
if (err != null) {
stdout.printf ("%s\n", err.message);
stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
return 1;
}
......
......@@ -117,4 +117,26 @@ public class Vala.Attribute : CodeNode {
return 0;
}
/**
* Returns the boolean value of the specified named argument.
*
* @param name argument name
* @return boolean value
*/
public bool get_bool (string! name) {
// FIXME: use hash table
foreach (NamedArgument arg in args) {
if (arg.name == name) {
if (arg.argument is LiteralExpression) {
var lit = ((LiteralExpression) arg.argument).literal;
if (lit is BooleanLiteral) {
return ((BooleanLiteral) lit).value;
}
}
}
}
return false;
}
}
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