Diff
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/API/JSScriptRef.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/API/JSScriptRef.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/API/JSScriptRef.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -70,8 +70,8 @@
static bool parseScript(VM* vm, const SourceCode& source, ParserError& error)
{
return !!JSC::parse<JSC::ProgramNode>(
- vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, JSParserCodeType::Program,
+ vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
+ JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode,
error);
}
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/ChangeLog (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/ChangeLog 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/ChangeLog 2015-08-14 11:46:08 UTC (rev 188463)
@@ -1,3 +1,103 @@
+2015-08-13 Yusuke Suzuki <[email protected]>
+
+ Unify JSParserCodeType, FunctionParseMode and ModuleParseMode into SourceParseMode
+ https://bugs.webkit.org/show_bug.cgi?id=147353
+
+ Reviewed by Saam Barati.
+
+ This is the follow-up patch after r188355.
+ It includes the following changes.
+
+ - Unify JSParserCodeType, FunctionParseMode and ModuleParseMode into SourceParseMode
+ - Make SourceParseMode to C++ strongly-typed enum.
+ - Fix the comments.
+ - Rename ModuleSpecifier to ModuleName.
+ - Add the type name `ImportEntry` before the C++11 uniform initialization.
+ - Fix the thrown message for duplicate 'default' names.
+ - Assert the all statements in the top-level source elements are the module declarations under the module analyzer phase.
+
+ * API/JSScriptRef.cpp:
+ (parseScript):
+ * builtins/BuiltinExecutables.cpp:
+ (JSC::BuiltinExecutables::createExecutableInternal):
+ * bytecode/UnlinkedFunctionExecutable.cpp:
+ (JSC::generateFunctionCodeBlock):
+ * bytecode/UnlinkedFunctionExecutable.h:
+ * bytecompiler/BytecodeGenerator.h:
+ (JSC::BytecodeGenerator::makeFunction):
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createFunctionMetadata):
+ (JSC::ASTBuilder::createModuleName):
+ (JSC::ASTBuilder::createImportDeclaration):
+ (JSC::ASTBuilder::createExportAllDeclaration):
+ (JSC::ASTBuilder::createExportNamedDeclaration):
+ (JSC::ASTBuilder::createModuleSpecifier): Deleted.
+ * parser/ModuleAnalyzer.cpp:
+ (JSC::ModuleAnalyzer::analyze):
+ * parser/NodeConstructors.h:
+ (JSC::ModuleNameNode::ModuleNameNode):
+ (JSC::ImportDeclarationNode::ImportDeclarationNode):
+ (JSC::ExportAllDeclarationNode::ExportAllDeclarationNode):
+ (JSC::ExportNamedDeclarationNode::ExportNamedDeclarationNode):
+ (JSC::ModuleSpecifierNode::ModuleSpecifierNode): Deleted.
+ * parser/Nodes.cpp:
+ (JSC::FunctionMetadataNode::FunctionMetadataNode):
+ * parser/Nodes.h:
+ (JSC::StatementNode::isModuleDeclarationNode):
+ (JSC::ModuleDeclarationNode::isModuleDeclarationNode):
+ (JSC::ImportDeclarationNode::moduleName):
+ (JSC::ExportAllDeclarationNode::moduleName):
+ (JSC::ExportNamedDeclarationNode::moduleName):
+ (JSC::ImportDeclarationNode::moduleSpecifier): Deleted.
+ (JSC::ExportAllDeclarationNode::moduleSpecifier): Deleted.
+ (JSC::ExportNamedDeclarationNode::moduleSpecifier): Deleted.
+ * parser/NodesAnalyzeModule.cpp:
+ (JSC::SourceElements::analyzeModule):
+ (JSC::ImportDeclarationNode::analyzeModule):
+ (JSC::ExportAllDeclarationNode::analyzeModule):
+ (JSC::ExportNamedDeclarationNode::analyzeModule):
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::Parser):
+ (JSC::Parser<LexerType>::parseInner):
+ (JSC::Parser<LexerType>::parseModuleSourceElements):
+ (JSC::Parser<LexerType>::parseFunctionBody):
+ (JSC::stringForFunctionMode):
+ (JSC::Parser<LexerType>::parseFunctionParameters):
+ (JSC::Parser<LexerType>::parseFunctionInfo):
+ (JSC::Parser<LexerType>::parseFunctionDeclaration):
+ (JSC::Parser<LexerType>::parseClass):
+ (JSC::Parser<LexerType>::parseModuleName):
+ (JSC::Parser<LexerType>::parseImportDeclaration):
+ (JSC::Parser<LexerType>::parseExportDeclaration):
+ (JSC::Parser<LexerType>::parsePropertyMethod):
+ (JSC::Parser<LexerType>::parseGetterSetter):
+ (JSC::Parser<LexerType>::parsePrimaryExpression):
+ (JSC::Parser<LexerType>::parseArrowFunctionExpression):
+ (JSC::Parser<LexerType>::parseModuleSpecifier): Deleted.
+ * parser/Parser.h:
+ (JSC::Parser<LexerType>::parse):
+ (JSC::parse):
+ * parser/ParserModes.h:
+ (JSC::isFunctionParseMode):
+ (JSC::isModuleParseMode):
+ (JSC::isProgramParseMode):
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::createFunctionMetadata):
+ (JSC::SyntaxChecker::createModuleName):
+ (JSC::SyntaxChecker::createImportDeclaration):
+ (JSC::SyntaxChecker::createExportAllDeclaration):
+ (JSC::SyntaxChecker::createExportNamedDeclaration):
+ (JSC::SyntaxChecker::createModuleSpecifier): Deleted.
+ * runtime/CodeCache.cpp:
+ (JSC::CodeCache::getGlobalCodeBlock):
+ (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
+ * runtime/Completion.cpp:
+ (JSC::checkSyntax):
+ (JSC::checkModuleSyntax):
+ * runtime/Executable.cpp:
+ (JSC::ProgramExecutable::checkSyntax):
+ * tests/stress/modules-syntax-error-with-names.js:
+
2015-08-13 Geoffrey Garen <[email protected]>
Periodic code deletion should delete RegExp code
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/builtins/BuiltinExecutables.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/builtins/BuiltinExecutables.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/builtins/BuiltinExecutables.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -69,9 +69,9 @@
UnlinkedFunctionKind kind = isParsingDefaultConstructor ? UnlinkedNormalFunction : UnlinkedBuiltinFunction;
RefPtr<SourceProvider> sourceOverride = isParsingDefaultConstructor ? source.provider() : nullptr;
std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
- &m_vm, source, Identifier(), builtinMode,
- JSParserStrictMode::NotStrict, JSParserCodeType::Program, error,
- &positionBeforeLastNewline, FunctionParseMode::NotAFunctionMode, constructorKind);
+ &m_vm, source, Identifier(), builtinMode,
+ JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, error,
+ &positionBeforeLastNewline, constructorKind);
if (!program) {
dataLog("Fatal error compiling builtin function '", name.string(), "': ", error.message());
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -54,9 +54,9 @@
{
JSParserBuiltinMode builtinMode = executable->isBuiltinFunction() ? JSParserBuiltinMode::Builtin : JSParserBuiltinMode::NotBuiltin;
JSParserStrictMode strictMode = executable->isInStrictContext() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
+ ASSERT(isFunctionParseMode(executable->parseMode()));
std::unique_ptr<FunctionNode> function = parse<FunctionNode>(
- &vm, source, executable->name(), builtinMode, strictMode,
- JSParserCodeType::Function, error, nullptr, executable->parseMode());
+ &vm, source, executable->name(), builtinMode, strictMode, executable->parseMode(), error, nullptr);
if (!function) {
ASSERT(error.isValid());
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecode/UnlinkedFunctionExecutable.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -78,7 +78,7 @@
const Identifier& inferredName() const { return m_inferredName; }
JSString* nameValue() const { return m_nameValue.get(); }
unsigned parameterCount() const { return m_parameterCount; };
- FunctionParseMode parseMode() const { return m_parseMode; };
+ SourceParseMode parseMode() const { return m_parseMode; };
bool isInStrictContext() const { return m_isInStrictContext; }
FunctionMode functionMode() const { return static_cast<FunctionMode>(m_functionMode); }
ConstructorKind constructorKind() const { return static_cast<ConstructorKind>(m_constructorKind); }
@@ -146,7 +146,7 @@
unsigned m_typeProfilingStartOffset;
unsigned m_typeProfilingEndOffset;
unsigned m_parameterCount;
- FunctionParseMode m_parseMode;
+ SourceParseMode m_parseMode;
CodeFeatures m_features;
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -717,9 +717,9 @@
VariableEnvironment variablesUnderTDZ;
getVariablesUnderTDZ(variablesUnderTDZ);
- FunctionParseMode parseMode = metadata->parseMode();
+ SourceParseMode parseMode = metadata->parseMode();
ConstructAbility constructAbility = ConstructAbility::CanConstruct;
- if (parseMode == GetterMode || parseMode == SetterMode || parseMode == ArrowFunctionMode || (parseMode == MethodMode && metadata->constructorKind() == ConstructorKind::None))
+ if (parseMode == SourceParseMode::GetterMode || parseMode == SourceParseMode::SetterMode || parseMode == SourceParseMode::ArrowFunctionMode || (parseMode == SourceParseMode::MethodMode && metadata->constructorKind() == ConstructorKind::None))
constructAbility = ConstructAbility::CannotConstruct;
return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode->source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, variablesUnderTDZ);
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ASTBuilder.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ASTBuilder.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ASTBuilder.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -112,7 +112,7 @@
#if ENABLE(ES6_CLASS_SYNTAX)
typedef ClassExprNode* ClassExpression;
#endif
- typedef ModuleSpecifierNode* ModuleSpecifier;
+ typedef ModuleNameNode* ModuleName;
typedef ImportSpecifierNode* ImportSpecifier;
typedef ImportSpecifierListNode* ImportSpecifierList;
typedef ExportSpecifierNode* ExportSpecifier;
@@ -361,7 +361,7 @@
const JSTokenLocation& startLocation, const JSTokenLocation& endLocation,
unsigned startColumn, unsigned endColumn, int functionKeywordStart,
int functionNameStart, int parametersStart, bool inStrictContext,
- ConstructorKind constructorKind, unsigned parameterCount, FunctionParseMode mode)
+ ConstructorKind constructorKind, unsigned parameterCount, SourceParseMode mode)
{
return new (m_parserArena) FunctionMetadataNode(
m_parserArena, startLocation, endLocation, startColumn, endColumn,
@@ -619,9 +619,9 @@
return result;
}
- ModuleSpecifierNode* createModuleSpecifier(const JSTokenLocation& location, const Identifier& moduleName)
+ ModuleNameNode* createModuleName(const JSTokenLocation& location, const Identifier& moduleName)
{
- return new (m_parserArena) ModuleSpecifierNode(location, moduleName);
+ return new (m_parserArena) ModuleNameNode(location, moduleName);
}
ImportSpecifierNode* createImportSpecifier(const JSTokenLocation& location, const Identifier& importedName, const Identifier& localName)
@@ -639,14 +639,14 @@
specifierList->append(specifier);
}
- StatementNode* createImportDeclaration(const JSTokenLocation& location, ImportSpecifierListNode* importSpecifierList, ModuleSpecifierNode* moduleSpecifier)
+ StatementNode* createImportDeclaration(const JSTokenLocation& location, ImportSpecifierListNode* importSpecifierList, ModuleNameNode* moduleName)
{
- return new (m_parserArena) ImportDeclarationNode(location, importSpecifierList, moduleSpecifier);
+ return new (m_parserArena) ImportDeclarationNode(location, importSpecifierList, moduleName);
}
- StatementNode* createExportAllDeclaration(const JSTokenLocation& location, ModuleSpecifierNode* moduleSpecifier)
+ StatementNode* createExportAllDeclaration(const JSTokenLocation& location, ModuleNameNode* moduleName)
{
- return new (m_parserArena) ExportAllDeclarationNode(location, moduleSpecifier);
+ return new (m_parserArena) ExportAllDeclarationNode(location, moduleName);
}
StatementNode* createExportDefaultDeclaration(const JSTokenLocation& location, StatementNode* declaration, const Identifier& localName)
@@ -659,9 +659,9 @@
return new (m_parserArena) ExportLocalDeclarationNode(location, declaration);
}
- StatementNode* createExportNamedDeclaration(const JSTokenLocation& location, ExportSpecifierListNode* exportSpecifierList, ModuleSpecifierNode* moduleSpecifier)
+ StatementNode* createExportNamedDeclaration(const JSTokenLocation& location, ExportSpecifierListNode* exportSpecifierList, ModuleNameNode* moduleName)
{
- return new (m_parserArena) ExportNamedDeclarationNode(location, exportSpecifierList, moduleSpecifier);
+ return new (m_parserArena) ExportNamedDeclarationNode(location, exportSpecifierList, moduleName);
}
ExportSpecifierNode* createExportSpecifier(const JSTokenLocation& location, const Identifier& localName, const Identifier& exportedName)
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ModuleAnalyzer.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ModuleAnalyzer.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ModuleAnalyzer.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -100,10 +100,10 @@
Ref<ModuleRecord> ModuleAnalyzer::analyze(ModuleProgramNode& moduleProgramNode)
{
// Traverse the module AST and collect
- // 1. Import entries
- // 2. Export entries that have FromClause (e.g. export { a } from "mod")
- // 3. Export entries that have star (e.g. export * from "mod")
- // 4. Aliased export names (e.g. export { a as b })
+ // * Import entries
+ // * Export entries that have FromClause (e.g. export { a } from "mod")
+ // * Export entries that have star (e.g. export * from "mod")
+ // * Aliased export names (e.g. export { a as b })
moduleProgramNode.analyzeModule(*this);
// Based on the collected information, categorize export entries into 3 types.
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/NodeConstructors.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/NodeConstructors.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/NodeConstructors.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -738,7 +738,7 @@
{
}
- inline ModuleSpecifierNode::ModuleSpecifierNode(const JSTokenLocation& location, const Identifier& moduleName)
+ inline ModuleNameNode::ModuleNameNode(const JSTokenLocation& location, const Identifier& moduleName)
: Node(location)
, m_moduleName(moduleName)
{
@@ -751,16 +751,16 @@
{
}
- inline ImportDeclarationNode::ImportDeclarationNode(const JSTokenLocation& location, ImportSpecifierListNode* importSpecifierList, ModuleSpecifierNode* moduleSpecifier)
+ inline ImportDeclarationNode::ImportDeclarationNode(const JSTokenLocation& location, ImportSpecifierListNode* importSpecifierList, ModuleNameNode* moduleName)
: ModuleDeclarationNode(location)
, m_specifierList(importSpecifierList)
- , m_moduleSpecifier(moduleSpecifier)
+ , m_moduleName(moduleName)
{
}
- inline ExportAllDeclarationNode::ExportAllDeclarationNode(const JSTokenLocation& location, ModuleSpecifierNode* moduleSpecifier)
+ inline ExportAllDeclarationNode::ExportAllDeclarationNode(const JSTokenLocation& location, ModuleNameNode* moduleName)
: ModuleDeclarationNode(location)
- , m_moduleSpecifier(moduleSpecifier)
+ , m_moduleName(moduleName)
{
}
@@ -777,10 +777,10 @@
{
}
- inline ExportNamedDeclarationNode::ExportNamedDeclarationNode(const JSTokenLocation& location, ExportSpecifierListNode* exportSpecifierList, ModuleSpecifierNode* moduleSpecifier)
+ inline ExportNamedDeclarationNode::ExportNamedDeclarationNode(const JSTokenLocation& location, ExportSpecifierListNode* exportSpecifierList, ModuleNameNode* moduleName)
: ModuleDeclarationNode(location)
, m_specifierList(exportSpecifierList)
- , m_moduleSpecifier(moduleSpecifier)
+ , m_moduleName(moduleName)
{
}
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Nodes.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Nodes.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Nodes.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -151,7 +151,7 @@
ParserArena&, const JSTokenLocation& startLocation,
const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn,
int functionKeywordStart, int functionNameStart, int parametersStart, bool isInStrictContext,
- ConstructorKind constructorKind, unsigned parameterCount, FunctionParseMode mode)
+ ConstructorKind constructorKind, unsigned parameterCount, SourceParseMode mode)
: Node(endLocation)
, m_startColumn(startColumn)
, m_endColumn(endColumn)
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Nodes.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Nodes.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Nodes.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -203,6 +203,7 @@
virtual bool isContinue() const { return false; }
virtual bool isBlock() const { return false; }
virtual bool isFuncDeclNode() const { return false; }
+ virtual bool isModuleDeclarationNode() const { return false; }
protected:
StatementNode* m_next;
@@ -1641,9 +1642,9 @@
unsigned m_endColumn;
};
- class ModuleSpecifierNode : public Node {
+ class ModuleNameNode : public Node {
public:
- ModuleSpecifierNode(const JSTokenLocation&, const Identifier& moduleName);
+ ModuleNameNode(const JSTokenLocation&, const Identifier& moduleName);
const Identifier& moduleName() { return m_moduleName; }
@@ -1680,6 +1681,7 @@
class ModuleDeclarationNode : public StatementNode {
public:
virtual void analyzeModule(ModuleAnalyzer&) = 0;
+ virtual bool isModuleDeclarationNode() const { return true; }
protected:
ModuleDeclarationNode(const JSTokenLocation&);
@@ -1687,30 +1689,30 @@
class ImportDeclarationNode : public ModuleDeclarationNode {
public:
- ImportDeclarationNode(const JSTokenLocation&, ImportSpecifierListNode*, ModuleSpecifierNode*);
+ ImportDeclarationNode(const JSTokenLocation&, ImportSpecifierListNode*, ModuleNameNode*);
ImportSpecifierListNode* specifierList() const { return m_specifierList; }
- ModuleSpecifierNode* moduleSpecifier() const { return m_moduleSpecifier; }
+ ModuleNameNode* moduleName() const { return m_moduleName; }
private:
virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
virtual void analyzeModule(ModuleAnalyzer&) override;
ImportSpecifierListNode* m_specifierList;
- ModuleSpecifierNode* m_moduleSpecifier;
+ ModuleNameNode* m_moduleName;
};
class ExportAllDeclarationNode : public ModuleDeclarationNode {
public:
- ExportAllDeclarationNode(const JSTokenLocation&, ModuleSpecifierNode*);
+ ExportAllDeclarationNode(const JSTokenLocation&, ModuleNameNode*);
- ModuleSpecifierNode* moduleSpecifier() const { return m_moduleSpecifier; }
+ ModuleNameNode* moduleName() const { return m_moduleName; }
private:
virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
virtual void analyzeModule(ModuleAnalyzer&) override;
- ModuleSpecifierNode* m_moduleSpecifier;
+ ModuleNameNode* m_moduleName;
};
class ExportDefaultDeclarationNode : public ModuleDeclarationNode {
@@ -1767,16 +1769,16 @@
class ExportNamedDeclarationNode : public ModuleDeclarationNode {
public:
- ExportNamedDeclarationNode(const JSTokenLocation&, ExportSpecifierListNode*, ModuleSpecifierNode*);
+ ExportNamedDeclarationNode(const JSTokenLocation&, ExportSpecifierListNode*, ModuleNameNode*);
ExportSpecifierListNode* specifierList() const { return m_specifierList; }
- ModuleSpecifierNode* moduleSpecifier() const { return m_moduleSpecifier; }
+ ModuleNameNode* moduleName() const { return m_moduleName; }
private:
virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
virtual void analyzeModule(ModuleAnalyzer&) override;
ExportSpecifierListNode* m_specifierList;
- ModuleSpecifierNode* m_moduleSpecifier { nullptr };
+ ModuleNameNode* m_moduleName { nullptr };
};
class FunctionParameters : public ParserArenaDeletable {
@@ -1807,7 +1809,7 @@
ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end,
unsigned startColumn, unsigned endColumn, int functionKeywordStart,
int functionNameStart, int parametersStart, bool isInStrictContext,
- ConstructorKind, unsigned, FunctionParseMode);
+ ConstructorKind, unsigned, SourceParseMode);
void finishParsing(const SourceCode&, const Identifier&, FunctionMode);
@@ -1824,7 +1826,7 @@
unsigned startColumn() const { return m_startColumn; }
unsigned endColumn() const { return m_endColumn; }
unsigned parameterCount() const { return m_parameterCount; }
- FunctionParseMode parseMode() const { return m_parseMode; }
+ SourceParseMode parseMode() const { return m_parseMode; }
void setEndPosition(JSTextPosition);
@@ -1855,7 +1857,7 @@
int m_startStartOffset;
unsigned m_parameterCount;
int m_lastLine;
- FunctionParseMode m_parseMode;
+ SourceParseMode m_parseMode;
unsigned m_isInStrictContext : 1;
unsigned m_constructorKind : 2;
};
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/NodesAnalyzeModule.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/NodesAnalyzeModule.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/NodesAnalyzeModule.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -40,16 +40,18 @@
void SourceElements::analyzeModule(ModuleAnalyzer& analyzer)
{
// In the module analyzer phase, only module declarations are included in the top-level SourceElements.
- for (StatementNode* statement = m_head; statement; statement = statement->next())
+ for (StatementNode* statement = m_head; statement; statement = statement->next()) {
+ ASSERT(statement->isModuleDeclarationNode());
static_cast<ModuleDeclarationNode*>(statement)->analyzeModule(analyzer);
+ }
}
void ImportDeclarationNode::analyzeModule(ModuleAnalyzer& analyzer)
{
- analyzer.moduleRecord().appendRequestedModule(m_moduleSpecifier->moduleName());
+ analyzer.moduleRecord().appendRequestedModule(m_moduleName->moduleName());
for (auto* specifier : m_specifierList->specifiers()) {
- analyzer.moduleRecord().addImportEntry({
- m_moduleSpecifier->moduleName(),
+ analyzer.moduleRecord().addImportEntry(ModuleRecord::ImportEntry {
+ m_moduleName->moduleName(),
specifier->importedName(),
specifier->localName()
});
@@ -58,8 +60,8 @@
void ExportAllDeclarationNode::analyzeModule(ModuleAnalyzer& analyzer)
{
- analyzer.moduleRecord().appendRequestedModule(m_moduleSpecifier->moduleName());
- analyzer.moduleRecord().addStarExportEntry(m_moduleSpecifier->moduleName());
+ analyzer.moduleRecord().appendRequestedModule(m_moduleName->moduleName());
+ analyzer.moduleRecord().addStarExportEntry(m_moduleName->moduleName());
}
void ExportDefaultDeclarationNode::analyzeModule(ModuleAnalyzer& analyzer)
@@ -73,16 +75,16 @@
void ExportNamedDeclarationNode::analyzeModule(ModuleAnalyzer& analyzer)
{
- if (m_moduleSpecifier)
- analyzer.moduleRecord().appendRequestedModule(m_moduleSpecifier->moduleName());
+ if (m_moduleName)
+ analyzer.moduleRecord().appendRequestedModule(m_moduleName->moduleName());
for (auto* specifier : m_specifierList->specifiers()) {
- if (m_moduleSpecifier) {
+ if (m_moduleName) {
// export { v } from "mod"
//
// In this case, no local variable names are imported into the current module.
// "v" indirectly points the binding in "mod".
- analyzer.moduleRecord().addExportEntry(ModuleRecord::ExportEntry::createIndirect(specifier->exportedName(), specifier->localName(), m_moduleSpecifier->moduleName()));
+ analyzer.moduleRecord().addExportEntry(ModuleRecord::ExportEntry::createIndirect(specifier->exportedName(), specifier->localName(), m_moduleName->moduleName()));
continue;
}
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Parser.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Parser.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Parser.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -192,7 +192,7 @@
template <typename LexerType>
Parser<LexerType>::Parser(
VM* vm, const SourceCode& source, JSParserBuiltinMode builtinMode,
- JSParserStrictMode strictMode, JSParserCodeType codeType,
+ JSParserStrictMode strictMode, SourceParseMode parseMode,
ConstructorKind defaultConstructorKind, ThisTDZMode thisTDZMode)
: m_vm(vm)
, m_source(&source)
@@ -209,7 +209,6 @@
, m_parsingBuiltin(builtinMode == JSParserBuiltinMode::Builtin)
, m_defaultConstructorKind(defaultConstructorKind)
, m_thisTDZMode(thisTDZMode)
- , m_codeType(codeType)
{
m_lexer = std::make_unique<LexerType>(vm, builtinMode);
m_lexer->setCode(source, &m_parserArena);
@@ -219,9 +218,9 @@
m_token.m_location.lineStartOffset = source.startOffset();
m_functionCache = vm->addSourceProviderCache(source.provider());
ScopeRef scope = pushScope();
- if (codeType == JSParserCodeType::Function)
+ if (isFunctionParseMode(parseMode))
scope->setIsFunction();
- if (codeType == JSParserCodeType::Module)
+ if (isModuleParseMode(parseMode))
scope->setIsModule();
if (strictMode == JSParserStrictMode::Strict)
scope->setStrictMode();
@@ -235,12 +234,10 @@
}
template <typename LexerType>
-String Parser<LexerType>::parseInner(const Identifier& calleeName, FunctionParseMode parseMode, ModuleParseMode moduleParseMode)
+String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode)
{
- UNUSED_PARAM(moduleParseMode);
+ String parseError = String();
- String parseError = String();
-
ASTBuilder context(const_cast<VM*>(m_vm), m_parserArena, const_cast<SourceCode*>(m_source));
ScopeRef scope = currentScope();
scope->setIsLexicalScope();
@@ -252,7 +249,7 @@
m_parameters = functionInfo.parameters;
#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
- if (parseMode == ArrowFunctionMode && !hasError()) {
+ if (parseMode == SourceParseMode::ArrowFunctionMode && !hasError()) {
// The only way we could have an error wile reparsing is if we run out of stack space.
RELEASE_ASSERT(match(ARROWFUNCTION));
next();
@@ -273,8 +270,8 @@
if (isArrowFunctionBodyExpression)
sourceElements = parseArrowFunctionSingleExpressionBodySourceElements(context);
#if ENABLE(ES6_MODULES)
- else if (m_codeType == JSParserCodeType::Module)
- sourceElements = parseModuleSourceElements(context, moduleParseMode);
+ else if (isModuleParseMode(parseMode))
+ sourceElements = parseModuleSourceElements(context, parseMode);
#endif
else
sourceElements = parseSourceElements(context, CheckForStrictMode);
@@ -414,7 +411,7 @@
}
template <typename LexerType>
-template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseModuleSourceElements(TreeBuilder& context, ModuleParseMode moduleParseMode)
+template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseModuleSourceElements(TreeBuilder& context, SourceParseMode parseMode)
{
TreeSourceElements sourceElements = context.createSourceElements();
SyntaxChecker syntaxChecker(const_cast<VM*>(m_vm), m_lexer.get());
@@ -428,7 +425,7 @@
else {
const Identifier* directive = 0;
unsigned directiveLiteralLength = 0;
- if (moduleParseMode == ModuleParseMode::Analyze) {
+ if (parseMode == SourceParseMode::ModuleAnalyzeMode) {
if (!parseStatementListItem(syntaxChecker, directive, &directiveLiteralLength))
break;
continue;
@@ -1547,7 +1544,7 @@
template <typename LexerType>
template <class TreeBuilder> TreeFunctionBody Parser<LexerType>::parseFunctionBody(
TreeBuilder& context, const JSTokenLocation& startLocation, int startColumn, int functionKeywordStart, int functionNameStart, int parametersStart,
- ConstructorKind constructorKind, FunctionBodyType bodyType, unsigned parameterCount, FunctionParseMode parseMode)
+ ConstructorKind constructorKind, FunctionBodyType bodyType, unsigned parameterCount, SourceParseMode parseMode)
{
if (bodyType == StandardFunctionBodyBlock || bodyType == ArrowFunctionBodyBlock) {
next();
@@ -1568,20 +1565,22 @@
return context.createFunctionMetadata(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind, parameterCount, parseMode);
}
-static const char* stringForFunctionMode(FunctionParseMode mode)
+static const char* stringForFunctionMode(SourceParseMode mode)
{
switch (mode) {
- case GetterMode:
+ case SourceParseMode::GetterMode:
return "getter";
- case SetterMode:
+ case SourceParseMode::SetterMode:
return "setter";
- case NormalFunctionMode:
+ case SourceParseMode::NormalFunctionMode:
return "function";
- case MethodMode:
+ case SourceParseMode::MethodMode:
return "method";
- case ArrowFunctionMode:
+ case SourceParseMode::ArrowFunctionMode:
return "arrow function";
- case NotAFunctionMode:
+ case SourceParseMode::ProgramMode:
+ case SourceParseMode::ModuleAnalyzeMode:
+ case SourceParseMode::ModuleEvaluateMode:
RELEASE_ASSERT_NOT_REACHED();
return "";
}
@@ -1589,15 +1588,15 @@
return nullptr;
}
-template <typename LexerType> template <class TreeBuilder> int Parser<LexerType>::parseFunctionParameters(TreeBuilder& context, FunctionParseMode mode, ParserFunctionInfo<TreeBuilder>& functionInfo)
+template <typename LexerType> template <class TreeBuilder> int Parser<LexerType>::parseFunctionParameters(TreeBuilder& context, SourceParseMode mode, ParserFunctionInfo<TreeBuilder>& functionInfo)
{
- RELEASE_ASSERT(mode != NotAFunctionMode);
+ RELEASE_ASSERT(mode != SourceParseMode::ProgramMode && mode != SourceParseMode::ModuleAnalyzeMode && mode != SourceParseMode::ModuleEvaluateMode);
int parametersStart = m_token.m_location.startOffset;
TreeFormalParameterList parameterList = context.createFormalParameterList();
functionInfo.parameters = parameterList;
functionInfo.startOffset = parametersStart;
- if (mode == ArrowFunctionMode) {
+ if (mode == SourceParseMode::ArrowFunctionMode) {
if (!match(IDENT) && !match(OPENPAREN)) {
semanticFailureDueToKeyword(stringForFunctionMode(mode), " name");
failWithMessage("Expected an arrow function input parameter");
@@ -1627,10 +1626,10 @@
failWithMessage("Expected an opening '(' before a ", stringForFunctionMode(mode), "'s parameter list");
}
- if (mode == GetterMode) {
+ if (mode == SourceParseMode::GetterMode) {
consumeOrFail(CLOSEPAREN, "getter functions must have no parameters");
functionInfo.parameterCount = 0;
- } else if (mode == SetterMode) {
+ } else if (mode == SourceParseMode::SetterMode) {
failIfTrue(match(CLOSEPAREN), "setter functions must have one parameter");
const Identifier* duplicateParameter = nullptr;
auto parameter = parseDestructuringPattern(context, DestructureToParameters, ExportType::NotExported, &duplicateParameter);
@@ -1654,9 +1653,9 @@
}
template <typename LexerType>
-template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionParseType parseType)
+template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, SourceParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& functionInfo, FunctionParseType parseType)
{
- RELEASE_ASSERT(mode != NotAFunctionMode);
+ RELEASE_ASSERT(isFunctionParseMode(mode));
AutoPopScopeRef functionScope(this, pushScope());
functionScope->setIsFunction();
@@ -1670,7 +1669,7 @@
switch (parseType) {
case StandardFunctionParseType: {
- RELEASE_ASSERT(mode != ArrowFunctionMode);
+ RELEASE_ASSERT(mode != SourceParseMode::ArrowFunctionMode);
if (match(IDENT) || isLETMaskedAsIDENT()) {
functionInfo.name = m_token.m_data.ident;
m_lastFunctionName = functionInfo.name;
@@ -1678,7 +1677,7 @@
if (!nameIsInContainingScope)
failIfTrueIfStrict(functionScope->declareVariable(functionInfo.name) & DeclarationResult::InvalidStrictMode, "'", functionInfo.name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode");
} else if (requirements == FunctionNeedsName) {
- if (match(OPENPAREN) && mode == NormalFunctionMode)
+ if (match(OPENPAREN) && mode == SourceParseMode::NormalFunctionMode)
semanticFail("Function statements must have a name");
semanticFailureDueToKeyword(stringForFunctionMode(mode), " name");
failDueToUnexpectedToken();
@@ -1708,7 +1707,7 @@
}
#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
case ArrowFunctionParseType: {
- RELEASE_ASSERT(mode == ArrowFunctionMode);
+ RELEASE_ASSERT(mode == SourceParseMode::ArrowFunctionMode);
startLocation = tokenLocation();
functionInfo.startLine = tokenLine();
@@ -1804,7 +1803,7 @@
failIfFalse(functionInfo.body, "Cannot parse the body of this ", stringForFunctionMode(mode));
context.setEndOffset(functionInfo.body, m_lexer->currentOffset());
if (functionScope->strictMode() && functionInfo.name) {
- RELEASE_ASSERT(mode == NormalFunctionMode || mode == MethodMode || mode == ArrowFunctionMode);
+ RELEASE_ASSERT(mode == SourceParseMode::NormalFunctionMode || mode == SourceParseMode::MethodMode || mode == SourceParseMode::ArrowFunctionMode);
semanticFailIfTrue(m_vm->propertyNames->arguments == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode");
semanticFailIfTrue(m_vm->propertyNames->eval == *functionInfo.name, "'", functionInfo.name->impl(), "' is not a valid function name in strict mode");
}
@@ -1869,7 +1868,7 @@
unsigned functionKeywordStart = tokenStart();
next();
ParserFunctionInfo<TreeBuilder> functionInfo;
- failIfFalse((parseFunctionInfo(context, FunctionNeedsName, NormalFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded,
+ failIfFalse((parseFunctionInfo(context, FunctionNeedsName, SourceParseMode::NormalFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded,
functionKeywordStart, functionInfo, StandardFunctionParseType)), "Cannot parse this function");
failIfFalse(functionInfo.name, "Function statements must have a name");
failIfTrueIfStrict(declareVariable(functionInfo.name) & DeclarationResult::InvalidStrictMode, "Cannot declare a function named '", functionInfo.name->impl(), "' in strict mode");
@@ -1999,7 +1998,7 @@
} else {
ParserFunctionInfo<TreeBuilder> methodInfo;
bool isConstructor = !isStaticMethod && *ident == propertyNames.constructor;
- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
failIfTrue(!ident || (declareVariable(ident) & DeclarationResult::InvalidStrictMode), "Cannot declare a method named '", methodInfo.name->impl(), "'");
methodInfo.name = isConstructor ? className : ident;
@@ -2226,16 +2225,16 @@
}
template <typename LexerType>
-template <class TreeBuilder> typename TreeBuilder::ModuleSpecifier Parser<LexerType>::parseModuleSpecifier(TreeBuilder& context)
+template <class TreeBuilder> typename TreeBuilder::ModuleName Parser<LexerType>::parseModuleName(TreeBuilder& context)
{
- // ModuleSpecifier represents the module name imported by the script.
+ // ModuleName (ModuleSpecifier in the spec) represents the module name imported by the script.
// http://www.ecma-international.org/ecma-262/6.0/#sec-imports
// http://www.ecma-international.org/ecma-262/6.0/#sec-exports
JSTokenLocation specifierLocation(tokenLocation());
failIfFalse(match(STRING), "Imported modules names must be string literals");
const Identifier* moduleName = m_token.m_data.ident;
next();
- return context.createModuleSpecifier(specifierLocation, *moduleName);
+ return context.createModuleName(specifierLocation, *moduleName);
}
template <typename LexerType>
@@ -2327,10 +2326,10 @@
if (match(STRING)) {
// import ModuleSpecifier ;
- auto moduleSpecifier = parseModuleSpecifier(context);
- failIfFalse(moduleSpecifier, "Cannot parse the module name");
+ auto moduleName = parseModuleName(context);
+ failIfFalse(moduleName, "Cannot parse the module name");
failIfFalse(autoSemiColon(), "Expected a ';' following a targeted import declaration");
- return context.createImportDeclaration(importLocation, specifierList, moduleSpecifier);
+ return context.createImportDeclaration(importLocation, specifierList, moduleName);
}
bool isFinishedParsingImport = false;
@@ -2378,11 +2377,11 @@
failIfFalse(matchContextualKeyword(m_vm->propertyNames->from), "Expected 'from' before imported module name");
next();
- auto moduleSpecifier = parseModuleSpecifier(context);
- failIfFalse(moduleSpecifier, "Cannot parse the module name");
+ auto moduleName = parseModuleName(context);
+ failIfFalse(moduleName, "Cannot parse the module name");
failIfFalse(autoSemiColon(), "Expected a ';' following a targeted import declaration");
- return context.createImportDeclaration(importLocation, specifierList, moduleSpecifier);
+ return context.createImportDeclaration(importLocation, specifierList, moduleName);
}
template <typename LexerType>
@@ -2427,11 +2426,11 @@
failIfFalse(matchContextualKeyword(m_vm->propertyNames->from), "Expected 'from' before exported module name");
next();
- auto moduleSpecifier = parseModuleSpecifier(context);
- failIfFalse(moduleSpecifier, "Cannot parse the 'from' clause");
+ auto moduleName = parseModuleName(context);
+ failIfFalse(moduleName, "Cannot parse the 'from' clause");
failIfFalse(autoSemiColon(), "Expected a ';' following a targeted export declaration");
- return context.createExportAllDeclaration(exportLocation, moduleSpecifier);
+ return context.createExportAllDeclaration(exportLocation, moduleName);
}
case DEFAULT: {
@@ -2474,6 +2473,9 @@
//
// const *default* = expr;
// export { *default* as default }
+ //
+ // In the above example, *default* is the invisible variable to the users.
+ // We use the private symbol to represent the name of this variable.
JSTokenLocation location(tokenLocation());
JSTextPosition start = tokenStartPosition();
TreeExpression _expression_ = parseAssignmentExpression(context);
@@ -2481,7 +2483,7 @@
DeclarationResultMask declarationResult = declareVariable(&m_vm->propertyNames->starDefaultPrivateName, DeclarationType::ConstDeclaration);
if (declarationResult & DeclarationResult::InvalidDuplicateDeclaration)
- internalFailWithMessage(false, "Cannot export 'default' name twice: '");
+ internalFailWithMessage(false, "Only one 'default' export is allowed");
TreeExpression assignment = context.createAssignResolve(location, m_vm->propertyNames->starDefaultPrivateName, _expression_, start, start, tokenEndPosition(), AssignmentContext::ConstDeclarationStatement);
result = context.createExprStatement(location, assignment, start, tokenEndPosition());
@@ -2491,7 +2493,7 @@
}
failIfFalse(result, "Cannot parse the declaration");
- semanticFailIfFalse(exportName(m_vm->propertyNames->defaultKeyword), "Cannot export 'default' name twice.");
+ semanticFailIfFalse(exportName(m_vm->propertyNames->defaultKeyword), "Only one 'default' export is allowed");
currentScope()->moduleScopeData().exportBinding(*localName);
return context.createExportDefaultDeclaration(exportLocation, result, *localName);
}
@@ -2525,15 +2527,15 @@
}
handleProductionOrFail(CLOSEBRACE, "}", "end", "export list");
- typename TreeBuilder::ModuleSpecifier moduleSpecifier = 0;
+ typename TreeBuilder::ModuleName moduleName = 0;
if (matchContextualKeyword(m_vm->propertyNames->from)) {
next();
- moduleSpecifier = parseModuleSpecifier(context);
- failIfFalse(moduleSpecifier, "Cannot parse the 'from' clause");
+ moduleName = parseModuleName(context);
+ failIfFalse(moduleName, "Cannot parse the 'from' clause");
}
failIfFalse(autoSemiColon(), "Expected a ';' following a targeted export declaration");
- if (!moduleSpecifier) {
+ if (!moduleName) {
semanticFailIfTrue(hasKeywordForLocalBindings, "Cannot use keyword as exported variable name");
// Since this export declaration does not have module specifier part, it exports the local bindings.
// While the export declaration with module specifier does not have any effect on the current module's scope,
@@ -2549,7 +2551,7 @@
}
}
- return context.createExportNamedDeclaration(exportLocation, specifierList, moduleSpecifier);
+ return context.createExportNamedDeclaration(exportLocation, specifierList, moduleName);
}
default: {
@@ -2886,7 +2888,7 @@
JSTokenLocation methodLocation(tokenLocation());
unsigned methodStart = tokenStart();
ParserFunctionInfo<TreeBuilder> methodInfo;
- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, MethodMode, false, ConstructorKind::None, SuperBinding::NotNeeded, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::MethodMode, false, ConstructorKind::None, SuperBinding::NotNeeded, methodStart, methodInfo, StandardFunctionParseType)), "Cannot parse this method");
methodInfo.name = methodName;
return context.createFunctionExpr(methodLocation, methodInfo);
}
@@ -2912,11 +2914,11 @@
ParserFunctionInfo<TreeBuilder> info;
if (type & PropertyNode::Getter) {
failIfFalse(match(OPENPAREN), "Expected a parameter list for getter definition");
- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, GetterMode, false, constructorKind, superBinding,
+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::GetterMode, false, constructorKind, superBinding,
getterOrSetterStartOffset, info, StandardFunctionParseType)), "Cannot parse getter definition");
} else {
failIfFalse(match(OPENPAREN), "Expected a parameter list for setter definition");
- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SetterMode, false, constructorKind, superBinding,
+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::SetterMode, false, constructorKind, superBinding,
getterOrSetterStartOffset, info, StandardFunctionParseType)), "Cannot parse setter definition");
}
if (stringPropertyName)
@@ -3184,7 +3186,7 @@
next();
ParserFunctionInfo<TreeBuilder> info;
info.name = &m_vm->propertyNames->nullIdentifier;
- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, NormalFunctionMode, false, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, StandardFunctionParseType)), "Cannot parse function _expression_");
+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::NormalFunctionMode, false, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, StandardFunctionParseType)), "Cannot parse function _expression_");
return context.createFunctionExpr(location, info);
}
#if ENABLE(ES6_CLASS_SYNTAX)
@@ -3456,7 +3458,7 @@
location = tokenLocation();
ParserFunctionInfo<TreeBuilder> info;
info.name = &m_vm->propertyNames->nullIdentifier;
- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, ArrowFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, ArrowFunctionParseType)), "Cannot parse arrow function _expression_");
+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::ArrowFunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, ArrowFunctionParseType)), "Cannot parse arrow function _expression_");
return context.createArrowFunctionExpr(location, info);
}
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Parser.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Parser.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/Parser.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -615,12 +615,12 @@
public:
Parser(
- VM*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, JSParserCodeType,
+ VM*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, SourceParseMode,
ConstructorKind defaultConstructorKind = ConstructorKind::None, ThisTDZMode = ThisTDZMode::CheckIfNeeded);
~Parser();
template <class ParsedNode>
- std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, FunctionParseMode, ModuleParseMode);
+ std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode);
JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); }
JSTokenLocation locationBeforeLastToken() const { return m_lexer->lastTokenLocation(); }
@@ -848,7 +848,7 @@
}
Parser();
- String parseInner(const Identifier&, FunctionParseMode, ModuleParseMode);
+ String parseInner(const Identifier&, SourceParseMode);
void didFinishParsing(SourceElements*, DeclarationStacks::FunctionStack&, VariableEnvironment&, CodeFeatures, int, const Vector<RefPtr<UniquedStringImpl>>&&);
@@ -1103,7 +1103,7 @@
template <class TreeBuilder> TreeProperty parseProperty(TreeBuilder&, bool strict);
template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName);
template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded);
- template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, FunctionBodyType, unsigned, FunctionParseMode);
+ template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, FunctionBodyType, unsigned, SourceParseMode);
template <class TreeBuilder> ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&, TreeFormalParameterList, unsigned&);
enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
template <class TreeBuilder> TreeExpression parseVariableDeclarationList(TreeBuilder&, int& declarations, TreeDestructuringPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd, VarDeclarationListContext, DeclarationType, ExportType, bool& forLoopConstDoesNotHaveInitializer);
@@ -1113,17 +1113,17 @@
template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern parseDestructuringPattern(TreeBuilder&, DestructuringKind, ExportType, const Identifier** duplicateIdentifier = nullptr, bool* hasDestructuringPattern = nullptr, AssignmentContext = AssignmentContext::DeclarationStatement, int depth = 0);
template <class TreeBuilder> NEVER_INLINE TreeDestructuringPattern tryParseDestructuringPatternExpression(TreeBuilder&, AssignmentContext);
template <class TreeBuilder> NEVER_INLINE TreeExpression parseDefaultValueForDestructuringPattern(TreeBuilder&);
- template <class TreeBuilder> TreeSourceElements parseModuleSourceElements(TreeBuilder&, ModuleParseMode);
+ template <class TreeBuilder> TreeSourceElements parseModuleSourceElements(TreeBuilder&, SourceParseMode);
enum class ImportSpecifierType { NamespaceImport, NamedImport, DefaultImport };
template <class TreeBuilder> typename TreeBuilder::ImportSpecifier parseImportClauseItem(TreeBuilder&, ImportSpecifierType);
- template <class TreeBuilder> typename TreeBuilder::ModuleSpecifier parseModuleSpecifier(TreeBuilder&);
+ template <class TreeBuilder> typename TreeBuilder::ModuleName parseModuleName(TreeBuilder&);
template <class TreeBuilder> TreeStatement parseImportDeclaration(TreeBuilder&);
template <class TreeBuilder> typename TreeBuilder::ExportSpecifier parseExportSpecifier(TreeBuilder& context, Vector<const Identifier*>& maybeLocalNames, bool& hasKeywordForLocalBindings);
template <class TreeBuilder> TreeStatement parseExportDeclaration(TreeBuilder&);
- template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionParseType);
+ template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, SourceParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionParseType);
- template <class TreeBuilder> NEVER_INLINE int parseFunctionParameters(TreeBuilder&, FunctionParseMode, ParserFunctionInfo<TreeBuilder>&);
+ template <class TreeBuilder> NEVER_INLINE int parseFunctionParameters(TreeBuilder&, SourceParseMode, ParserFunctionInfo<TreeBuilder>&);
#if ENABLE(ES6_CLASS_SYNTAX)
template <class TreeBuilder> NEVER_INLINE TreeClassExpression parseClass(TreeBuilder&, FunctionRequirements, ParserClassInfo<TreeBuilder>&);
@@ -1247,7 +1247,6 @@
Vector<RefPtr<UniquedStringImpl>> m_closedVariables;
CodeFeatures m_features;
int m_numConstants;
- JSParserCodeType m_codeType;
struct DepthManager {
DepthManager(int* depth)
@@ -1270,7 +1269,7 @@
template <typename LexerType>
template <class ParsedNode>
-std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, FunctionParseMode parseMode, ModuleParseMode moduleParseMode)
+std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode)
{
int errLine;
String errMsg;
@@ -1287,7 +1286,7 @@
ASSERT(m_source->startColumn() > 0);
unsigned startColumn = m_source->startColumn() - 1;
- String parseError = parseInner(calleeName, parseMode, moduleParseMode);
+ String parseError = parseInner(calleeName, parseMode);
int lineNumber = m_lexer->lineNumber();
bool lexError = m_lexer->sawError();
@@ -1353,18 +1352,17 @@
std::unique_ptr<ParsedNode> parse(
VM* vm, const SourceCode& source,
const Identifier& name, JSParserBuiltinMode builtinMode,
- JSParserStrictMode strictMode, JSParserCodeType codeType,
+ JSParserStrictMode strictMode, SourceParseMode parseMode,
ParserError& error, JSTextPosition* positionBeforeLastNewline = nullptr,
- FunctionParseMode parseMode = NotAFunctionMode, ConstructorKind defaultConstructorKind = ConstructorKind::None,
- ThisTDZMode thisTDZMode = ThisTDZMode::CheckIfNeeded,
- ModuleParseMode moduleParseMode = ModuleParseMode::Analyze)
+ ConstructorKind defaultConstructorKind = ConstructorKind::None,
+ ThisTDZMode thisTDZMode = ThisTDZMode::CheckIfNeeded)
{
SamplingRegion samplingRegion("Parsing");
ASSERT(!source.provider()->source().isNull());
if (source.provider()->source().is8Bit()) {
- Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
- std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode, moduleParseMode);
+ Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, parseMode, defaultConstructorKind, thisTDZMode);
+ std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
if (positionBeforeLastNewline)
*positionBeforeLastNewline = parser.positionBeforeLastNewline();
if (builtinMode == JSParserBuiltinMode::Builtin) {
@@ -1376,8 +1374,8 @@
return result;
}
ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string");
- Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
- std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode, moduleParseMode);
+ Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, parseMode, defaultConstructorKind, thisTDZMode);
+ std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(error, name, parseMode);
if (positionBeforeLastNewline)
*positionBeforeLastNewline = parser.positionBeforeLastNewline();
return result;
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ParserModes.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ParserModes.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/ParserModes.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -38,22 +38,80 @@
enum class ConstructorKind { None, Base, Derived };
enum class SuperBinding { Needed, NotNeeded };
enum class ThisTDZMode { AlwaysCheck, CheckIfNeeded };
-enum class ModuleParseMode { Analyze, Evaluate };
enum ProfilerMode { ProfilerOff, ProfilerOn };
enum DebuggerMode { DebuggerOff, DebuggerOn };
enum FunctionMode { FunctionExpression, FunctionDeclaration };
-enum FunctionParseMode {
+enum class SourceParseMode {
NormalFunctionMode,
GetterMode,
SetterMode,
MethodMode,
- NotAFunctionMode,
- ArrowFunctionMode
+ ArrowFunctionMode,
+ ProgramMode,
+ ModuleAnalyzeMode,
+ ModuleEvaluateMode
};
+inline bool isFunctionParseMode(SourceParseMode parseMode)
+{
+ switch (parseMode) {
+ case SourceParseMode::NormalFunctionMode:
+ case SourceParseMode::GetterMode:
+ case SourceParseMode::SetterMode:
+ case SourceParseMode::MethodMode:
+ case SourceParseMode::ArrowFunctionMode:
+ return true;
+
+ case SourceParseMode::ProgramMode:
+ case SourceParseMode::ModuleAnalyzeMode:
+ case SourceParseMode::ModuleEvaluateMode:
+ return false;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
+}
+
+inline bool isModuleParseMode(SourceParseMode parseMode)
+{
+ switch (parseMode) {
+ case SourceParseMode::ModuleAnalyzeMode:
+ case SourceParseMode::ModuleEvaluateMode:
+ return true;
+
+ case SourceParseMode::NormalFunctionMode:
+ case SourceParseMode::GetterMode:
+ case SourceParseMode::SetterMode:
+ case SourceParseMode::MethodMode:
+ case SourceParseMode::ArrowFunctionMode:
+ case SourceParseMode::ProgramMode:
+ return false;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
+}
+
+inline bool isProgramParseMode(SourceParseMode parseMode)
+{
+ switch (parseMode) {
+ case SourceParseMode::ProgramMode:
+ return true;
+
+ case SourceParseMode::NormalFunctionMode:
+ case SourceParseMode::GetterMode:
+ case SourceParseMode::SetterMode:
+ case SourceParseMode::MethodMode:
+ case SourceParseMode::ArrowFunctionMode:
+ case SourceParseMode::ModuleAnalyzeMode:
+ case SourceParseMode::ModuleEvaluateMode:
+ return false;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return false;
+}
+
inline bool functionNameIsInScope(const Identifier& name, FunctionMode functionMode)
{
if (name.isNull())
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/SyntaxChecker.h (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/SyntaxChecker.h 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/parser/SyntaxChecker.h 2015-08-14 11:46:08 UTC (rev 188463)
@@ -84,7 +84,7 @@
TemplateStringResult, TemplateStringListResult,
TemplateExpressionListResult, TemplateExpr,
TaggedTemplateExpr,
- ModuleSpecifierResult,
+ ModuleNameResult,
ImportSpecifierResult, ImportSpecifierListResult,
ExportSpecifierResult, ExportSpecifierListResult
};
@@ -127,7 +127,7 @@
#if ENABLE(ES6_CLASS_SYNTAX)
typedef int ClassExpression;
#endif
- typedef int ModuleSpecifier;
+ typedef int ModuleName;
typedef int ImportSpecifier;
typedef int ImportSpecifierList;
typedef int ExportSpecifier;
@@ -186,7 +186,7 @@
ClassExpression createClassExpr(const JSTokenLocation&, const Identifier&, ExpressionType, ExpressionType, PropertyList, PropertyList) { return ClassExpr; }
#endif
ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
- int createFunctionMetadata(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, unsigned, int) { return FunctionBodyResult; }
+ int createFunctionMetadata(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, int, int, int, ConstructorKind, unsigned, SourceParseMode) { return FunctionBodyResult; }
ExpressionType createArrowFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&) { return FunctionExpr; }
void setFunctionNameStart(int, int) { }
int createArguments() { return ArgumentsResult; }
@@ -259,15 +259,15 @@
int createThrowStatement(const JSTokenLocation&, int, int, int) { return StatementResult; }
int createDebugger(const JSTokenLocation&, int, int) { return StatementResult; }
int createConstStatement(const JSTokenLocation&, int, int, int) { return StatementResult; }
- int createModuleSpecifier(const JSTokenLocation&, const Identifier&) { return ModuleSpecifierResult; }
+ int createModuleName(const JSTokenLocation&, const Identifier&) { return ModuleNameResult; }
ImportSpecifier createImportSpecifier(const JSTokenLocation&, const Identifier&, const Identifier&) { return ImportSpecifierResult; }
ImportSpecifierList createImportSpecifierList() { return ImportSpecifierListResult; }
void appendImportSpecifier(ImportSpecifierList, ImportSpecifier) { }
- int createImportDeclaration(const JSTokenLocation&, ImportSpecifierList, ModuleSpecifier) { return StatementResult; }
- int createExportAllDeclaration(const JSTokenLocation&, ModuleSpecifier) { return StatementResult; }
+ int createImportDeclaration(const JSTokenLocation&, ImportSpecifierList, ModuleName) { return StatementResult; }
+ int createExportAllDeclaration(const JSTokenLocation&, ModuleName) { return StatementResult; }
int createExportDefaultDeclaration(const JSTokenLocation&, int, const Identifier&) { return StatementResult; }
int createExportLocalDeclaration(const JSTokenLocation&, int) { return StatementResult; }
- int createExportNamedDeclaration(const JSTokenLocation&, ExportSpecifierList, ModuleSpecifier) { return StatementResult; }
+ int createExportNamedDeclaration(const JSTokenLocation&, ExportSpecifierList, ModuleName) { return StatementResult; }
ExportSpecifier createExportSpecifier(const JSTokenLocation&, const Identifier&, const Identifier&) { return ExportSpecifierResult; }
ExportSpecifierList createExportSpecifierList() { return ExportSpecifierListResult; }
void appendExportSpecifier(ExportSpecifierList, ExportSpecifier) { }
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/CodeCache.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/CodeCache.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/CodeCache.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -94,8 +94,8 @@
typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode;
std::unique_ptr<RootNode> rootNode = parse<RootNode>(
- &vm, source, Identifier(), builtinMode, strictMode,
- JSParserCodeType::Program, error, nullptr, FunctionParseMode::NotAFunctionMode, ConstructorKind::None, thisTDZMode);
+ &vm, source, Identifier(), builtinMode, strictMode,
+ SourceParseMode::ProgramMode, error, nullptr, ConstructorKind::None, thisTDZMode);
if (!rootNode)
return nullptr;
@@ -145,8 +145,8 @@
JSTextPosition positionBeforeLastNewline;
std::unique_ptr<ProgramNode> program = parse<ProgramNode>(
- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, JSParserCodeType::Program,
+ &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
+ JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode,
error, &positionBeforeLastNewline);
if (!program) {
RELEASE_ASSERT(error.isValid());
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/Completion.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/Completion.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/Completion.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -59,8 +59,8 @@
JSLockHolder lock(vm);
RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
return !!parse<ProgramNode>(
- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, JSParserCodeType::Program, error);
+ &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
+ JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, error);
}
bool checkModuleSyntax(VM& vm, const SourceCode& source, ParserError& error)
@@ -69,7 +69,7 @@
RELEASE_ASSERT(vm.atomicStringTable() == wtfThreadData().atomicStringTable());
std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>(
&vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::Strict, JSParserCodeType::Module, error);
+ JSParserStrictMode::Strict, SourceParseMode::ModuleAnalyzeMode, error);
if (!moduleProgramNode)
return false;
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/Executable.cpp (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/Executable.cpp 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/runtime/Executable.cpp 2015-08-14 11:46:08 UTC (rev 188463)
@@ -462,7 +462,7 @@
JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
std::unique_ptr<ProgramNode> programNode = parse<ProgramNode>(
vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin,
- JSParserStrictMode::NotStrict, JSParserCodeType::Program, error);
+ JSParserStrictMode::NotStrict, SourceParseMode::ProgramMode, error);
if (programNode)
return 0;
ASSERT(error.isValid());
Modified: releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/tests/stress/modules-syntax-error-with-names.js (188462 => 188463)
--- releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/tests/stress/modules-syntax-error-with-names.js 2015-08-14 11:33:44 UTC (rev 188462)
+++ releases/WebKitGTK/webkit-2.10/Source/_javascript_Core/tests/stress/modules-syntax-error-with-names.js 2015-08-14 11:46:08 UTC (rev 188463)
@@ -187,8 +187,13 @@
checkModuleSyntaxError(String.raw`
export default 20;
export default function hello () { }
-`, `SyntaxError: Cannot export 'default' name twice..:4`);
+`, `SyntaxError: Only one 'default' export is allowed.:4`);
+checkModuleSyntaxError(String.raw`
+export default function hello () { }
+export default 20;
+`, `SyntaxError: Only one 'default' export is allowed.:4`);
+
// FIXME: These tests also should be passed. But now, var and lexical declared names can be co-exist on Script / Module top level scope.
// This will be fixed when this issue is fixed for Script environment.
// http://www.ecma-international.org/ecma-262/6.0/#sec-scripts-static-semantics-early-errors