From c158d3cb4772a37b1ebb6e77d92341658b76ff44 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 14 Dec 2014 15:43:42 -0500 Subject: added struct, struct field and corresponding instructions Can new and set/get the fields of a struct. Still using underlying tree object to implement. --- src/parser.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/parser.cc') diff --git a/src/parser.cc b/src/parser.cc index 78f8df95..264508cd 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -869,7 +869,8 @@ void BaseParser::contextVarDef( const InputLoc &loc, ObjectField *objField ) object->rootScope->insertField( objField->name, objField ); } -void BaseParser::contextHead( const InputLoc &loc, const String &data ) +void BaseParser::contextHead( const InputLoc &loc, const String &data, + ObjectDef::Type objectType ) { /* Make the new namespace. */ Namespace *nspace = createNamespace( loc, data ); @@ -880,7 +881,7 @@ void BaseParser::contextHead( const InputLoc &loc, const String &data ) ContextDef *contextDef = new ContextDef( data, context, nspace ); nspace->contextDefList.append( contextDef ); - context->objectDef = ObjectDef::cons( ObjectDef::UserType, + context->objectDef = ObjectDef::cons( objectType, data, pd->nextObjectId++ ); } -- cgit v1.2.1