8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:03:04 +01:00

Remove kind field.

This commit is contained in:
Adriano dos Santos Fernandes 2017-09-13 16:14:58 +00:00
parent 01e0ab39bd
commit 96f2c92375
7 changed files with 47 additions and 24 deletions

View File

@ -285,9 +285,8 @@ public:
KIND_LIST
};
explicit DmlNode(MemoryPool& pool, Kind aKind)
: Node(pool),
kind(aKind)
explicit DmlNode(MemoryPool& pool)
: Node(pool)
{
}
@ -301,13 +300,11 @@ public:
}
public:
virtual Kind getKind() = 0;
virtual void genBlr(DsqlCompilerScratch* dsqlScratch) = 0;
virtual DmlNode* pass1(thread_db* tdbb, CompilerScratch* csb) = 0;
virtual DmlNode* pass2(thread_db* tdbb, CompilerScratch* csb) = 0;
virtual DmlNode* copy(thread_db* tdbb, NodeCopier& copier) const = 0;
public:
const Kind kind;
};
@ -460,8 +457,8 @@ public:
static const unsigned FLAG_DATE = 0x20;
static const unsigned FLAG_VALUE = 0x40; // Full value area required in impure space.
explicit ExprNode(Type aType, MemoryPool& pool, Kind aKind)
: DmlNode(pool, aKind),
explicit ExprNode(Type aType, MemoryPool& pool)
: DmlNode(pool),
type(aType),
nodFlags(0),
impureOffset(0),
@ -721,10 +718,15 @@ class BoolExprNode : public ExprNode
{
public:
BoolExprNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool, KIND_BOOLEAN)
: ExprNode(aType, pool)
{
}
virtual Kind getKind()
{
return KIND_BOOLEAN;
}
virtual BoolExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
ExprNode::dsqlPass(dsqlScratch);
@ -761,7 +763,7 @@ class ValueExprNode : public ExprNode
{
public:
ValueExprNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool, KIND_VALUE),
: ExprNode(aType, pool),
nodScale(0)
{
nodDesc.clear();
@ -770,6 +772,11 @@ public:
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const = 0;
virtual Kind getKind()
{
return KIND_VALUE;
}
virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
ExprNode::dsqlPass(dsqlScratch);
@ -1021,13 +1028,18 @@ public:
static const unsigned DFLAG_CURSOR = 0x40;
RecordSourceNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool, KIND_REC_SOURCE),
: ExprNode(aType, pool),
dsqlFlags(0),
dsqlContext(NULL),
stream(INVALID_STREAM)
{
}
virtual Kind getKind()
{
return KIND_REC_SOURCE;
}
virtual StreamType getStream() const
{
return stream;
@ -1110,10 +1122,15 @@ class ListExprNode : public ExprNode
{
public:
ListExprNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool, KIND_LIST)
: ExprNode(aType, pool)
{
}
virtual Kind getKind()
{
return KIND_LIST;
}
virtual void genBlr(DsqlCompilerScratch* /*dsqlScratch*/)
{
fb_assert(false);
@ -1399,7 +1416,7 @@ public:
public:
explicit StmtNode(Type aType, MemoryPool& pool)
: DmlNode(pool, KIND_STATEMENT),
: DmlNode(pool),
type(aType),
parentStmt(NULL),
impureOffset(0),
@ -1450,6 +1467,11 @@ public:
*node = (*node)->pass2(tdbb, csb);
}
virtual Kind getKind()
{
return KIND_STATEMENT;
}
virtual StmtNode* dsqlPass(DsqlCompilerScratch* dsqlScratch)
{
DmlNode::dsqlPass(dsqlScratch);

View File

@ -126,7 +126,7 @@ void GEN_expr(DsqlCompilerScratch* dsqlScratch, ExprNode* node)
const char* compatDialectVerb;
if (node->kind == DmlNode::KIND_VALUE && dsqlScratch->clientDialect == SQL_DIALECT_V6_TRANSITION &&
if (node->getKind() == DmlNode::KIND_VALUE && dsqlScratch->clientDialect == SQL_DIALECT_V6_TRANSITION &&
(compatDialectVerb = node->getCompatDialectVerb()))
{
dsc desc;

View File

@ -1412,7 +1412,7 @@ void PASS1_expand_select_node(DsqlCompilerScratch* dsqlScratch, ExprNode* node,
}
else
{
fb_assert(node->kind == DmlNode::KIND_VALUE);
fb_assert(node->getKind() == DmlNode::KIND_VALUE);
list->add(static_cast<ValueExprNode*>(node));
}
}

View File

@ -67,7 +67,7 @@ JrdStatement::JrdStatement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
makeSubRoutines(tdbb, this, csb, csb->subProcedures);
makeSubRoutines(tdbb, this, csb, csb->subFunctions);
topNode = (csb->csb_node->kind == DmlNode::KIND_STATEMENT) ?
topNode = (csb->csb_node->getKind() == DmlNode::KIND_STATEMENT) ?
static_cast<StmtNode*>(csb->csb_node) : NULL;
accessList = csb->csb_access;
@ -233,7 +233,7 @@ JrdStatement* JrdStatement::makeStatement(thread_db* tdbb, CompilerScratch* csb,
DmlNode::doPass1(tdbb, csb, fieldInfo.validationExpr.getAddress());
}
if (csb->csb_node->kind == DmlNode::KIND_STATEMENT)
if (csb->csb_node->getKind() == DmlNode::KIND_STATEMENT)
StmtNode::doPass2(tdbb, csb, reinterpret_cast<StmtNode**>(&csb->csb_node), NULL);
else
ExprNode::doPass2(tdbb, csb, &csb->csb_node);

View File

@ -1228,7 +1228,8 @@ const StmtNode* EXE_looper(thread_db* tdbb, jrd_req* request, const StmtNode* no
jrd_tra* sysTransaction = attachment->getSysTransaction();
Database* dbb = tdbb->getDatabase();
if (!node || node->kind != DmlNode::KIND_STATEMENT)
// ASF: It's already a StmtNode, so do not do a virtual call in execution.
if (!node) /// if (!node || node->getKind() != DmlNode::KIND_STATEMENT
BUGCHECK(147);
// Save the old pool and request to restore on exit

View File

@ -3856,7 +3856,7 @@ void MET_scan_relation(thread_db* tdbb, jrd_rel* relation)
if (rseNode)
{
fb_assert(rseNode->kind == DmlNode::KIND_REC_SOURCE);
fb_assert(rseNode->getKind() == DmlNode::KIND_REC_SOURCE);
relation->rel_view_rse = static_cast<RseNode*>(rseNode);
fb_assert(relation->rel_view_rse->type == RseNode::TYPE);
}

View File

@ -180,7 +180,7 @@ namespace
*tdbb->getDefaultPool());
DmlNode* relationNode = PAR_parse_node(tdbb, csb);
if (relationNode->kind != DmlNode::KIND_REC_SOURCE)
if (relationNode->getKind() != DmlNode::KIND_REC_SOURCE)
PAR_syntax_error(csb, "TABLE");
RelationSourceNode* relationSource = static_cast<RelationSourceNode*>(relationNode);
@ -1571,7 +1571,7 @@ BoolExprNode* PAR_parse_boolean(thread_db* tdbb, CompilerScratch* csb)
{
DmlNode* node = PAR_parse_node(tdbb, csb);
if (node->kind != DmlNode::KIND_BOOLEAN)
if (node->getKind() != DmlNode::KIND_BOOLEAN)
PAR_syntax_error(csb, "boolean");
return static_cast<BoolExprNode*>(node);
@ -1582,7 +1582,7 @@ ValueExprNode* PAR_parse_value(thread_db* tdbb, CompilerScratch* csb)
{
DmlNode* node = PAR_parse_node(tdbb, csb);
if (node->kind != DmlNode::KIND_VALUE)
if (node->getKind() != DmlNode::KIND_VALUE)
PAR_syntax_error(csb, "value");
return static_cast<ValueExprNode*>(node);
@ -1593,7 +1593,7 @@ StmtNode* PAR_parse_stmt(thread_db* tdbb, CompilerScratch* csb)
{
DmlNode* node = PAR_parse_node(tdbb, csb);
if (node->kind != DmlNode::KIND_STATEMENT)
if (node->getKind() != DmlNode::KIND_STATEMENT)
PAR_syntax_error(csb, "statement");
return static_cast<StmtNode*>(node);
@ -1650,7 +1650,7 @@ DmlNode* PAR_parse_node(thread_db* tdbb, CompilerScratch* csb)
DmlNode* node = blr_parsers[blr_operator](tdbb, *tdbb->getDefaultPool(), csb, blr_operator);
FB_SIZE_T pos = 0;
if (node->kind == DmlNode::KIND_STATEMENT && csb->csb_dbg_info->blrToSrc.find(blr_offset, pos))
if (node->getKind() == DmlNode::KIND_STATEMENT && csb->csb_dbg_info->blrToSrc.find(blr_offset, pos))
{
MapBlrToSrcItem& i = csb->csb_dbg_info->blrToSrc[pos];
StmtNode* stmt = static_cast<StmtNode*>(node);