2007-02-02 17:25:09 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
|
|
* 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 com.ibm.wala.cast.js.ssa;
|
|
|
|
|
2007-02-09 15:34:25 +00:00
|
|
|
import java.util.Collection;
|
|
|
|
|
2007-02-02 17:25:09 +00:00
|
|
|
import com.ibm.wala.ssa.SSAAbstractUnaryInstruction;
|
|
|
|
import com.ibm.wala.ssa.SSAInstruction;
|
2009-04-10 18:33:07 +00:00
|
|
|
import com.ibm.wala.ssa.SSAInstructionFactory;
|
2007-02-02 17:25:09 +00:00
|
|
|
import com.ibm.wala.ssa.SymbolTable;
|
2007-02-09 15:34:25 +00:00
|
|
|
import com.ibm.wala.types.TypeReference;
|
2007-02-02 17:25:09 +00:00
|
|
|
|
|
|
|
public class JavaScriptTypeOfInstruction extends SSAAbstractUnaryInstruction {
|
|
|
|
|
|
|
|
public JavaScriptTypeOfInstruction(int lval, int object) {
|
|
|
|
super(lval, object);
|
|
|
|
}
|
|
|
|
|
2009-04-10 18:33:07 +00:00
|
|
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
|
|
|
return ((JSInstructionFactory)insts).TypeOfInstruction((defs != null ? defs[0] : getDef(0)), (uses != null ? uses[0] : getUse(0)));
|
2007-02-02 17:25:09 +00:00
|
|
|
}
|
|
|
|
|
2008-01-15 14:40:23 +00:00
|
|
|
public String toString(SymbolTable symbolTable) {
|
|
|
|
return getValueString(symbolTable, getDef(0)) + " = typeof(" + getValueString(symbolTable, getUse(0)) + ")";
|
2007-02-02 17:25:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void visit(IVisitor v) {
|
2012-03-01 02:45:51 +00:00
|
|
|
((JSInstructionVisitor) v).visitTypeOf(this);
|
2007-02-02 17:25:09 +00:00
|
|
|
}
|
|
|
|
|
2007-02-09 15:34:25 +00:00
|
|
|
public Collection<TypeReference> getExceptionTypes() {
|
2007-02-02 17:25:09 +00:00
|
|
|
return Util.noExceptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|