2008-04-13 Jürg Billeter <j@bitron.ch>
+ * */*.vala: fix build when using non-null types
+
+2008-04-13 Jürg Billeter <j@bitron.ch>
+
* vala/valacodecontext.vala, vala/valasemanticanalyzer.vala,
gobject/valaccodegenerator.vala, compiler/valacompiler.vala:
Add --enable-non-null-experimental commandline option
/* valaccodeenum.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
private Gee.List<CCodeEnumValue> values = new ArrayList<CCodeEnumValue> ();
- public CCodeEnum (string name = null) {
+ public CCodeEnum (string? name = null) {
this.name = name;
}
/* valaccodeenumvalue.vala
*
- * Copyright (C) 2007 Jürg Billeter
+ * Copyright (C) 2007-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
/**
* The numerical representation of this enum value.
*/
- public CCodeExpression value { get; set; }
+ public CCodeExpression? value { get; set; }
- public CCodeEnumValue (string name, CCodeExpression value = null) {
- this.value = value;
+ public CCodeEnumValue (string name, CCodeExpression? value = null) {
this.name = name;
+ this.value = value;
}
public override void write (CCodeWriter writer) {
/**
* The function to be called.
*/
- public CCodeExpression call { get; set; }
+ public CCodeExpression? call { get; set; }
private Gee.List<CCodeExpression> arguments = new ArrayList<CCodeExpression> ();
- public CCodeFunctionCall (CCodeExpression call = null) {
+ public CCodeFunctionCall (CCodeExpression? call = null) {
this.call = call;
}
/* valaccodeifstatement.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
/**
* The optional statement to be evaluated if the condition doesn't hold.
*/
- public CCodeStatement false_statement { get; set construct; }
+ public CCodeStatement? false_statement { get; set construct; }
- public CCodeIfStatement (CCodeExpression cond, CCodeStatement true_stmt, CCodeStatement false_stmt = null) {
+ public CCodeIfStatement (CCodeExpression cond, CCodeStatement true_stmt, CCodeStatement? false_stmt = null) {
condition = cond;
true_statement = true_stmt;
false_statement = false_stmt;
/* valaccodereturnstatement.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
/**
* The optional expression to return.
*/
- public CCodeExpression return_expression { get; set; }
+ public CCodeExpression? return_expression { get; set; }
- public CCodeReturnStatement (CCodeExpression expr = null) {
+ public CCodeReturnStatement (CCodeExpression? expr = null) {
return_expression = expr;
}
/**
* The optional initializer expression.
*/
- public CCodeExpression initializer { get; set; }
-
- public CCodeVariableDeclarator (string _name) {
- name = _name;
+ public CCodeExpression? initializer { get; set; }
+
+ public CCodeVariableDeclarator (string name) {
+ this.name = name;
}
-
- public CCodeVariableDeclarator.with_initializer (string _name, CCodeExpression init) {
- name = _name;
- initializer = init;
+
+ public CCodeVariableDeclarator.with_initializer (string name, CCodeExpression? initializer) {
+ this.name = name;
+ this.initializer = initializer;
}
public override void write (CCodeWriter writer) {
/* valaccodewriter.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
/**
* Writes tabs according to the current indent level.
*/
- public void write_indent (CCodeLineDirective line = null) {
+ public void write_indent (CCodeLineDirective? line = null) {
if (line_directives && line != null) {
line.write (this);
}
context.library = library;
context.assert = !disable_assert;
context.checking = !disable_checking;
- context.non_null = non_null || non_null_experimental;
+ context.non_null = non_null || non_null_experimental || true;
context.non_null_experimental = non_null_experimental;
Report.set_verbose_errors (verbose);
if (!ccode_only) {
var ccompiler = new CCodeCompiler ();
- ccompiler.compile (context, cc_command, cc_options);
+ if (cc_options == null) {
+ ccompiler.compile (context, cc_command, cc_options);
+ } else {
+ ccompiler.compile (context, cc_command, new string[] { null });
+ }
}
return quit ();
* @param context a code context
*/
[NoArrayLength]
- public void compile (CodeContext context, string cc_command, string[] cc_options) {
+ public void compile (CodeContext context, string? cc_command, string[] cc_options) {
string pc = "pkg-config --cflags";
if (!context.compile_only) {
pc += " --libs";
cmdline += " -o " + Shell.quote (output);
}
cmdline += " " + pkgflags;
- if (cc_options != null) {
- foreach (string cc_option in cc_options) {
- cmdline += " " + cc_option;
- }
+ foreach (string cc_option in cc_options) {
+ cmdline += " " + cc_option;
}
/* make sure include files can be found if -d is used */
list.ccodenode = clist;
}
- public VariableDeclarator get_temp_variable_declarator (DataType type, bool takes_ownership = true, CodeNode node_reference = null) {
+ public VariableDeclarator get_temp_variable_declarator (DataType type, bool takes_ownership = true, CodeNode? node_reference = null) {
var decl = new VariableDeclarator ("_tmp%d".printf (next_temp_var_id));
decl.type_reference = type.copy ();
decl.type_reference.is_ref = false;
}
}
- private CCodeExpression get_dup_func_expression (DataType type, SourceReference source_reference) {
+ private CCodeExpression get_dup_func_expression (DataType type, SourceReference? source_reference) {
if (type.data_type != null) {
string dup_function;
if (type.data_type.is_reference_counting ()) {
return result;
}
- public CCodeExpression get_implicit_cast_expression (CCodeExpression cexpr, DataType expression_type, DataType target_type) {
+ public CCodeExpression get_implicit_cast_expression (CCodeExpression cexpr, DataType? expression_type, DataType target_type) {
if (null == expression_type) {
return cexpr;
}
using GLib;
public class Vala.CCodeGenerator {
- private void process_cmember (MemberAccess expr, CCodeExpression pub_inst, DataType base_type) {
+ private void process_cmember (MemberAccess expr, CCodeExpression? pub_inst, DataType? base_type) {
if (expr.symbol_reference is Method) {
var m = (Method) expr.symbol_reference;
}
}
- public string get_signal_marshaller_function (Signal sig, string prefix = null) {
+ public string get_signal_marshaller_function (Signal sig, string? prefix = null) {
var signature = get_signal_signature (sig);
string ret;
var params = sig.get_parameters ();
* Represents a dynamic bound DBus method.
*/
public class Vala.DBusMethod : Method {
- public DBusMethod (string name, DataType return_type, SourceReference source_reference = null) {
+ public DBusMethod (string name, DataType return_type, SourceReference? source_reference = null) {
this.return_type = return_type;
this.source_reference = source_reference;
this.name = name;
* Represents a dynamic bound DBus signal.
*/
public class Vala.DBusSignal : Signal {
- public DBusSignal (string name, DataType return_type, SourceReference source_reference = null) {
+ public DBusSignal (string name, DataType return_type, SourceReference? source_reference = null) {
this.return_type = return_type;
this.source_reference = source_reference;
this.name = name;
get { return _read_only; }
}
- public Sample(construct string! name) {
+ public Sample (string name) {
+ this.name = name;
}
construct {
* @param inner variable whose address is to be computed
* @return newly created address-of expression
*/
- public AddressofExpression (Expression inner, SourceReference source_reference = null) {
+ public AddressofExpression (Expression inner, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.inner = inner;
}
/* valaarraycreationexpression.vala
*
- * Copyright (C) 2006-2007 Raffaele Sandrini, Jürg Billeter
+ * Copyright (C) 2006-2008 Raffaele Sandrini, 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
/**
* The root array initializer list.
*/
- public InitializerList initializer_list { get; set construct; }
+ public InitializerList? initializer_list { get; set construct; }
private DataType _element_type;
return new ReadOnlyList<Expression> (sizes);
}
- public ArrayCreationExpression (DataType element_type, int rank, InitializerList initializer_list, SourceReference source_reference) {
+ public ArrayCreationExpression (DataType element_type, int rank, InitializerList? initializer_list, SourceReference source_reference) {
+ this.element_type = element_type;
this.rank = rank;
this.initializer_list = initializer_list;
this.source_reference = source_reference;
- this.element_type = element_type;
}
public override void accept_children (CodeVisitor visitor) {
private ArrayResizeMethod resize_method;
private ArrayMoveMethod move_method;
- public ArrayType (DataType element_type, int rank, SourceReference source_reference) {
+ public ArrayType (DataType element_type, int rank, SourceReference? source_reference) {
this.element_type = element_type;
this.rank = rank;
this.source_reference = source_reference;
* @param source_reference reference to source code
* @return newly created assignment
*/
- public Assignment (Expression left, Expression right, AssignmentOperator operator = AssignmentOperator.SIMPLE, SourceReference source_reference = null) {
+ public Assignment (Expression left, Expression right, AssignmentOperator operator = AssignmentOperator.SIMPLE, SourceReference? source_reference = null) {
this.right = right;
this.operator = operator;
this.source_reference = source_reference;
* @param source_reference reference to source code
* @return newly created attribute
*/
- public Attribute (string name, SourceReference source_reference) {
- this.source_reference = source_reference;
+ public Attribute (string name, SourceReference? source_reference) {
this.name = name;
+ this.source_reference = source_reference;
}
/**
* @param source reference to source code
* @return newly created base access expression
*/
- public BaseAccess (SourceReference source = null) {
+ public BaseAccess (SourceReference? source = null) {
source_reference = source;
}
* @param source reference to source code
* @return newly created binary expression
*/
- public BinaryExpression (BinaryOperator op, Expression _left, Expression _right, SourceReference source = null) {
+ public BinaryExpression (BinaryOperator op, Expression _left, Expression _right, SourceReference? source = null) {
operator = op;
left = _left;
right = _right;
*
* @param source reference to source code
*/
- public Block (SourceReference source_reference = null) {
+ public Block (SourceReference? source_reference = null) {
this.source_reference = source_reference;
}
* @param source_reference reference to source code
* @return newly created catch clause
*/
- public CatchClause (DataType? type_reference, string variable_name, Block body, SourceReference source_reference = null) {
+ public CatchClause (DataType? type_reference, string variable_name, Block body, SourceReference? source_reference = null) {
this.type_reference = type_reference;
this.variable_name = variable_name;
this.body = body;
* @param source reference to source code
* @return newly created class
*/
- public Class (string name, SourceReference source_reference = null) {
+ public Class (string name, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.name = name;
}
return lower_case_csuffix;
}
- public override string get_lower_case_cname (string infix) {
+ public override string? get_lower_case_cname (string? infix) {
if (infix == null) {
infix = "";
}
return lower_case_cprefix;
}
- public override string get_upper_case_cname (string infix) {
+ public override string get_upper_case_cname (string? infix) {
return get_lower_case_cname (infix).up ();
}
return null;
}
- public Namespace create_namespace (string name, SourceReference source_reference = null) {
+ public Namespace create_namespace (string name, SourceReference? source_reference = null) {
var node = new Namespace (name, source_reference);
node.code_binding = codegen.create_namespace_binding (node);
return node;
}
- public Class create_class (string name, SourceReference source_reference = null) {
+ public Class create_class (string name, SourceReference? source_reference = null) {
var node = new Class (name, source_reference);
node.code_binding = codegen.create_class_binding (node);
return node;
}
- public Struct create_struct (string name, SourceReference source_reference = null) {
+ public Struct create_struct (string name, SourceReference? source_reference = null) {
var node = new Struct (name, source_reference);
node.code_binding = codegen.create_struct_binding (node);
return node;
}
- public Interface create_interface (string name, SourceReference source_reference = null) {
+ public Interface create_interface (string name, SourceReference? source_reference = null) {
var node = new Interface (name, source_reference);
node.code_binding = codegen.create_interface_binding (node);
return node;
}
- public Enum create_enum (string name, SourceReference source_reference = null) {
+ public Enum create_enum (string name, SourceReference? source_reference = null) {
var node = new Enum (name, source_reference);
node.code_binding = codegen.create_enum_binding (node);
return node;
}
- public EnumValue create_enum_value (string name, SourceReference source_reference = null) {
+ public EnumValue create_enum_value (string name, SourceReference? source_reference = null) {
var node = new EnumValue (name, source_reference);
node.code_binding = codegen.create_enum_value_binding (node);
return node;
}
- public EnumValue create_enum_value_with_value (string name, Expression value, SourceReference source_reference = null) {
+ public EnumValue create_enum_value_with_value (string name, Expression? value, SourceReference? source_reference = null) {
var node = new EnumValue.with_value (name, value, source_reference);
node.code_binding = codegen.create_enum_value_binding (node);
return node;
}
- public ErrorDomain create_error_domain (string name, SourceReference source_reference = null) {
+ public ErrorDomain create_error_domain (string name, SourceReference? source_reference = null) {
var node = new ErrorDomain (name, source_reference);
node.code_binding = codegen.create_error_domain_binding (node);
return node;
return node;
}
- public ErrorCode create_error_code_with_value (string name, Expression value) {
+ public ErrorCode create_error_code_with_value (string name, Expression? value) {
var node = new ErrorCode.with_value (name, value);
node.code_binding = codegen.create_error_code_binding (node);
return node;
}
- public Delegate create_delegate (string name, DataType return_type, SourceReference source_reference = null) {
+ public Delegate create_delegate (string? name, DataType return_type, SourceReference? source_reference = null) {
var node = new Delegate (name, return_type, source_reference);
node.code_binding = codegen.create_delegate_binding (node);
return node;
}
- public Constant create_constant (string name, DataType type_reference, Expression initializer, SourceReference source_reference) {
+ public Constant create_constant (string name, DataType type_reference, Expression? initializer, SourceReference? source_reference) {
var node = new Constant (name, type_reference, initializer, source_reference);
node.code_binding = codegen.create_constant_binding (node);
return node;
}
- public Field create_field (string name, DataType type_reference, Expression initializer, SourceReference source_reference = null) {
+ public Field create_field (string name, DataType type_reference, Expression? initializer, SourceReference? source_reference = null) {
var node = new Field (name, type_reference, initializer, source_reference);
node.code_binding = codegen.create_field_binding (node);
return node;
}
- public Method create_method (string name, DataType return_type, SourceReference source_reference = null) {
+ public Method create_method (string name, DataType return_type, SourceReference? source_reference = null) {
var node = new Method (name, return_type, source_reference);
node.code_binding = codegen.create_method_binding (node);
return node;
}
- public CreationMethod create_creation_method (string type_name, string name, SourceReference source_reference = null) {
+ public CreationMethod create_creation_method (string type_name, string? name, SourceReference? source_reference = null) {
var node = new CreationMethod (type_name, name, source_reference);
node.code_binding = codegen.create_creation_method_binding (node);
return node;
}
- public FormalParameter create_formal_parameter (string name, DataType type_reference, SourceReference source_reference = null) {
+ public FormalParameter create_formal_parameter (string name, DataType type_reference, SourceReference? source_reference = null) {
var node = new FormalParameter (name, type_reference, source_reference);
node.code_binding = codegen.create_formal_parameter_binding (node);
return node;
}
- public FormalParameter create_formal_parameter_with_ellipsis (SourceReference source_reference = null) {
+ public FormalParameter create_formal_parameter_with_ellipsis (SourceReference? source_reference = null) {
var node = new FormalParameter.with_ellipsis (source_reference);
node.code_binding = codegen.create_formal_parameter_binding (node);
return node;
}
- public Property create_property (string name, DataType type_reference, PropertyAccessor get_accessor, PropertyAccessor set_accessor, SourceReference source_reference) {
+ public Property create_property (string name, DataType type_reference, PropertyAccessor? get_accessor, PropertyAccessor? set_accessor, SourceReference? source_reference) {
var node = new Property (name, type_reference, get_accessor, set_accessor, source_reference);
node.code_binding = codegen.create_property_binding (node);
return node;
}
- public PropertyAccessor create_property_accessor (bool readable, bool writable, bool construction, Block body, SourceReference source_reference) {
+ public PropertyAccessor create_property_accessor (bool readable, bool writable, bool construction, Block? body, SourceReference? source_reference) {
var node = new PropertyAccessor (readable, writable, construction, body, source_reference);
node.code_binding = codegen.create_property_accessor_binding (node);
return node;
}
- public Signal create_signal (string name, DataType return_type, SourceReference source_reference = null) {
+ public Signal create_signal (string name, DataType return_type, SourceReference? source_reference = null) {
var node = new Signal (name, return_type, source_reference);
node.code_binding = codegen.create_signal_binding (node);
return node;
}
- public Constructor create_constructor (SourceReference source_reference) {
+ public Constructor create_constructor (SourceReference? source_reference) {
var node = new Constructor (source_reference);
node.code_binding = codegen.create_constructor_binding (node);
return node;
}
- public Destructor create_destructor (SourceReference source_reference = null) {
+ public Destructor create_destructor (SourceReference? source_reference = null) {
var node = new Destructor (source_reference);
node.code_binding = codegen.create_destructor_binding (node);
return node;
}
- public TypeParameter create_type_parameter (string name, SourceReference source_reference) {
+ public TypeParameter create_type_parameter (string name, SourceReference? source_reference) {
var node = new TypeParameter (name, source_reference);
node.code_binding = codegen.create_type_parameter_binding (node);
return node;
}
- public Block create_block (SourceReference source_reference = null) {
+ public Block create_block (SourceReference? source_reference = null) {
var node = new Block (source_reference);
node.code_binding = codegen.create_block_binding (node);
return node;
}
- public EmptyStatement create_empty_statement (SourceReference source_reference = null) {
+ public EmptyStatement create_empty_statement (SourceReference? source_reference = null) {
var node = new EmptyStatement (source_reference);
node.code_binding = codegen.create_empty_statement_binding (node);
return node;
}
- public DeclarationStatement create_declaration_statement (LocalVariableDeclaration declaration, SourceReference source_reference) {
+ public DeclarationStatement create_declaration_statement (LocalVariableDeclaration declaration, SourceReference? source_reference) {
var node = new DeclarationStatement (declaration, source_reference);
node.code_binding = codegen.create_declaration_statement_binding (node);
return node;
}
- public LocalVariableDeclaration create_local_variable_declaration (DataType type_reference, SourceReference source_reference) {
+ public LocalVariableDeclaration create_local_variable_declaration (DataType type_reference, SourceReference? source_reference) {
var node = new LocalVariableDeclaration (type_reference, source_reference);
node.code_binding = codegen.create_local_variable_declaration_binding (node);
return node;
}
- public LocalVariableDeclaration create_local_variable_declaration_var_type (SourceReference source_reference) {
+ public LocalVariableDeclaration create_local_variable_declaration_var_type (SourceReference? source_reference) {
var node = new LocalVariableDeclaration.var_type (source_reference);
node.code_binding = codegen.create_local_variable_declaration_binding (node);
return node;
}
- public VariableDeclarator create_variable_declarator (string name, Expression initializer = null, SourceReference source_reference = null) {
+ public VariableDeclarator create_variable_declarator (string name, Expression? initializer = null, SourceReference? source_reference = null) {
var node = new VariableDeclarator (name, initializer, source_reference);
node.code_binding = codegen.create_variable_declarator_binding (node);
return node;
}
- public InitializerList create_initializer_list (SourceReference source_reference) {
+ public InitializerList create_initializer_list (SourceReference? source_reference) {
var node = new InitializerList (source_reference);
node.code_binding = codegen.create_initializer_list_binding (node);
return node;
}
- public ExpressionStatement create_expression_statement (Expression expression, SourceReference source_reference = null) {
+ public ExpressionStatement create_expression_statement (Expression expression, SourceReference? source_reference = null) {
var node = new ExpressionStatement (expression, source_reference);
node.code_binding = codegen.create_expression_statement_binding (node);
return node;
}
- public IfStatement create_if_statement (Expression condition, Block true_statement, Block false_statement, SourceReference source_reference) {
+ public IfStatement create_if_statement (Expression condition, Block true_statement, Block? false_statement, SourceReference? source_reference) {
var node = new IfStatement (condition, true_statement, false_statement, source_reference);
node.code_binding = codegen.create_if_statement_binding (node);
return node;
}
- public SwitchStatement create_switch_statement (Expression expression, SourceReference source_reference) {
+ public SwitchStatement create_switch_statement (Expression expression, SourceReference? source_reference) {
var node = new SwitchStatement (expression, source_reference);
node.code_binding = codegen.create_switch_statement_binding (node);
return node;
}
- public SwitchSection create_switch_section (SourceReference source_reference) {
+ public SwitchSection create_switch_section (SourceReference? source_reference) {
var node = new SwitchSection (source_reference);
node.code_binding = codegen.create_switch_section_binding (node);
return node;
}
- public SwitchLabel create_switch_label (Expression expression, SourceReference source_reference = null) {
+ public SwitchLabel create_switch_label (Expression expression, SourceReference? source_reference = null) {
var node = new SwitchLabel (expression, source_reference);
node.code_binding = codegen.create_switch_label_binding (node);
return node;
}
- public SwitchLabel create_switch_label_with_default (SourceReference source_reference = null) {
+ public SwitchLabel create_switch_label_with_default (SourceReference? source_reference = null) {
var node = new SwitchLabel.with_default (source_reference);
node.code_binding = codegen.create_switch_label_binding (node);
return node;
}
- public WhileStatement create_while_statement (Expression condition, Block body, SourceReference source_reference = null) {
+ public WhileStatement create_while_statement (Expression condition, Block body, SourceReference? source_reference = null) {
var node = new WhileStatement (condition, body, source_reference);
node.code_binding = codegen.create_while_statement_binding (node);
return node;
}
- public DoStatement create_do_statement (Block body, Expression condition, SourceReference source_reference = null) {
+ public DoStatement create_do_statement (Block body, Expression condition, SourceReference? source_reference = null) {
var node = new DoStatement (body, condition, source_reference);
node.code_binding = codegen.create_do_statement_binding (node);
return node;
}
- public ForStatement create_for_statement (Expression condition, Block body, SourceReference source_reference = null) {
+ public ForStatement create_for_statement (Expression condition, Block body, SourceReference? source_reference = null) {
var node = new ForStatement (condition, body, source_reference);
node.code_binding = codegen.create_for_statement_binding (node);
return node;
}
- public ForeachStatement create_foreach_statement (DataType type_reference, string variable_name, Expression collection, Block body, SourceReference source_reference) {
+ public ForeachStatement create_foreach_statement (DataType type_reference, string variable_name, Expression collection, Block body, SourceReference? source_reference) {
var node = new ForeachStatement (type_reference, variable_name, collection, body, source_reference);
node.code_binding = codegen.create_foreach_statement_binding (node);
return node;
}
- public BreakStatement create_break_statement (SourceReference source_reference) {
+ public BreakStatement create_break_statement (SourceReference? source_reference) {
var node = new BreakStatement (source_reference);
node.code_binding = codegen.create_break_statement_binding (node);
return node;
}
- public ContinueStatement create_continue_statement (SourceReference source_reference) {
+ public ContinueStatement create_continue_statement (SourceReference? source_reference) {
var node = new ContinueStatement (source_reference);
node.code_binding = codegen.create_continue_statement_binding (node);
return node;
}
- public ReturnStatement create_return_statement (Expression return_expression = null, SourceReference source_reference = null) {
+ public ReturnStatement create_return_statement (Expression? return_expression = null, SourceReference? source_reference = null) {
var node = new ReturnStatement (return_expression, source_reference);
node.code_binding = codegen.create_return_statement_binding (node);
return node;
}
- public ThrowStatement create_throw_statement (Expression error_expression, SourceReference source_reference = null) {
+ public ThrowStatement create_throw_statement (Expression error_expression, SourceReference? source_reference = null) {
var node = new ThrowStatement (error_expression, source_reference);
node.code_binding = codegen.create_throw_statement_binding (node);
return node;
}
- public TryStatement create_try_statement (Block body, Block finally_body, SourceReference source_reference = null) {
+ public TryStatement create_try_statement (Block body, Block? finally_body, SourceReference? source_reference = null) {
var node = new TryStatement (body, finally_body, source_reference);
node.code_binding = codegen.create_try_statement_binding (node);
return node;
}
- public CatchClause create_catch_clause (DataType type_reference, string variable_name, Block body, SourceReference source_reference = null) {
+ public CatchClause create_catch_clause (DataType type_reference, string variable_name, Block body, SourceReference? source_reference = null) {
var node = new CatchClause (type_reference, variable_name, body, source_reference);
node.code_binding = codegen.create_catch_clause_binding (node);
return node;
}
- public LockStatement create_lock_statement (Expression resource, Block body, SourceReference source_reference = null) {
+ public LockStatement create_lock_statement (Expression resource, Block body, SourceReference? source_reference = null) {
var node = new LockStatement (resource, body, source_reference);
node.code_binding = codegen.create_lock_statement_binding (node);
return node;
}
- public DeleteStatement create_delete_statement (Expression expression, SourceReference source_reference = null) {
+ public DeleteStatement create_delete_statement (Expression expression, SourceReference? source_reference = null) {
var node = new DeleteStatement (expression, source_reference);
node.code_binding = codegen.create_delete_statement_binding (node);
return node;
}
- public ArrayCreationExpression create_array_creation_expression (DataType element_type, int rank, InitializerList initializer_list, SourceReference source_reference) {
+ public ArrayCreationExpression create_array_creation_expression (DataType element_type, int rank, InitializerList? initializer_list, SourceReference? source_reference) {
var node = new ArrayCreationExpression (element_type, rank, initializer_list, source_reference);
node.code_binding = codegen.create_array_creation_expression_binding (node);
return node;
}
- public BooleanLiteral create_boolean_literal (bool value, SourceReference source_reference) {
+ public BooleanLiteral create_boolean_literal (bool value, SourceReference? source_reference) {
var node = new BooleanLiteral (value, source_reference);
node.code_binding = codegen.create_boolean_literal_binding (node);
return node;
}
- public CharacterLiteral create_character_literal (string value, SourceReference source_reference) {
+ public CharacterLiteral create_character_literal (string value, SourceReference? source_reference) {
var node = new CharacterLiteral (value, source_reference);
node.code_binding = codegen.create_character_literal_binding (node);
return node;
}
- public IntegerLiteral create_integer_literal (string value, SourceReference source_reference = null) {
+ public IntegerLiteral create_integer_literal (string value, SourceReference? source_reference = null) {
var node = new IntegerLiteral (value, source_reference);
node.code_binding = codegen.create_integer_literal_binding (node);
return node;
}
- public RealLiteral create_real_literal (string value, SourceReference source_reference) {
+ public RealLiteral create_real_literal (string value, SourceReference? source_reference) {
var node = new RealLiteral (value, source_reference);
node.code_binding = codegen.create_real_literal_binding (node);
return node;
}
- public StringLiteral create_string_literal (string value, SourceReference source_reference) {
+ public StringLiteral create_string_literal (string value, SourceReference? source_reference) {
var node = new StringLiteral (value, source_reference);
node.code_binding = codegen.create_string_literal_binding (node);
return node;
}
- public NullLiteral create_null_literal (SourceReference source_reference = null) {
+ public NullLiteral create_null_literal (SourceReference? source_reference = null) {
var node = new NullLiteral (source_reference);
node.code_binding = codegen.create_null_literal_binding (node);
return node;
}
- public ParenthesizedExpression create_parenthesized_expression (Expression inner, SourceReference source_reference) {
+ public ParenthesizedExpression create_parenthesized_expression (Expression inner, SourceReference? source_reference) {
var node = new ParenthesizedExpression (inner, source_reference);
node.code_binding = codegen.create_parenthesized_expression_binding (node);
return node;
}
- public MemberAccess create_member_access (Expression inner, string member_name, SourceReference source_reference = null) {
+ public MemberAccess create_member_access (Expression? inner, string member_name, SourceReference? source_reference = null) {
var node = new MemberAccess (inner, member_name, source_reference);
node.code_binding = codegen.create_member_access_binding (node);
return node;
}
- public MemberAccess create_member_access_simple (string member_name, SourceReference source_reference = null) {
+ public MemberAccess create_member_access_simple (string member_name, SourceReference? source_reference = null) {
var node = new MemberAccess.simple (member_name, source_reference);
node.code_binding = codegen.create_member_access_binding (node);
return node;
}
- public MemberAccess create_member_access_pointer (Expression inner, string member_name, SourceReference source_reference = null) {
+ public MemberAccess create_member_access_pointer (Expression inner, string member_name, SourceReference? source_reference = null) {
var node = new MemberAccess.pointer (inner, member_name, source_reference);
node.code_binding = codegen.create_member_access_binding (node);
return node;
}
- public InvocationExpression create_invocation_expression (Expression call, SourceReference source_reference = null) {
+ public InvocationExpression create_invocation_expression (Expression call, SourceReference? source_reference = null) {
var node = new InvocationExpression (call, source_reference);
node.code_binding = codegen.create_invocation_expression_binding (node);
return node;
}
- public ElementAccess create_element_access (Expression container, SourceReference source_reference) {
+ public ElementAccess create_element_access (Expression container, SourceReference? source_reference) {
var node = new ElementAccess (container, source_reference);
node.code_binding = codegen.create_element_access_binding (node);
return node;
}
- public BaseAccess create_base_access (SourceReference source_reference = null) {
+ public BaseAccess create_base_access (SourceReference? source_reference = null) {
var node = new BaseAccess (source_reference);
node.code_binding = codegen.create_base_access_binding (node);
return node;
}
- public PostfixExpression create_postfix_expression (Expression inner, bool increment, SourceReference source_reference) {
+ public PostfixExpression create_postfix_expression (Expression inner, bool increment, SourceReference? source_reference) {
var node = new PostfixExpression (inner, increment, source_reference);
node.code_binding = codegen.create_postfix_expression_binding (node);
return node;
}
- public ObjectCreationExpression create_object_creation_expression (MemberAccess member_name, SourceReference source_reference) {
+ public ObjectCreationExpression create_object_creation_expression (MemberAccess member_name, SourceReference? source_reference) {
var node = new ObjectCreationExpression (member_name, source_reference);
node.code_binding = codegen.create_object_creation_expression_binding (node);
return node;
}
- public SizeofExpression create_sizeof_expression (DataType type_reference, SourceReference source_reference) {
+ public SizeofExpression create_sizeof_expression (DataType type_reference, SourceReference? source_reference) {
var node = new SizeofExpression (type_reference, source_reference);
node.code_binding = codegen.create_sizeof_expression_binding (node);
return node;
}
- public TypeofExpression create_typeof_expression (DataType type_reference, SourceReference source_reference) {
+ public TypeofExpression create_typeof_expression (DataType type_reference, SourceReference? source_reference) {
var node = new TypeofExpression (type_reference, source_reference);
node.code_binding = codegen.create_typeof_expression_binding (node);
return node;
}
- public UnaryExpression create_unary_expression (UnaryOperator operator, Expression inner, SourceReference source_reference) {
+ public UnaryExpression create_unary_expression (UnaryOperator operator, Expression inner, SourceReference? source_reference) {
var node = new UnaryExpression (operator, inner, source_reference);
node.code_binding = codegen.create_unary_expression_binding (node);
return node;
}
- public CastExpression create_cast_expression (Expression inner, DataType type_reference, SourceReference source_reference, bool is_silent_cast) {
+ public CastExpression create_cast_expression (Expression inner, DataType type_reference, SourceReference? source_reference, bool is_silent_cast) {
var node = new CastExpression (inner, type_reference, source_reference, is_silent_cast);
node.code_binding = codegen.create_cast_expression_binding (node);
return node;
}
- public PointerIndirection create_pointer_indirection (Expression inner, SourceReference source_reference = null) {
+ public PointerIndirection create_pointer_indirection (Expression inner, SourceReference? source_reference = null) {
var node = new PointerIndirection (inner, source_reference);
node.code_binding = codegen.create_pointer_indirection_binding (node);
return node;
}
- public AddressofExpression create_addressof_expression (Expression inner, SourceReference source_reference = null) {
+ public AddressofExpression create_addressof_expression (Expression inner, SourceReference? source_reference = null) {
var node = new AddressofExpression (inner, source_reference);
node.code_binding = codegen.create_addressof_expression_binding (node);
return node;
}
- public ReferenceTransferExpression create_reference_transfer_expression (Expression inner, SourceReference source_reference = null) {
+ public ReferenceTransferExpression create_reference_transfer_expression (Expression inner, SourceReference? source_reference = null) {
var node = new ReferenceTransferExpression (inner, source_reference);
node.code_binding = codegen.create_reference_transfer_expression_binding (node);
return node;
}
- public BinaryExpression create_binary_expression (BinaryOperator operator, Expression left, Expression right, SourceReference source_reference = null) {
+ public BinaryExpression create_binary_expression (BinaryOperator operator, Expression left, Expression right, SourceReference? source_reference = null) {
var node = new BinaryExpression (operator, left, right, source_reference);
node.code_binding = codegen.create_binary_expression_binding (node);
return node;
}
- public TypeCheck create_type_check (Expression expression, DataType type_reference, SourceReference source_reference) {
+ public TypeCheck create_type_check (Expression expression, DataType type_reference, SourceReference? source_reference) {
var node = new TypeCheck (expression, type_reference, source_reference);
node.code_binding = codegen.create_type_check_binding (node);
return node;
}
- public ConditionalExpression create_conditional_expression (Expression condition, Expression true_expression, Expression false_expression, SourceReference source_reference) {
+ public ConditionalExpression create_conditional_expression (Expression condition, Expression true_expression, Expression false_expression, SourceReference? source_reference) {
var node = new ConditionalExpression (condition, true_expression, false_expression, source_reference);
node.code_binding = codegen.create_conditional_expression_binding (node);
return node;
}
- public LambdaExpression create_lambda_expression (Expression expression_body, SourceReference source_reference) {
+ public LambdaExpression create_lambda_expression (Expression expression_body, SourceReference? source_reference) {
var node = new LambdaExpression (expression_body, source_reference);
node.code_binding = codegen.create_lambda_expression_binding (node);
return node;
}
- public LambdaExpression create_lambda_expression_with_statement_body (Block statement_body, SourceReference source_reference) {
+ public LambdaExpression create_lambda_expression_with_statement_body (Block statement_body, SourceReference? source_reference) {
var node = new LambdaExpression.with_statement_body (statement_body, source_reference);
node.code_binding = codegen.create_lambda_expression_binding (node);
return node;
}
- public Assignment create_assignment (Expression left, Expression right, AssignmentOperator operator = AssignmentOperator.SIMPLE, SourceReference source_reference = null) {
+ public Assignment create_assignment (Expression left, Expression right, AssignmentOperator operator = AssignmentOperator.SIMPLE, SourceReference? source_reference = null) {
var node = new Assignment (left, right, operator, source_reference);
node.code_binding = codegen.create_assignment_binding (node);
return node;
/* valaconstant.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
* @param source_reference reference to source code
* @return newly created constant
*/
- public Constant (string name, DataType type_reference, Expression initializer, SourceReference source_reference) {
+ public Constant (string name, DataType type_reference, Expression? initializer, SourceReference? source_reference) {
+ this.name = name;
this.type_reference = type_reference;
this.initializer = initializer;
this.source_reference = source_reference;
- this.name = name;
}
public override void accept (CodeVisitor visitor) {
* @param source_reference reference to source code
* @return newly created method
*/
- public CreationMethod (string type_name, string name, SourceReference source_reference = null) {
+ public CreationMethod (string? type_name, string? name, SourceReference? source_reference = null) {
this.name = name;
this.source_reference = source_reference;
this.type_name = type_name;
* name or null
* @return the lower case name to be used in C code
*/
- public virtual string get_lower_case_cname (string infix = null) {
+ public virtual string? get_lower_case_cname (string? infix = null) {
return data_type.get_lower_case_cname (infix);
}
* @param source reference to source code
* @return newly created delegate
*/
- public Delegate (string name, DataType return_type, SourceReference source_reference = null) {
+ public Delegate (string? name, DataType return_type, SourceReference? source_reference = null) {
+ this.name = name;
this.return_type = return_type;
this.source_reference = source_reference;
- this.name = name;
}
construct {
*/
public Expression expression { get; set; }
- public DeleteStatement (Expression expression, SourceReference source_reference = null) {
+ public DeleteStatement (Expression expression, SourceReference? source_reference = null) {
this.expression = expression;
this.source_reference = source_reference;
}
* @param source_reference reference to source code
* @return newly created destructor
*/
- public Destructor (SourceReference source_reference = null) {
+ public Destructor (SourceReference? source_reference = null) {
this.source_reference = source_reference;
}
* @param source reference to source code
* @return newly created do statement
*/
- public DoStatement (Block body, Expression condition, SourceReference source_reference = null) {
+ public DoStatement (Block body, Expression condition, SourceReference? source_reference = null) {
this.condition = condition;
this.source_reference = source_reference;
this.body = body;
* @param source_reference reference to source code
* @return newly created enum
*/
- public Enum (string name, SourceReference source_reference = null) {
+ public Enum (string name, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.name = name;
}
return lower_case_csuffix;
}
- public override string get_lower_case_cname (string infix) {
+ public override string? get_lower_case_cname (string? infix) {
if (infix == null) {
infix = "";
}
return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
}
- public override string get_upper_case_cname (string infix = null) {
+ public override string get_upper_case_cname (string? infix = null) {
return get_lower_case_cname (infix).up ();
}
* @param name enum value name
* @return newly created enum value
*/
- public EnumValue (string name, SourceReference source_reference = null) {
+ public EnumValue (string name, SourceReference? source_reference = null) {
this.name = name;
this.source_reference = source_reference;
}
* @param value numerical representation
* @return newly created enum value
*/
- public EnumValue.with_value (string name, Expression value, SourceReference source_reference = null) {
+ public EnumValue.with_value (string name, Expression value, SourceReference? source_reference = null) {
this.name = name;
this.value = value;
this.source_reference = source_reference;
* @param source_reference reference to source code
* @return newly created error domain
*/
- public ErrorDomain (string name, SourceReference source_reference = null) {
+ public ErrorDomain (string name, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.name = name;
}
return lower_case_csuffix;
}
- public override string get_lower_case_cname (string infix) {
+ public override string? get_lower_case_cname (string? infix) {
if (infix == null) {
infix = "";
}
return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
}
- public override string get_upper_case_cname (string infix) {
+ public override string get_upper_case_cname (string? infix) {
return get_lower_case_cname (null).up ();
}
*/
public weak ErrorDomain? error_domain { get; set; }
- public ErrorType (ErrorDomain? error_domain, SourceReference source_reference) {
+ public ErrorType (ErrorDomain? error_domain, SourceReference? source_reference) {
this.error_domain = error_domain;
this.data_type = error_domain;
this.source_reference = source_reference;
return "GError*";
}
- public override string get_lower_case_cname (string infix = null) {
+ public override string? get_lower_case_cname (string? infix = null) {
if (error_domain == null) {
if (infix == null) {
return "g_error";
* @param source reference to source code
* @return newly created expression statement
*/
- public ExpressionStatement (Expression expression, SourceReference source_reference = null) {
+ public ExpressionStatement (Expression expression, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.expression = expression;
}
/* valafield.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
* @param source reference to source code
* @return newly created field
*/
- public Field (string name, DataType type_reference, Expression initializer, SourceReference source_reference = null) {
+ public Field (string name, DataType type_reference, Expression? initializer, SourceReference? source_reference = null) {
this.type_reference = type_reference;
this.initializer = initializer;
this.source_reference = source_reference;
* @param source reference to source code
* @return newly created formal parameter
*/
- public FormalParameter (string _name, DataType type, SourceReference source = null) {
+ public FormalParameter (string _name, DataType type, SourceReference? source = null) {
name = _name;
type_reference = type;
source_reference = source;
* Creates a new ellipsis parameter representing an indefinite number of
* parameters.
*/
- public FormalParameter.with_ellipsis (SourceReference source = null) {
+ public FormalParameter.with_ellipsis (SourceReference? source = null) {
ellipsis = true;
source_reference = source;
}
* @param source_reference reference to source code
* @return newly created for statement
*/
- public ForStatement (Expression condition, Block body, SourceReference source_reference = null) {
+ public ForStatement (Expression condition, Block body, SourceReference? source_reference = null) {
this.body = body;
this.source_reference = source_reference;
this.condition = condition;
/**
* The optional statement to be evaluated if the condition doesn't hold.
*/
- public Block false_statement { get; set construct; }
+ public Block? false_statement { get; set construct; }
private Expression _condition;
* @param false_stmt statement to be evaluated if condition is false
* @return newly created if statement
*/
- public IfStatement (Expression cond, Block true_stmt, Block false_stmt, SourceReference source) {
+ public IfStatement (Expression cond, Block true_stmt, Block? false_stmt, SourceReference? source) {
condition = cond;
true_statement = true_stmt;
false_statement = false_stmt;
* @param source reference to source code
* @return newly created integer literal
*/
- public IntegerLiteral (string i, SourceReference source = null) {
+ public IntegerLiteral (string i, SourceReference? source = null) {
value = i;
source_reference = source;
}
* @param source reference to source code
* @return newly created interface
*/
- public Interface (string name, SourceReference source_reference = null) {
+ public Interface (string name, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.name = name;
}
this.lower_case_csuffix = csuffix;
}
- public override string get_lower_case_cname (string infix) {
+ public override string? get_lower_case_cname (string? infix) {
if (infix == null) {
infix = "";
}
return "%s_".printf (get_lower_case_cname (null));
}
- public override string get_upper_case_cname (string infix) {
+ public override string get_upper_case_cname (string? infix) {
return get_lower_case_cname (infix).up ();
}
* @param source_reference reference to source code
* @return newly created invocation expression
*/
- public InvocationExpression (Expression call, SourceReference source_reference = null) {
+ public InvocationExpression (Expression call, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.call = call;
}
*/
public Block body { get; set construct; }
- public LockStatement (Expression resource, Block body, SourceReference source_reference = null) {
+ public LockStatement (Expression resource, Block body, SourceReference? source_reference = null) {
this.body = body;
this.source_reference = source_reference;
this.resource = resource;
/**
* The parent of the member.
*/
- public Expression inner {
+ public Expression? inner {
get {
return _inner;
}
*/
public bool creation_member { get; set; }
- private Expression _inner;
+ private Expression? _inner;
private Gee.List<DataType> type_argument_list = new ArrayList<DataType> ();
/**
* @param source_reference reference to source code
* @return newly created member access expression
*/
- public MemberAccess (Expression inner, string member_name, SourceReference source_reference = null) {
+ public MemberAccess (Expression? inner, string member_name, SourceReference? source_reference = null) {
this.inner = inner;
this.member_name = member_name;
this.source_reference = source_reference;
}
- public MemberAccess.simple (string member_name, SourceReference source_reference = null) {
+ public MemberAccess.simple (string member_name, SourceReference? source_reference = null) {
this.member_name = member_name;
this.source_reference = source_reference;
}
- public MemberAccess.pointer (Expression inner, string member_name, SourceReference source_reference = null) {
+ public MemberAccess.pointer (Expression inner, string member_name, SourceReference? source_reference = null) {
this.inner = inner;
this.member_name = member_name;
this.source_reference = source_reference;
* @param source_reference reference to source code
* @return newly created member initializer
*/
- public MemberInitializer (string name, Expression initializer, SourceReference source_reference = null) {
+ public MemberInitializer (string name, Expression initializer, SourceReference? source_reference = null) {
this.initializer = initializer;
this.source_reference = source_reference;
this.name = name;
* @param source reference to source code
* @return newly created method
*/
- public Method (string name, DataType return_type, SourceReference source_reference = null) {
+ public Method (string name, DataType return_type, SourceReference? source_reference = null) {
this.return_type = return_type;
this.source_reference = source_reference;
this.name = name;
* @param source_reference reference to source code
* @return newly created namespace
*/
- public Namespace (string name, SourceReference source_reference = null) {
+ public Namespace (string? name, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.name = name;
access = SymbolAccessibility.PUBLIC;
* @param source reference to source code
* @return newly created null literal
*/
- public NullLiteral (SourceReference source = null) {
+ public NullLiteral (SourceReference? source = null) {
source_reference = source;
}
* @param source reference to source code
* @return newly created parenthesized expression
*/
- public ParenthesizedExpression (Expression _inner, SourceReference source) {
+ public ParenthesizedExpression (Expression _inner, SourceReference? source) {
inner = _inner;
source_reference = source;
}
stars++;
}
+ bool nullable = accept (TokenType.INTERR);
+
int array_rank = 0;
if (accept (TokenType.OPEN_BRACKET)) {
do {
}
while (accept (TokenType.COMMA));
expect (TokenType.CLOSE_BRACKET);
+
+ nullable = accept (TokenType.INTERR);
}
if (accept (TokenType.OP_NEG)) {
Report.warning (get_last_src (), "obsolete syntax, types are non-null by default");
}
- bool nullable = accept (TokenType.INTERR);
-
bool transfers_ownership = accept (TokenType.HASH);
var type = new UnresolvedType.from_symbol (sym, get_src (begin));
return attrs;
}
- void set_attributes (CodeNode node, Gee.List<Attribute> attributes) {
+ void set_attributes (CodeNode node, Gee.List<Attribute>? attributes) {
if (attributes != null) {
- foreach (Attribute attr in attributes) {
+ foreach (Attribute attr in (Gee.List<Attribute>) attributes) {
node.attributes.append (attr);
}
}
return RecoveryState.EOF;
}
- Namespace parse_namespace_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Namespace parse_namespace_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
expect (TokenType.NAMESPACE);
var sym = parse_symbol_name ();
}
}
- Symbol parse_class_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Symbol parse_class_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
var flags = parse_type_declaration_modifiers ();
}
}
- Constant parse_constant_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Constant parse_constant_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_member_declaration_modifiers ();
return c;
}
- Field parse_field_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Field parse_field_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
var flags = parse_member_declaration_modifiers ();
}
}
- Method parse_method_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Method parse_method_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
var flags = parse_member_declaration_modifiers ();
return method;
}
- Property parse_property_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Property parse_property_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
var flags = parse_member_declaration_modifiers ();
return prop;
}
- Signal parse_signal_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Signal parse_signal_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_member_declaration_modifiers ();
return sig;
}
- Constructor parse_constructor_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Constructor parse_constructor_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var flags = parse_member_declaration_modifiers ();
expect (TokenType.CONSTRUCT);
return c;
}
- Destructor parse_destructor_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Destructor parse_destructor_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
expect (TokenType.TILDE);
parse_identifier ();
return d;
}
- Symbol parse_struct_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Symbol parse_struct_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_type_declaration_modifiers ();
}
}
- Symbol parse_interface_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Symbol parse_interface_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_type_declaration_modifiers ();
}
}
- Symbol parse_enum_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Symbol parse_enum_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_type_declaration_modifiers ();
return result;
}
- Symbol parse_errordomain_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Symbol parse_errordomain_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_type_declaration_modifiers ();
return param;
}
- CreationMethod parse_creation_method_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ CreationMethod parse_creation_method_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
parse_member_declaration_modifiers ();
return method;
}
- Symbol parse_delegate_declaration (Gee.List<Attribute> attrs) throws ParseError {
+ Symbol parse_delegate_declaration (Gee.List<Attribute>? attrs) throws ParseError {
var begin = get_location ();
var access = parse_access_modifier ();
var flags = parse_member_declaration_modifiers ();
* @param inner pointer to be dereferenced
* @return newly created pointer indirection
*/
- public PointerIndirection (Expression inner, SourceReference source_reference = null) {
+ public PointerIndirection (Expression inner, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.inner = inner;
}
/**
* The get accessor of this property if available.
*/
- public PropertyAccessor get_accessor { get; set; }
+ public PropertyAccessor? get_accessor { get; set; }
/**
* The set/construct accessor of this property if available.
*/
- public PropertyAccessor set_accessor { get; set; }
+ public PropertyAccessor? set_accessor { get; set; }
/**
* Represents the generated ´this' parameter in this property.
* @param source reference to source code
* @return newly created property
*/
- public Property (string _name, DataType type, PropertyAccessor _get_accessor, PropertyAccessor _set_accessor, SourceReference source) {
+ public Property (string _name, DataType type, PropertyAccessor? _get_accessor, PropertyAccessor? _set_accessor, SourceReference source) {
name = _name;
type_reference = type;
get_accessor = _get_accessor;
/**
* The accessor body.
*/
- public Block body { get; set; }
+ public Block? body { get; set; }
public BasicBlock entry_block { get; set; }
* @param source reference to source code
* @return newly created property accessor
*/
- public PropertyAccessor (bool readable, bool writable, bool construction, Block body, SourceReference source_reference) {
+ public PropertyAccessor (bool readable, bool writable, bool construction, Block? body, SourceReference? source_reference) {
+ this.readable = readable;
this.writable = writable;
this.construction = construction;
this.body = body;
this.source_reference = source_reference;
- this.readable = readable;
}
public override void accept (CodeVisitor visitor) {
* @param inner variable whose reference is to be transferred
* @return newly created reference transfer expression
*/
- public ReferenceTransferExpression (Expression inner, SourceReference source_reference = null) {
+ public ReferenceTransferExpression (Expression inner, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.inner = inner;
}
/* valareport.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
* @param source reference to source code
* @param message warning message
*/
- public static void warning (SourceReference source, string message) {
+ public static void warning (SourceReference? source, string message) {
warnings++;
if (source == null) {
stderr.printf ("warning: %s\n", message);
* @param source reference to source code
* @param message error message
*/
- public static void error (SourceReference source, string message) {
+ public static void error (SourceReference? source, string message) {
errors++;
if (source == null) {
stderr.printf ("error: %s\n", message);
/* valareturnstatement.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
/**
* The optional expression to return.
*/
- public Expression return_expression {
+ public Expression? return_expression {
get { return _return_expression; }
set {
_return_expression = value;
* @param source_reference reference to source code
* @return newly created return statement
*/
- public ReturnStatement (Expression return_expression = null, SourceReference source_reference = null) {
+ public ReturnStatement (Expression? return_expression = null, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.return_expression = return_expression;
}
* @param source reference to source code
* @return newly created signal
*/
- public Signal (string name, DataType return_type, SourceReference source_reference = null) {
+ public Signal (string name, DataType return_type, SourceReference? source_reference = null) {
this.return_type = return_type;
this.source_reference = source_reference;
this.name = name;
* @param sym a symbol
* @param dep_type type of dependency
*/
- public void add_symbol_dependency (Symbol sym, SourceFileDependencyType dep_type) {
+ public void add_symbol_dependency (Symbol? sym, SourceFileDependencyType dep_type) {
if (pkg) {
return;
}
/* valasourcereference.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
* @param comment code comment
* @return newly created source reference
*/
- public SourceReference.with_comment (SourceFile _file, int _first_line, int _first_column, int _last_line, int _last_column, string _comment) {
+ public SourceReference.with_comment (SourceFile _file, int _first_line, int _first_column, int _last_line, int _last_column, string? _comment) {
file = _file;
first_line = _first_line;
first_column = _first_column;
* @param source_reference reference to source code
* @return newly created struct
*/
- public Struct (string name, SourceReference source_reference = null) {
+ public Struct (string name, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.name = name;
}
return lower_case_csuffix;
}
- public override string get_lower_case_cname (string infix) {
+ public override string? get_lower_case_cname (string? infix) {
if (infix == null) {
infix = "";
}
return "%s%s%s".printf (parent_symbol.get_lower_case_cprefix (), infix, get_lower_case_csuffix ());
}
- public override string get_upper_case_cname (string infix) {
+ public override string get_upper_case_cname (string? infix) {
return get_lower_case_cname (infix).up ();
}
* @param source reference to source code
* @return newly created switch case label
*/
- public SwitchLabel (Expression expr, SourceReference source = null) {
+ public SwitchLabel (Expression expr, SourceReference? source = null) {
expression = expr;
source_reference = source;
}
* @param source reference to source code
* @return newly created switch default label
*/
- public SwitchLabel.with_default (SourceReference source = null) {
+ public SwitchLabel.with_default (SourceReference? source = null) {
source_reference = source;
}
* name or null
* @return the lower case name to be used in C code
*/
- public virtual string get_lower_case_cname (string infix = null) {
+ public virtual string? get_lower_case_cname (string? infix = null) {
return null;
}
* @param source_reference reference to source code
* @return newly created throw statement
*/
- public ThrowStatement (Expression error_expression, SourceReference source_reference = null) {
+ public ThrowStatement (Expression error_expression, SourceReference? source_reference = null) {
this.source_reference = source_reference;
this.error_expression = error_expression;
}
/**
* Specifies the body of the optional finally clause.
*/
- public Block finally_body { get; set; }
+ public Block? finally_body { get; set; }
private Gee.List<CatchClause> catch_clauses = new ArrayList<CatchClause> ();
* @param source_reference reference to source code
* @return newly created try statement
*/
- public TryStatement (Block body, Block finally_body, SourceReference source_reference = null) {
+ public TryStatement (Block body, Block? finally_body, SourceReference? source_reference = null) {
+ this.body = body;
this.finally_body = finally_body;
this.source_reference = source_reference;
- this.body = body;
}
/**
* name or null
* @return the upper case name to be used in C code
*/
- public virtual string get_upper_case_cname (string infix = null) {
+ public virtual string get_upper_case_cname (string? infix = null) {
return null;
}
* @param source reference to source code
* @return newly created type reference
*/
- public UnresolvedType.from_symbol (UnresolvedSymbol symbol, SourceReference source = null) {
+ public UnresolvedType.from_symbol (UnresolvedSymbol symbol, SourceReference? source = null) {
this.unresolved_symbol = symbol;
source_reference = source;
}
/* valavariabledeclarator.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
* @param source reference to source code
* @return newly created variable declarator
*/
- public VariableDeclarator (string name, Expression initializer = null, SourceReference source_reference = null) {
+ public VariableDeclarator (string name, Expression? initializer = null, SourceReference? source_reference = null) {
+ this.name = name;
this.initializer = initializer;
this.source_reference = source_reference;
- this.name = name;
}
public override void accept (CodeVisitor visitor) {
* @param source reference to source code
* @return newly created while statement
*/
- public WhileStatement (Expression condition, Block body, SourceReference source_reference = null) {
+ public WhileStatement (Expression condition, Block body, SourceReference? source_reference = null) {
this.body = body;
this.source_reference = source_reference;
this.condition = condition;
return type;
}
- private Method create_method (string name, string symbol, IdlNodeParam res, GLib.List<IdlNodeParam> parameters, bool is_constructor, bool is_interface) {
+ private Method create_method (string name, string symbol, IdlNodeParam? res, GLib.List<IdlNodeParam>? parameters, bool is_constructor, bool is_interface) {
UnresolvedType return_type = null;
if (res != null) {
return_type = parse_param (res);