Skip to content

Commit

Permalink
Array.set_at has been removed by #3634
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Sep 2, 2022
1 parent a50365a commit 352cf25
Showing 1 changed file with 0 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public enum PolyglotCallType {
* long)}.
*/
READ_ARRAY_ELEMENT,
/**
* The method call should be handled through {@link InteropLibrary#writeArrayElement(Object,
* long,Object)}.
*/
WRITE_ARRAY_ELEMENT,
/**
* The method call should be handled through {@link InteropLibrary#removeArrayElement(Object,
* long)}.
Expand Down Expand Up @@ -102,7 +97,6 @@ public boolean isInteropLibrary() {

private static final String ARRAY_LENGTH_NAME = "length";
private static final String ARRAY_READ_NAME = "at";
private static final String ARRAY_WRITE_NAME = "set";
private static final String ARRAY_REMOVE_NAME = "remove";
private static final String NEW_NAME = "new";

Expand Down Expand Up @@ -145,8 +139,6 @@ public static PolyglotCallType getPolyglotCallType(
return PolyglotCallType.GET_ARRAY_LENGTH;
} else if (library.hasArrayElements(self) && methodName.equals(ARRAY_READ_NAME)) {
return PolyglotCallType.READ_ARRAY_ELEMENT;
} else if (library.hasArrayElements(self) && methodName.equals(ARRAY_WRITE_NAME)) {
return PolyglotCallType.WRITE_ARRAY_ELEMENT;
} else if (library.hasArrayElements(self) && methodName.equals(ARRAY_REMOVE_NAME)) {
return PolyglotCallType.REMOVE_ARRAY_ELEMENT;
}
Expand Down Expand Up @@ -300,38 +292,6 @@ Object resolveHostArrayRead(
}
}

@Specialization(guards = {"callType == WRITE_ARRAY_ELEMENT"})
void resolveHostArrayWrite(
PolyglotCallType callType,
String symbol,
Object self,
Object[] args,
@CachedLibrary(limit = "LIB_LIMIT") InteropLibrary arrays,
@Cached BranchProfile arityErrorProfile,
@Cached BranchProfile typeErrorProfile,
@Cached HostValueToEnsoNode hostValueToEnsoNode) {
if (args.length != 2) {
arityErrorProfile.enter();
throw new PanicException(
Context.get(this).getBuiltins().error().makeArityError(2, 2, args.length), this);
}
if (!(args[0] instanceof Long)) {
typeErrorProfile.enter();
throw new PanicException(
Context.get(this).getBuiltins().error().makeInvalidArrayIndexError(self, args[0]), this);
}
long idx = (Long) args[0];
try {
arrays.writeArrayElement(self, idx, args[1]);
} catch (UnsupportedMessageException | UnsupportedTypeException e) {
CompilerDirectives.transferToInterpreter();
throw new IllegalStateException("Impossible to reach here, self is checked to be an array");
} catch (InvalidArrayIndexException e) {
throw new PanicException(
Context.get(this).getBuiltins().error().makeInvalidArrayIndexError(self, idx), this);
}
}

@Specialization(guards = {"callType == REMOVE_ARRAY_ELEMENT"})
void resolveHostArrayRemove(
PolyglotCallType callType,
Expand Down

0 comments on commit 352cf25

Please sign in to comment.