1 /* valacodevisitor.vala
3 * Copyright (C) 2006-2010 Jürg Billeter
4 * Copyright (C) 2006-2008 Raffaele Sandrini
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * Jürg Billeter <j@bitron.ch>
22 * Raffaele Sandrini <raffaele@sandrini.ch>
28 * Abstract code node visitor for traversing source code tree.
30 public abstract class Vala
.CodeVisitor
{
32 * Visit operation called for source files.
34 * @param source_file a source file
36 public virtual void visit_source_file (SourceFile source_file
) {
40 * Visit operation called for namespaces.
42 * @param ns a namespace
44 public virtual void visit_namespace (Namespace ns
) {
48 * Visit operation called for classes.
52 public virtual void visit_class (Class cl
) {
56 * Visit operation called for structs.
60 public virtual void visit_struct (Struct st
) {
64 * Visit operation called for interfaces.
66 * @param iface an interface
68 public virtual void visit_interface (Interface iface
) {
72 * Visit operation called for enums.
76 public virtual void visit_enum (Enum en
) {
80 * Visit operation called for enum values.
82 * @param ev an enum value
84 public virtual void visit_enum_value (EnumValue ev
) {
88 * Visit operation called for error domains.
90 * @param edomain an error domain
92 public virtual void visit_error_domain (ErrorDomain edomain
) {
96 * Visit operation called for error codes.
98 * @param ecode an error code
100 public virtual void visit_error_code (ErrorCode ecode
) {
104 * Visit operation called for delegates.
106 * @param d a delegate
108 public virtual void visit_delegate (Delegate d
) {
112 * Visit operation called for constants.
114 * @param c a constant
116 public virtual void visit_constant (Constant c
) {
120 * Visit operation called for fields.
124 public virtual void visit_field (Field f
) {
128 * Visit operation called for methods.
132 public virtual void visit_method (Method m
) {
136 * Visit operation called for creation methods.
140 public virtual void visit_creation_method (CreationMethod m
) {
144 * Visit operation called for formal parameters.
146 * @param p a formal parameter
148 public virtual void visit_formal_parameter (Parameter p
) {
152 * Visit operation called for properties.
154 * @param prop a property
156 public virtual void visit_property (Property prop
) {
160 * Visit operation called for property accessors.
162 * @param acc a property accessor
164 public virtual void visit_property_accessor (PropertyAccessor acc
) {
168 * Visit operation called for signals.
170 * @param sig a signal
172 public virtual void visit_signal (Signal sig
) {
176 * Visit operation called for constructors.
178 * @param c a constructor
180 public virtual void visit_constructor (Constructor c
) {
184 * Visit operation called for destructors.
186 * @param d a destructor
188 public virtual void visit_destructor (Destructor d
) {
192 * Visit operation called for type parameters.
194 * @param p a type parameter
196 public virtual void visit_type_parameter (TypeParameter p
) {
200 * Visit operation called for using directives.
202 * @param ns a using directive
204 public virtual void visit_using_directive (UsingDirective ns
) {
208 * Visit operation called for type references.
210 * @param type a type reference
212 public virtual void visit_data_type (DataType type
) {
216 * Visit operation called for blocks.
220 public virtual void visit_block (Block b
) {
224 * Visit operation called for empty statements.
226 * @param stmt an empty statement
228 public virtual void visit_empty_statement (EmptyStatement stmt
) {
232 * Visit operation called for declaration statements.
234 * @param stmt a declaration statement
236 public virtual void visit_declaration_statement (DeclarationStatement stmt
) {
240 * Visit operation called for local variables.
242 * @param local a local variable
244 public virtual void visit_local_variable (LocalVariable local
) {
248 * Visit operation called for initializer lists
250 * @param list an initializer list
252 public virtual void visit_initializer_list (InitializerList list
) {
256 * Visit operation called for expression statements.
258 * @param stmt an expression statement
260 public virtual void visit_expression_statement (ExpressionStatement stmt
) {
264 * Visit operation called for if statements.
266 * @param stmt an if statement
268 public virtual void visit_if_statement (IfStatement stmt
) {
272 * Visit operation called for switch statements.
274 * @param stmt a switch statement
276 public virtual void visit_switch_statement (SwitchStatement stmt
) {
280 * Visit operation called for switch sections.
282 * @param section a switch section
284 public virtual void visit_switch_section (SwitchSection section
) {
288 * Visit operation called for switch label.
290 * @param label a switch label
292 public virtual void visit_switch_label (SwitchLabel label
) {
296 * Visit operation called for loops.
300 public virtual void visit_loop (Loop stmt
) {
304 * Visit operation called for while statements.
306 * @param stmt an while statement
308 public virtual void visit_while_statement (WhileStatement stmt
) {
312 * Visit operation called for do statements.
314 * @param stmt a do statement
316 public virtual void visit_do_statement (DoStatement stmt
) {
320 * Visit operation called for for statements.
322 * @param stmt a for statement
324 public virtual void visit_for_statement (ForStatement stmt
) {
328 * Visit operation called for foreach statements.
330 * @param stmt a foreach statement
332 public virtual void visit_foreach_statement (ForeachStatement stmt
) {
336 * Visit operation called for break statements.
338 * @param stmt a break statement
340 public virtual void visit_break_statement (BreakStatement stmt
) {
344 * Visit operation called for continue statements.
346 * @param stmt a continue statement
348 public virtual void visit_continue_statement (ContinueStatement stmt
) {
352 * Visit operation called for return statements.
354 * @param stmt a return statement
356 public virtual void visit_return_statement (ReturnStatement stmt
) {
360 * Visit operation called for yield statement.
362 * @param y a yield statement
364 public virtual void visit_yield_statement (YieldStatement y
) {
368 * Visit operation called for throw statements.
370 * @param stmt a throw statement
372 public virtual void visit_throw_statement (ThrowStatement stmt
) {
376 * Visit operation called for try statements.
378 * @param stmt a try statement
380 public virtual void visit_try_statement (TryStatement stmt
) {
384 * Visit operation called for catch clauses.
386 * @param clause a catch cluase
388 public virtual void visit_catch_clause (CatchClause clause
) {
392 * Visit operation called for lock statements before the body has been visited.
394 * @param stmt a lock statement
396 public virtual void visit_lock_statement (LockStatement stmt
) {
400 * Visit operation called for unlock statements.
402 * @param stmt an unlock statement
404 public virtual void visit_unlock_statement (UnlockStatement stmt
) {
408 * Visit operation called for delete statements.
410 * @param stmt a delete statement
412 public virtual void visit_delete_statement (DeleteStatement stmt
) {
416 * Visit operations called for expresions.
418 * @param expr an expression
420 public virtual void visit_expression (Expression expr
) {
424 * Visit operations called for array creation expresions.
426 * @param expr an array creation expression
428 public virtual void visit_array_creation_expression (ArrayCreationExpression expr
) {
432 * Visit operation called for boolean literals.
434 * @param lit a boolean literal
436 public virtual void visit_boolean_literal (BooleanLiteral lit
) {
440 * Visit operation called for character literals.
442 * @param lit a character literal
444 public virtual void visit_character_literal (CharacterLiteral lit
) {
448 * Visit operation called for integer literals.
450 * @param lit an integer literal
452 public virtual void visit_integer_literal (IntegerLiteral lit
) {
456 * Visit operation called for real literals.
458 * @param lit a real literal
460 public virtual void visit_real_literal (RealLiteral lit
) {
464 * Visit operation called for regex literals.
466 * @param lit a regex literal
468 public virtual void visit_regex_literal (RegexLiteral lit
) {
473 * Visit operation called for string literals.
475 * @param lit a string literal
477 public virtual void visit_string_literal (StringLiteral lit
) {
481 * Visit operation called for string templates.
483 * @param tmpl a string template
485 public virtual void visit_template (Template tmpl
) {
489 * Visit operation called for tuples.
491 * @param tuple a tuple
493 public virtual void visit_tuple (Tuple tuple
) {
497 * Visit operation called for null literals.
499 * @param lit a null literal
501 public virtual void visit_null_literal (NullLiteral lit
) {
505 * Visit operation called for member access expressions.
507 * @param expr a member access expression
509 public virtual void visit_member_access (MemberAccess expr
) {
513 * Visit operation called for invocation expressions.
515 * @param expr an invocation expression
517 public virtual void visit_method_call (MethodCall expr
) {
521 * Visit operation called for element access expressions.
523 * @param expr an element access expression
525 public virtual void visit_element_access (ElementAccess expr
) {
529 * Visit operation called for array slice expressions.
531 * @param expr an array slice expression
533 public virtual void visit_slice_expression (SliceExpression expr
) {
537 * Visit operation called for base access expressions.
539 * @param expr a base access expression
541 public virtual void visit_base_access (BaseAccess expr
) {
545 * Visit operation called for postfix expressions.
547 * @param expr a postfix expression
549 public virtual void visit_postfix_expression (PostfixExpression expr
) {
553 * Visit operation called for object creation expressions.
555 * @param expr an object creation expression
557 public virtual void visit_object_creation_expression (ObjectCreationExpression expr
) {
561 * Visit operation called for sizeof expressions.
563 * @param expr a sizeof expression
565 public virtual void visit_sizeof_expression (SizeofExpression expr
) {
569 * Visit operation called for typeof expressions.
571 * @param expr a typeof expression
573 public virtual void visit_typeof_expression (TypeofExpression expr
) {
577 * Visit operation called for unary expressions.
579 * @param expr an unary expression
581 public virtual void visit_unary_expression (UnaryExpression expr
) {
585 * Visit operation called for call expressions.
587 * @param expr a call expression
589 public virtual void visit_cast_expression (CastExpression expr
) {
593 * Visit operation called for named arguments.
595 * @param expr a named argument
597 public virtual void visit_named_argument (NamedArgument expr
) {
601 * Visit operation called for pointer indirections.
603 * @param expr a pointer indirection
605 public virtual void visit_pointer_indirection (PointerIndirection expr
) {
609 * Visit operation called for address-of expressions.
611 * @param expr an address-of expression
613 public virtual void visit_addressof_expression (AddressofExpression expr
) {
617 * Visit operation called for reference transfer expressions.
619 * @param expr a reference transfer expression
621 public virtual void visit_reference_transfer_expression (ReferenceTransferExpression expr
) {
625 * Visit operation called for binary expressions.
627 * @param expr a binary expression
629 public virtual void visit_binary_expression (BinaryExpression expr
) {
633 * Visit operation called for type checks.
635 * @param expr a type check expression
637 public virtual void visit_type_check (TypeCheck expr
) {
641 * Visit operation called for conditional expressions.
643 * @param expr a conditional expression
645 public virtual void visit_conditional_expression (ConditionalExpression expr
) {
649 * Visit operation called for lambda expressions.
651 * @param expr a lambda expression
653 public virtual void visit_lambda_expression (LambdaExpression expr
) {
657 * Visit operation called for assignments.
659 * @param a an assignment
661 public virtual void visit_assignment (Assignment a
) {
665 * Visit operation called at end of full expressions.
667 * @param expr a full expression
669 public virtual void visit_end_full_expression (Expression expr
) {