blob: 7561f0cdf182242c333508fbca91c9fac04af1c8 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.languages.javascript.rhino.jsdi;
import java.util.Map;
import org.eclipse.e4.languages.javascript.jsdi.FunctionReference;
import org.eclipse.e4.languages.javascript.jsdi.ObjectReference;
/**
* Rhino object value implementation
*
* @since 1.0
*/
public class ObjectReferenceImpl extends PropertiesReferenceImpl implements ObjectReference {
private final String className;
private final Number constructorRef;
private final Number prototypeRef;
public ObjectReferenceImpl(VirtualMachineImpl vm, Map body, StackFrameImpl frame) {
super(vm, body, frame);
this.className = (String) body.get("className");
this.constructorRef = (Number) ((Map) body.get("constructorFunction")).get("ref");
this.prototypeRef = (Number) ((Map) body.get("prototypeObject")).get("ref");
}
public String className() {
return this.className;
}
public FunctionReference constructor() {
return (FunctionReference) frame.lookupValue(constructorRef);
}
public ObjectReference prototype() {
return (ObjectReference) frame.lookupValue(prototypeRef);
}
public String getValueTypeName() {
return "object";
}
}