Skip to content

Commit

Permalink
Merge branch 'feature/refactor-javanative-stdlib-classes' into featur…
Browse files Browse the repository at this point in the history
…e/refactor
  • Loading branch information
stanhebben committed Oct 25, 2024
2 parents 92ea82d + e72c652 commit fc48652
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.openzen.zencode.shared.CodePosition;
import org.openzen.zenscript.codemodel.*;
import org.openzen.zenscript.codemodel.identifiers.MethodID;
import org.openzen.zenscript.codemodel.identifiers.instances.IteratorInstance;
import org.openzen.zenscript.codemodel.identifiers.instances.MethodInstance;
import org.openzen.zenscript.codemodel.statement.Statement;
import org.openzen.zenscript.codemodel.type.IteratorTypeID;
Expand Down Expand Up @@ -49,7 +50,13 @@ public String describe() {

@Override
public void registerTo(TypeID targetType, MemberSet.Builder members, GenericMapper mapper) {
TypeID[] instancedTypes = mapper.map(iteratorTypes);
IteratorTypeID iteratorTypeID = new IteratorTypeID(instancedTypes);
FunctionHeader header = new FunctionHeader(iteratorTypeID);

MethodInstance instance = new MethodInstance(this, header, targetType);
IteratorInstance iterator = new IteratorInstance(targetType, instancedTypes, instance);
members.iterator(iterator);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#dependency: stdlib
#output: 1
#output: thing

import stdlib.List;

var list = new List<string>();
list.add('thing');

println(list.length);
for item in list {
println(item);
}

0 comments on commit fc48652

Please sign in to comment.