1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00

ASTWriter needs to handle literal nodes.

This commit is contained in:
Markus Schorn 2008-07-21 10:45:15 +00:00
parent b6b73f1b19
commit 935b16e82c
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
/** /**
* Used for inserting literal code by means of the rewrite facility. The node * Used for inserting literal code by means of the rewrite facility. The node
@ -34,7 +35,10 @@ public class ASTLiteralNode implements IASTNode {
} }
public boolean accept(ASTVisitor visitor) { public boolean accept(ASTVisitor visitor) {
return false; if (visitor instanceof ASTWriterVisitor) {
((ASTWriterVisitor) visitor).visit(this);
}
return true;
} }
public boolean contains(IASTNode node) { public boolean contains(IASTNode node) {

View file

@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTLiteralNode;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap; import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/** /**
@ -134,6 +135,9 @@ public class ASTWriterVisitor extends CPPASTVisitor {
} }
} }
public void visit(ASTLiteralNode lit) {
scribe.print(lit.getRawSignature());
}
@Override @Override
public int visit(IASTName name) { public int visit(IASTName name) {