Super use should be recorded in per-function scope
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Nov 2015 21:19:57 +0000 (21:19 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Nov 2015 21:19:57 +0000 (21:19 +0000)
commit1cea38f4ebc1e28f576ffe9e35717a59e8fbbf1c
tree239a169526f9d5727e67c76a7b98ed1964097401
parentf3696f196e25d4b84bbb9b92027690889894127b
Super use should be recorded in per-function scope
https://bugs.webkit.org/show_bug.cgi?id=151500

Reviewed by Geoffrey Garen.

"super" use is prohibited under the non-constructor / non-class-method-related functions.
This "super" use should be recorded in per-function scope to check its incorrect use after
parsing a function.
Currently, we accidentally record it to a lexical current scope. So when using "super" inside
a block scope, our "super" use guard miss it.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseMemberExpression):
* parser/Parser.h:
(JSC::Parser::currentVariableScope):
(JSC::Parser::currentFunctionScope):
(JSC::Parser::declareVariable):
* tests/stress/super-in-lexical-scope.js: Added.
(testSyntax):
(testSyntaxError):
(testSyntaxError.test):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js [new file with mode: 0644]