Fix stdlib drop and add bytecode return/break test

This commit is contained in:
sergeych committed 2026-01-28 08:54:54 +03:00
1 parent 8dfdbaa0a0
commit 7b3d92beb9
2 files changed
+33 -1

No files matched your search

+5 -1
View File
@@ -65,7 +65,11 @@ fun Iterable.filterNotNull(): List {
/* Skip the first N elements of this iterable. */
fun Iterable.drop(n) {
var cnt = 0
filter { cnt++ >= n }
val result = []
for( item in this ) {
if( cnt++ >= n ) result.add(item)
}
result
}
/* Return the first element or throw if the iterable is empty. */