2007-02-02 17:17:13 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*****************************************************************************/
|
|
|
|
package com.ibm.wala.cast.tree.visit;
|
|
|
|
|
2007-07-06 22:09:29 +00:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import com.ibm.wala.cast.tree.CAstEntity;
|
|
|
|
import com.ibm.wala.cast.tree.CAstNode;
|
2012-08-30 16:10:30 +00:00
|
|
|
import com.ibm.wala.cast.tree.CAstSourcePositionMap;
|
2012-01-27 20:15:33 +00:00
|
|
|
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
2007-02-02 17:17:13 +00:00
|
|
|
import com.ibm.wala.cast.util.CAstPrinter;
|
2007-07-11 21:07:32 +00:00
|
|
|
import com.ibm.wala.util.collections.HashMapFactory;
|
2007-02-02 17:17:13 +00:00
|
|
|
import com.ibm.wala.util.debug.Assertions;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Igor Peshansky
|
|
|
|
* Ripped out of Julian's AstTranslator
|
|
|
|
* TODO: document me.
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public abstract class CAstVisitor<C extends CAstVisitor.Context> {
|
2013-04-09 22:47:22 +00:00
|
|
|
|
|
|
|
public static boolean DEBUG = true;
|
2007-02-02 17:17:13 +00:00
|
|
|
|
2015-12-15 17:53:36 +00:00
|
|
|
protected Position currentPosition;
|
2012-01-27 20:15:33 +00:00
|
|
|
|
2012-08-30 16:10:30 +00:00
|
|
|
public Position getCurrentPosition() {
|
2012-01-27 20:15:33 +00:00
|
|
|
return currentPosition;
|
|
|
|
}
|
|
|
|
|
2012-08-30 16:10:30 +00:00
|
|
|
protected CAstVisitor() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* This interface represents a visitor-specific context. All
|
|
|
|
* it knows is how to get its top-level entity. It is expected
|
|
|
|
* that visitors will have classes implementing this interface
|
|
|
|
* to collect visitor-specific information.
|
|
|
|
*
|
|
|
|
* @author Igor Peshansky
|
|
|
|
*/
|
|
|
|
public interface Context {
|
2012-08-30 16:10:30 +00:00
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
CAstEntity top();
|
2012-08-30 16:10:30 +00:00
|
|
|
|
|
|
|
CAstSourcePositionMap getSourceMap();
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a context for a File entity.
|
|
|
|
* @param context a visitor-specific context in which this file was visited
|
|
|
|
* @param n the file entity
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected C makeFileContext(C context, CAstEntity n) { return context; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Construct a context for a Type entity.
|
|
|
|
* @param context a visitor-specific context in which this type was visited
|
|
|
|
* @param n the type entity
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected C makeTypeContext(C context, CAstEntity n) { return context; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Construct a context for a Code entity.
|
|
|
|
* @param context a visitor-specific context in which the code was visited
|
|
|
|
* @param n the code entity
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected C makeCodeContext(C context, CAstEntity n) { return context; }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a context for a LocalScope node.
|
|
|
|
* @param context a visitor-specific context in which the local scope was visited
|
|
|
|
* @param n the local scope node
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected C makeLocalContext(C context, CAstNode n) { return context; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Construct a context for an Unwind node.
|
|
|
|
* @param context a visitor-specific context in which the unwind was visited
|
|
|
|
* @param n the unwind node
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected C makeUnwindContext(C context, CAstNode n, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return context; }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
2007-07-11 21:07:32 +00:00
|
|
|
private final Map<CAstEntity, CAstEntity> entityParents = HashMapFactory.make();
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the parent entity for a given entity.
|
|
|
|
* @param entity the child entity
|
|
|
|
* @return the parent entity for the given entity
|
|
|
|
*/
|
|
|
|
protected CAstEntity getParent(CAstEntity entity) {
|
2007-02-08 20:45:07 +00:00
|
|
|
return entityParents.get(entity);
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the parent entity for a given entity.
|
|
|
|
* @param entity the child entity
|
|
|
|
* @param parent the parent entity
|
|
|
|
*/
|
|
|
|
protected void setParent(CAstEntity entity, CAstEntity parent) {
|
|
|
|
entityParents.put(entity, parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Entity processing hook; sub-classes are expected to override if they introduce new
|
|
|
|
* entity types.
|
|
|
|
* Should invoke super.doVisitEntity() for unprocessed entities.
|
|
|
|
* @return true if entity was handled
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
@SuppressWarnings("unused")
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean doVisitEntity(CAstEntity n, C context, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit scoped entities of an entity using a given iterator.
|
|
|
|
* Prerequisite (unchecked): i iterates over entities scoped in n.
|
|
|
|
* @param n the parent entity of the entities to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
Fix nearly all Eclipse warnings about using raw types
Along the way, I also converted many "for (;;)" loops into modern
"for (:)" loops. I didn't systematically look for all opportunities
to do this, though. I merely made this change where I was already
converting raw Iterator uses into modern Iterator<...> uses.
Better use of generics also allowed many casts to become statically
redundant. I have removed all such redundant casts.
Only three raw-types warnings remain after this batch of fixes. All
three involve raw uses of CallGraphBuilder. I've tried to fix these
too, but it quickly snowballs into a cascade of changes that may or
may not eventually reach a statically-type-save fixed point. I may
give these last few problem areas another go in the future. For now,
though, the hundreds of other fixes seem worth keeping even if there
are a few stragglers.
This commit may change some public APIs, but only by making weaker
type signatures stronger by replacing raw types with generic types.
For example, we may change something like "Set" into "Set<String>",
but we're not adding new arguments, changing any
underlying (post-generics-erasure) types, etc.
2017-07-09 18:38:35 +00:00
|
|
|
public final void visitScopedEntities(CAstEntity n, Map<CAstNode,Collection<CAstEntity>> allScopedEntities, C context, CAstVisitor<C> visitor) {
|
|
|
|
for (Collection<CAstEntity> collection : allScopedEntities.values()) {
|
|
|
|
visitScopedEntities(n, collection.iterator(), context, visitor);
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Fix nearly all Eclipse warnings about using raw types
Along the way, I also converted many "for (;;)" loops into modern
"for (:)" loops. I didn't systematically look for all opportunities
to do this, though. I merely made this change where I was already
converting raw Iterator uses into modern Iterator<...> uses.
Better use of generics also allowed many casts to become statically
redundant. I have removed all such redundant casts.
Only three raw-types warnings remain after this batch of fixes. All
three involve raw uses of CallGraphBuilder. I've tried to fix these
too, but it quickly snowballs into a cascade of changes that may or
may not eventually reach a statically-type-save fixed point. I may
give these last few problem areas another go in the future. For now,
though, the hundreds of other fixes seem worth keeping even if there
are a few stragglers.
This commit may change some public APIs, but only by making weaker
type signatures stronger by replacing raw types with generic types.
For example, we may change something like "Set" into "Set<String>",
but we're not adding new arguments, changing any
underlying (post-generics-erasure) types, etc.
2017-07-09 18:38:35 +00:00
|
|
|
public final void visitScopedEntities(CAstEntity n, Iterator<CAstEntity> i, C context, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
while (i.hasNext()) {
|
Fix nearly all Eclipse warnings about using raw types
Along the way, I also converted many "for (;;)" loops into modern
"for (:)" loops. I didn't systematically look for all opportunities
to do this, though. I merely made this change where I was already
converting raw Iterator uses into modern Iterator<...> uses.
Better use of generics also allowed many casts to become statically
redundant. I have removed all such redundant casts.
Only three raw-types warnings remain after this batch of fixes. All
three involve raw uses of CallGraphBuilder. I've tried to fix these
too, but it quickly snowballs into a cascade of changes that may or
may not eventually reach a statically-type-save fixed point. I may
give these last few problem areas another go in the future. For now,
though, the hundreds of other fixes seem worth keeping even if there
are a few stragglers.
This commit may change some public APIs, but only by making weaker
type signatures stronger by replacing raw types with generic types.
For example, we may change something like "Set" into "Set<String>",
but we're not adding new arguments, changing any
underlying (post-generics-erasure) types, etc.
2017-07-09 18:38:35 +00:00
|
|
|
CAstEntity child = i.next();
|
2007-02-02 17:17:13 +00:00
|
|
|
setParent(child, n);
|
|
|
|
visitor.visitEntities(child, context, visitor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Recursively visit an entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public final void visitEntities(final CAstEntity n, C context, CAstVisitor<C> visitor) {
|
2012-05-08 17:17:01 +00:00
|
|
|
Position restore = currentPosition;
|
|
|
|
if (n.getPosition() != null) {
|
|
|
|
currentPosition = n.getPosition();
|
|
|
|
} else {
|
|
|
|
currentPosition = null;
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.enterEntity(n, context, visitor))
|
|
|
|
return;
|
|
|
|
switch (n.getKind()) {
|
|
|
|
case CAstEntity.FILE_ENTITY: {
|
2012-01-27 20:15:33 +00:00
|
|
|
C fileContext = visitor.makeFileContext(context, n);
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.visitFileEntity(n, context, fileContext, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visitScopedEntities(n, n.getAllScopedEntities(), fileContext, visitor);
|
|
|
|
visitor.leaveFileEntity(n, context, fileContext, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CAstEntity.FIELD_ENTITY: {
|
|
|
|
if (visitor.visitFieldEntity(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveFieldEntity(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
2009-02-26 16:54:30 +00:00
|
|
|
case CAstEntity.GLOBAL_ENTITY: {
|
|
|
|
if (visitor.visitGlobalEntity(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveGlobalEntity(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
2007-02-02 17:17:13 +00:00
|
|
|
case CAstEntity.TYPE_ENTITY: {
|
2012-01-27 20:15:33 +00:00
|
|
|
C typeContext = visitor.makeTypeContext(context, n);
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.visitTypeEntity(n, context, typeContext, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visitScopedEntities(n, n.getAllScopedEntities(), typeContext, visitor);
|
|
|
|
visitor.leaveTypeEntity(n, context, typeContext, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CAstEntity.FUNCTION_ENTITY: {
|
2018-10-17 23:44:44 +00:00
|
|
|
for(CAstNode dflt : n.getArgumentDefaults()) {
|
|
|
|
visitor.visit(dflt, context, visitor);
|
|
|
|
visitor.visitScopedEntities(context.top(), context.top().getScopedEntities(dflt), context, visitor);
|
|
|
|
}
|
2012-01-27 20:15:33 +00:00
|
|
|
C codeContext = visitor.makeCodeContext(context, n);
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.visitFunctionEntity(n, context, codeContext, visitor))
|
|
|
|
break;
|
|
|
|
// visit the AST if any
|
|
|
|
if (n.getAST() != null)
|
|
|
|
visitor.visit(n.getAST(), codeContext, visitor);
|
|
|
|
// XXX: there may be code that needs to go in here
|
|
|
|
// process any remaining scoped children
|
|
|
|
visitor.visitScopedEntities(n, n.getScopedEntities(null), codeContext, visitor);
|
|
|
|
visitor.leaveFunctionEntity(n, context, codeContext, visitor);
|
|
|
|
break;
|
|
|
|
}
|
2008-03-25 15:16:21 +00:00
|
|
|
case CAstEntity.MACRO_ENTITY: {
|
2012-01-27 20:15:33 +00:00
|
|
|
C codeContext = visitor.makeCodeContext(context, n);
|
2008-03-25 15:16:21 +00:00
|
|
|
if (visitor.visitMacroEntity(n, context, codeContext, visitor))
|
|
|
|
break;
|
|
|
|
// visit the AST if any
|
|
|
|
if (n.getAST() != null)
|
|
|
|
visitor.visit(n.getAST(), codeContext, visitor);
|
|
|
|
// XXX: there may be code that needs to go in here
|
|
|
|
// process any remaining scoped children
|
|
|
|
visitor.visitScopedEntities(n, n.getScopedEntities(null), codeContext, visitor);
|
|
|
|
visitor.leaveMacroEntity(n, context, codeContext, visitor);
|
|
|
|
break;
|
|
|
|
}
|
2007-02-02 17:17:13 +00:00
|
|
|
case CAstEntity.SCRIPT_ENTITY: {
|
2012-01-27 20:15:33 +00:00
|
|
|
C codeContext = visitor.makeCodeContext(context, n);
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.visitScriptEntity(n, context, codeContext, visitor))
|
|
|
|
break;
|
|
|
|
// visit the AST if any
|
|
|
|
if (n.getAST() != null)
|
|
|
|
visitor.visit(n.getAST(), codeContext, visitor);
|
|
|
|
// XXX: there may be code that needs to go in here
|
|
|
|
// process any remaining scoped children
|
|
|
|
visitor.visitScopedEntities(n, n.getScopedEntities(null), codeContext, visitor);
|
|
|
|
visitor.leaveScriptEntity(n, context, codeContext, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
if (!visitor.doVisitEntity(n, context, visitor)) {
|
2009-04-09 20:31:14 +00:00
|
|
|
System.err.println(("No handler for entity " + n.getName()));
|
2007-02-02 17:17:13 +00:00
|
|
|
Assertions.UNREACHABLE("cannot handle entity of kind" + n.getKind());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
visitor.postProcessEntity(n, context, visitor);
|
2012-05-08 17:17:01 +00:00
|
|
|
|
|
|
|
currentPosition = restore;
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter the entity visitor.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean enterEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Post-process an entity after visiting it.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void postProcessEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit any entity. Override only this to change behavior for all entities.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
public boolean visitEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave any entity. Override only this to change behavior for all entities.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
public void leaveEntity(CAstEntity n, C context, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit a File entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
2012-01-27 20:15:33 +00:00
|
|
|
* @param fileC a visitor-specific context for this file
|
2007-02-02 17:17:13 +00:00
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitFileEntity(CAstEntity n, C context, C fileC, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a File entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param fileContext a visitor-specific context for this file
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveFileEntity(CAstEntity n, C context, C fileContext, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Field entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitFieldEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Field entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveFieldEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
2009-02-26 16:54:30 +00:00
|
|
|
* Visit a Field entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitGlobalEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2009-02-26 16:54:30 +00:00
|
|
|
/**
|
|
|
|
* Leave a Field entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveGlobalEntity(CAstEntity n, C context, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2009-02-26 16:54:30 +00:00
|
|
|
/**
|
2007-02-02 17:17:13 +00:00
|
|
|
* Visit a Type entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param typeContext a visitor-specific context for this type
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitTypeEntity(CAstEntity n, C context, C typeContext, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Type entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param typeContext a visitor-specific context for this type
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveTypeEntity(CAstEntity n, C context, C typeContext, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Function entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param codeContext a visitor-specific context for this function
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitFunctionEntity(CAstEntity n, C context, C codeContext, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Function entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param codeContext a visitor-specific context for this function
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveFunctionEntity(CAstEntity n, C context, C codeContext, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
/**
|
|
|
|
* Visit a Macro entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param codeContext a visitor-specific context for this macro
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitMacroEntity(CAstEntity n, C context, C codeContext, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
/**
|
|
|
|
* Leave a Macro entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param codeContext a visitor-specific context for this macro
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveMacroEntity(CAstEntity n, C context, C codeContext, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Script entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param codeContext a visitor-specific context for this script
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitScriptEntity(CAstEntity n, C context, C codeContext, CAstVisitor<C> visitor) { return visitor.visitEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Script entity.
|
|
|
|
* @param n the entity to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
* @param codeContext a visitor-specific context for this script
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveScriptEntity(CAstEntity n, C context, C codeContext, CAstVisitor<C> visitor) { visitor.leaveEntity(n, context, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Node processing hook; sub-classes are expected to override if they
|
|
|
|
* introduce new node types.
|
|
|
|
*
|
|
|
|
* (Should invoke super.doVisit() for unprocessed nodes.)
|
|
|
|
*
|
|
|
|
* @return true if node was handled
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
@SuppressWarnings("unused")
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean doVisit(CAstNode n, C context, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Node processing hook; sub-classes are expected to override if they
|
|
|
|
* introduce new node types that appear on the left hand side of assignment
|
|
|
|
* operations.
|
|
|
|
*
|
|
|
|
* (Should invoke super.doVisit() for unprocessed nodes.)
|
|
|
|
*
|
|
|
|
* @return true if node was handled
|
|
|
|
*/
|
2018-02-05 23:18:37 +00:00
|
|
|
@SuppressWarnings("unused")
|
|
|
|
protected boolean doVisitAssignNodes(CAstNode n, C context, CAstNode v, CAstNode a, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit children of a node starting at a given index.
|
|
|
|
* @param n the parent node of the nodes to process
|
|
|
|
* @param start the starting index of the nodes to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public final void visitChildren(CAstNode n, int start, C context, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
int end = n.getChildCount();
|
|
|
|
for (int i = start; i < end; i++)
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Visit all children of a node.
|
|
|
|
* @param n the parent node of the nodes to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public final void visitAllChildren(CAstNode n, C context, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.visitChildren(n, 0, context, visitor);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Recursively visit a given node.
|
|
|
|
* TODO: do assertions about structure belong here?
|
|
|
|
* @param n the node to process
|
|
|
|
* @param context a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public final void visit(final CAstNode n, C context, CAstVisitor<C> visitor) {
|
|
|
|
Position restore = currentPosition;
|
2014-06-26 15:05:43 +00:00
|
|
|
if (context != null && context.getSourceMap() != null) {
|
2012-08-30 16:10:30 +00:00
|
|
|
Position p = context.getSourceMap().getPosition(n);
|
2012-01-27 20:15:33 +00:00
|
|
|
if (p != null) {
|
|
|
|
currentPosition = p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.enterNode(n, context, visitor))
|
|
|
|
return;
|
|
|
|
|
|
|
|
int NT = n.getKind();
|
|
|
|
switch (NT) {
|
|
|
|
case CAstNode.FUNCTION_EXPR: {
|
|
|
|
if (visitor.visitFunctionExpr(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveFunctionExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.FUNCTION_STMT: {
|
|
|
|
if (visitor.visitFunctionStmt(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveFunctionStmt(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.LOCAL_SCOPE: {
|
|
|
|
if (visitor.visitLocalScope(n, context, visitor))
|
|
|
|
break;
|
2012-01-27 20:15:33 +00:00
|
|
|
C localContext = visitor.makeLocalContext(context, n);
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.visit(n.getChild(0), localContext, visitor);
|
|
|
|
visitor.leaveLocalScope(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-06-26 15:05:43 +00:00
|
|
|
case CAstNode.SPECIAL_PARENT_SCOPE: {
|
|
|
|
if (visitor.visitSpecialParentScope(n, context, visitor))
|
|
|
|
break;
|
|
|
|
C localContext = visitor.makeSpecialParentContext(context, n);
|
|
|
|
visitor.visit(n.getChild(1), localContext, visitor);
|
|
|
|
visitor.leaveSpecialParentScope(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
case CAstNode.BLOCK_EXPR: {
|
|
|
|
if (visitor.visitBlockExpr(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visitAllChildren(n, context, visitor);
|
|
|
|
visitor.leaveBlockExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.BLOCK_STMT: {
|
|
|
|
if (visitor.visitBlockStmt(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visitAllChildren(n, context, visitor);
|
|
|
|
visitor.leaveBlockStmt(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.LOOP: {
|
|
|
|
if (visitor.visitLoop(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveLoopHeader(n, context, visitor);
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveLoop(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
case CAstNode.FORIN_LOOP: {
|
|
|
|
if (visitor.visitForIn(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
visitor.leaveForIn(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
case CAstNode.GET_CAUGHT_EXCEPTION: {
|
|
|
|
if (visitor.visitGetCaughtException(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveGetCaughtException(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.THIS: {
|
|
|
|
if (visitor.visitThis(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveThis(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.SUPER: {
|
|
|
|
if (visitor.visitSuper(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveSuper(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.CALL: {
|
|
|
|
if (visitor.visitCall(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.visitChildren(n, 2, context, visitor);
|
|
|
|
visitor.leaveCall(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.VAR: {
|
|
|
|
if (visitor.visitVar(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveVar(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.CONSTANT: {
|
|
|
|
if (visitor.visitConstant(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveConstant(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.BINARY_EXPR: {
|
|
|
|
if (visitor.visitBinaryExpr(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.visit(n.getChild(2), context, visitor);
|
|
|
|
visitor.leaveBinaryExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.UNARY_EXPR: {
|
|
|
|
if (visitor.visitUnaryExpr(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveUnaryExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.ARRAY_LENGTH: {
|
|
|
|
if (visitor.visitArrayLength(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveArrayLength(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.ARRAY_REF: {
|
|
|
|
if (visitor.visitArrayRef(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.visitChildren(n, 2, context, visitor);
|
|
|
|
visitor.leaveArrayRef(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.DECL_STMT: {
|
|
|
|
if (visitor.visitDeclStmt(n, context, visitor))
|
|
|
|
break;
|
2007-04-04 13:02:17 +00:00
|
|
|
if (n.getChildCount() == 2)
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.leaveDeclStmt(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.RETURN: {
|
|
|
|
if (visitor.visitReturn(n, context, visitor))
|
|
|
|
break;
|
|
|
|
if (n.getChildCount() > 0)
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveReturn(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.IFGOTO: {
|
|
|
|
if (visitor.visitIfgoto(n, context, visitor))
|
|
|
|
break;
|
|
|
|
if (n.getChildCount() == 1) {
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
} else if (n.getChildCount() == 3) {
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.visit(n.getChild(2), context, visitor);
|
|
|
|
} else {
|
|
|
|
Assertions.UNREACHABLE();
|
|
|
|
}
|
|
|
|
|
|
|
|
visitor.leaveIfgoto(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.GOTO: {
|
|
|
|
if (visitor.visitGoto(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveGoto(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.LABEL_STMT: {
|
|
|
|
if (visitor.visitLabelStmt(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
if (n.getChildCount() == 2)
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
2009-04-30 13:16:52 +00:00
|
|
|
else
|
|
|
|
assert n.getChildCount() < 2;
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.leaveLabelStmt(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.IF_STMT: {
|
|
|
|
if (visitor.visitIfStmt(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveIfStmtCondition(n, context, visitor);
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveIfStmtTrueClause(n, context, visitor);
|
|
|
|
if (n.getChildCount() == 3)
|
|
|
|
visitor.visit(n.getChild(2), context, visitor);
|
|
|
|
visitor.leaveIfStmt(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.IF_EXPR: {
|
|
|
|
if (visitor.visitIfExpr(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveIfExprCondition(n, context, visitor);
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveIfExprTrueClause(n, context, visitor);
|
|
|
|
if (n.getChildCount() == 3)
|
|
|
|
visitor.visit(n.getChild(2), context, visitor);
|
|
|
|
visitor.leaveIfExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-18 15:16:16 +00:00
|
|
|
case CAstNode.NEW_ENCLOSING:
|
2007-02-02 17:17:13 +00:00
|
|
|
case CAstNode.NEW: {
|
|
|
|
if (visitor.visitNew(n, context, visitor))
|
|
|
|
break;
|
|
|
|
|
|
|
|
for(int i = 1; i < n.getChildCount(); i++) {
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
}
|
|
|
|
|
|
|
|
visitor.leaveNew(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.OBJECT_LITERAL: {
|
|
|
|
if (visitor.visitObjectLiteral(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
for (int i = 1; i < n.getChildCount(); i+=2) {
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
visitor.visit(n.getChild(i+1), context, visitor);
|
|
|
|
visitor.leaveObjectLiteralFieldInit(n, i, context, visitor);
|
|
|
|
}
|
|
|
|
visitor.leaveObjectLiteral(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.ARRAY_LITERAL: {
|
|
|
|
if (visitor.visitArrayLiteral(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveArrayLiteralObject(n, context, visitor);
|
|
|
|
for (int i = 1; i < n.getChildCount(); i++) {
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
visitor.leaveArrayLiteralInitElement(n, i, context, visitor);
|
|
|
|
}
|
|
|
|
visitor.leaveArrayLiteral(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.OBJECT_REF: {
|
|
|
|
if (visitor.visitObjectRef(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveObjectRef(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.ASSIGN:
|
|
|
|
case CAstNode.ASSIGN_PRE_OP:
|
|
|
|
case CAstNode.ASSIGN_POST_OP: {
|
|
|
|
if (visitor.visitAssign(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
// TODO: is this correct?
|
|
|
|
if (visitor.visitAssignNodes(n.getChild(0), context, n.getChild(1), n, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveAssign(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.SWITCH: {
|
|
|
|
if (visitor.visitSwitch(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveSwitchValue(n, context, visitor);
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveSwitch(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.THROW: {
|
|
|
|
if (visitor.visitThrow(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveThrow(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.CATCH: {
|
|
|
|
if (visitor.visitCatch(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visitChildren(n, 1, context, visitor);
|
|
|
|
visitor.leaveCatch(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.UNWIND: {
|
|
|
|
if (visitor.visitUnwind(n, context, visitor))
|
|
|
|
break;
|
2012-01-27 20:15:33 +00:00
|
|
|
C unwindContext = visitor.makeUnwindContext(context, n.getChild(1), visitor);
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.visit(n.getChild(0), unwindContext, visitor);
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveUnwind(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.TRY: {
|
|
|
|
if (visitor.visitTry(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveTryBlock(n, context, visitor);
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveTry(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.EMPTY: {
|
|
|
|
if (visitor.visitEmpty(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveEmpty(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.PRIMITIVE: {
|
|
|
|
if (visitor.visitPrimitive(n, context, visitor))
|
|
|
|
break;
|
2012-03-01 02:45:51 +00:00
|
|
|
visitor.visitAllChildren(n, context, visitor);
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.leavePrimitive(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.VOID: {
|
|
|
|
if (visitor.visitVoid(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.leaveVoid(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.CAST: {
|
|
|
|
if (visitor.visitCast(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveCast(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.INSTANCEOF: {
|
|
|
|
if (visitor.visitInstanceOf(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
visitor.leaveInstanceOf(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.ASSERT: {
|
|
|
|
if (visitor.visitAssert(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveAssert(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
case CAstNode.EACH_ELEMENT_GET: {
|
2007-02-02 17:17:13 +00:00
|
|
|
if (visitor.visitEachElementGet(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
2015-07-25 02:44:10 +00:00
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.leaveEachElementGet(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.EACH_ELEMENT_HAS_NEXT: {
|
|
|
|
if (visitor.visitEachElementHasNext(n, context, visitor))
|
|
|
|
break;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
2015-07-25 02:44:10 +00:00
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
2007-02-02 17:17:13 +00:00
|
|
|
visitor.leaveEachElementHasNext(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
2012-01-27 20:15:33 +00:00
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
case CAstNode.TYPE_LITERAL_EXPR: {
|
|
|
|
if (visitor.visitTypeLiteralExpr(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
visitor.leaveTypeLiteralExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
2014-06-26 15:05:43 +00:00
|
|
|
|
2007-04-19 13:48:01 +00:00
|
|
|
case CAstNode.IS_DEFINED_EXPR: {
|
|
|
|
if (visitor.visitIsDefinedExpr(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
if (n.getChildCount() == 2){
|
|
|
|
visitor.visit(n.getChild(1), context, visitor);
|
|
|
|
}
|
|
|
|
visitor.leaveIsDefinedExpr(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-03-25 15:16:21 +00:00
|
|
|
case CAstNode.INCLUDE: {
|
|
|
|
if (visitor.visitInclude(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
visitor.leaveInclude(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.MACRO_VAR: {
|
|
|
|
if (visitor.visitMacroVar(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
visitor.leaveMacroVar(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-12-10 04:26:21 +00:00
|
|
|
case CAstNode.ECHO: {
|
|
|
|
if (visitor.visitEcho(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for(int i = 0; i < n.getChildCount(); i++) {
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
}
|
|
|
|
visitor.leaveEcho(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-07-22 20:19:32 +00:00
|
|
|
case CAstNode.RETURN_WITHOUT_BRANCH: {
|
|
|
|
if (visitor.visitYield(n, context, visitor)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for(int i = 0; i < n.getChildCount(); i++) {
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
}
|
|
|
|
visitor.leaveYield(n, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
default: {
|
|
|
|
if (!visitor.doVisit(n, context, visitor)) {
|
2009-04-09 20:31:14 +00:00
|
|
|
System.err.println(("looking at unhandled " + n + "(" + NT + ")" + " of " + n.getClass()));
|
2007-02-02 17:17:13 +00:00
|
|
|
Assertions.UNREACHABLE("cannot handle node of kind " + NT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context != null) {
|
|
|
|
visitor.visitScopedEntities(context.top(), context.top().getScopedEntities(n), context, visitor);
|
|
|
|
}
|
|
|
|
|
|
|
|
visitor.postProcessNode(n, context, visitor);
|
2012-01-27 20:15:33 +00:00
|
|
|
|
|
|
|
currentPosition = restore;
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
|
2014-06-26 15:05:43 +00:00
|
|
|
protected void leaveSpecialParentScope(CAstNode n, C context, CAstVisitor<C> visitor) {
|
|
|
|
visitor.leaveNode(n, context, visitor);
|
|
|
|
}
|
|
|
|
|
2017-07-28 20:33:41 +00:00
|
|
|
protected C makeSpecialParentContext(C context, @SuppressWarnings("unused") CAstNode n) {
|
2014-06-26 15:05:43 +00:00
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected boolean visitSpecialParentScope(CAstNode n, C context, CAstVisitor<C> visitor) {
|
|
|
|
return visitor.visitNode(n, context, visitor);
|
|
|
|
}
|
|
|
|
|
2007-07-18 15:55:54 +00:00
|
|
|
/**
|
|
|
|
* Process the given array reference node. Factored out so that derived languages can reuse this
|
|
|
|
* code for specially-marked types of array references (as in X10, for which different instruction
|
|
|
|
* types get generated, but whose structure is essentially the same as an ordinary array reference).
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean doVisitArrayRefNode(CAstNode n, CAstNode v, CAstNode a, boolean assign, boolean preOp, C context, CAstVisitor<C> visitor) {
|
2007-07-18 15:55:54 +00:00
|
|
|
if (assign ? visitor.visitArrayRefAssign(n, v, a, context, visitor)
|
|
|
|
: visitor.visitArrayRefAssignOp(n, v, a, preOp, context, visitor))
|
|
|
|
return true;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
// XXX: we don't really need to visit array dims twice!
|
|
|
|
visitor.visitChildren(n, 2, context, visitor);
|
|
|
|
if (assign)
|
|
|
|
visitor.leaveArrayRefAssign(n, v, a, context, visitor);
|
|
|
|
else
|
|
|
|
visitor.leaveArrayRefAssignOp(n, v, a, preOp, context, visitor);
|
2007-07-18 18:13:44 +00:00
|
|
|
return false;
|
2007-07-18 15:55:54 +00:00
|
|
|
}
|
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitAssignNodes(CAstNode n, C context, CAstNode v, CAstNode a, CAstVisitor<C> visitor) {
|
2007-02-02 17:17:13 +00:00
|
|
|
int NT = a.getKind();
|
|
|
|
boolean assign = NT == CAstNode.ASSIGN;
|
|
|
|
boolean preOp = NT == CAstNode.ASSIGN_PRE_OP;
|
|
|
|
switch (n.getKind()) {
|
|
|
|
case CAstNode.ARRAY_REF: {
|
2007-07-18 18:13:44 +00:00
|
|
|
if (doVisitArrayRefNode(n, v, a, assign, preOp, context, visitor)) {
|
2013-04-09 22:47:22 +00:00
|
|
|
return true;
|
2007-07-18 18:13:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.OBJECT_REF: {
|
2013-04-09 22:47:22 +00:00
|
|
|
if (assign ? visitor.visitObjectRefAssign(n, v, a, context, visitor) : visitor.visitObjectRefAssignOp(n, v, a, preOp,
|
|
|
|
context, visitor))
|
2007-02-02 17:17:13 +00:00
|
|
|
return true;
|
|
|
|
visitor.visit(n.getChild(0), context, visitor);
|
|
|
|
if (assign)
|
|
|
|
visitor.leaveObjectRefAssign(n, v, a, context, visitor);
|
|
|
|
else
|
|
|
|
visitor.leaveObjectRefAssignOp(n, v, a, preOp, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.BLOCK_EXPR: {
|
2013-04-09 22:47:22 +00:00
|
|
|
if (assign ? visitor.visitBlockExprAssign(n, v, a, context, visitor) : visitor.visitBlockExprAssignOp(n, v, a, preOp,
|
|
|
|
context, visitor))
|
2007-02-02 17:17:13 +00:00
|
|
|
return true;
|
|
|
|
// FIXME: is it correct to ignore all the other children?
|
|
|
|
if (visitor.visitAssignNodes(n.getChild(n.getChildCount() - 1), context, v, a, visitor))
|
|
|
|
return true;
|
|
|
|
if (assign)
|
|
|
|
visitor.leaveBlockExprAssign(n, v, a, context, visitor);
|
|
|
|
else
|
|
|
|
visitor.leaveBlockExprAssignOp(n, v, a, preOp, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CAstNode.VAR: {
|
2013-04-09 22:47:22 +00:00
|
|
|
if (assign ? visitor.visitVarAssign(n, v, a, context, visitor) : visitor.visitVarAssignOp(n, v, a, preOp, context, visitor))
|
2007-02-02 17:17:13 +00:00
|
|
|
return true;
|
|
|
|
if (assign)
|
|
|
|
visitor.leaveVarAssign(n, v, a, context, visitor);
|
|
|
|
else
|
|
|
|
visitor.leaveVarAssignOp(n, v, a, preOp, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-02-05 23:18:37 +00:00
|
|
|
case CAstNode.ARRAY_LITERAL: {
|
|
|
|
assert assign;
|
|
|
|
if (visitor.visitArrayLiteralAssign(n, v, a, context, visitor))
|
|
|
|
return true;
|
|
|
|
visitor.leaveArrayLiteralAssign(n, v, a, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-10-16 04:34:31 +00:00
|
|
|
case CAstNode.OBJECT_LITERAL: {
|
|
|
|
assert assign;
|
|
|
|
for(int i = 1; i < n.getChildCount(); i+=2) {
|
|
|
|
visitor.visit(n.getChild(i), context, visitor);
|
|
|
|
}
|
|
|
|
if (visitor.visitObjectLiteralAssign(n, v, a, context, visitor))
|
|
|
|
return true;
|
|
|
|
visitor.leaveObjectLiteralAssign(n, v, a, context, visitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
default: {
|
2018-02-05 23:18:37 +00:00
|
|
|
if (!visitor.doVisitAssignNodes(n, context, a, v, visitor)) {
|
2013-04-09 22:47:22 +00:00
|
|
|
if (DEBUG) {
|
|
|
|
System.err.println(("cannot handle assign to kind " + n.getKind()));
|
|
|
|
}
|
|
|
|
throw new UnsupportedOperationException("cannot handle assignment: " + CAstPrinter.print(a, context.getSourceMap()));
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter the node visitor.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean enterNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Post-process a node after visiting it.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void postProcessNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit any node. Override only this to change behavior for all nodes.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
public boolean visitNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave any node. Override only this to change behavior for all nodes.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
public void leaveNode(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { return; }
|
2007-02-02 17:17:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit a FunctionExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitFunctionExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a FunctionExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveFunctionExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a FunctionStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitFunctionStmt(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a FunctionStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveFunctionStmt(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a LocalScope node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitLocalScope(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a LocalScope node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveLocalScope(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BlockExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitBlockExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a BlockExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveBlockExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BlockStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitBlockStmt(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a BlockStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveBlockStmt(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Loop node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitLoop(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
|
|
|
/**
|
|
|
|
* Visit a For..In node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
|
|
|
protected boolean visitForIn(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Loop node after processing the loop header.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveLoopHeader(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Loop node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveLoop(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
|
|
|
/**
|
|
|
|
* Leave a For..In node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
|
|
|
protected void leaveForIn(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a GetCaughtException node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitGetCaughtException(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a GetCaughtException node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveGetCaughtException(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a This node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitThis(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a This node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveThis(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Super node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitSuper(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Super node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveSuper(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Call node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitCall(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Call node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveCall(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Var node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitVar(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Var node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveVar(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Constant node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitConstant(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Constant node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveConstant(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BinaryExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitBinaryExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a BinaryExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveBinaryExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a UnaryExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitUnaryExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a UnaryExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveUnaryExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayLength node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitArrayLength(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an ArrayLength node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveArrayLength(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayRef node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitArrayRef(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an ArrayRef node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveArrayRef(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a DeclStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitDeclStmt(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a DeclStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveDeclStmt(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Return node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitReturn(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Return node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveReturn(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2018-07-22 20:19:32 +00:00
|
|
|
/**
|
|
|
|
* Visit a Return node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
|
|
|
protected boolean visitYield(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
|
|
|
/**
|
|
|
|
* Leave a Return node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
|
|
|
protected void leaveYield(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an Ifgoto node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitIfgoto(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an Ifgoto node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveIfgoto(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Goto node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitGoto(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Goto node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveGoto(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a LabelStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitLabelStmt(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a LabelStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveLabelStmt(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an IfStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitIfStmt(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an IfStmt node after processing the condition.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveIfStmtCondition(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an IfStmt node after processing the true clause.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveIfStmtTrueClause(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an IfStmt node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveIfStmt(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an IfExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitIfExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an IfExpr node after processing the condition.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveIfExprCondition(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an IfExpr node after processing the true clause.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveIfExprTrueClause(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an IfExpr node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveIfExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a New node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitNew(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a New node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveNew(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectLiteral node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitObjectLiteral(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectLiteral node after processing the {i}th field initializer.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param i the field position that was initialized
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveObjectLiteralFieldInit(CAstNode n, int i, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an ObjectLiteral node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveObjectLiteral(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayLiteral node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitArrayLiteral(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayLiteral node after processing the array object.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveArrayLiteralObject(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayLiteral node after processing the {i}th element initializer.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param i the index that was initialized
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveArrayLiteralInitElement(CAstNode n, int i, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a ArrayLiteral node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveArrayLiteral(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectRef node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitObjectRef(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an ObjectRef node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveObjectRef(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an Assign node. Override only this to change behavior for all assignment nodes.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public boolean visitAssign(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an Assign node. Override only this to change behavior for all assignment nodes.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
public void leaveAssign(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayRef Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitArrayRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayRef Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveArrayRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayRef Op/Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitArrayRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ArrayRef Op/Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveArrayRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectRef Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitObjectRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectRef Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveObjectRefAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectRef Op/Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an ObjectRef Op/Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveObjectRefAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BlockExpr Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitBlockExprAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BlockExpr Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveBlockExprAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BlockExpr Op/Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitBlockExprAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a BlockExpr Op/Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveBlockExprAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Var Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitVarAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Var Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveVarAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2018-02-05 23:18:37 +00:00
|
|
|
/**
|
|
|
|
* Visit an array literal Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
|
|
|
protected boolean visitArrayLiteralAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
|
|
|
/**
|
|
|
|
* Visit an array literal Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
|
|
|
protected void leaveArrayLiteralAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2018-10-16 04:34:31 +00:00
|
|
|
/**
|
|
|
|
* Visit an array literal Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
|
|
|
protected boolean visitObjectLiteralAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
|
|
|
/**
|
|
|
|
* Visit an array literal Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
|
|
|
protected void leaveObjectLiteralAssign(CAstNode n, CAstNode v, CAstNode a, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Var Op/Assignment node after visiting the RHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected boolean visitVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ return false; }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Var Op/Assignment node after visiting the LHS.
|
|
|
|
* @param n the LHS node to process
|
|
|
|
* @param v the RHS node to process
|
|
|
|
* @param a the assignment node to process
|
|
|
|
* @param pre whether the value before the operation should be used
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Switch node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitSwitch(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Switch node after processing the switch value.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveSwitchValue(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Switch node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveSwitch(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Throw node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitThrow(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Throw node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveThrow(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Catch node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitCatch(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Catch node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveCatch(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an Unwind node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitUnwind(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an Unwind node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveUnwind(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Try node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitTry(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Try node after processing the try block.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2017-07-28 20:33:41 +00:00
|
|
|
protected void leaveTryBlock(CAstNode n, C c, @SuppressWarnings("unused") CAstVisitor<C> visitor) { /* empty */ }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Try node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveTry(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an Empty node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitEmpty(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an Empty node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveEmpty(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Primitive node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitPrimitive(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Primitive node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leavePrimitive(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Void node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitVoid(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Void node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveVoid(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit a Cast node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitCast(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave a Cast node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveCast(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an InstanceOf node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitInstanceOf(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an InstanceOf node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveInstanceOf(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an InstanceOf node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveAssert(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
|
|
|
protected boolean visitAssert(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an InstanceOf node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitEachElementHasNext(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
|
|
|
protected void leaveEachElementHasNext(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an InstanceOf node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitEachElementGet(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an FOR_EACH_ELEMENT_GET node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveEachElementGet(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Visit an TYPE_LITERAL_EXPR node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
* @return true if no further processing is needed
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitTypeLiteralExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-02-02 17:17:13 +00:00
|
|
|
/**
|
|
|
|
* Leave an TYPE_LITERAL_EXPR node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveTypeLiteralExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-04-19 13:48:01 +00:00
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitIsDefinedExpr(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-04-19 13:48:01 +00:00
|
|
|
/**
|
|
|
|
* Leave an IS_DEFINED_EXPR node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveIsDefinedExpr(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2007-12-10 04:26:21 +00:00
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitEcho(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2007-12-10 04:26:21 +00:00
|
|
|
/**
|
|
|
|
* Leave an ECHO node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveEcho(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitInclude(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
/**
|
|
|
|
* Leave an INCLUDE node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveInclude(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
|
2012-01-27 20:15:33 +00:00
|
|
|
protected boolean visitMacroVar(CAstNode n, C c, CAstVisitor<C> visitor) { return visitor.visitNode(n, c, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
/**
|
|
|
|
* Leave an MACRO_VAR node.
|
|
|
|
* @param n the node to process
|
|
|
|
* @param c a visitor-specific context
|
|
|
|
*/
|
2012-01-27 20:15:33 +00:00
|
|
|
protected void leaveMacroVar(CAstNode n, C c, CAstVisitor<C> visitor) { visitor.leaveNode(n, c, visitor); }
|
2008-03-25 15:16:21 +00:00
|
|
|
|
2007-02-02 17:17:13 +00:00
|
|
|
}
|