1 32 package org.jruby.ast; 33 34 import java.util.List ; 35 36 import org.jruby.ast.types.INameNode; 37 import org.jruby.ast.visitor.NodeVisitor; 38 import org.jruby.evaluator.Instruction; 39 import org.jruby.lexer.yacc.ISourcePosition; 40 import org.jruby.parser.StaticScope; 41 import org.jruby.runtime.Visibility; 42 43 48 public class DefnNode extends MethodDefNode implements INameNode { 49 static final long serialVersionUID = -7634791007500033454L; 50 51 private final Visibility visibility; 52 53 public DefnNode(ISourcePosition position, ArgumentNode nameNode, ArgsNode argsNode, 54 StaticScope scope, Node bodyNode, Visibility visibility) { 55 super(position, nameNode, argsNode, scope, bodyNode, NodeTypes.DEFNNODE); 56 57 this.visibility = visibility; 58 } 59 60 public Instruction accept(NodeVisitor iVisitor) { 61 return iVisitor.visitDefnNode(this); 62 } 63 64 68 public Visibility getVisibility() { 69 return visibility; 70 } 71 72 75 public String getName() { 76 return nameNode.getName(); 77 } 78 79 public List childNodes() { 80 return Node.createList(nameNode, argsNode, bodyNode); 81 } 82 } 83 | Popular Tags |