mirror of
https://github.com/enso-org/enso.git
synced 2024-11-25 02:35:04 +03:00
update: TypeOfNode
This commit is contained in:
parent
386f4028b1
commit
86bfb986d1
@ -15,7 +15,6 @@ import org.enso.interpreter.instrument.profiling.ExecutionTime;
|
||||
import org.enso.interpreter.instrument.profiling.ProfilingInfo;
|
||||
import org.enso.interpreter.node.callable.FunctionCallInstrumentationNode;
|
||||
import org.enso.interpreter.runtime.callable.UnresolvedSymbol;
|
||||
import org.enso.interpreter.runtime.data.EnsoMultiValue;
|
||||
import org.enso.interpreter.runtime.data.Type;
|
||||
import org.enso.interpreter.runtime.library.dispatch.TypeOfNode;
|
||||
import org.enso.interpreter.runtime.type.Constants;
|
||||
@ -220,22 +219,18 @@ final class ExecutionCallbacks implements IdExecutionService.Callbacks {
|
||||
return new String[] {Constants.UNRESOLVED_SYMBOL};
|
||||
}
|
||||
|
||||
if (value instanceof EnsoMultiValue multiValue) {
|
||||
var valueTypes = multiValue.allTypes();
|
||||
var resultTypes = new String[valueTypes.length];
|
||||
|
||||
for (int i = 0; i < valueTypes.length; i++) {
|
||||
resultTypes[i] = getTypeQualifiedName(valueTypes[i]);
|
||||
}
|
||||
|
||||
return resultTypes;
|
||||
}
|
||||
|
||||
var typeOfNode = TypeOfNode.getUncached();
|
||||
Object typeResult = value == null ? null : typeOfNode.execute(value);
|
||||
if (typeResult instanceof Type t) {
|
||||
return new String[] {getTypeQualifiedName(t)};
|
||||
}
|
||||
if (typeResult instanceof Type[] types) {
|
||||
var result = new String[types.length];
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
result[i] = getTypeQualifiedName(types[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -75,6 +75,11 @@ public abstract class TypeOfNode extends Node {
|
||||
return withoutWarning.execute(value.getValue());
|
||||
}
|
||||
|
||||
@Specialization
|
||||
Object doEnsoMultiValue(EnsoMultiValue value) {
|
||||
return value.allTypes();
|
||||
}
|
||||
|
||||
static boolean isWithType(Object value, TypesLibrary types, InteropLibrary iop) {
|
||||
if (value instanceof EnsoMultiValue) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user