public AAccessSpecifierAccessSpecifier getStatic(PDefinition d, boolean asStatic) { AAccessSpecifierAccessSpecifier paccess = d.getAccess(); if (paccess instanceof AAccessSpecifierAccessSpecifier) { return AstFactory.newAAccessSpecifierAccessSpecifier(paccess.getAccess().clone(), asStatic && paccess.getStatic() != null, paccess.getAsync() != null, false); } assert false : "PAccessSpecifier must be instance of AAccessSpecifierAccessSpecifier"; return null; }
public void setAccessibility(List<PDefinition> defs, AAccessSpecifierAccessSpecifier access) { for (PDefinition d : defs) { d.setAccess(access.clone()); } }
/** * Creates a new complete constructor {@code AAccessSpecifierAccessSpecifier} 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 access_ the {@link PAccess} node for the {@code access} child of this {@link AAccessSpecifierAccessSpecifier} node * @param static_ the {@link TStatic} node for the {@code static} child of this {@link AAccessSpecifierAccessSpecifier} node * @param async_ the {@link TAsync} node for the {@code async} child of this {@link AAccessSpecifierAccessSpecifier} node * @param pure_ the {@link Boolean} node for the {@code pure} child of this {@link AAccessSpecifierAccessSpecifier} node */ public AAccessSpecifierAccessSpecifier(PAccess access_, TStatic static_, TAsync async_, Boolean pure_) { super(); this.setAccess(access_); this.setStatic(static_); this.setAsync(async_); this.setPure(pure_); }
public boolean isPublic(PAccessSpecifier access) { if (access instanceof AAccessSpecifierAccessSpecifier) { AAccessSpecifierAccessSpecifier a = (AAccessSpecifierAccessSpecifier) access; return a.getAccess() instanceof APublicAccess; } return false; }
AAccessSpecifierAccessSpecifier acc = f.getAccess().clone(); acc.setAccess(new APublicAccess()); // Guaranteed to be accessible else if (!curracc.getPure() && f.getAccess().getPure()) f.getAccess().getStatic() != null, f.getAccess().getAsync() != null, curracc.getPure() || f.getAccess().getPure()); optype.setPure(access.get(synthname).getPure()); ptype = optype; newname = synthname.getModifiedName(optype.getParameters()); (newname == null ? synthname : newname), NameScope.GLOBAL, ptype); def.setAccess(access.get(synthname).clone()); newdefs.add(def);
/** * Called by the {@link AFieldField} node from {@link AFieldField#apply(IAnalysis)}. * @param node the calling {@link AFieldField} node */ public void caseAFieldField(AFieldField node) throws AnalysisException { _visitedNodes.add(node); inAFieldField(node); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) { node.getAccess().apply(this); } if(node.getTagname() != null ) { node.getTagname().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outAFieldField(node); }
@Override public SDeclIR caseAInstanceVariableDefinition( AInstanceVariableDefinition node, IRInfo question) throws AnalysisException { String access = node.getAccess().getAccess().toString(); String name = node.getName().getName(); boolean isStatic = node.getAccess().getStatic() != null; boolean isFinal = false; STypeIR type = node.getType().apply(question.getTypeVisitor(), question); SExpIR exp = node.getExpression().apply(question.getExpVisitor(), question); return question.getDeclAssistant().constructField(access, name, isStatic, isFinal, type, exp); }
TypeCheckerErrors.detail2("This", override.getAccess().getAccess()+" "+ override.getName(), "Super",indef.getAccess().getAccess()+" "+ indef.getName()); else if (override.getAccess().getPure() != indef.getAccess().getPure()) TypeCheckerErrors.report(3341, "Overriding definition must " + (override.getAccess().getPure() ? "not" : "also") + " be pure", override.getName().getLocation(),override); } else
PDefinition def = readOperationDefinition(); def.setAccess(access); ((AOperationType)def.getType()).setPure(access.getPure()); list.add(def);
public boolean isStatic(AAccessSpecifierAccessSpecifier access) { return access != null && access.getStatic() != null; }
public boolean isAsync(PAccessSpecifier access) { if (access instanceof AAccessSpecifierAccessSpecifier) { AAccessSpecifierAccessSpecifier a = (AAccessSpecifierAccessSpecifier) access; return a.getAsync() != null; } return false; }
/** * Essentially this.toString().equals(o.toString()). **/ @Override public boolean equals(Object o) { if (o != null && o instanceof AAccessSpecifierAccessSpecifier) { return toString().equals(o.toString()); } return false; }
private List<PDefinition> readTypes() throws LexException, ParserException { checkFor(VDMToken.TYPES, 2013, "Expected 'types'"); List<PDefinition> list = new Vector<PDefinition>(); while (!newSection()) { try { AAccessSpecifierAccessSpecifier access = readAccessSpecifier(false, false); access.setStatic(new TStatic()); ATypeDefinition def = readTypeDefinition(); // Force all type defs (invs) to be static def.setAccess(access); list.add(def); if (!newSection()) { checkFor(VDMToken.SEMICOLON, 2078, "Missing ';' after type definition"); } } catch (LocatedException e) { report(e, afterArray, sectionArray); } } return list; }
public boolean isPrivate(AAccessSpecifierAccessSpecifier access) { return access.getAccess() instanceof APrivateAccess; }
/** * Called by the {@link AFieldField} node from {@link AFieldField#apply(IPOFAnalysis)}. * @param node the calling {@link AFieldField} node */ public void caseAFieldField(AFieldField node) throws AnalysisException { _visitedNodes.add(node); inAFieldField(node); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) { node.getAccess().apply(this); } if(node.getTagname() != null ) { node.getTagname().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outAFieldField(node); }
@Override public PType caseATimeExp(ATimeExp node, TypeCheckInfo question) { PDefinition encl = question.env.getEnclosingDefinition(); if (encl != null && encl.getAccess().getPure()) { TypeCheckerErrors.report(3346, "Cannot use 'time' in pure operations", node.getLocation(), node); } if (Settings.release == Release.VDM_10 && question.env.isFunctional()) { TypeCheckerErrors.report(3348, "Cannot use 'time' in a functional context", node.getLocation(), node); } node.setType(AstFactory.newANatNumericBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
public boolean isStatic(AAccessSpecifierAccessSpecifier access) { return access.getStatic() != null; }