}
if (inner.value_type.is_reference_type_or_type_parameter ()) {
- value_type = new PointerType (new PointerType (inner.value_type));
+ value_type = new PointerType (new PointerType (inner.value_type), source_reference);
} else {
- value_type = new PointerType (inner.value_type);
+ value_type = new PointerType (inner.value_type, source_reference);
}
return !error;
// FIXME: only do this if the backend doesn't support
// the assignment natively
- var old_value = new MemberAccess (ma.inner, ma.member_name);
+ var old_value = new MemberAccess (ma.inner, ma.member_name, source_reference);
BinaryOperator bop;
if (to_string_method == null) {
var string_type = CodeContext.get ().analyzer.string_type.copy ();
string_type.value_owned = false;
- to_string_method = new Method ("to_string", string_type);
+ to_string_method = new Method ("to_string", string_type, source_reference);
to_string_method.access = SymbolAccessibility.PUBLIC;
to_string_method.is_extern = true;
if (CodeContext.get ().profile == Profile.POSIX) {
to_string_method.set_attribute_string ("CCode", "cheader_filename", "glib-object.h");
}
to_string_method.owner = type_symbol.scope;
- to_string_method.this_parameter = new Parameter ("this", copy ());
+ to_string_method.this_parameter = new Parameter ("this", copy (), source_reference);
to_string_method.scope.add (to_string_method.this_parameter.name, to_string_method.this_parameter);
}
return to_string_method;
context.analyzer.current_symbol = old_symbol;
- collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name));
+ collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name), null, source_reference);
add_local_variable (collection_variable);
collection_variable.active = true;
method.check (context);
- value_type = new MethodType (method);
+ value_type = new MethodType (method, source_reference);
value_type.value_owned = target_type.value_owned;
return !error;
}
if (inner is MemberAccess && inner.symbol_reference is TypeParameter) {
- inner.value_type = new GenericType ((TypeParameter) inner.symbol_reference);
- inner.value_type.source_reference = source_reference;
+ inner.value_type = new GenericType ((TypeParameter) inner.symbol_reference, source_reference);
}
if (symbol_reference == null && inner.value_type != null) {
}
var m = new DynamicMethod (inner.value_type, member_name, ret_type, source_reference);
m.invocation = invoc;
- var err = new ErrorType (null, null);
+ var err = new ErrorType (null, null, m.source_reference);
err.dynamic_error = true;
m.add_error_type (err);
m.access = SymbolAccessibility.PUBLIC;
// required when using instance methods as delegates in constants
// TODO replace by MethodPrototype
value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
+ value_type.source_reference = source_reference;
} else if (symbol_reference is Field) {
- value_type = new FieldPrototype ((Field) symbol_reference);
+ value_type = new FieldPrototype ((Field) symbol_reference, source_reference);
} else if (symbol_reference is Property) {
- value_type = new PropertyPrototype ((Property) symbol_reference);
+ value_type = new PropertyPrototype ((Property) symbol_reference, source_reference);
} else {
error = true;
value_type = new InvalidType ();
if (m != null && m.binding == MemberBinding.STATIC && m.parent_symbol is ObjectTypeSymbol &&
inner != null && inner.value_type == null && inner_ma.type_argument_list.size > 0) {
// support static methods in generic classes
- inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol);
+ inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol, source_reference);
foreach (var type_argument in inner_ma.type_argument_list) {
inner.value_type.add_type_argument (type_argument);
}
}
- var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback"));
+ var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback"), source_reference);
callback_type.nullable = true;
callback_type.value_owned = true;
callback_type.is_called_once = true;
- var callback_param = new Parameter ("_callback_", callback_type);
+ var callback_param = new Parameter ("_callback_", callback_type, source_reference);
callback_param.initializer = new NullLiteral (source_reference);
callback_param.initializer.target_type = callback_type.copy ();
callback_param.set_attribute_double ("CCode", "pos", -1);
var glib_ns = CodeContext.get ().root.scope.lookup ("GLib");
var result_type = new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup ("AsyncResult"));
- var result_param = new Parameter ("_res_", result_type);
+ var result_param = new Parameter ("_res_", result_type, source_reference);
result_param.set_attribute_double ("CCode", "pos", get_attribute_double ("CCode", "async_result_pos", 0.1));
scope.add (null, result_param);
async_end_parameters.add (result_param);
Report.error (source_reference, "chain up to `GLib.Object' not supported");
return false;
}
- call.value_type = new ObjectType (context.analyzer.object_type);
+ call.value_type = new ObjectType (context.analyzer.object_type, source_reference);
mtype = call.value_type;
}
}
dynamic_sig.add_parameter (param.copy ());
}
}
- dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate (new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this));
+ dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate (new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this), source_reference);
}
if (m != null && m.has_type_parameters ()) {
if (m != null && m.coroutine) {
unowned MemberAccess ma = (MemberAccess) call;
if (ma.member_name == "end") {
- mtype = new MethodType (m.get_end_method ());
+ mtype = new MethodType (m.get_end_method (), source_reference);
}
}
}
public Delegate get_delegate (DataType sender_type, CodeNode node_reference) {
var actual_return_type = return_type.get_actual_type (sender_type, null, node_reference);
- var generated_delegate = new Delegate (null, actual_return_type);
+ var generated_delegate = new Delegate (null, actual_return_type, source_reference);
generated_delegate.access = SymbolAccessibility.PUBLIC;
generated_delegate.owner = scope;
public DelegateType get_handler_type () {
var type_sym = (ObjectTypeSymbol) signal_symbol.parent_symbol;
var sender_type = SemanticAnalyzer.get_data_type_for_symbol (type_sym);
- var result = new DelegateType (signal_symbol.get_delegate (sender_type, this));
+ var result = new DelegateType (signal_symbol.get_delegate (sender_type, this), source_reference);
result.value_owned = true;
if (result.delegate_symbol.has_type_parameters ()) {
foreach (var type_param in type_sym.get_type_parameters ()) {
- var type_arg = new GenericType (type_param);
+ var type_arg = new GenericType (type_param, source_reference);
type_arg.value_owned = true;
result.add_type_argument (type_arg);
}
unowned Method get_connect_method () {
if (connect_method == null) {
var ulong_type = CodeContext.get ().analyzer.ulong_type.copy ();
- connect_method = new Method ("connect", ulong_type);
+ connect_method = new Method ("connect", ulong_type, source_reference);
connect_method.access = SymbolAccessibility.PUBLIC;
connect_method.external = true;
connect_method.owner = signal_symbol.scope;
- connect_method.add_parameter (new Parameter ("handler", get_handler_type ()));
+ connect_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference));
}
return connect_method;
}
unowned Method get_connect_after_method () {
if (connect_after_method == null) {
var ulong_type = CodeContext.get ().analyzer.ulong_type.copy ();
- connect_after_method = new Method ("connect_after", ulong_type);
+ connect_after_method = new Method ("connect_after", ulong_type, source_reference);
connect_after_method.access = SymbolAccessibility.PUBLIC;
connect_after_method.external = true;
connect_after_method.owner = signal_symbol.scope;
- connect_after_method.add_parameter (new Parameter ("handler", get_handler_type ()));
+ connect_after_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference));
}
return connect_after_method;
}
unowned Method get_disconnect_method () {
if (disconnect_method == null) {
- disconnect_method = new Method ("disconnect", new VoidType ());
+ disconnect_method = new Method ("disconnect", new VoidType (), source_reference);
disconnect_method.access = SymbolAccessibility.PUBLIC;
disconnect_method.external = true;
disconnect_method.owner = signal_symbol.scope;
- disconnect_method.add_parameter (new Parameter ("handler", get_handler_type ()));
+ disconnect_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference));
}
return disconnect_method;
}
} else {
var slice_method = container.value_type.get_member ("slice") as Method;
if (slice_method != null) {
- var slice_call = new MethodCall (new MemberAccess (container, "slice"));
+ var slice_call = new MethodCall (new MemberAccess (container, "slice", source_reference), source_reference);
slice_call.add_argument (start);
slice_call.add_argument (stop);
slice_call.target_type = this.target_type;