/*******************************************************************************
* Copyright (c) 2013 Bruno Medeiros and other Contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Bruno Medeiros - initial API and implementation
*******************************************************************************/
package dtool.ast.declarations;
import melnorme.lang.tooling.ast.CommonASTNode;
import melnorme.lang.tooling.ast.IASTVisitor;
import melnorme.lang.tooling.ast.util.ASTCodePrinter;
import melnorme.lang.tooling.ast_actual.ASTNode;
import melnorme.lang.tooling.ast_actual.ASTNodeTypes;
import dtool.ast.declarations.AbstractConditionalDeclaration.VersionSymbol;
/**
* Debug/Version specification declaration
*/
public class DeclarationDebugVersionSpec extends ASTNode implements IDeclaration {
public final boolean isDebug;
public final VersionSymbol value;
public DeclarationDebugVersionSpec(boolean isDebug, VersionSymbol value) {
this.isDebug = isDebug;
this.value = parentize(value);
}
@Override
public ASTNodeTypes getNodeType() {
return ASTNodeTypes.DECLARATION_DEBUG_VERSION_SPEC;
}
@Override
public void visitChildren(IASTVisitor visitor) {
acceptVisitor(visitor, value);
}
@Override
protected CommonASTNode doCloneTree() {
return new DeclarationDebugVersionSpec(isDebug, clone(value));
}
@Override
public void toStringAsCode(ASTCodePrinter cp) {
cp.append(isDebug ? "debug = " : "version = ");
cp.append(value);
cp.append(";");
}
}