summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-12-31 10:41:10 -0500
committerAdrian Thurston <thurston@complang.org>2013-12-31 10:41:36 -0500
commitfc1d502d70df74114c8edff5c7ce808895f156f9 (patch)
treee9695c23d38a7b2101c4fe600b51e774044726e4 /src
parentd863c7b048a81e49263d66e6c831100d8d334ab6 (diff)
downloadcolm-fc1d502d70df74114c8edff5c7ce808895f156f9.tar.gz
use Form as name for AST node types in QualItem
Diffstat (limited to 'src')
-rw-r--r--src/consinit.cc2
-rw-r--r--src/loadcolm.cc4
-rw-r--r--src/loadinit.cc2
-rw-r--r--src/parsetree.h8
-rw-r--r--src/resolve.cc1
-rw-r--r--src/synthesis.cc12
6 files changed, 14 insertions, 15 deletions
diff --git a/src/consinit.cc b/src/consinit.cc
index 6a3d3d30..e056d797 100644
--- a/src/consinit.cc
+++ b/src/consinit.cc
@@ -743,7 +743,7 @@ void ConsInit::parseInput( StmtList *stmtList )
/* Pop argv, this yields the file name . */
CallArgVect *popArgs = new CallArgVect;
QualItemVect *popQual = new QualItemVect;
- popQual->append( QualItem( internal, String( "argv" ), QualItem::Dot ) );
+ popQual->append( QualItem( QualItem::Dot, internal, String( "argv" ) ) );
LangVarRef *popRef = LangVarRef::cons( internal, popQual, String("pop") );
LangExpr *pop = LangExpr::cons( LangTerm::cons( InputLoc(), popRef, popArgs ) );
diff --git a/src/loadcolm.cc b/src/loadcolm.cc
index 9bb8355b..f09cc4ac 100644
--- a/src/loadcolm.cc
+++ b/src/loadcolm.cc
@@ -1130,8 +1130,8 @@ struct LoadColm
case qual::_Arrow: {
qualItemVect = walkQual( RecQual );
String id = Qual.id().data();
- QualItem::Type type = Qual.DOT() != 0 ? QualItem::Dot : QualItem::Arrow;
- qualItemVect->append( QualItem( Qual.id().loc(), id, type ) );
+ QualItem::Form form = Qual.DOT() != 0 ? QualItem::Dot : QualItem::Arrow;
+ qualItemVect->append( QualItem( form, Qual.id().loc(), id ) );
break;
}
case qual::_Base: {
diff --git a/src/loadinit.cc b/src/loadinit.cc
index 827d3737..b594fc57 100644
--- a/src/loadinit.cc
+++ b/src/loadinit.cc
@@ -283,7 +283,7 @@ void LoadInit::consParseStmt( StmtList *stmtList )
/* Pop argv, this yields the file name . */
CallArgVect *popArgs = new CallArgVect;
QualItemVect *popQual = new QualItemVect;
- popQual->append( QualItem( internal, String( "argv" ), QualItem::Dot ) );
+ popQual->append( QualItem( QualItem::Dot, internal, String( "argv" ) ) );
LangVarRef *popRef = LangVarRef::cons( internal, popQual, String("pop") );
LangExpr *pop = LangExpr::cons( LangTerm::cons( InputLoc(), popRef, popArgs ) );
diff --git a/src/parsetree.h b/src/parsetree.h
index 87d9ffc9..bc863c12 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -2480,14 +2480,14 @@ struct VarRefLookup
struct QualItem
{
- enum Type { Dot, Arrow };
+ enum Form { Dot, Arrow };
- QualItem( const InputLoc &loc, const String &data, Type type )
- : loc(loc), data(data), type(type) {}
+ QualItem( Form form, const InputLoc &loc, const String &data )
+ : form(form), loc(loc), data(data) {}
+ Form form;
InputLoc loc;
String data;
- Type type;
};
typedef Vector<QualItem> QualItemVect;
diff --git a/src/resolve.cc b/src/resolve.cc
index e819a8bf..5ee577a8 100644
--- a/src/resolve.cc
+++ b/src/resolve.cc
@@ -517,7 +517,6 @@ void LangStmt::resolve( Compiler *pd ) const
}
case AssignType: {
/* Evaluate the exrepssion. */
-// cout << "Assign Type" << endl;
expr->resolve( pd );
break;
}
diff --git a/src/synthesis.cc b/src/synthesis.cc
index 9519edce..da63d262 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -482,7 +482,7 @@ long LangVarRef::loadQualificationRefs( Compiler *pd, CodeVect &code ) const
if ( elUT->typeId == TYPE_ITER )
elUT = el->typeRef->searchUniqueType;
- assert( qi->type == QualItem::Dot );
+ assert( qi->form == QualItem::Dot );
searchObjDef = objDefFromUT( pd, elUT );
count += 1;
@@ -528,13 +528,13 @@ void LangVarRef::loadQualification( Compiler *pd, CodeVect &code,
UniqueType *qualUT = loadFieldInstr( pd, code, searchObjDef,
el, lfForWriting, lfRevert );
- if ( qi->type == QualItem::Dot ) {
+ if ( qi->form == QualItem::Dot ) {
/* Cannot a reference. Iterator yes (access of the iterator not
* hte current) */
if ( qualUT->typeId == TYPE_PTR )
error(loc) << "dot cannot be used to access a pointer" << endp;
}
- else if ( qi->type == QualItem::Arrow ) {
+ else if ( qi->form == QualItem::Arrow ) {
if ( qualUT->typeId == TYPE_PTR ) {
/* Always dereference references when used for qualification. If
* this is the last one then we must start with the reverse
@@ -714,13 +714,13 @@ VarRefLookup LangVarRef::lookupQualification( Compiler *pd, ObjectDef *rootDef )
if ( qualUT->typeId == TYPE_PTR )
lastPtrInQual = qi.pos();
- if ( qi->type == QualItem::Dot ) {
+ if ( qi->form == QualItem::Dot ) {
/* Cannot dot a reference. Iterator yes (access of the iterator
* not the current) */
if ( qualUT->typeId == TYPE_PTR )
error(loc) << "dot cannot be used to access a pointer" << endp;
}
- else if ( qi->type == QualItem::Arrow ) {
+ else if ( qi->form == QualItem::Arrow ) {
if ( qualUT->typeId == TYPE_ITER )
qualUT = el->typeRef->searchUniqueType;
else if ( qualUT->typeId == TYPE_PTR )
@@ -777,7 +777,7 @@ VarRefLookup LangVarRef::lookupMethod( Compiler *pd )
if ( method == 0 ) {
/* Not found as a method, try it as an object on which we will call a
* default function. */
- qual->append( QualItem( loc, name, QualItem::Dot ) );
+ qual->append( QualItem( QualItem::Dot, loc, name ) );
/* Lookup the object that the field is in. */
VarRefLookup lookup = lookupObj( pd );