Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Commit

Permalink
ensure final variable for immutable parameter in function and method
Browse files Browse the repository at this point in the history
  • Loading branch information
Thecarisma committed May 16, 2019
1 parent 43dc253 commit a45eb99
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 85 deletions.
6 changes: 2 additions & 4 deletions examples/basic/BareClass_1.sim
Original file line number Diff line number Diff line change
@@ -1,8 1,7 @@

class String
class Int

/*class SampleString
class String

var Value:String
var Length:Int
Expand All @@ -23,5 22,4 @@ class Int
end
end

end
*/
end
9 changes: 6 additions & 3 deletions examples/basic/test.sim
Original file line number Diff line number Diff line change
@@ -1,6 1,9 @@
from "BareClass_1.sim"

#var name:String = new SampleString("Hello World")
@"The Sum of " 20 " and " 30 " is " Sum(20, 30)
final var name:String
name = "adewale"
#@"The Sum of " 20 " and " 30 " is " Sum(20, 30, 40)

block Sum(num1: Int, num2: Int) return num1 * num2
block Sum(num1: Int, num2: Int, num3:Int)
num3 = 30
return num1 num2 num3
32 changes: 16 additions & 16 deletions examples/text editors/notepad /notepad .xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 24,7 @@
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">class&#x000D;&#x000A;block&#x000D;&#x000A;module&#x000D;&#x000A;call&#x000D;&#x000A;private&#x000D;&#x000A;try&#x000D;&#x000A;catch&#x000D;&#x000A;while&#x000D;&#x000A;end&#x000D;&#x000A;for&#x000D;&#x000A;break&#x000D;&#x000A;if&#x000D;&#x000A;elif&#x000D;&#x000A;else&#x000D;&#x000A;switch&#x000D;&#x000A;case&#x000D;&#x000A;default&#x000D;&#x000A;return&#x000D;&#x000A;do&#x000D;&#x000A;from&#x000D;&#x000A;var</Keywords>
<Keywords name="Keywords1">class&#x000D;&#x000A;block&#x000D;&#x000A;module&#x000D;&#x000A;call&#x000D;&#x000A;private&#x000D;&#x000A;final&#x000D;&#x000A;try&#x000D;&#x000A;catch&#x000D;&#x000A;while&#x000D;&#x000A;end&#x000D;&#x000A;for&#x000D;&#x000A;break&#x000D;&#x000A;if&#x000D;&#x000A;elif&#x000D;&#x000A;else&#x000D;&#x000A;switch&#x000D;&#x000A;case&#x000D;&#x000A;default&#x000D;&#x000A;return&#x000D;&#x000A;do&#x000D;&#x000A;from&#x000D;&#x000A;var</Keywords>
<Keywords name="Keywords2">display&#x000D;&#x000A;crlf&#x000D;&#x000A;read&#x000D;&#x000A;true&#x000D;&#x000A;false&#x000D;&#x000A;or&#x000D;&#x000A;and</Keywords>
<Keywords name="Keywords3">__exit__&#x000D;&#x000A;__err__&#x000D;&#x000A;null</Keywords>
<Keywords name="Keywords4"></Keywords>
Expand All @@ -39,25 39,25 @@
<WordsStyle name="COMMENTS" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="000080" bgColor="FFFFFF" fontName="&#x50E0;&#xDC43;&#x0091;" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="000080" bgColor="FFFFFF" fontName="no" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="yes" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="700" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="4" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="&#xFF20;&#xE13B;&#x0091;" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="&#x0CC0;&#xDEB8;&#x0091;" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="&#x3ED0;&#xE223;&#x0091;" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="800000" bgColor="FFFFFF" fontName="no" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="800000" bgColor="FFFFFF" fontName="yes" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="no" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="3" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="0" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
Expand Down
16 changes: 8 additions & 8 deletions simple/include/simple_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 262,23 @@ SIMPLE_API int simple_vm_findvar2 ( VM *vm,int x,List *list2,const char *cStr )

SIMPLE_API void simple_vm_newvar ( VM *vm,const char *cStr ) ;

SIMPLE_API List * simple_vm_newvar2 ( VM *vm,const char *cStr,List *pParent ) ;
SIMPLE_API List * simple_vm_newvar2 ( VM *vm,const char *cStr,List *pParent, int is_initial_declarion, int is_final ) ;

SIMPLE_API void simple_vm_addnewnumbervar ( VM *vm,const char *cStr,double x ) ;
SIMPLE_API void simple_vm_addnewnumbervar ( VM *vm,const char *cStr,double x, int is_initial_declarion, int is_final ) ;

SIMPLE_API void simple_vm_addnewstringvar ( VM *vm,const char *cStr,const char *cStr2 ) ;
SIMPLE_API void simple_vm_addnewstringvar ( VM *vm,const char *cStr,const char *cStr2, int is_initial_declarion, int is_final ) ;

SIMPLE_API void simple_vm_deletescope ( VM *vm ) ;

SIMPLE_API void simple_vm_addnewpointervar ( VM *vm,const char *cStr,void *x,int y ) ;
SIMPLE_API void simple_vm_addnewpointervar ( VM *vm,const char *cStr,void *x,int y, int is_initial_declarion, int is_final ) ;

SIMPLE_API void simple_vm_newtempvar ( VM *vm,const char *cStr, List *Temlist ) ;
SIMPLE_API void simple_vm_newtempvar ( VM *vm,const char *cStr, List *Temlist, int is_initial_declarion, int is_final ) ;

SIMPLE_API void simple_vm_addnewstringvar2 ( VM *vm,const char *cStr,const char *cStr2,int str_size ) ;
SIMPLE_API void simple_vm_addnewstringvar2 ( VM *vm,const char *cStr,const char *cStr2,int str_size, int is_initial_declarion, int is_final ) ;

List * simple_vm_newtempvar2 ( VM *vm,const char *cStr,List *list3 ) ;
SIMPLE_API List * simple_vm_newtempvar2 ( VM *vm,const char *cStr,List *list3, int is_initial_declarion, int is_final ) ;

SIMPLE_API void simple_vm_addnewcpointervar ( VM *vm,const char *cStr,void *pointer,const char *cStr2 ) ;
SIMPLE_API void simple_vm_addnewcpointervar ( VM *vm,const char *cStr,void *pointer,const char *cStr2, int is_initial_declarion, int is_final ) ;
/* Jump */

SIMPLE_API void simple_vm_jump ( VM *vm ) ;
Expand Down
2 changes: 1 addition & 1 deletion simple/sources/simple_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 109,7 @@ SIMPLE_API void api_ret_list ( void *pointer,List *list )
VM *vm ;
vm = (VM *) pointer ;
list2 = simple_list_getlist(vm->pMem,simple_list_getsize(vm->pMem)-1);
list3 = simple_vm_newvar2(vm,SIMPLE_TEMP_VARIABLE,list2);
list3 = simple_vm_newvar2(vm,SIMPLE_TEMP_VARIABLE,list2,0,0);
simple_list_setint_gc(((VM *) pointer)->sState,list3,SIMPLE_VAR_TYPE,SIMPLE_VM_LIST);
simple_list_setlist_gc(((VM *) pointer)->sState,list3,SIMPLE_VAR_VALUE);
list2 = simple_list_getlist(list3,SIMPLE_VAR_VALUE);
Expand Down
22 changes: 21 additions & 1 deletion simple/sources/simple_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 1365,17 @@ int simple_parser_paralist ( Parser *parser )
#endif
return param_count ;
}
/* ParaList --> [ Identifier { , Identifier } ] */
/* ParaList --> [ [final] Identifier { , [final] Identifier } ] */
if ( simple_parser_iskeyword(parser,KEYWORD_FINAL) ) {
/* Generate Code */
simple_parser_icg_newoperandint(parser,1);
simple_parser_nexttoken(parser);
}
else
{
/* Generate Code */
simple_parser_icg_newoperandint(parser,0);
}
if ( simple_parser_isidentifier(parser)) {
cToken = parser->TokenText ;
simple_parser_nexttoken(parser);
Expand Down Expand Up @@ -1414,6 1424,16 @@ int simple_parser_paralist ( Parser *parser )
}
while ( simple_parser_isoperator2(parser,OP_COMMA) ) {
simple_parser_nexttoken(parser);
if ( simple_parser_iskeyword(parser,KEYWORD_FINAL) ) {
/* Generate Code */
simple_parser_icg_newoperandint(parser,1);
simple_parser_nexttoken(parser);
}
else
{
/* Generate Code */
simple_parser_icg_newoperandint(parser,0);
}
SIMPLE_PARSER_IGNORENEWLINE ;
if ( simple_parser_isidentifier(parser)) {
if (is_variadic) {
Expand Down
26 changes: 13 additions & 13 deletions simple/sources/simple_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,11 1319,11 @@ SIMPLE_API void simple_vm_addglobalvariables ( VM *vm )
** Add Variables
** We write variable name in lower case because Identifiers is converted to lower by Compiler(Scanner)
*/
simple_vm_addnewnumbervar(vm,"true",1);
simple_vm_addnewnumbervar(vm,"false",0);
simple_vm_addnewstringvar(vm,"crlf","\r\n");
simple_vm_addnewnumbervar(vm,"true",1,0,1);
simple_vm_addnewnumbervar(vm,"false",0,0,1);
simple_vm_addnewstringvar(vm,"crlf","\r\n",0,1);
/* Add null pointer */
list = simple_vm_newvar2(vm,"null",vm->pActiveMem);
list = simple_vm_newvar2(vm,"null",vm->pActiveMem,0,1);
simple_list_setint_gc(vm->sState,list,SIMPLE_VAR_TYPE,SIMPLE_VM_LIST);
simple_list_setlist_gc(vm->sState,list,SIMPLE_VAR_VALUE);
list2 = simple_list_new_gc(vm->sState,0);
Expand All @@ -1332,16 1332,16 @@ SIMPLE_API void simple_vm_addglobalvariables ( VM *vm )
simple_list_addint_gc(vm->sState,list2,2);
simple_list_copy(simple_list_getlist(list,SIMPLE_VAR_VALUE),list2);
/* End Add null pointer */
simple_vm_addnewpointervar(vm,"simple_gettemp_var",NULL,0);
simple_vm_addnewstringvar(vm,"__err__","");
simple_vm_addnewpointervar(vm,"simple_settemp_var",NULL,0);
simple_vm_addnewnumbervar(vm,"simple_tempflag_var",0);
simple_vm_addnewstringvar(vm,"tab","\t");
simple_vm_addnewstringvar(vm,"cr","\r");
simple_vm_addnewstringvar(vm,"nl","\n");
simple_vm_addnewpointervar(vm,"this",NULL,0);
simple_vm_addnewpointervar(vm,"simple_gettemp_var",NULL,0,0,1);
simple_vm_addnewstringvar(vm,"__err__","",0,1);
simple_vm_addnewpointervar(vm,"simple_settemp_var",NULL,0,0,1);
simple_vm_addnewnumbervar(vm,"simple_tempflag_var",0,0,1);
simple_vm_addnewstringvar(vm,"tab","\t",0,1);
simple_vm_addnewstringvar(vm,"cr","\r",0,1);
simple_vm_addnewstringvar(vm,"nl","\n",0,1);
simple_vm_addnewpointervar(vm,"this",NULL,0,0,1);
/* Add Command Line Parameters */
list = simple_vm_newvar2(vm,"cmdparams",vm->pActiveMem);
list = simple_vm_newvar2(vm,"cmdparams",vm->pActiveMem,0,1);
simple_list_setint_gc(vm->sState,list,SIMPLE_VAR_TYPE,SIMPLE_VM_LIST);
simple_list_setlist_gc(vm->sState,list,SIMPLE_VAR_VALUE);
list = simple_list_getlist(list,SIMPLE_VAR_VALUE);
Expand Down
26 changes: 14 additions & 12 deletions simple/sources/simple_vmblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 265,13 @@ SIMPLE_API void simple_vm_call2 ( VM *vm )
for ( x = nsp 1 ; x <= nMax1 ; x ) {
vm->nsp = x ;
if ( SIMPLE_VM_STACK_ISSTRING ) {
simple_vm_addnewstringvar2(vm,"",SIMPLE_VM_STACK_READC,SIMPLE_VM_STACK_STRINGSIZE);
simple_vm_addnewstringvar2(vm,"",SIMPLE_VM_STACK_READC,SIMPLE_VM_STACK_STRINGSIZE,0,0);
}
else if ( SIMPLE_VM_STACK_ISNUMBER ) {
simple_vm_addnewnumbervar(vm,"",SIMPLE_VM_STACK_READN);
simple_vm_addnewnumbervar(vm,"",SIMPLE_VM_STACK_READN,0,0);
}
else if ( SIMPLE_VM_STACK_ISPOINTER ) {
simple_vm_addnewpointervar(vm,"",SIMPLE_VM_STACK_READP,SIMPLE_VM_STACK_OBJTYPE);
simple_vm_addnewpointervar(vm,"",SIMPLE_VM_STACK_READP,SIMPLE_VM_STACK_OBJTYPE,0,0);
}
vm->nCBlockParaCount ;
}
Expand Down Expand Up @@ -417,7 417,7 @@ SIMPLE_API void simple_vm_returnnull ( VM *vm )

SIMPLE_API void simple_vm_newblock ( VM *vm )
{
int w,x,y,z,nsp,insp,type, is_variadic ;
int w,x,y,z,nsp,insp,type, is_variadic,is_final ;
List *list, *variadic_list ;
String *param, *v_param ;
Item *item, *variadic_item ;
Expand Down Expand Up @@ -445,33 445,35 @@ SIMPLE_API void simple_vm_newblock ( VM *vm )
z = 0 ;
for (; x >= 3 && y <= SIMPLE_VM_IR_PARACOUNT ; x--, y ) {
param = simple_string_new(SIMPLE_VM_IR_READCVALUE(x-1));
is_final = SIMPLE_VM_IR_READIVALUE(x-2);
x--;
if (strcmp(param->str,simple_secondary_keyword_value(KEYWORD_VARIADIC)) == 0 ) {
is_variadic = 1 ; continue ;
}
if (x == SIMPLE_VM_IR_PARACOUNT || is_variadic) {
v_param = simple_string_new(SIMPLE_VM_IR_READCVALUE(x-1));
}
if (is_variadic) { variadic_value = param->str; is_variadic = 0; }
if ( nsp < vm->nsp || strcmp(v_param->str,variadic_value) == 0) {
if ( nsp < vm->nsp || strcmp(v_param->str,variadic_value) == 0) {
if ( strcmp(param->str,variadic_value) == 0 ) {
variadic_item = simple_item_new_gc (vm->sState,ITEMTYPE_LIST);
variadic_item->data.list = variadic_list ;
SIMPLE_VM_STACK_PUSHPVALUE(variadic_item) ;
SIMPLE_VM_STACK_OBJTYPE = SIMPLE_OBJTYPE_LISTITEM ;
simple_vm_addnewpointervar(vm,param->str,SIMPLE_VM_STACK_READP,SIMPLE_VM_STACK_OBJTYPE);
simple_vm_addnewpointervar(vm,param->str,SIMPLE_VM_STACK_READP,SIMPLE_VM_STACK_OBJTYPE,0,is_final);
w = SIMPLE_VM_IR_PARACOUNT - 3 ;
SIMPLE_VM_STACK_POP_(w) ;
}
if ( SIMPLE_VM_STACK_ISSTRING ) {
simple_vm_addnewstringvar(vm,param->str,SIMPLE_VM_STACK_READC);
simple_vm_addnewstringvar(vm,param->str,SIMPLE_VM_STACK_READC,0,is_final);
SIMPLE_VM_STACK_POP ;
}
else if ( SIMPLE_VM_STACK_ISNUMBER ) {
simple_vm_addnewnumbervar(vm,param->str,SIMPLE_VM_STACK_READN);
else if ( SIMPLE_VM_STACK_ISNUMBER ) {
simple_vm_addnewnumbervar(vm,param->str,SIMPLE_VM_STACK_READN,0,is_final);
SIMPLE_VM_STACK_POP ;
}
else if ( SIMPLE_VM_STACK_ISPOINTER ) {
simple_vm_addnewpointervar(vm,param->str,SIMPLE_VM_STACK_READP,SIMPLE_VM_STACK_OBJTYPE);
simple_vm_addnewpointervar(vm,param->str,SIMPLE_VM_STACK_READP,SIMPLE_VM_STACK_OBJTYPE,0,is_final);
SIMPLE_VM_STACK_POP ;
}
if (y == (SIMPLE_VM_IR_PARACOUNT - 3) && strcmp(v_param->str,variadic_value) == 0) {
Expand Down Expand Up @@ -586,7 588,7 @@ SIMPLE_API void simple_vm_movetoprevscope ( VM *vm )
return ;
}
list2 = simple_list_getlist(vm->pMem,simple_list_getsize(vm->pMem)-1);
list3 = simple_vm_newvar2(vm,SIMPLE_TEMP_VARIABLE,list2);
list3 = simple_vm_newvar2(vm,SIMPLE_TEMP_VARIABLE,list2,0,0);
simple_list_setint_gc(vm->sState,list3,SIMPLE_VAR_TYPE,SIMPLE_VM_LIST);
simple_list_setlist_gc(vm->sState,list3,SIMPLE_VAR_VALUE);
list2 = simple_list_getlist(list3,SIMPLE_VAR_VALUE);
Expand All @@ -610,7 612,7 @@ SIMPLE_API void simple_vm_createtemlist ( VM *vm )
*/
list = simple_list_getlist(vm->pBlockCallList,simple_list_getsize(vm->pBlockCallList));
list = simple_list_getlist(list,SIMPLE_BLOCKCL_TEMPMEM);
simple_vm_newtempvar(vm,SIMPLE_TEMP_VARIABLE,list);
simple_vm_newtempvar(vm,SIMPLE_TEMP_VARIABLE,list,0,0);
}

SIMPLE_API void simple_vm_saveloadaddressscope ( VM *vm )
Expand Down
4 changes: 2 additions & 2 deletions simple/sources/simple_vmlists.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 48,7 @@ SIMPLE_API void simple_vm_liststart ( VM *vm )
simple_vm_createtemlist(vm);
} else {
/* Create the list in the General Temp Memory */
simple_vm_newtempvar(vm, SIMPLE_TEMP_VARIABLE ,vm->pTempMem);
simple_vm_newtempvar(vm, SIMPLE_TEMP_VARIABLE ,vm->pTempMem, 0, 0);
}
var = (List *) SIMPLE_VM_STACK_READP ;
nType = SIMPLE_VM_STACK_OBJTYPE ;
Expand All @@ -57,7 57,7 @@ SIMPLE_API void simple_vm_liststart ( VM *vm )
} else {
if ( SIMPLE_VM_STACK_ISPOINTER == 0 ) {
/* Create the List in Global Temp Memory. */
simple_vm_newtempvar(vm, SIMPLE_TEMP_VARIABLE ,vm->pTempMem);
simple_vm_newtempvar(vm, SIMPLE_TEMP_VARIABLE ,vm->pTempMem, 0, 0);
simple_list_addint_gc(vm->sState,vm->aLoadAddressScope,SIMPLE_VARSCOPE_LOCAL);
}
nType = SIMPLE_VM_STACK_OBJTYPE ;
Expand Down
4 changes: 2 additions & 2 deletions simple/sources/simple_vmoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 81,7 @@ SIMPLE_API void simple_vm_oop_newobj ( VM *vm )
/* Create List for the Object State */
list3 = simple_list_newlist_gc(vm->sState,list2);
/* Create Self variable in the state list */
pSelf = simple_vm_newvar2(vm,"self",list3);
pSelf = simple_vm_newvar2(vm,"self",list3,0,1);
simple_list_setint_gc(vm->sState,pSelf,SIMPLE_VAR_TYPE,SIMPLE_VM_POINTER);
if ( nType == SIMPLE_OBJTYPE_VARIABLE ) {
simple_list_setpointer_gc(vm->sState,pSelf,SIMPLE_VAR_VALUE,var);
Expand Down Expand Up @@ -658,7 658,7 @@ SIMPLE_API void simple_vm_oop_newsuperobj ( VM *vm,List *pState,List *pClass )
List *pSuper,*pSuper2,*pMethods,*list ;
const char *cParentClassName,*cClassName ;
int x ;
pSuper = simple_vm_newvar2(vm,"super",pState);
pSuper = simple_vm_newvar2(vm,"super",pState,0,1);
simple_list_setint_gc(vm->sState,pSuper,SIMPLE_VAR_TYPE,SIMPLE_VM_LIST);
simple_list_setlist_gc(vm->sState,pSuper,SIMPLE_VAR_VALUE);
pSuper2 = simple_list_getlist(pSuper,SIMPLE_VAR_VALUE);
Expand Down
Loading

0 comments on commit a45eb99

Please sign in to comment.