diff options
| author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-15 19:04:49 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-15 19:04:49 -0700 |
| commit | 588d2bdefe0d8a4ff3a5ad45afe1806aee022762 (patch) | |
| tree | 56e753ee1256702c3f13fcf77fd7d7251cb9daa2 /libacc | |
| parent | 6b840e9b61a22ca9644fd9afa90e5a0f4d242b44 (diff) | |
| parent | d1f57e689b703faa46d26decb1758a6f0330e9ec (diff) | |
| download | system_core-588d2bdefe0d8a4ff3a5ad45afe1806aee022762.tar.gz system_core-588d2bdefe0d8a4ff3a5ad45afe1806aee022762.tar.bz2 system_core-588d2bdefe0d8a4ff3a5ad45afe1806aee022762.zip | |
Merge change 7495
* changes:
Improve error handling
Diffstat (limited to 'libacc')
| -rw-r--r-- | libacc/acc.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libacc/acc.cpp b/libacc/acc.cpp index a84bd910..c527a96f 100644 --- a/libacc/acc.cpp +++ b/libacc/acc.cpp @@ -3910,6 +3910,8 @@ class Compiler : public ErrorSink { next(); } else if (t == EOF ) { error("Unexpected EOF."); + } else if (t == ';') { + error("Unexpected ';'"); } else if (!checkSymbol(t)) { // Don't have to do anything special here, the error // message was printed by checkSymbol() above. @@ -4038,7 +4040,12 @@ class Compiler : public ErrorSink { } else { pGen->pushR0(); binaryOp(level); - + // Check for syntax error. + if (pGen->getR0Type() == NULL) { + // We failed to parse a right-hand argument. + // Push a dummy value so we don't fail + pGen->li(0, mkpInt); + } if ((level == 4) | (level == 5)) { pGen->gcmp(t, mkpInt); } else { @@ -4595,6 +4602,8 @@ class Compiler : public ErrorSink { // Function declaration if (accept(';')) { // forward declaration. + } else if (tok != '{') { + error("expected '{'"); } else { if (name) { /* patch forward references (XXX: does not work for function |
