Internals: Rename MethodCall. No functional change.

This commit is contained in:
Wilson Snyder 2019-11-17 08:51:25 -05:00
parent 09ca4ce791
commit 39eeda50c6
3 changed files with 15 additions and 15 deletions

View File

@ -1114,25 +1114,25 @@ public:
void fromp(AstNode* nodep) { setOp1p(nodep); } void fromp(AstNode* nodep) { setOp1p(nodep); }
}; };
class AstMethodSel : public AstNode { class AstMethodCall : public AstNode {
// A reference to a member task (or function) // A reference to a member task (or function)
// We do not support generic member calls yet, so this is only enough to // We do not support generic member calls yet, so this is only enough to
// make built-in methods work // make built-in methods work
private: private:
string m_name; // Name of variable string m_name; // Name of variable
public: public:
AstMethodSel(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name, AstNode* pinsp) AstMethodCall(FileLine* fl, AstNode* fromp, VFlagChildDType, const string& name, AstNode* pinsp)
: AstNode(fl), m_name(name) { : AstNode(fl), m_name(name) {
setOp1p(fromp); setOp1p(fromp);
dtypep(NULL); // V3Width will resolve dtypep(NULL); // V3Width will resolve
addNOp2p(pinsp); addNOp2p(pinsp);
} }
AstMethodSel(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp) AstMethodCall(FileLine* fl, AstNode* fromp, const string& name, AstNode* pinsp)
: AstNode(fl), m_name(name) { : AstNode(fl), m_name(name) {
setOp1p(fromp); setOp1p(fromp);
addNOp2p(pinsp); addNOp2p(pinsp);
} }
ASTNODE_NODE_FUNCS(MethodSel) ASTNODE_NODE_FUNCS(MethodCall)
virtual string name() const { return m_name; } // * = Var name virtual string name() const { return m_name; } // * = Var name
virtual void name(const string& name) { m_name = name; } virtual void name(const string& name) { m_name = name; }
AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing) AstNode* fromp() const { return op1p(); } // op1 = Extracting what (NULL=TBD during parsing)

View File

@ -2264,7 +2264,7 @@ private:
// EnumItemRef may be under a dot. Should already be resolved. // EnumItemRef may be under a dot. Should already be resolved.
iterateChildren(nodep); iterateChildren(nodep);
} }
virtual void visit(AstMethodSel* nodep) { virtual void visit(AstMethodCall* nodep) {
// Created here so should already be resolved. // Created here so should already be resolved.
DotStates lastStates = m_ds; DotStates lastStates = m_ds;
{ {
@ -2312,7 +2312,7 @@ private:
AstNode* varEtcp = m_ds.m_dotp->lhsp()->unlinkFrBack(); AstNode* varEtcp = m_ds.m_dotp->lhsp()->unlinkFrBack();
AstNode* argsp = NULL; AstNode* argsp = NULL;
if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext(); if (nodep->pinsp()) argsp = nodep->pinsp()->unlinkFrBackWithNext();
AstNode* newp = new AstMethodSel(nodep->fileline(), varEtcp, AstNode* newp = new AstMethodCall(nodep->fileline(), varEtcp,
VFlagChildDType(), nodep->name(), argsp); VFlagChildDType(), nodep->name(), argsp);
nodep->replaceWith(newp); nodep->replaceWith(newp);
pushDeletep(nodep); VL_DANGLING(nodep); pushDeletep(nodep); VL_DANGLING(nodep);

View File

@ -1592,7 +1592,7 @@ private:
|| VN_IS(fromDtp, BasicDType)) { || VN_IS(fromDtp, BasicDType)) {
// Method call on enum without following parenthesis, e.g. "ENUM.next" // Method call on enum without following parenthesis, e.g. "ENUM.next"
// Convert this into a method call, and let that visitor figure out what to do next // Convert this into a method call, and let that visitor figure out what to do next
AstNode* newp = new AstMethodSel(nodep->fileline(), AstNode* newp = new AstMethodCall(nodep->fileline(),
nodep->fromp()->unlinkFrBack(), nodep->name(), NULL); nodep->fromp()->unlinkFrBack(), nodep->name(), NULL);
nodep->replaceWith(newp); nodep->replaceWith(newp);
pushDeletep(nodep); VL_DANGLING(nodep); pushDeletep(nodep); VL_DANGLING(nodep);
@ -1629,7 +1629,7 @@ private:
} }
} }
virtual void visit(AstMethodSel* nodep) { virtual void visit(AstMethodCall* nodep) {
UINFO(5," METHODSEL "<<nodep<<endl); UINFO(5," METHODSEL "<<nodep<<endl);
if (debug()>=9) nodep->dumpTree("-mts-in: "); if (debug()>=9) nodep->dumpTree("-mts-in: ");
// Should check types the method requires, but at present we don't do much // Should check types the method requires, but at present we don't do much
@ -1659,7 +1659,7 @@ private:
<<"' which is a '"<<nodep->fromp()->dtypep()->prettyTypeName()<<"'"); <<"' which is a '"<<nodep->fromp()->dtypep()->prettyTypeName()<<"'");
} }
} }
void methodOkArguments(AstMethodSel* nodep, int minArg, int maxArg) { void methodOkArguments(AstMethodCall* nodep, int minArg, int maxArg) {
int narg = 0; int narg = 0;
for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) { for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) {
++narg; ++narg;
@ -1684,7 +1684,7 @@ private:
} }
} }
void methodCallEnum(AstMethodSel* nodep, AstEnumDType* adtypep) { void methodCallEnum(AstMethodCall* nodep, AstEnumDType* adtypep) {
// Method call on enum without following parenthesis, e.g. "ENUM.next" // Method call on enum without following parenthesis, e.g. "ENUM.next"
// Convert this into a method call, and let that visitor figure out what to do next // Convert this into a method call, and let that visitor figure out what to do next
if (adtypep) {} if (adtypep) {}
@ -1764,7 +1764,7 @@ private:
nodep->v3error("Unknown built-in enum method " << nodep->prettyNameQ()); nodep->v3error("Unknown built-in enum method " << nodep->prettyNameQ());
} }
} }
void methodCallUnpack(AstMethodSel* nodep, AstUnpackArrayDType* adtypep) { void methodCallUnpack(AstMethodCall* nodep, AstUnpackArrayDType* adtypep) {
enum { UNKNOWN = 0, ARRAY_OR, ARRAY_AND, ARRAY_XOR } methodId; enum { UNKNOWN = 0, ARRAY_OR, ARRAY_AND, ARRAY_XOR } methodId;
methodId = UNKNOWN; methodId = UNKNOWN;
@ -1796,7 +1796,7 @@ private:
nodep->v3error("Unknown built-in array method " << nodep->prettyNameQ()); nodep->v3error("Unknown built-in array method " << nodep->prettyNameQ());
} }
} }
void methodCallString(AstMethodSel* nodep, AstBasicDType* adtypep) { void methodCallString(AstMethodCall* nodep, AstBasicDType* adtypep) {
// Method call on string // Method call on string
if (nodep->name() == "len") { if (nodep->name() == "len") {
// Constant value // Constant value
@ -3886,7 +3886,7 @@ private:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// METHODS - strings // METHODS - strings
void replaceWithSFormat(AstMethodSel* nodep, const string& format) { void replaceWithSFormat(AstMethodCall* nodep, const string& format) {
// For string.itoa and similar, replace with SFormatF // For string.itoa and similar, replace with SFormatF
AstArg* argp = VN_CAST(nodep->pinsp(), Arg); AstArg* argp = VN_CAST(nodep->pinsp(), Arg);
if (!argp) { if (!argp) {