From fecd70784dfb2ae9159c1ed40840bbb09dd218f0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 28 Jul 2009 17:34:41 +0200 Subject: Fix tst_QScriptEngine::automaticSemicolonInsertion Some Semicollon were added at the end of the input while they shouldn't have. Let handle the automatic semicolon insertion by the Parser (as it does already for the normal new lines) Reviewed-by: Kent Hansen --- src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp | 4 ++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp index 8e89c18..b22832f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Lexer.cpp @@ -293,11 +293,15 @@ start: int startOffset = currentOffset(); if (m_current == -1) { +#ifndef QT_BUILD_SCRIPT_LIB /* the parser takes cate about automatic semicolon. + this might add incorrect semicolons */ + //m_delimited and m_isReparsing are now useless if (!m_terminator && !m_delimited && !m_isReparsing) { // automatic semicolon insertion if program incomplete token = ';'; goto doneSemicolon; } +#endif return 0; } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 9959990..5b4d02d 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -2459,29 +2459,22 @@ void tst_QScriptEngine::automaticSemicolonInsertion() { QScriptValue ret = eng.evaluate("if (0)"); - QEXPECT_FAIL("", "Semicolon incorrectly inserted", Continue); QVERIFY(ret.isError()); } { QScriptValue ret = eng.evaluate("while (0)"); - QEXPECT_FAIL("", "Semicolon incorrectly inserted", Continue); QVERIFY(ret.isError()); } -#if 0 // ### hangs because of the semicolon insertion { QScriptValue ret = eng.evaluate("for (;;)"); - QEXPECT_FAIL("", "Semicolon incorrectly inserted", Continue); QVERIFY(ret.isError()); } -#endif { QScriptValue ret = eng.evaluate("for (p in this)"); - QEXPECT_FAIL("", "Semicolon incorrectly inserted", Continue); QVERIFY(ret.isError()); } { QScriptValue ret = eng.evaluate("with (this)"); - QEXPECT_FAIL("", "Semicolon incorrectly inserted", Continue); QVERIFY(ret.isError()); } { -- cgit v0.12