/** * @author Alberto DEMICHELIS * @author Edouard DUPIN * @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2003-2017, Alberto DEMICHELIS, all right reserved * @license MPL-2 (see license file) */ #pragma once #include #include #include #include #include namespace rabbit { class FuncState { public: FuncState(rabbit::SharedState *ss,rabbit::FuncState *parent,compilererrorFunc efunc,void *ed); ~FuncState(); #ifdef _DEBUG_DUMP void dump(rabbit::FunctionProto *func); #endif void error(const char *err); FuncState *pushChildState(rabbit::SharedState *ss); void popChildState(); void addInstruction(SQOpcode _op,int64_t arg0=0,int64_t arg1=0,int64_t arg2=0,int64_t arg3=0); void addInstruction(rabbit::Instruction &i); void setIntructionParams(int64_t pos,int64_t arg0,int64_t arg1,int64_t arg2=0,int64_t arg3=0); void setIntructionParam(int64_t pos,int64_t arg,int64_t val); rabbit::Instruction &getInstruction(int64_t pos){return _instructions[pos];} void popInstructions(int64_t size){for(int64_t i=0;i _vlocals; etk::Vector _targetstack; int64_t _stacksize; bool _varparams; bool _bgenerator; etk::Vector _unresolvedbreaks; etk::Vector _unresolvedcontinues; etk::Vector _functions; etk::Vector _parameters; etk::Vector _outervalues; etk::Vector _instructions; etk::Vector _localvarinfos; rabbit::ObjectPtr _literals; rabbit::ObjectPtr _strings; rabbit::ObjectPtr _name; rabbit::ObjectPtr _sourcename; int64_t _nliterals; etk::Vector _lineinfos; FuncState *_parent; etk::Vector _scope_blocks; etk::Vector _breaktargets; etk::Vector _continuetargets; etk::Vector _defaultparams; int64_t _lastline; int64_t _traps; //contains number of nested exception traps int64_t _outers; bool _optimization; rabbit::SharedState *_sharedstate; etk::Vector _childstates; int64_t getConstant(const rabbit::Object &cons); private: compilererrorFunc _errfunc; void *_errtarget; rabbit::SharedState *_ss; }; }