Class SymbolVisitor
- java.lang.Object
-
- org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor
-
- org.sonar.javascript.tree.symbols.SymbolVisitor
-
- All Implemented Interfaces:
TreeVisitor
public class SymbolVisitor extends DoubleDispatchVisitor
This visitor creates new symbols for not hoisted variables (like class name) and implicitly declared variables (declared without keyword). Also it creates usages for all known symbols.
-
-
Constructor Summary
Constructors Constructor Description SymbolVisitor(Map<Tree,Scope> treeScopeMap)
-
Method Summary
-
Methods inherited from class org.sonar.plugins.javascript.api.visitors.DoubleDispatchVisitor
getContext, scan, scan, scanChildren, scanTree, visitArgumentList, visitArrayAssignmentPattern, visitArrayBindingPattern, visitArrayLiteral, visitAssignmentPatternRestElement, visitBinaryExpression, visitBindingProperty, visitBreakStatement, visitCallExpression, visitCaseClause, visitComment, visitComputedPropertyName, visitConditionalExpression, visitContinueStatement, visitDebugger, visitDecorator, visitDefaultClause, visitDefaultExportDeclaration, visitDoWhileStatement, visitElseClause, visitEmptyStatement, visitExportClause, visitExportDefaultBinding, visitExportDefaultBindingWithExportList, visitExportDefaultBindingWithNameSpaceExport, visitExpressionStatement, visitExtendsClause, visitFieldDeclaration, visitFinallyBlock, visitFlowArrayTypeShorthand, visitFlowArrayTypeWithKeywordTree, visitFlowCastingExpression, visitFlowDeclare, visitFlowFunctionSignature, visitFlowFunctionType, visitFlowFunctionTypeParameter, visitFlowFunctionTypeParameterClause, visitFlowGenericParameter, visitFlowGenericParameterClause, visitFlowImplementsClause, visitFlowInterfaceDeclaration, visitFlowIntersectionType, visitFlowLiteralType, visitFlowMethodPropertyDefinitionKey, visitFlowModule, visitFlowModuleExports, visitFlowNamespacedType, visitFlowObjectTypeTree, visitFlowOpaqueType, visitFlowOptionalBindingElement, visitFlowOptionalType, visitFlowParameterizedGenerics, visitFlowParenthesisedType, visitFlowPropertyType, visitFlowPropertyTypeKey, visitFlowSimpleType, visitFlowTupleType, visitFlowTypeAliasStatement, visitFlowTypeAnnotation, visitFlowTypedBindingElement, visitFlowTypeofType, visitFlowUnionType, visitFromClause, visitIfStatement, visitImport, visitImportClause, visitImportDeclaration, visitImportModuleDeclaration, visitInitializedAssignmentPatternElement, visitInitializedBindingElement, visitJsxClosingElement, visitJsxEmptyClosingElement, visitJsxEmptyOpeningElement, visitJsxIdentifier, visitJsxJavaScriptExpression, visitJsxOpeningElement, visitJsxSelfClosingElement, visitJsxShortFragmentElement, visitJsxSpreadAttribute, visitJsxStandardAttribute, visitJsxStandardElement, visitJsxText, visitLabelledStatement, visitLiteral, visitMemberExpression, visitModule, visitNamedExportDeclaration, visitNamedImportExportClause, visitNameSpaceExportDeclaration, visitNameSpaceImport, visitNewExpression, visitNewTarget, visitObjectAssignmentPattern, visitObjectAssignmentPatternPairElement, visitObjectBindingPattern, visitObjectLiteral, visitPairProperty, visitParameterList, visitParenthesisedExpression, visitRestElement, visitReturnStatement, visitSpecifier, visitSpreadElement, visitSuper, visitTaggedTemplate, visitTemplateCharacters, visitTemplateExpression, visitTemplateLiteral, visitThrowStatement, visitToken, visitTryStatement, visitVariableStatement, visitWhileStatement, visitWithStatement, visitYieldExpression
-
-
-
-
Method Detail
-
visitScript
public void visitScript(ScriptTree tree)
- Overrides:
visitScriptin classDoubleDispatchVisitor
-
visitBlock
public void visitBlock(BlockTree tree)
- Overrides:
visitBlockin classDoubleDispatchVisitor
-
visitForStatement
public void visitForStatement(ForStatementTree tree)
- Overrides:
visitForStatementin classDoubleDispatchVisitor
-
visitSwitchStatement
public void visitSwitchStatement(SwitchStatementTree tree)
- Overrides:
visitSwitchStatementin classDoubleDispatchVisitor
-
visitMethodDeclaration
public void visitMethodDeclaration(MethodDeclarationTree tree)
- Overrides:
visitMethodDeclarationin classDoubleDispatchVisitor
-
visitAccessorMethodDeclaration
public void visitAccessorMethodDeclaration(AccessorMethodDeclarationTree tree)
- Overrides:
visitAccessorMethodDeclarationin classDoubleDispatchVisitor
-
visitCatchBlock
public void visitCatchBlock(CatchBlockTree tree)
- Overrides:
visitCatchBlockin classDoubleDispatchVisitor
-
visitFunctionDeclaration
public void visitFunctionDeclaration(FunctionDeclarationTree tree)
- Overrides:
visitFunctionDeclarationin classDoubleDispatchVisitor
-
visitFunctionExpression
public void visitFunctionExpression(FunctionExpressionTree tree)
- Overrides:
visitFunctionExpressionin classDoubleDispatchVisitor
-
visitArrowFunction
public void visitArrowFunction(ArrowFunctionTree tree)
- Overrides:
visitArrowFunctionin classDoubleDispatchVisitor
-
visitClass
public void visitClass(ClassTree tree)
- Overrides:
visitClassin classDoubleDispatchVisitor
-
visitVariableDeclaration
public void visitVariableDeclaration(VariableDeclarationTree tree)
- Overrides:
visitVariableDeclarationin classDoubleDispatchVisitor
-
visitAssignmentExpression
public void visitAssignmentExpression(AssignmentExpressionTree tree)
When an assignment is done to a symbol that has not been declared before, a global variable is created with the left-hand side identifier as name.- Overrides:
visitAssignmentExpressionin classDoubleDispatchVisitor
-
visitIdentifier
public void visitIdentifier(IdentifierTree tree)
- Overrides:
visitIdentifierin classDoubleDispatchVisitor
-
visitUnaryExpression
public void visitUnaryExpression(UnaryExpressionTree tree)
- Overrides:
visitUnaryExpressionin classDoubleDispatchVisitor
-
visitForObjectStatement
public void visitForObjectStatement(ForObjectStatementTree tree)
- Overrides:
visitForObjectStatementin classDoubleDispatchVisitor
-
-