Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.dynjs.runtime.linker.js;
 
 import static org.dynjs.runtime.linker.LinkerUtils.*;
 
 
    public JavascriptPrimitiveLinkStrategy(LinkLogger logger){ 
        super(ExecutionContext.classlogger);
    }
    
    @Override
    public StrategicLink linkGetProperty(StrategyChain chainObject receiverString propNameBinder binderBinder guardBinderthrows NoSuchMethodException,
            IllegalAccessException {
        //System.err.println("jsprimitive: link getprop: " + receiver + " // " + propName);
        // [ object(receiver), T(context), string(name) ]
        if (isJavascriptPrimitiveReference(receiver)) {
            MethodHandle handle = binder
                    .convertObject.classReference.classExecutionContext.classString.class )
                    .permute( 1, 0, 1, 2 )
                    .foldprimitiveReferenceBaseFolder() )
                    .drop( 1, 2 )
                    .convert(Object.classJSObject.classExecutionContext.classString.class)
                    .invokeVirtual(lookup(), "get");
            MethodHandle guard = javascriptPrimitiveReferenceGuard(guardBinder);
            return new StrategicLink(handleguard);
        }
        return chain.nextStrategy();
    }
    
    @Override
    public StrategicLink linkCall(StrategyChain chainObject receiverObject selfObject[] argsBinder binderBinder guardBinderthrows NoSuchMethodException,
            IllegalAccessException {
        
        //System.err.println("jsprimitive: link call: " + receiver.getClass() + " // " + receiver );
        
        
        // * [ object(receiver) ?(context) object(self) object[](args)
 
        if (isPrimitiveDereferencedReference(receiver) ) {
            /*
            MethodHandle handle = binder
                    .permute(1, 0, 2, 3)
                    .convert(Object.class, ExecutionContext.class, Reference.class, Object.class, Object[].class)
                    .invokeVirtual(lookup(), "call");
            MethodHandle guard = javascriptPrimitiveReferenceGuard(guardBinder);
            return new StrategicLink(handle, guard);
            */
            MethodHandle handle = binder
                    .drop(0)
                    .drop(1, binder.type().parameterCount() - 2)
                    .convert(Object.classExecutionContext.class)
                    .filter(0, createTypeErrorFilter())
                    .throwException();
            MethodHandle guard = getReceiverClassGuard(JSObject.classguardBinder);
            return new StrategicLink(handleguard);
        }
        return chain.nextStrategy();
    }
    
        return MethodHandles.lookup().findStatic(JavascriptObjectLinkStrategy.class"createTypeErrorFilter",
                MethodType.methodType(ThrowException.classExecutionContext.class));
    }
New to GrepCode? Check out our FAQ X