test262: class and function names should be inferred in assignment
https://bugs.webkit.org/show_bug.cgi?id=146262
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-29
Reviewed by Saam Barati.
JSTests:
* stress/arrowfunction-name.js: Added.
Quick tests for arrow function names.
* stress/inferred-names.js: Added.
General test for inferred function names.
* test262.yaml:
Pass many tests checking inferred function names.
Source/JavaScriptCore:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::appendParameter):
(JSC::ASTBuilder::appendArrayPatternEntry):
(JSC::ASTBuilder::appendObjectPatternEntry):
(JSC::ASTBuilder::tryInferFunctionNameInPattern):
Assign names to default value functions and classes in destructuring.
(JSC::ASTBuilder::createAssignResolve):
(JSC::ASTBuilder::createProperty):
(JSC::ASTBuilder::makeAssignNode):
Assign names to both normal and arrow functions.
* parser/Nodes.h:
(JSC::ExpressionNode::isBaseFuncExprNode):
Both functions and arrow functions infer name, they both extend
this base so give the base an is check.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/parser/Nodes.h b/Source/JavaScriptCore/parser/Nodes.h
index c293290..49b066c 100644
--- a/Source/JavaScriptCore/parser/Nodes.h
+++ b/Source/JavaScriptCore/parser/Nodes.h
@@ -170,6 +170,7 @@
virtual bool isBracketAccessorNode() const { return false; }
virtual bool isDotAccessorNode() const { return false; }
virtual bool isDestructuringNode() const { return false; }
+ virtual bool isBaseFuncExprNode() const { return false; }
virtual bool isFuncExprNode() const { return false; }
virtual bool isArrowFuncExprNode() const { return false; }
virtual bool isClassExprNode() const { return false; }
@@ -1955,6 +1956,8 @@
public:
FunctionMetadataNode* metadata() { return m_metadata; }
+ bool isBaseFuncExprNode() const override { return true; }
+
protected:
BaseFuncExprNode(const JSTokenLocation&, const Identifier&, FunctionMetadataNode*, const SourceCode&, FunctionMode);