-
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.
Merge pull request #166 from ZenCodeLang/feature/refactor-changes-in-…
…tests-2 Feature/refactor changes in tests 2
- Loading branch information
Showing
326 changed files
with
2,226 additions
and
1,925 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
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
49 changes: 49 additions & 0 deletions
49
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/InterfaceCaster.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,49 @@ | ||
package org.openzen.zenscript.codemodel.member; | ||
|
||
import org.openzen.zenscript.codemodel.FunctionHeader; | ||
import org.openzen.zenscript.codemodel.GenericMapper; | ||
import org.openzen.zenscript.codemodel.Modifiers; | ||
import org.openzen.zenscript.codemodel.compilation.AnyMethod; | ||
import org.openzen.zenscript.codemodel.compilation.ExpressionBuilder; | ||
import org.openzen.zenscript.codemodel.compilation.InstanceCallableMethod; | ||
import org.openzen.zenscript.codemodel.expression.CallArguments; | ||
import org.openzen.zenscript.codemodel.expression.Expression; | ||
import org.openzen.zenscript.codemodel.identifiers.instances.MethodInstance; | ||
import org.openzen.zenscript.codemodel.member.ref.ImplementationMemberInstance; | ||
|
||
import java.util.Optional; | ||
|
||
public class InterfaceCaster implements InstanceCallableMethod { | ||
private final FunctionHeader header; | ||
private final ImplementationMemberInstance implementationInstance; | ||
|
||
public InterfaceCaster(FunctionHeader header, ImplementationMemberInstance implementationInstance) { | ||
this.header = header; | ||
this.implementationInstance = implementationInstance; | ||
} | ||
|
||
@Override | ||
public FunctionHeader getHeader() { | ||
return header; | ||
} | ||
|
||
@Override | ||
public Optional<MethodInstance> asMethod() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public AnyMethod withGenericArguments(GenericMapper mapper) { | ||
return new InterfaceCaster(header.withGenericArguments(mapper), implementationInstance); | ||
} | ||
|
||
@Override | ||
public Modifiers getModifiers() { | ||
return Modifiers.IMPLICIT; | ||
} | ||
|
||
@Override | ||
public Expression call(ExpressionBuilder builder, Expression instance, CallArguments arguments) { | ||
return builder.interfaceCast(implementationInstance, instance); | ||
} | ||
} |
52 changes: 1 addition & 51 deletions
52
...rc/main/java/org/openzen/zenscript/codemodel/member/ref/ImplementationMemberInstance.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 |
---|---|---|
@@ -1,61 +1,11 @@ | ||
package org.openzen.zenscript.codemodel.member.ref; | ||
|
||
import org.openzen.zencode.shared.CodePosition; | ||
import org.openzen.zencode.shared.Tag; | ||
import org.openzen.zenscript.codemodel.FunctionHeader; | ||
import org.openzen.zenscript.codemodel.annotations.MemberAnnotation; | ||
import org.openzen.zenscript.codemodel.member.IDefinitionMember; | ||
import org.openzen.zenscript.codemodel.member.ImplementationMember; | ||
import org.openzen.zenscript.codemodel.type.TypeID; | ||
|
||
public class ImplementationMemberInstance { | ||
public final ImplementationMember member; | ||
public final TypeID implementsType; | ||
private final TypeID type; | ||
|
||
public ImplementationMemberInstance(ImplementationMember member, TypeID owner, TypeID implementsType) { | ||
this.member = member; | ||
this.type = owner; | ||
public ImplementationMemberInstance(TypeID implementsType) { | ||
this.implementsType = implementsType; | ||
} | ||
|
||
/* @Override | ||
public CodePosition getPosition() { | ||
return member.position; | ||
} | ||
@Override | ||
public TypeID getOwnerType() { | ||
return type; | ||
} | ||
@Override | ||
public String describe() { | ||
return member.describe(); | ||
} | ||
@Override | ||
public <T extends Tag> T getTag(Class<T> type) { | ||
return member.getTag(type); | ||
} | ||
@Override | ||
public DefinitionMemberRef getOverrides() { | ||
return null; | ||
} | ||
@Override | ||
public FunctionHeader getHeader() { | ||
return null; | ||
} | ||
@Override | ||
public MemberAnnotation[] getAnnotations() { | ||
return member.annotations; | ||
} | ||
@Override | ||
public IDefinitionMember getTarget() { | ||
return member; | ||
}*/ | ||
} |
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.