vala: remove the as_glib_list helper function.
authorSimon Tatham <anakin@pobox.com>
Sun, 12 May 2019 08:17:34 +0000 (09:17 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 13 May 2019 14:40:47 +0000 (15:40 +0100)
It turned out I only ever called in one place, and I'm about to change
that call site to do things differently anyway.

vala/core.vala
vala/types.vala

index 1657a07..46317ea 100644 (file)
@@ -756,7 +756,9 @@ class Mal.BuiltinFunctionApply : Mal.BuiltinFunction {
         if (list == null)
             throw new Mal.Error.BAD_PARAMS(
                 "%s: expected final argument to be a list", name());
-        var fnargs = list.as_glib_list();
+        var fnargs = new GLib.List<Mal.Val>();
+        for (var iter = list.iter(); iter.nonempty(); iter.step())
+            fnargs.append(iter.deref());
         for (unowned GLib.List<Mal.Val> link = lastlink.prev;
              link != args.vs; link = link.prev)
             fnargs.prepend(link.data);
index 33abc23..b437a59 100644 (file)
@@ -38,12 +38,6 @@ class Mal.Bool : Mal.Hashable {
 // make that easy, Mal.Nil also derives from Mal.Listlike.
 abstract class Mal.Listlike : Mal.ValWithMetadata {
     public abstract Mal.Iterator iter();
-    public GLib.List<Mal.Val> as_glib_list() {
-        var newlist = new GLib.List<Mal.Val>();
-        for (var it = iter(); it.nonempty(); it.step())
-            newlist.append(it.deref());
-        return newlist;
-    }
 }
 
 abstract class Mal.Iterator : GLib.Object {