Search in sources :

Example 11 with AbsoluteReference

use of st.gravel.support.compiler.ast.AbsoluteReference in project gravel by gravel-st.

the class MethodLinker method globalWriteBootstrap.

public static CallSite globalWriteBootstrap(Lookup lookup, String selector, MethodType type, String namespaceString) throws Throwable {
    AbsoluteReference namespace = (AbsoluteReference) Reference.factory.value_(namespaceString);
    AbsoluteReference fullReference = namespace.$slash$(Symbol.value(selector));
    final AlmostFinalValue singletonHolder = ImageBootstrapper.systemMapping.resolveSingletonHolder_(fullReference);
    final MethodHandle target = lookup.findVirtual(AlmostFinalValue.class, "setValue", MethodType.methodType(Object.class, Object.class)).bindTo(singletonHolder);
    return new ConstantCallSite(target);
}
Also used : AbsoluteReference(st.gravel.support.compiler.ast.AbsoluteReference) ConstantCallSite(java.lang.invoke.ConstantCallSite) MethodHandle(java.lang.invoke.MethodHandle)

Example 12 with AbsoluteReference

use of st.gravel.support.compiler.ast.AbsoluteReference in project gravel by gravel-st.

the class MetaclassNode method superclassReferenceForMethodLookup.

@Override
public Reference superclassReferenceForMethodLookup() {
    final Reference _csr;
    _csr = _classNode.superclassReference();
    if (_csr == null) {
        return AbsoluteReference.factory.path_(new st.gravel.core.Symbol[] { st.gravel.core.Symbol.value("st"), st.gravel.core.Symbol.value("gravel"), st.gravel.core.Symbol.value("lang"), st.gravel.core.Symbol.value("Class") });
    }
    return ClassReference.factory.reference_(((AbsoluteReference) _csr));
}
Also used : Reference(st.gravel.support.compiler.ast.Reference) AbsoluteReference(st.gravel.support.compiler.ast.AbsoluteReference) ClassReference(st.gravel.support.compiler.ast.ClassReference) AbsoluteReference(st.gravel.support.compiler.ast.AbsoluteReference)

Aggregations

AbsoluteReference (st.gravel.support.compiler.ast.AbsoluteReference)12 SharedDeclarationNode (st.gravel.support.compiler.ast.SharedDeclarationNode)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 Reference (st.gravel.support.compiler.ast.Reference)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ConstantCallSite (java.lang.invoke.ConstantCallSite)2 ClassReference (st.gravel.support.compiler.ast.ClassReference)2 NamespaceNode (st.gravel.support.compiler.ast.NamespaceNode)2 MethodHandle (java.lang.invoke.MethodHandle)1 HashSet (java.util.HashSet)1 AbstractClassMapping (st.gravel.support.compiler.ast.AbstractClassMapping)1 ClassDescriptionNode (st.gravel.support.compiler.ast.ClassDescriptionNode)1 ClassMapping (st.gravel.support.compiler.ast.ClassMapping)1 ClassNode (st.gravel.support.compiler.ast.ClassNode)1