]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/codegen.c
cppbind: automatic conversion of SGReferenced derived pointers.
[simgear.git] / simgear / nasal / codegen.c
index d8b701b6940a19904a458421da08f714a92caf16..8636fbb958e0f90c8fe3132629d429c69d8cbabe 100644 (file)
@@ -485,6 +485,11 @@ static int tokMatch(struct Token* a, struct Token* b)
 static void genBreakContinue(struct Parser* p, struct Token* t)
 {
     int levels = 1, loop = -1, bp, cp, i;
+    // http://code.google.com/p/flightgear-bugs/issues/detail?id=587
+    // Make sure we are inside of a loop
+    if(p->cg->loopTop <= 0)
+        naParseError(p, "break/continue outside of a valid loop", t->line);
+    
     if(RIGHT(t)) {
         if(RIGHT(t)->type != TOK_SYMBOL)
             naParseError(p, "bad break/continue label", t->line);
@@ -550,7 +555,10 @@ static void genAssign(struct Parser* p, struct Token* t)
     if(parListLen(lv) || (lv->type == TOK_VAR && parListLen(RIGHT(lv)))) {
         if(lv->type == TOK_VAR) { lv = RIGHT(lv); var = 1; }
         len = parListLen(lv);
-        if(rv->type == TOK_LPAR) {
+        // http://code.google.com/p/flightgear-bugs/issues/detail?id=585
+        // TOK_LPAR can mean multi-value assignment or function call,
+        // disambigaute by checking the rule of the token
+        if(rv->type == TOK_LPAR && rv->rule != PREC_SUFFIX) {
             if(len != parListLen(rv))
                 naParseError(p, "bad assignment count", rv->line);
             genCommaList(p, LEFT(rv));