diff options
author | Adrian Thurston <thurston@complang.org> | 2015-01-03 10:47:51 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-01-03 10:47:51 -0500 |
commit | 7d983b551cd369a81ba87ac9be5b5b2d8f1eba4e (patch) | |
tree | 971e2be7aea6eeb268c3acd588ba31208517992d /src/parser.cc | |
parent | 897837b2f4690fc08a32c6b2eea0f621ac0623bf (diff) | |
download | colm-7d983b551cd369a81ba87ac9be5b5b2d8f1eba4e.tar.gz |
merged StructDef and Context structs
Diffstat (limited to 'src/parser.cc')
-rw-r--r-- | src/parser.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/parser.cc b/src/parser.cc index 5c316aa6..c1fd9ad1 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -25,8 +25,7 @@ void BaseParser::init() pd->globalObjectDef = ObjectDef::cons( ObjectDef::UserType, global, pd->nextObjectId++ ); - Context *context = new Context( internal, pd->globalObjectDef ); - pd->global = new StructDef( global, context ); + pd->global = new Context( internal, global, pd->globalObjectDef ); pd->rootNamespace->structDefList.append( pd->global ); /* Setup the stream object. */ @@ -34,12 +33,10 @@ void BaseParser::init() ObjectDef *objectDef = ObjectDef::cons( ObjectDef::BuiltinType, global, pd->nextObjectId++ ); - context = new Context( internal, objectDef ); - pd->stream = new StructDef( global, context ); + pd->stream = new Context( internal, global, objectDef ); StructEl *sel = declareStruct( pd, pd->rootNamespace, - pd->stream->name, pd->stream->context ); - sel->context = pd->stream->context; + pd->stream->name, pd->stream ); /* Insert the name into the top of the region stack after popping the * region just created. We need it in the parent. */ @@ -901,12 +898,10 @@ void BaseParser::structHead( const InputLoc &loc, const String &data, ObjectDef *objectDef = ObjectDef::cons( objectType, data, pd->nextObjectId++ ); - Context *context = new Context( loc, objectDef ); + Context *context = new Context( loc, data, objectDef ); contextStack.push( context ); - StructDef *structDef = new StructDef( data, context ); - nspace->structDefList.append( structDef ); - + nspace->structDefList.append( context ); } StmtList *BaseParser::appendStatement( StmtList *stmtList, LangStmt *stmt ) |