@Override public List<PDefinition> caseAThreadDefinition(AThreadDefinition node) throws AnalysisException { List<PDefinition> result = new Vector<PDefinition>(); result.add(node.getOperationDef()); return result; }
public AExplicitOperationDefinition getThreadDefinition(AThreadDefinition d) { AOperationType type = AstFactory.newAOperationType(d.getLocation()); // () ==> () AExplicitOperationDefinition def = AstFactory.newAExplicitOperationDefinition(d.getOperationName(), type, new Vector<PPattern>(), null, null, d.getStatement().clone()); def.setAccess(d.getAccess().clone()); def.setClassDefinition(d.getClassDefinition()); return def; }
/** * Creates a new complete constructor {@code AThreadDefinition} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param statement_ the {@link PStm} node for the {@code statement} child of this {@link AThreadDefinition} node * @param operationName_ the {@link ILexNameToken} node for the {@code operationName} child of this {@link AThreadDefinition} node * @param operationDef_ the {@link AExplicitOperationDefinition} node for the {@code operationDef} child of this {@link AThreadDefinition} node */ public AThreadDefinition(ILexLocation location_, ILexNameToken name_, NameScope nameScope_, Boolean used_, SClassDefinition classDefinition_, AAccessSpecifierAccessSpecifier access_, PType type_, Pass pass_, PStm statement_, ILexNameToken operationName_, AExplicitOperationDefinition operationDef_) { super(location_,name_,nameScope_,used_,classDefinition_,access_,type_,pass_); this.setStatement(statement_); this.setOperationName(operationName_); this.setOperationDef(operationDef_); }
if(node.getName() != null ) node.getName().apply(this, question); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) node.getClassDefinition().apply(this, question); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) node.getAccess().apply(this, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this, question); if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) node.getStatement().apply(this, question); if(node.getOperationName() != null ) node.getOperationName().apply(this, question); if(node.getOperationDef() != null && !_visitedNodes.contains(node.getOperationDef())) node.getOperationDef().apply(this, question);
@Override public PType caseAThreadDefinition(AThreadDefinition node, TypeCheckInfo question) throws AnalysisException { question.scope = NameScope.NAMESANDSTATE; FlatEnvironment local = new FlatEnvironment(question.assistantFactory, question.assistantFactory.createPDefinitionAssistant().getSelfDefinition(node), question.env); PType rt = node.getStatement().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope)); if (!(rt instanceof AVoidType) && !(rt instanceof AUnknownType)) { TypeCheckerErrors.report(3049, "Thread statement/operation must not return a value", node.getLocation(), node); } node.setType(rt); node.getOperationDef().setBody(node.getStatement().clone());// This // operation // is a // wrapper // for the // thread return rt; }
public static AThreadDefinition newAThreadDefinition(PStm statement) { AThreadDefinition result = new AThreadDefinition(); // Definition initialization initDefinition(result, Pass.DEFS, statement.getLocation(), null, NameScope.GLOBAL); result.setStatement(statement); // used to be a static method on LexNameToken - removed when we went to // interface result.setOperationName(new LexNameToken(statement.getLocation().getModule(), "thread", statement.getLocation())); result.getOperationName().setTypeQualifier(new Vector<PType>()); result.setAccess(af.createPAccessSpecifierAssistant().getProtected()); return result; }
@Override public PStm caseAThreadDefinition(AThreadDefinition def, Integer lineno) throws AnalysisException { return af.createPStmAssistant().findStatement(def.getStatement(), lineno); }
@Override public Boolean caseAThreadDefinition(AThreadDefinition node, Object other) throws AnalysisException { if (other instanceof AThreadDefinition) { AThreadDefinition tho = (AThreadDefinition) other; return tho.getOperationName().equals(node.getOperationName()); } return false; }
@Override public void caseAThreadDefinition(AThreadDefinition node, Environment question) throws AnalysisException { // ORIGINAL CODE FROM ASSISTANT // node.setOperationDef(AThreadDefinitionAssistantTC.getThreadDefinition(node)); // Mine non static call of the code. node.setOperationDef(getThreadDefinition(node)); }
if(node.getName() != null ) node.getName().apply(this); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) node.getClassDefinition().apply(this); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) node.getAccess().apply(this); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) node.getStatement().apply(this); if(node.getOperationName() != null ) node.getOperationName().apply(this); if(node.getOperationDef() != null && !_visitedNodes.contains(node.getOperationDef())) node.getOperationDef().apply(this);
@Override public PExp caseAThreadDefinition(AThreadDefinition def, Integer lineno) throws AnalysisException { return af.createPStmAssistant().findExpression(def.getStatement(), lineno); }
if(node.getName() != null ) node.getName().apply(this); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) node.getClassDefinition().apply(this); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) node.getAccess().apply(this); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) node.getStatement().apply(this); if(node.getOperationName() != null ) node.getOperationName().apply(this); if(node.getOperationDef() != null && !_visitedNodes.contains(node.getOperationDef())) node.getOperationDef().apply(this);
@Override public PDefinition caseAThreadDefinition(AThreadDefinition node, Newquestion question) throws AnalysisException { return node.getOperationDef().apply(this, question); // PDefinitionAssistantTC.findName(definition.getOperationDef(), // sought, scope); }
/** * Creates a new tree field only constructor {@code AThreadDefinition TAG=thread} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param statement_ the {@link PStm} node for the {@code statement} child of this {@link AThreadDefinition} node * @param operationName_ the {@link ILexNameToken} node for the {@code operationName} child of this {@link AThreadDefinition} node * @param operationDef_ the {@link AExplicitOperationDefinition} node for the {@code operationDef} child of this {@link AThreadDefinition} node */ public AThreadDefinition(ILexLocation location_, NameScope nameScope_, Boolean used_, AAccessSpecifierAccessSpecifier access_, Pass pass_, PStm statement_, ILexNameToken operationName_, AExplicitOperationDefinition operationDef_) { super(location_,null,nameScope_,used_,null,access_,null,pass_); this.setStatement(statement_); this.setOperationName(operationName_); this.setOperationDef(operationDef_); }
if(node.getName() != null ) mergeReturns(retVal,node.getName().apply(this)); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) mergeReturns(retVal,node.getClassDefinition().apply(this)); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) mergeReturns(retVal,node.getAccess().apply(this)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this)); if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) mergeReturns(retVal,node.getStatement().apply(this)); if(node.getOperationName() != null ) mergeReturns(retVal,node.getOperationName().apply(this)); if(node.getOperationDef() != null && !_visitedNodes.contains(node.getOperationDef())) mergeReturns(retVal,node.getOperationDef().apply(this));
@Override public NameValuePairList caseAThreadDefinition(AThreadDefinition def, Context initialContext) throws AnalysisException { return def.getOperationDef().apply(THIS, initialContext); }
if(node.getName() != null ) mergeReturns(retVal,node.getName().apply(this, question)); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) mergeReturns(retVal,node.getClassDefinition().apply(this, question)); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) mergeReturns(retVal,node.getAccess().apply(this, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this, question)); if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) mergeReturns(retVal,node.getStatement().apply(this, question)); if(node.getOperationName() != null ) mergeReturns(retVal,node.getOperationName().apply(this, question)); if(node.getOperationDef() != null && !_visitedNodes.contains(node.getOperationDef())) mergeReturns(retVal,node.getOperationDef().apply(this, question));
@Override public LexNameList caseAThreadDefinition(AThreadDefinition node) throws AnalysisException { return node.getOperationDef() == null ? null : new LexNameList(node.getOperationDef().getName()); }
@Override public SDeclIR caseAThreadDefinition(AThreadDefinition node, IRInfo question) throws AnalysisException { PStm stm = node.getOperationDef().getBody(); SStmIR stmIR = stm.apply(question.getStmVisitor(), question); AThreadDeclIR threaddcl = new AThreadDeclIR(); threaddcl.setStm(stmIR); return threaddcl; }
if (((AThreadDefinition) d).getOperationDef() != null)// Differnt from VDMJ return new LexNameList(((AThreadDefinition) d).getOperationDef().getName()); } else