Class ASTNumberLiteral
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.impl.AbstractNode<net.sourceforge.pmd.lang.ecmascript.ast.AbstractEcmascriptNode<?>,EcmascriptNode<?>>
-
- net.sourceforge.pmd.lang.ecmascript.ast.ASTNumberLiteral
-
- All Implemented Interfaces:
GenericNode<EcmascriptNode<?>>
,Node
,EcmascriptNode<org.mozilla.javascript.ast.NumberLiteral>
,Reportable
public final class ASTNumberLiteral extends AbstractNode<net.sourceforge.pmd.lang.ecmascript.ast.AbstractEcmascriptNode<?>,EcmascriptNode<?>>
-
-
Field Summary
Fields Modifier and Type Field Description protected T
node
-
Fields inherited from interface net.sourceforge.pmd.lang.ast.Node
COORDS_COMPARATOR
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <P,R>
RacceptJsVisitor(EcmascriptVisitor<? super P,? extends R> visitor, P data)
<P,R>
RacceptVisitor(AstVisitor<? super P,? extends R> visitor, P data)
protected void
addChild(net.sourceforge.pmd.lang.ecmascript.ast.AbstractEcmascriptNode<?> child, int index)
String
getJsDoc()
Get the JsDoc associated with the given node.String
getNormalizedImage()
double
getNumber()
TextRegion
getTextRegion()
String
getValue()
String
getXPathNodeName()
boolean
hasSideEffects()
boolean
isInaccurate()
Checks if this number literal cannot be represented exactly without loss as a JavaScript Number.protected void
setTrailingCommaExists(boolean b)
-
Methods inherited from class net.sourceforge.pmd.lang.ast.impl.AbstractNode
children, firstChild, getChild, getIndexInParent, getNumChildren, getParent, getUserMap, insertChild, remove, removeChildAtIndex, setChild, setParent, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.impl.GenericNode
ancestors, ancestorsOrSelf, asStream, children, descendants, descendantsOrSelf, getChild, getFirstChild, getLastChild, getNextSibling, getParent, getPreviousSibling
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
ancestors, children, compareLocation, descendants, firstChild, getAstInfo, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage, getIndexInParent, getLanguageVersion, getNumChildren, getReportLocation, getRoot, getTextDocument, getUserMap, getXPathAttributesIterator, hasImageEqualTo, isFindBoundary
-
-
-
-
Method Detail
-
acceptJsVisitor
protected <P,R> R acceptJsVisitor(EcmascriptVisitor<? super P,? extends R> visitor, P data)
-
getNormalizedImage
public String getNormalizedImage()
-
getNumber
public double getNumber()
-
getValue
public String getValue()
-
isInaccurate
public boolean isInaccurate()
Checks if this number literal cannot be represented exactly without loss as a JavaScript Number. The number is either too big or uses too many decimal places.- Returns:
true
if the literal is inaccurate.- Since:
- 7.4.0
-
addChild
protected void addChild(net.sourceforge.pmd.lang.ecmascript.ast.AbstractEcmascriptNode<?> child, int index)
- Overrides:
addChild
in classAbstractNode<net.sourceforge.pmd.lang.ecmascript.ast.AbstractEcmascriptNode<?>,EcmascriptNode<?>>
-
getTextRegion
public TextRegion getTextRegion()
- Specified by:
getTextRegion
in interfaceNode
-
acceptVisitor
public final <P,R> R acceptVisitor(AstVisitor<? super P,? extends R> visitor, P data)
- Specified by:
acceptVisitor
in interfaceNode
-
getJsDoc
public String getJsDoc()
Description copied from interface:EcmascriptNode
Get the JsDoc associated with the given node. If there is no JsDoc on this node, it may be associated with a parent node, on more representative of the entire expression containing this node.- Specified by:
getJsDoc
in interfaceEcmascriptNode<T extends org.mozilla.javascript.ast.AstNode>
- Returns:
- The JsDoc comment for the node, may be
null
.
-
hasSideEffects
public boolean hasSideEffects()
- Specified by:
hasSideEffects
in interfaceEcmascriptNode<T extends org.mozilla.javascript.ast.AstNode>
-
getXPathNodeName
public String getXPathNodeName()
- Specified by:
getXPathNodeName
in interfaceNode
-
setTrailingCommaExists
protected void setTrailingCommaExists(boolean b)
-
-