2007-11-28 Jürg Billeter <j@bitron.ch>
+ * vala/parser.y, vala/scanner.l, vala/valamethod.vala,
+ ccode/valaccodefunction.vala, ccode/valaccodemodifiers.vala,
+ gobject/valaccodegeneratormethod.vala: add support for inline methods
+
+2007-11-28 Jürg Billeter <j@bitron.ch>
+
* vapi/glib-2.0.vapi: bind atomic operations, fixes bug 499970
2007-11-28 Jürg Billeter <j@bitron.ch>
* vala/parser.y, vala/scanner.l, vala/valafield.vala,
gobject/valaccodegenerator.vala: add support for volatile fields,
- fixes bug #499960
+ fixes bug 499960
2007-11-27 Jürg Billeter <j@bitron.ch>
public override void write (CCodeWriter! writer) {
writer.write_indent (line);
- if ((modifiers & CCodeModifiers.STATIC) == CCodeModifiers.STATIC) {
+ if (CCodeModifiers.STATIC in modifiers) {
writer.write_string ("static ");
}
+ if (CCodeModifiers.INLINE in modifiers) {
+ writer.write_string ("inline ");
+ }
writer.write_string (return_type);
writer.write_string (" ");
writer.write_string (name);
NONE,
STATIC,
REGISTER,
- EXTERN
+ EXTERN,
+ INLINE
}
function = new CCodeFunction (m.get_real_cname (), m.return_type.get_cname ());
m.ccodenode = function;
+
+ if (m.is_inline) {
+ function.modifiers |= CCodeModifiers.INLINE;
+ }
+
CCodeFunctionDeclarator vdeclarator = null;
CCodeFormalParameter instance_param = null;
VALA_MODIFIER_OVERRIDE = 1 << 1,
VALA_MODIFIER_STATIC = 1 << 2,
VALA_MODIFIER_VIRTUAL = 1 << 3,
- VALA_MODIFIER_VOLATILE = 1 << 4
+ VALA_MODIFIER_VOLATILE = 1 << 4,
+ VALA_MODIFIER_INLINE = 1 << 5
} ValaModifier;
int yylex (YYSTYPE *yylval_param, YYLTYPE *yylloc_param, ValaParser *parser);
%token GET "get"
%token IF "if"
%token IN "in"
+%token INLINE "inline"
%token INTERFACE "interface"
%token IS "is"
%token LOCK "lock"
{
$$ = VALA_MODIFIER_VOLATILE;
}
+ | INLINE
+ {
+ $$ = VALA_MODIFIER_INLINE;
+ }
;
opt_class_base
vala_report_error (vala_code_node_get_source_reference (VALA_CODE_NODE ($$)), "Only one of `abstract', `virtual', and `override' may be specified.");
vala_code_node_set_error (VALA_CODE_NODE ($$), TRUE);
}
+ if (($4 & VALA_MODIFIER_INLINE) == VALA_MODIFIER_INLINE) {
+ vala_method_set_is_inline ($$, TRUE);
+ }
VALA_CODE_NODE($$)->attributes = $2;
for (l = $8; l != NULL; l = l->next) {
"get" { uploc; return GET; }
"if" { uploc; return IF; }
"in" { uploc; return IN; }
+"inline" { uploc; return INLINE; }
"interface" { uploc; return INTERFACE; }
"is" { uploc; return IS; }
"lock" { uploc; return LOCK; }
* of a base type.
*/
public bool overrides { get; set; }
+
+ /**
+ * Specifies whether this method should be inlined.
+ */
+ public bool is_inline { get; set; }
/**
* Specifies whether the C method returns a new instance pointer which