org.fulib.scenarios.ast.scope.Scope Maven / Gradle / Ivy
package org.fulib.scenarios.ast.scope;
import org.fulib.scenarios.ast.decl.Decl;
import org.fulib.scenarios.diagnostic.Marker;
import java.util.function.BiConsumer;
import java.util.function.Function;
public interface Scope
{
Decl resolve(String name);
void list(BiConsumer super String, ? super Decl> consumer);
default T resolve(String name, Class type, Function super String, ? extends T> create)
{
final Decl own = this.resolve(name);
if (type.isInstance(own))
{
return (T) own;
}
throw new UnsupportedOperationException("create");
}
void report(Marker marker);
}