Created
October 31, 2010 23:14
-
-
Save diakopter/657302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Pops a value from a low level list (something that | |
/// uses the P6list representation). | |
/// </summary> | |
/// <param name="TC"></param> | |
/// <param name="LLList"></param> | |
/// <returns></returns> | |
public static RakudoObject lllist_pop(ThreadContext TC, RakudoObject LLList) | |
{ | |
if (LLList is P6list.Instance) | |
{ | |
List<RakudoObject> store = ((P6list.Instance)LLList).Storage; | |
int idx = store.Count - 1; | |
if (idx < 0) | |
{ | |
throw new ArgumentOutOfRangeException("The P6list was empty"); | |
} | |
RakudoObject item = store[idx]; | |
store.RemoveAt(idx); | |
return item; | |
} | |
else | |
{ | |
throw new Exception("Cannot use lllist_elems if representation is not P6list"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment