001/*
002 * Copyright (c) 2012-2017 Institut National des Sciences Appliquées de Lyon (INSA-Lyon)
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 */
009
010package org.eclipse.golo.compiler.ir;
011
012/**
013 * Abstract IR Visitor.
014 * <p>
015 * This visitor walk the IR tree, but do nothing. It can be used to implement specific IR
016 * visitors by overriding only the specific methods, like for example the ones used in the
017 * compilation check and transformation step.
018 */
019
020public abstract class AbstractGoloIrVisitor implements GoloIrVisitor {
021
022  /**
023   * @inheritDoc
024   */
025  @Override
026  public void visitModule(GoloModule module) {
027    module.walk(this);
028  }
029
030  /**
031   * @inheritDoc
032   */
033  @Override
034  public void visitModuleImport(ModuleImport moduleImport) {
035    moduleImport.walk(this);
036  }
037
038  /**
039   * @inheritDoc
040   */
041  @Override
042  public void visitStruct(Struct struct) {
043    struct.walk(this);
044  }
045
046  /**
047   * @inheritDoc
048   */
049  @Override
050  public void visitUnion(Union union) {
051    union.walk(this);
052  }
053
054  /**
055   * @inheritDoc
056   */
057  @Override
058  public void visitUnionValue(UnionValue value) {
059    value.walk(this);
060  }
061
062  /**
063   * @inheritDoc
064   */
065  @Override
066  public void visitAugmentation(Augmentation augment) {
067    augment.walk(this);
068  }
069
070  /**
071   * @inheritDoc
072   */
073  @Override
074  public void visitNamedAugmentation(NamedAugmentation augment) {
075    augment.walk(this);
076  }
077
078  /**
079   * @inheritDoc
080   */
081  @Override
082  public void visitFunction(GoloFunction function) {
083    function.walk(this);
084  }
085
086  /**
087   * @inheritDoc
088   */
089  @Override
090  public void visitDecorator(Decorator decorator) {
091    decorator.walk(this);
092  }
093
094  /**
095   * @inheritDoc
096   */
097  @Override
098  public void visitBlock(Block block) {
099    block.walk(this);
100  }
101
102  /**
103   * @inheritDoc
104   */
105  @Override
106  public void visitConstantStatement(ConstantStatement constantStatement) {
107    constantStatement.walk(this);
108  }
109
110  /**
111   * @inheritDoc
112   */
113  @Override
114  public void visitReturnStatement(ReturnStatement returnStatement) {
115    returnStatement.walk(this);
116  }
117
118  /**
119   * @inheritDoc
120   */
121  @Override
122  public void visitFunctionInvocation(FunctionInvocation functionInvocation) {
123    functionInvocation.walk(this);
124  }
125
126  /**
127   * @inheritDoc
128   */
129  @Override
130  public void visitMethodInvocation(MethodInvocation methodInvocation) {
131    methodInvocation.walk(this);
132  }
133
134  /**
135   * @inheritDoc
136   */
137  @Override
138  public void visitAssignmentStatement(AssignmentStatement assignmentStatement) {
139    assignmentStatement.walk(this);
140  }
141
142  /**
143   * @inheritDoc
144   */
145  @Override
146  public void visitDestructuringAssignment(DestructuringAssignment assignment) {
147    assignment.walk(this);
148  }
149
150  /**
151   * @inheritDoc
152   */
153  @Override
154  public void visitReferenceLookup(ReferenceLookup referenceLookup) {
155    referenceLookup.walk(this);
156  }
157
158  /**
159   * @inheritDoc
160   */
161  @Override
162  public void visitConditionalBranching(ConditionalBranching conditionalBranching) {
163    conditionalBranching.walk(this);
164  }
165
166  /**
167   * @inheritDoc
168   */
169  @Override
170  public void visitBinaryOperation(BinaryOperation binaryOperation) {
171    binaryOperation.walk(this);
172  }
173
174  /**
175   * @inheritDoc
176   */
177  @Override
178  public void visitUnaryOperation(UnaryOperation unaryOperation) {
179    unaryOperation.walk(this);
180  }
181
182  /**
183   * @inheritDoc
184   */
185  @Override
186  public void visitLoopStatement(LoopStatement loopStatement) {
187    loopStatement.walk(this);
188  }
189
190  /**
191   * @inheritDoc
192   */
193  @Override
194  public void visitForEachLoopStatement(ForEachLoopStatement foreachStatement) {
195    foreachStatement.walk(this);
196  }
197
198  /**
199   * @inheritDoc
200   */
201  @Override
202  public void visitCaseStatement(CaseStatement caseStatement) {
203    caseStatement.walk(this);
204  }
205
206  /**
207   * @inheritDoc
208   */
209  @Override
210  public void visitMatchExpression(MatchExpression matchExpression) {
211    matchExpression.walk(this);
212  }
213
214  /**
215   * @inheritDoc
216   */
217  @Override
218  public void visitWhenClause(WhenClause<?> whenClause) {
219    whenClause.walk(this);
220  }
221
222  /**
223   * @inheritDoc
224   */
225  @Override
226  public void visitThrowStatement(ThrowStatement throwStatement) {
227    throwStatement.walk(this);
228  }
229
230  /**
231   * @inheritDoc
232   */
233  @Override
234  public void visitTryCatchFinally(TryCatchFinally tryCatchFinally) {
235    tryCatchFinally.walk(this);
236  }
237
238  /**
239   * @inheritDoc
240   */
241  @Override
242  public void visitClosureReference(ClosureReference closureReference) {
243    closureReference.walk(this);
244  }
245
246  /**
247   * @inheritDoc
248   */
249  @Override
250  public void visitLoopBreakFlowStatement(LoopBreakFlowStatement loopBreakFlowStatement) {
251    loopBreakFlowStatement.walk(this);
252  }
253
254  /**
255   * @inheritDoc
256   */
257  @Override
258  public void visitCollectionLiteral(CollectionLiteral collectionLiteral) {
259    collectionLiteral.walk(this);
260  }
261
262  /**
263   * @inheritDoc
264   */
265  @Override
266  public void visitCollectionComprehension(CollectionComprehension collectionComprehension) {
267    collectionComprehension.walk(this);
268  }
269
270  /**
271   * @inheritDoc
272   */
273  @Override
274  public void visitNamedArgument(NamedArgument namedArgument) {
275    namedArgument.walk(this);
276  }
277
278  /**
279   * @inheritDoc
280   */
281  @Override
282  public void visitLocalReference(LocalReference localRef) {
283    localRef.walk(this);
284  }
285
286  /**
287   * @inheritDoc
288   */
289  @Override
290  public void visitMember(Member member) {
291    member.walk(this);
292  }
293
294}