-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/refactor data flow analyses broken arrays map 2 (#138)
* Attempt to fix arrays/arrays-maps-2 * Switch order of stuff * Actually fix the thing * Cleanup JavaWriter Constants * Fix methodDescriptor for generic expansion methods in generic expansions * Add Test for accessing nested classes --------- Co-authored-by: Witixin1512 <[email protected]> Co-authored-by: Silk <[email protected]> Co-authored-by: kindlich <[email protected]>
- Loading branch information
1 parent
f9dafe8
commit 17d8d35
Showing
19 changed files
with
466 additions
and
156 deletions.
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
59 changes: 59 additions & 0 deletions
59
...in/java/org/openzen/zenscript/codemodel/compilation/impl/capture/LocalThisExpression.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,59 @@ | ||
package org.openzen.zenscript.codemodel.compilation.impl.capture; | ||
|
||
import org.openzen.zencode.shared.CodePosition; | ||
import org.openzen.zenscript.codemodel.FunctionParameter; | ||
import org.openzen.zenscript.codemodel.compilation.CompilingExpression; | ||
import org.openzen.zenscript.codemodel.compilation.ExpressionCompiler; | ||
import org.openzen.zenscript.codemodel.compilation.expression.AbstractCompilingExpression; | ||
import org.openzen.zenscript.codemodel.expression.*; | ||
import org.openzen.zenscript.codemodel.ssa.CodeBlockStatement; | ||
import org.openzen.zenscript.codemodel.ssa.SSAVariableCollector; | ||
import org.openzen.zenscript.codemodel.type.TypeID; | ||
|
||
public class LocalThisExpression implements LocalExpression { | ||
private final CodePosition position; | ||
private final TypeID type; | ||
|
||
public LocalThisExpression(CodePosition position, TypeID type) { | ||
this.position = position; | ||
this.type = type; | ||
} | ||
|
||
@Override | ||
public LocalExpression capture(LambdaClosure closure) { | ||
CapturedExpression value = new CapturedThisExpression(position, type, closure); | ||
closure.add(value); | ||
return new LocalCapturedExpression(value); | ||
} | ||
|
||
@Override | ||
public CompilingExpression compile(ExpressionCompiler compiler) { | ||
return new Compiling(compiler, position, type); | ||
} | ||
|
||
private static class Compiling extends AbstractCompilingExpression { | ||
private final TypeID type; | ||
|
||
public Compiling(ExpressionCompiler compiler, CodePosition position, TypeID type) { | ||
super(compiler, position); | ||
|
||
this.type = type; | ||
} | ||
|
||
@Override | ||
public Expression eval() { | ||
return compiler.at(position).getThis(type); | ||
} | ||
|
||
@Override | ||
public CompilingExpression assign(CompilingExpression value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public void collect(SSAVariableCollector collector) {} | ||
|
||
@Override | ||
public void linkVariables(CodeBlockStatement.VariableLinker linker) {} | ||
} | ||
} |
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
Oops, something went wrong.