Commit 48ca4e0f authored by Rico Tzschichholz's avatar Rico Tzschichholz

Add missing generic-type arguments of delegates

https://bugzilla.gnome.org/show_bug.cgi?id=772204
parent 3ddd1207
......@@ -123,7 +123,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
}
private ArrayList<GIRNamespace?> externals = new ArrayList<GIRNamespace?> ((EqualFunc) GIRNamespace.equal);
private ArrayList<GIRNamespace?> externals = new ArrayList<GIRNamespace?> ((EqualFunc<GIRNamespace>) GIRNamespace.equal);
public void write_includes() {
foreach (var i in externals) {
......
......@@ -32,18 +32,18 @@ public class Vala.ArrayList<G> : List<G> {
get { return _size; }
}
public EqualFunc equal_func {
public EqualFunc<G> equal_func {
set { _equal_func = value; }
}
private G[] _items = new G[4];
private int _size;
private EqualFunc _equal_func;
private EqualFunc<G> _equal_func;
// concurrent modification protection
private int _stamp = 0;
public ArrayList (EqualFunc equal_func = GLib.direct_equal) {
public ArrayList (EqualFunc<G> equal_func = GLib.direct_equal) {
this.equal_func = equal_func;
}
......
......@@ -32,15 +32,15 @@ public class Vala.HashMap<K,V> : Map<K,V> {
get { return _nnodes; }
}
public HashFunc key_hash_func {
public HashFunc<K> key_hash_func {
set { _key_hash_func = value; }
}
public EqualFunc key_equal_func {
public EqualFunc<K> key_equal_func {
set { _key_equal_func = value; }
}
public EqualFunc value_equal_func {
public EqualFunc<V> value_equal_func {
set { _value_equal_func = value; }
}
......@@ -51,14 +51,14 @@ public class Vala.HashMap<K,V> : Map<K,V> {
// concurrent modification protection
private int _stamp = 0;
private HashFunc _key_hash_func;
private EqualFunc _key_equal_func;
private EqualFunc _value_equal_func;
private HashFunc<K> _key_hash_func;
private EqualFunc<K> _key_equal_func;
private EqualFunc<V> _value_equal_func;
private const int MIN_SIZE = 11;
private const int MAX_SIZE = 13845163;
public HashMap (HashFunc key_hash_func = GLib.direct_hash, EqualFunc key_equal_func = GLib.direct_equal, EqualFunc value_equal_func = GLib.direct_equal) {
public HashMap (HashFunc<K> key_hash_func = GLib.direct_hash, EqualFunc<K> key_equal_func = GLib.direct_equal, EqualFunc<V> value_equal_func = GLib.direct_equal) {
this.key_hash_func = key_hash_func;
this.key_equal_func = key_equal_func;
this.value_equal_func = value_equal_func;
......
......@@ -32,11 +32,11 @@ public class Vala.HashSet<G> : Set<G> {
get { return _nnodes; }
}
public HashFunc hash_func {
public HashFunc<G> hash_func {
set { _hash_func = value; }
}
public EqualFunc equal_func {
public EqualFunc<G> equal_func {
set { _equal_func = value; }
}
......@@ -47,13 +47,13 @@ public class Vala.HashSet<G> : Set<G> {
// concurrent modification protection
private int _stamp = 0;
private HashFunc _hash_func;
private EqualFunc _equal_func;
private HashFunc<G> _hash_func;
private EqualFunc<G> _equal_func;
private const int MIN_SIZE = 11;
private const int MAX_SIZE = 13845163;
public HashSet (HashFunc hash_func = GLib.direct_hash, EqualFunc equal_func = GLib.direct_equal) {
public HashSet (HashFunc<G> hash_func = GLib.direct_hash, EqualFunc<G> equal_func = GLib.direct_equal) {
this.hash_func = hash_func;
this.equal_func = equal_func;
_array_size = MIN_SIZE;
......
......@@ -1651,10 +1651,10 @@ public class Vala.CodeWriter : CodeVisitor {
if (key == "cheader_filename" && sym is Namespace) {
continue;
}
keys.insert_sorted (key, (CompareDataFunc) strcmp);
keys.insert_sorted (key, (CompareDataFunc<string>) strcmp);
}
if (need_cheaders && attr.name == "CCode" && !attr.has_argument ("cheader_filename")) {
keys.insert_sorted ("cheader_filename", (CompareDataFunc) strcmp);
keys.insert_sorted ("cheader_filename", (CompareDataFunc<string>) strcmp);
}
if (attr.name == "CCode" && keys.get_length () == 0) {
......
......@@ -3949,8 +3949,7 @@ public class Vala.GirParser : CodeVisitor {
/* Hash and equal functions */
static uint unresolved_symbol_hash (void *ptr) {
var sym = (UnresolvedSymbol) ptr;
static uint unresolved_symbol_hash (UnresolvedSymbol? sym) {
var builder = new StringBuilder ();
while (sym != null) {
builder.append (sym.name);
......@@ -3959,9 +3958,7 @@ public class Vala.GirParser : CodeVisitor {
return builder.str.hash ();
}
static bool unresolved_symbol_equal (void *ptr1, void *ptr2) {
var sym1 = (UnresolvedSymbol) ptr1;
var sym2 = (UnresolvedSymbol) ptr2;
static bool unresolved_symbol_equal (UnresolvedSymbol? sym1, UnresolvedSymbol? sym2) {
while (sym1 != sym2) {
if (sym1 == null || sym2 == null) {
return false;
......
......@@ -3140,7 +3140,7 @@ namespace GLib {
public TokenValue cur_value ();
public uint set_scope (uint scope_id);
public void scope_add_symbol (uint scope_id, string symbol, void* value);
public void scope_foreach_symbol (uint scope_id, HFunc func);
public void scope_foreach_symbol (uint scope_id, HFunc<string, void*> func);
public void* scope_lookup_symbol (uint scope_id, string symbol);
public void scope_remove_symbol (uint scope_id, string symbol);
public void* lookup_symbol (string symbol);
......@@ -5086,7 +5086,7 @@ namespace GLib {
public Datalist ();
public void clear ();
[Version (since = "2.34")]
public G id_dup_data (Quark key_id, DuplicateFunc dup_func);
public G id_dup_data (Quark key_id, DuplicateFunc<G> dup_func);
public unowned G id_get_data (Quark key_id);
public void id_set_data (Quark key_id, owned G data);
public void id_set_data_full (Quark key_id, owned G data, DestroyNotify? destroy_func);
......@@ -5094,7 +5094,7 @@ namespace GLib {
public G id_remove_no_notify (Quark key_id);
[Version (since = "2.34")]
public bool id_replace_data (Quark key_id, G oldval, owned G newval, GLib.DestroyNotify? destroy, out GLib.DestroyNotify? old_destroy);
public void @foreach (DataForeachFunc func);
public void @foreach (DataForeachFunc<G> func);
public unowned G get_data (string key);
public void set_data_full (string key, owned G data, DestroyNotify? destry_func);
public G remove_no_notify (string key);
......
......@@ -383,8 +383,8 @@ namespace GLib {
public void insert (uint index_, GLib.Value value);
public void prepend (GLib.Value value);
public void remove (uint index_);
public void sort (GLib.CompareFunc compare_func);
public void sort_with_data (GLib.CompareDataFunc compare_func);
public void sort (GLib.CompareFunc<GLib.Value> compare_func);
public void sort_with_data (GLib.CompareDataFunc<GLib.Value> compare_func);
}
public interface TypePlugin {
}
......
......@@ -105,7 +105,7 @@ public class Vala.GIdlParser : CodeVisitor {
current_source_file = source_file;
codenode_attributes_map = new HashMap<string,string> (str_hash, str_equal);
codenode_attributes_patterns = new HashMap<PatternSpec*,string> (direct_hash, (EqualFunc) PatternSpec.equal);
codenode_attributes_patterns = new HashMap<PatternSpec*,string> (direct_hash, (EqualFunc<PatternSpec>) PatternSpec.equal);
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
......
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