blob: 7b9cdae7ffef7830865703882bdef3b8174ff91e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2016 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.ruby.ast;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.ASTVisitor;
import org.eclipse.dltk.ast.declarations.TypeDeclaration;
import org.eclipse.dltk.ast.statements.Block;
public class RubyModuleDeclaration extends TypeDeclaration {
private ASTNode name;
public RubyModuleDeclaration(ASTNode name, Block body, int start, int end) {
super(RubyASTUtil.resolveClassName(name), name.sourceStart(), name
.sourceEnd(), start, end);
this.name = name;
this.fBody = body;
setStart(start);
setEnd(end);
}
public ASTNode getClassName() {
return name;
}
@Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
if (name != null) {
if (visitor instanceof IRubyASTVisitor) {
((IRubyASTVisitor) visitor).visitTypeName(name);
} else {
name.traverse(visitor);
}
}
if (this.getBody() != null) {
getBody().traverse(visitor);
}
visitor.endvisit(this);
}
}
@Override
public String resolveSuperClassReference(ASTNode node) {
return RubyASTUtil.resolveClassName(node);
}
}