|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| SimpleMethodCall.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* | |
| 2 | * DynamicJava - Copyright (C) 1999-2001 | |
| 3 | * | |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | * copy of this software and associated documentation files | |
| 6 | * (the "Software"), to deal in the Software without restriction, including | |
| 7 | * without limitation the rights to use, copy, modify, merge, publish, | |
| 8 | * distribute, sublicense, and/or sell copies of the Software, and to permit | |
| 9 | * persons to whom the Software is furnished to do so, subject to the | |
| 10 | * following conditions: | |
| 11 | * The above copyright notice and this permission notice shall be included | |
| 12 | * in all copies or substantial portions of the Software. | |
| 13 | * | |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
| 17 | * IN NO EVENT SHALL DYADE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
| 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 20 | * DEALINGS IN THE SOFTWARE. | |
| 21 | * | |
| 22 | * Except as contained in this notice, the name of Dyade shall not be | |
| 23 | * used in advertising or otherwise to promote the sale, use or other | |
| 24 | * dealings in this Software without prior written authorization from | |
| 25 | * Dyade. | |
| 26 | * | |
| 27 | */ | |
| 28 | ||
| 29 | package koala.dynamicjava.tree; | |
| 30 | ||
| 31 | import java.util.*; | |
| 32 | ||
| 33 | import edu.rice.cs.plt.tuple.Option; | |
| 34 | ||
| 35 | import koala.dynamicjava.tree.visitor.*; | |
| 36 | ||
| 37 | /** | |
| 38 | * This class represents the function call nodes of the syntax tree. | |
| 39 | * For example: "foo(x, y+3)" | |
| 40 | * | |
| 41 | * @author Stephane Hillion | |
| 42 | * @version 1.0 - 1999/10/18 | |
| 43 | */ | |
| 44 | ||
| 45 | public class SimpleMethodCall extends MethodCall { | |
| 46 | /** | |
| 47 | * Creates a new node | |
| 48 | * @param mn the function name | |
| 49 | * @param args the arguments. Can be null. | |
| 50 | * @exception IllegalArgumentException if mn is null | |
| 51 | */ | |
| 52 | 112 | public SimpleMethodCall(String mn, List<Expression> args, SourceInfo si) { |
| 53 | 112 | this(Option.<List<TypeName>>none(), mn, args, si); |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * Creates a new node | |
| 58 | * @param targs type arguments | |
| 59 | * @param mn the function name | |
| 60 | * @param args the arguments. Can be null. | |
| 61 | * @exception IllegalArgumentException if mn is null | |
| 62 | */ | |
| 63 | 112 | public SimpleMethodCall(Option<List<TypeName>> targs, String mn, List<Expression> args, |
| 64 | SourceInfo si) { | |
| 65 | 112 | super(targs, mn, args, si); |
| 66 | } | |
| 67 | ||
| 68 | /** | |
| 69 | * Allows a visitor to traverse the tree | |
| 70 | * @param visitor the visitor to accept | |
| 71 | */ | |
| 72 | 216 | public <T> T acceptVisitor(Visitor<T> visitor) { |
| 73 | 216 | return visitor.visit(this); |
| 74 | } | |
| 75 | /** | |
| 76 | * Implementation of toString for use in unit testing | |
| 77 | */ | |
| 78 | 4 | public String toString() { |
| 79 | 4 | return "("+getClass().getName()+": "+getTypeArgs()+" "+getMethodName()+" "+getArguments()+")"; |
| 80 | } | |
| 81 | } |
|
||||||||||