/** * Called by the {@link AClassType} node from {@link AClassType#apply(IPOFAnalysis)}. * @param node the calling {@link AClassType} node */ public void caseAClassType(AClassType node) throws AnalysisException { _visitedNodes.add(node); inAClassType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getName() != null ) { node.getName().apply(this); } if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) { node.getClassdef().apply(this); } outAClassType(node); }
@Override public String kind() { return type.toString(); }
public static AClassType newAClassType(ILexLocation location, SClassDefinition classdef) { AClassType result = new AClassType(); initType(result, location); result.setClassdef(classdef); result.setName(classdef.getName().clone()); return result; }
/** * Returns a deep clone of this {@link AClassType} node. * @return a deep clone of this {@link AClassType} node */ public AClassType clone() { return new AClassType( _location, _resolved, _definitions, cloneNode(_name), _classdef ); }
|| !ctor.getName().getModule().equals(instance.type.getName().getLocation().getModule()) && ctor.getParamDefinitions().isEmpty() || !ClassInterpreter.getInstance().getAssistantFactory().createPAccessSpecifierAssistant().isPublic(ctor.getAccess())) for (PDefinition def : Interpreter.getInstance().initialContext.assistantFactory.createPDefinitionAssistant().getDefinitions(instance.type.getClassdef())) + instance.type.getName().getName());
/** * Sets the creator of this object value and adds this to the newCreator parsed as argument * * @param newCreator * The creator of this object value */ private synchronized void setCreator(ObjectValue newCreator) { // Do not set the creator if created by the system class. The System contains // fields with references to Thread instances which are not Serializable and // will fail a deep copy with a NotSerializableExpection for Thread if (newCreator != null && newCreator.type.getClassdef() instanceof ASystemClassDefinition) { return; } // establish transitive reference newCreator.addChild(this); }
@Override public SExpIR caseAIsOfClassExp(AIsOfClassExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); AClassType classType = node.getClassType(); PExp objRef = node.getExp(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); STypeIR classTypeCg = classType.apply(question.getTypeVisitor(), question); if (!(classTypeCg instanceof AClassTypeIR)) { log.error("Unexpected class type encountered for " + AIsOfClassExp.class.getName() + ". Expected class type: " + AClassTypeIR.class.getName() + ". Got: " + typeCg.getClass().getName() + " at " + node.getLocation()); } SExpIR objRefCg = objRef.apply(question.getExpVisitor(), question); AIsOfClassExpIR instanceOfExp = new AIsOfClassExpIR(); instanceOfExp.setType(typeCg); instanceOfExp.setCheckedType(classTypeCg); instanceOfExp.setExp(objRefCg); return instanceOfExp; }
@Override public void caseAClassType(AClassType type) throws AnalysisException { if (type.getResolved()) { type.setResolved(false); for (PDefinition d : type.getClassdef().getDefinitions()) { // PTypeAssistantTC.unResolve(af.createPDefinitionAssistant().getType(d)); af.createPTypeAssistant().unResolve(af.createPDefinitionAssistant().getType(d)); } } }
classString = classString + "_" + found.getName().getName(); // eg. "*union_A_B" count++; for (PDefinition f : af.createPDefinitionAssistant().getDefinitions(ct.getClassdef()))
public boolean hasDelegate(Context ctxt) { if (ctxt.assistantFactory.createSClassDefinitionAssistant().hasDelegate(type.getClassdef())) { if (delegateObject == null) { delegateObject = ctxt.assistantFactory.createSClassDefinitionAssistant().newInstance(type.getClassdef()); } return true; } return false; }
@Override public Integer caseAClassType(AClassType type) throws AnalysisException { return type.getName().apply(THIS); }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public void caseAIsOfClassExp(AIsOfClassExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAIsOfClassExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getClassName() != null ) { node.getClassName().apply(this, question); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { node.getClassType().apply(this, question); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this, question); } outAIsOfClassExp(node, question); }
throws AnalysisException if (type.getResolved()) type.setResolved(true); Environment self = new PrivateClassEnvironment(question.question.assistantFactory, type.getClassdef(), question.question.env); for (PDefinition d : type.getClassdef().getDefinitions())
/** * Creates a deep clone of this {@link AClassType} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link AClassType} node */ public AClassType clone(Map<INode,INode> oldToNewMap) { AClassType node = new AClassType( _location, _resolved, _definitions, cloneNode(_name, oldToNewMap), _classdef ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AClassType} node from {@link AClassType#apply(IAnalysis)}. * @param node the calling {@link AClassType} node */ public void caseAClassType(AClassType node) throws AnalysisException { _visitedNodes.add(node); inAClassType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getName() != null ) { node.getName().apply(this); } if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) { node.getClassdef().apply(this); } outAClassType(node); }
: breakContext.guardOp.name.getName(); for (PDefinition d : octxt.self.type.getClassdef().getDefinitions()) LexNameToken name = new LexNameToken(octxt.self.type.getName().getModule(), hexp.toString(), hexp.getLocation()); vars.put(name, v); } catch (Throwable e) LexNameToken name = new LexNameToken(octxt.self.type.getName().getModule(), hexp.toString(), mdef.getLocation()); vars.put(name, v); } catch (Throwable e)
public PDefinition findName(AClassType cls, ILexNameToken tag, NameScope scope) { return af.createPDefinitionAssistant().findName(cls.getClassdef(), tag, scope); }
public boolean isOfClass(ObjectValue obj, String name) { if (obj.type.getName().getName().equals(name)) { return true; } else { for (ObjectValue objval : obj.superobjects) { if (isOfClass(objval, name)) { return true; } } } return false; } }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public void caseAIsOfClassExp(AIsOfClassExp node) throws AnalysisException { _visitedNodes.add(node); inAIsOfClassExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getClassName() != null ) { node.getClassName().apply(this); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { node.getClassType().apply(this); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outAIsOfClassExp(node); }