-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rebase dev onto refactor. #140
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
39e60dd
Update StdLibs
jaredlll08 3ffba08
Add natives for Set and HashSet
jaredlll08 bba34c4
Fix inner blocks using outer scope
jaredlll08 b4ff96d
Fix incorrect signature being generated for variants
jaredlll08 e1ac799
Fix variant and option access being incorrect
jaredlll08 7f07241
Write the source for extensions and variants
jaredlll08 a439d4f
Fix lambda interfaces not generating correct bytecode
jaredlll08 3c2b134
Fix function return types not working for non interface types
jaredlll08 78dc953
Add UUID.parse
jaredlll08 1831df2
Fix foreach variables not handling primitives correctly
jaredlll08 702305c
Fix enum in switch cases
jaredlll08 991f0d9
Fix Signature on Generic Expansion Methods #51
jaredlll08 44a5123
Fix inconsistency with getASMType
jaredlll08 5f9995f
Add tests for array creation
jaredlll08 b1c4b3b
Add missing tests
jaredlll08 f16fbf1
Fix wrong arrays sort
jaredlll08 8786316
Fixed broken ArrayCreationTests
stanhebben 989085f
Processed PR remarks
stanhebben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
43 changes: 43 additions & 0 deletions
43
...deCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/ArrayHelperType.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.openzen.zenscript.javabytecode.compiler; | ||
|
||
import org.objectweb.asm.Type; | ||
import org.openzen.zenscript.codemodel.type.ArrayTypeID; | ||
import org.openzen.zenscript.codemodel.type.GenericTypeID; | ||
import org.openzen.zenscript.codemodel.type.TypeID; | ||
import org.openzen.zenscript.javabytecode.JavaBytecodeContext; | ||
import org.openzen.zenscript.javashared.JavaClass; | ||
import org.openzen.zenscript.javashared.JavaNativeMethod; | ||
|
||
public class ArrayHelperType { | ||
|
||
private final TypeID elementType; | ||
private final JavaBytecodeContext context; | ||
|
||
public ArrayHelperType(TypeID elementType, JavaBytecodeContext context) { | ||
this.elementType = elementType; | ||
this.context = context; | ||
} | ||
|
||
|
||
public ArrayHelperType getWithOneDimensionLess() { | ||
ArrayTypeID arrayTypeID = ((ArrayTypeID) elementType); | ||
return new ArrayHelperType(arrayTypeID.removeOneDimension(), context); | ||
} | ||
|
||
public void newArray(JavaWriter javaWriter) { | ||
if(elementType instanceof GenericTypeID) { | ||
|
||
elementType.accept(javaWriter, new JavaTypeExpressionVisitor(context)); | ||
javaWriter.swap(); | ||
final JavaClass arrayClass = JavaClass.fromInternalName("java/lang/reflect/Array", JavaClass.Kind.CLASS); | ||
javaWriter.invokeStatic(JavaNativeMethod.getStatic(arrayClass, "newInstance", "(Ljava/lang/Class;I)Ljava/lang/Object;", 0)); | ||
javaWriter.checkCast("[Ljava/lang/Object;"); | ||
} else { | ||
javaWriter.newArray(context.getType(elementType)); | ||
} | ||
} | ||
|
||
public Type getASMElementType() { | ||
return context.getType(elementType); | ||
} | ||
} |
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
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
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
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
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
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
16 changes: 16 additions & 0 deletions
16
JavaIntegration/src/main/java/org/openzen/zencode/java/JavaNativeModuleBuilder.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.openzen.zencode.java; | ||
|
||
import org.openzen.zencode.java.module.JavaNativeModule; | ||
import org.openzen.zencode.java.module.JavaRuntimeClass; | ||
import org.openzen.zencode.shared.CompileException; | ||
import org.openzen.zenscript.codemodel.globals.IGlobal; | ||
|
||
public interface JavaNativeModuleBuilder { | ||
JavaNativeModuleBuilder addGlobals(Class<?> cls); | ||
|
||
JavaNativeModuleBuilder addGlobal(String name, IGlobal global); | ||
|
||
JavaNativeModuleBuilder addClass(Class<?> cls); | ||
|
||
JavaNativeModule complete() throws CompileException; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically what the ToDO said.
I'm not even sure if this is the proper place, it was part of one of these humongous switch-statements inside the JavaExpressionVisitors: b11c1ff
Maybe this can be removed, even?