diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java index f713ed0c8..8aeefa818 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java @@ -1,1079 +1,101 @@ package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AUnaryOp - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AUnaryOp extends AOp { - - protected AOp aOp; - - /** - * - */ - public AUnaryOp(AOp aOp){ - super(aOp); - this.aOp = aOp; - } - /** - * Get value on attribute isPointerDeref - * @return the attribute's value - */ - public abstract Boolean getIsPointerDerefImpl(); - - /** - * Get value on attribute isPointerDeref - * @return the attribute's value - */ - public final Object getIsPointerDeref() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPointerDeref", Optional.empty()); - } - Boolean result = this.getIsPointerDerefImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPointerDeref", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPointerDeref", e); - } - } - - /** - * Get value on attribute operand - * @return the attribute's value - */ - public abstract AExpression getOperandImpl(); - - /** - * Get value on attribute operand - * @return the attribute's value - */ - public final Object getOperand() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "operand", Optional.empty()); - } - AExpression result = this.getOperandImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "operand", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "operand", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select operands - * @return - */ - public List selectOperand() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute isBitwise - * @return the attribute's value - */ - @Override - public Boolean getIsBitwiseImpl() { - return this.aOp.getIsBitwiseImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aOp.getKindImpl(); - } - - /** - * Get value on attribute operator - * @return the attribute's value - */ - @Override - public String getOperatorImpl() { - return this.aOp.getOperatorImpl(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aOp.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aOp.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aOp.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aOp.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aOp.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aOp.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aOp.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aOp.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aOp.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aOp.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aOp.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aOp.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aOp.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aOp.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aOp.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aOp.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aOp.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aOp.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aOp.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aOp.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aOp.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aOp.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aOp.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aOp.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aOp.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aOp.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aOp.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aOp.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aOp.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aOp.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aOp.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aOp.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aOp.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aOp.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aOp.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aOp.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aOp.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aOp.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aOp.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aOp.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aOp.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aOp.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aOp.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aOp.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aOp.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aOp.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aOp.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aOp.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aOp.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aOp.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aOp.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aOp.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aOp.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aOp.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aOp.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aOp.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aOp.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aOp.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aOp.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aOp.getParentImpl(); - } +import org.lara.interpreter.exception.AttributeException; +import org.lara.interpreter.weaver.interf.SelectOp; +import org.lara.interpreter.weaver.interf.events.Stage; +import pt.up.fe.specs.clava.ClavaNode; +import pt.up.fe.specs.clava.ast.expr.Operator; +import pt.up.fe.specs.clava.weaver.joinpoints.CxxOp; - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aOp.getParentRegionImpl(); - } +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aOp.getPragmasArrayImpl(); - } +/** + * Auto-Generated class for join point AUnaryOp + * This class is overwritten by the Weaver Generator. + * + * @author Lara Weaver Generator + */ +public abstract class AUnaryOp extends CxxOp { - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aOp.getRightJpImpl(); - } /** - * Get value on attribute root - * @return the attribute's value + * */ - @Override - public AProgram getRootImpl() { - return this.aOp.getRootImpl(); + public AUnaryOp(ClavaNode op) { + super((Operator) op); } - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aOp.getScopeNodesArrayImpl(); - } /** - * Get value on attribute siblingsLeftArrayImpl + * Get value on attribute isPointerDeref + * * @return the attribute's value */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aOp.getSiblingsLeftArrayImpl(); - } + public abstract Boolean getIsPointerDerefImpl(); /** - * Get value on attribute siblingsRightArrayImpl + * Get value on attribute isPointerDeref + * * @return the attribute's value */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aOp.getSiblingsRightArrayImpl(); + public final Object getIsPointerDeref() { + try { + if (hasListeners()) { + eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPointerDeref", Optional.empty()); + } + Boolean result = this.getIsPointerDerefImpl(); + if (hasListeners()) { + eventTrigger().triggerAttribute(Stage.END, this, "isPointerDeref", Optional.ofNullable(result)); + } + return result != null ? result : getUndefinedValue(); + } catch (Exception e) { + throw new AttributeException(get_class(), "isPointerDeref", e); + } } /** - * Get value on attribute stmt + * Get value on attribute operand + * * @return the attribute's value */ - @Override - public AStatement getStmtImpl() { - return this.aOp.getStmtImpl(); - } + public abstract AExpression getOperandImpl(); /** - * Get value on attribute type + * Get value on attribute operand + * * @return the attribute's value */ - @Override - public AType getTypeImpl() { - return this.aOp.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aOp.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aOp.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aOp.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aOp.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aOp.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aOp.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aOp.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aOp.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aOp.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aOp.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aOp.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aOp.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aOp.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aOp.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aOp.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aOp.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aOp.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aOp.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aOp.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aOp); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "operand": - joinPointList = selectOperand(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aOp.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); + public final Object getOperand() { + try { + if (hasListeners()) { + eventTrigger().triggerAttribute(Stage.BEGIN, this, "operand", Optional.empty()); + } + AExpression result = this.getOperandImpl(); + if (hasListeners()) { + eventTrigger().triggerAttribute(Stage.END, this, "operand", Optional.ofNullable(result)); + } + return result != null ? result : getUndefinedValue(); + } catch (Exception e) { + throw new AttributeException(get_class(), "operand", e); } } /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aOp.fillWithAttributes(attributes); - attributes.add("isPointerDeref"); - attributes.add("operand"); - } - - /** - * + * Default implementation of the method used by the lara interpreter to select operands + * + * @return */ - @Override - protected final void fillWithSelects(List selects) { - this.aOp.fillWithSelects(selects); - selects.add("operand"); + public List selectOperand() { + return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); } - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aOp.fillWithActions(actions); - } /** * Returns the join point type of this class + * * @return The join point type */ @Override @@ -1081,20 +103,9 @@ public final String get_class() { return "unaryOp"; } + /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aOp.instanceOf(joinpointClass); - } - /** - * + * */ protected enum UnaryOpAttributes { ISPOINTERDEREF("isPointerDeref"), @@ -1173,11 +184,12 @@ protected enum UnaryOpAttributes { private String name; /** - * + * */ - private UnaryOpAttributes(String name){ + private UnaryOpAttributes(String name) { this.name = name; } + /** * Return an attribute enumeration item from a given attribute name */ diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java index 808ed4270..ffe05e1e4 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java @@ -1,11 +1,11 @@ /** * Copyright 2017 SPeCS. - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. under the License. @@ -13,10 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.List; - -import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; import pt.up.fe.specs.clava.ast.expr.UnaryOperator; import pt.up.fe.specs.clava.ast.expr.enums.UnaryOperatorKind; @@ -24,28 +20,28 @@ import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AUnaryOp; -public class CxxUnaryOp extends AUnaryOp { +import java.util.Arrays; +import java.util.List; - private final UnaryOperator unaryOp; +public class CxxUnaryOp extends AUnaryOp { public CxxUnaryOp(UnaryOperator unaryOp) { - super(new CxxOp(unaryOp)); - this.unaryOp = unaryOp; + super(unaryOp); } @Override - public ClavaNode getNode() { - return unaryOp; + public UnaryOperator getNode() { + return (UnaryOperator) super.getNode(); } @Override public AExpression getOperandImpl() { - return CxxJoinpoints.create(ClavaNodes.normalize(unaryOp.getSubExpr()), AExpression.class); + return CxxJoinpoints.create(ClavaNodes.normalize(getNode().getSubExpr()), AExpression.class); } @Override public Boolean getIsPointerDerefImpl() { - return unaryOp.getOp() == UnaryOperatorKind.Deref; + return getNode().getOp() == UnaryOperatorKind.Deref; } @Override @@ -55,7 +51,7 @@ public List selectOperand() { @Override public Boolean getIsBitwiseImpl() { - return unaryOp.getOp().isBitwise(); + return getNode().getOp().isBitwise(); } }