Example #1
0
		void Compiler::compile()
		{
#if 0 && defined DEBUG
			lexer.trace();
#endif
			Program* program = parser.parse();

			ABCTraitsTable* global_traits = ALLOC(ABCTraitsTable, (this));
			ABCMethodInfo* global_info = ALLOC(ABCMethodInfo, (this, abc.addString("script$init"), 0, NULL, 0));
			ABCMethodBodyInfo* global_body = ALLOC(ABCMethodBodyInfo, (this, global_info, global_traits, 1));
			program->cogen(&global_body->cogen);
			global_info->setFlags(global_body->getFlags() | MethodInfo::SETS_DXNS);

			ALLOC(ABCScriptInfo, (this, global_info, global_traits));

			global_body->clearTraits();		// the traits belong to the script, so don't emit them with the body too
			
			abc.serialize(context->obtainStorageForResult(abc.size()));
		}