Fixed postfix increment operator

master
pur3mail 13 years ago
parent c676f31b83
commit 1baee8b066

@ -1,5 +1,5 @@
CC=g++
CFLAGS=-c -g -Wall -rdynamic
CFLAGS=-c -g -Wall -rdynamic -D_DEBUG
LDFLAGS=-g -rdynamic
SOURCES= \

@ -97,6 +97,7 @@
Version 0.30 : Rlyeh Mario's patch for Math Functions on VC++
Version 0.31 : Add exec() to TinyJS functions
Now print quoted JSON that can be read by PHP/Python parsers
Fixed postfix increment operator
NOTE:
Constructing an array with an initial length 'Array(5)' doesn't work
@ -1751,8 +1752,11 @@ CScriptVarLink *CTinyJS::expression(bool &execute) {
if (execute) {
CScriptVar one(1);
CScriptVar *res = a->var->mathsOp(&one, op==LEX_PLUSPLUS ? '+' : '-');
CScriptVarLink *oldValue = new CScriptVarLink(a->var);
// in-place add/subtract
a->replaceWith(res);
CLEAN(a);
a = oldValue;
}
} else {
CScriptVarLink *b = term(execute);

@ -36,6 +36,9 @@
#include <sstream>
#include <stdio.h>
#ifdef MTRACE
#include <mcheck.h>
#endif
//#define INSANE_MEMORY_DEBUG
@ -238,6 +241,9 @@ bool run_test(const char *filename) {
int main(int argc, char **argv)
{
#ifdef MTRACE
mtrace();
#endif
#ifdef INSANE_MEMORY_DEBUG
memtracing_init();
#endif
@ -271,10 +277,15 @@ int main(int argc, char **argv)
#ifdef INSANE_MEMORY_DEBUG
memtracing_kill();
#endif
#ifdef _WIN32
#ifdef _DEBUG
#ifdef _WIN32
_CrtDumpMemoryLeaks();
#endif
#endif
#ifdef MTRACE
muntrace();
#endif
return 0;
}

@ -1,5 +1,5 @@
// functions in variables
var bob;
var bob = {};
bob.add = function(x,y) { return x+y; };
result = bob.add(3,6)==9;

@ -1,6 +1,7 @@
// Variable creation and scope from http://en.wikipedia.org/wiki/JavaScript_syntax
x = 0; // A global variable
var y = 'Hello!'; // Another global variable
z = 0; // yet another global variable
function f(){
var z = 'foxes'; // A local variable

@ -1,6 +1,6 @@
// references for arrays
var a;
var a = [];
a[0] = 10;
a[1] = 22;

@ -1,7 +1,7 @@
// references with functions
var a = 42;
var b;
var b = [];
b[0] = 43;
function foo(myarray) {

@ -1,4 +1,5 @@
// mikael.kindborg@mobilesorcery.com - Function symbol is evaluated in bracket-less body of false if-statement
var foo; // a var is only created automated by assignment
if (foo !== undefined) foo();

Loading…
Cancel
Save