summaryrefslogtreecommitdiff
path: root/src/parser.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2014-12-25 16:02:14 -0500
committerAdrian Thurston <thurston@complang.org>2014-12-25 16:02:14 -0500
commite9a6e75710c42ab1a80c3cf54c5131e2bc4329e1 (patch)
tree1037ec581e8d9e88b46a3dd26812512cdc44bb48 /src/parser.cc
parent4bd915e48b6b6278ed8c4b7be95781535f2ce10a (diff)
downloadcolm-e9a6e75710c42ab1a80c3cf54c5131e2bc4329e1.tar.gz
converted the global object to a struct
Diffstat (limited to 'src/parser.cc')
-rw-r--r--src/parser.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/parser.cc b/src/parser.cc
index b7892480..1aeb3787 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -18,13 +18,17 @@ using std::endl;
void BaseParser::init()
{
/* Set up the root namespace. */
- Namespace *rootNamespace = createRootNamespace();
- pd->rootNamespace = rootNamespace;
+ pd->rootNamespace = createRootNamespace();
/* Set up the global object. */
String global = "global";
pd->globalObjectDef = ObjectDef::cons( ObjectDef::UserType,
global, pd->nextObjectId++ );
+
+ Context *context = new Context( internal, 0 );
+ pd->global = new StructDef( global, context );
+ pd->rootNamespace->structDefList.append( pd->global );
+ context->objectDef = pd->globalObjectDef;
/* Initialize the dictionary of graphs. This is our symbol table. The
* initialization needs to be done on construction which happens at the
@@ -894,7 +898,7 @@ void BaseParser::structHead( const InputLoc &loc, const String &data,
Context *context = new Context( loc, 0 );
contextStack.push( context );
- StructDef *structDef = new StructDef( data, context, nspace );
+ StructDef *structDef = new StructDef( data, context );
nspace->structDefList.append( structDef );
context->objectDef = ObjectDef::cons( objectType,