*developing lambda.

This commit is contained in:
paladin-t 2016-01-06 16:43:00 +08:00
parent f2b42770bd
commit ec695b5d5f
2 changed files with 4 additions and 1 deletions

View File

@ -417,6 +417,7 @@ typedef enum _invokable_e {
#ifdef MB_ENABLE_LAMBDA #ifdef MB_ENABLE_LAMBDA
typedef struct _running_context_ref_t { typedef struct _running_context_ref_t {
_ref_t ref; _ref_t ref;
struct _running_context_ref_t* prev;
struct _running_context_t* running; struct _running_context_t* running;
} _running_context_ref_t; } _running_context_ref_t;
#endif /* MB_ENABLE_LAMBDA */ #endif /* MB_ENABLE_LAMBDA */
@ -11455,6 +11456,7 @@ int _core_lambda(mb_interpreter_t* s, void** l) {
if(!routine->func.lambda.parameters) if(!routine->func.lambda.parameters)
routine->func.lambda.parameters = _ls_create(); routine->func.lambda.parameters = _ls_create();
_ls_pushback(routine->func.lambda.parameters, v); _ls_pushback(routine->func.lambda.parameters, v);
/* TODO: Add lambda parameters */
ast = (_ls_node_t*)*l; ast = (_ls_node_t*)*l;
if(_IS_FUNC(ast->data, _core_close_bracket)) if(_IS_FUNC(ast->data, _core_close_bracket))
@ -11479,6 +11481,7 @@ int _core_lambda(mb_interpreter_t* s, void** l) {
brackets++; brackets++;
else if(_IS_FUNC(ast->data, _core_close_bracket)) else if(_IS_FUNC(ast->data, _core_close_bracket))
brackets--; brackets--;
/* TODO: Mark upvalues */
ast = ast->next; ast = ast->next;
} }
*l = ast; *l = ast;

View File

@ -90,7 +90,7 @@ extern "C" {
#endif /* MB_ENABLE_CLASS */ #endif /* MB_ENABLE_CLASS */
#ifndef MB_ENABLE_LAMBDA #ifndef MB_ENABLE_LAMBDA
# define MB_ENABLE_LAMBDA # define MB_ENABLE_LAMBDA /* The Lambda is still under development */
#endif /* MB_ENABLE_LAMBDA */ #endif /* MB_ENABLE_LAMBDA */
#ifndef MB_COMPACT_MODE #ifndef MB_COMPACT_MODE