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