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;
|
|
|
|
|
2009-04-09 20:31:14 +00:00
|
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
import com.ibm.wala.cast.ir.ssa.AbstractReflectivePut;
|
|
|
|
import com.ibm.wala.ssa.SSAInstruction;
|
2009-04-10 18:33:07 +00:00
|
|
|
import com.ibm.wala.ssa.SSAInstructionFactory;
|
2009-04-09 20:31:14 +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 JavaScriptPropertyWrite extends AbstractReflectivePut {
|
2008-01-15 14:40:23 +00:00
|
|
|
|
2007-02-02 17:25:09 +00:00
|
|
|
public JavaScriptPropertyWrite(int objectRef, int memberRef, int value) {
|
|
|
|
super(objectRef, memberRef, value);
|
|
|
|
}
|
|
|
|
|
2009-04-10 18:33:07 +00:00
|
|
|
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {
|
|
|
|
return ((JSInstructionFactory)insts).PropertyWrite(uses == null ? getObjectRef() : uses[0], uses == null ? getMemberRef() : uses[1],
|
2008-01-15 14:40:23 +00:00
|
|
|
uses == null ? getValue() : uses[2]);
|
2007-02-02 17:25:09 +00:00
|
|
|
}
|
|
|
|
|
2008-01-15 14:40:23 +00:00
|
|
|
public String toString(SymbolTable symbolTable) {
|
|
|
|
return super.toString(symbolTable) + " = " + getValueString(symbolTable, getValue());
|
2007-02-02 17:25:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see com.ibm.domo.ssa.Instruction#visit(Visitor)
|
|
|
|
*/
|
|
|
|
public void visit(IVisitor v) {
|
2009-04-30 13:16:52 +00:00
|
|
|
assert v instanceof InstructionVisitor;
|
2008-01-15 14:40:23 +00:00
|
|
|
((InstructionVisitor) v).visitJavaScriptPropertyWrite(this);
|
2007-02-02 17:25:09 +00:00
|
|
|
}
|
|
|
|
|
2008-01-15 14:40:23 +00:00
|
|
|
/*
|
|
|
|
* (non-Javadoc)
|
2007-02-02 17:25:09 +00:00
|
|
|
* @see com.ibm.domo.ssa.Instruction#isPEI()
|
|
|
|
*/
|
|
|
|
public boolean isPEI() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-01-15 14:40:23 +00:00
|
|
|
/*
|
|
|
|
* (non-Javadoc)
|
2007-02-02 17:25:09 +00:00
|
|
|
* @see com.ibm.domo.ssa.Instruction#getExceptionTypes()
|
|
|
|
*/
|
2007-02-09 15:34:25 +00:00
|
|
|
public Collection<TypeReference> getExceptionTypes() {
|
2007-02-02 17:25:09 +00:00
|
|
|
return Util.typeErrorExceptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|