Modified: trunk/Source/_javascript_Core/parser/Nodes.h (187110 => 187111)
--- trunk/Source/_javascript_Core/parser/Nodes.h 2015-07-21 18:43:46 UTC (rev 187110)
+++ trunk/Source/_javascript_Core/parser/Nodes.h 2015-07-21 19:18:47 UTC (rev 187111)
@@ -1747,7 +1747,7 @@
};
#endif
- class DestructuringPatternNode : public ParserArenaDeletable {
+ class DestructuringPatternNode : public ParserArenaFreeable {
public:
virtual ~DestructuringPatternNode() { }
virtual void collectBoundIdentifiers(Vector<Identifier>&) const = 0;
@@ -1761,8 +1761,10 @@
DestructuringPatternNode();
};
- class ArrayPatternNode : public DestructuringPatternNode, public ThrowableExpressionData {
+ class ArrayPatternNode : public DestructuringPatternNode, public ThrowableExpressionData, public ParserArenaDeletable {
public:
+ using ParserArenaDeletable::operator new;
+
ArrayPatternNode();
enum class BindingType {
Elision,
@@ -1789,14 +1791,16 @@
Vector<Entry> m_targetPatterns;
};
- class ObjectPatternNode : public DestructuringPatternNode {
+ class ObjectPatternNode : public DestructuringPatternNode, public ParserArenaDeletable {
public:
+ using ParserArenaDeletable::operator new;
+
ObjectPatternNode();
void appendEntry(const JSTokenLocation&, const Identifier& identifier, bool wasString, DestructuringPatternNode* pattern, ExpressionNode* defaultValue)
{
m_targetPatterns.append(Entry{ identifier, wasString, pattern, defaultValue });
}
-
+
private:
virtual void collectBoundIdentifiers(Vector<Identifier>&) const override;
virtual void bindValue(BytecodeGenerator&, RegisterID*) const override;
@@ -1827,17 +1831,15 @@
JSTextPosition m_divotStart;
JSTextPosition m_divotEnd;
- Identifier m_boundProperty;
+ const Identifier& m_boundProperty;
AssignmentContext m_bindingContext;
};
- class DestructuringAssignmentNode : public ExpressionNode, public ParserArenaDeletable {
+ class DestructuringAssignmentNode : public ExpressionNode {
public:
DestructuringAssignmentNode(const JSTokenLocation&, DestructuringPatternNode*, ExpressionNode*);
DestructuringPatternNode* bindings() { return m_bindings; }
- using ParserArenaDeletable::operator new;
-
private:
virtual bool isAssignmentLocation() const override { return true; }
virtual bool isDestructuringNode() const override { return true; }
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (187110 => 187111)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2015-07-21 18:43:46 UTC (rev 187110)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2015-07-21 19:18:47 UTC (rev 187111)
@@ -763,27 +763,27 @@
if (match(CLOSEBRACE))
break;
- Identifier propertyName;
+ const Identifier* propertyName = nullptr;
TreeDestructuringPattern innerPattern = 0;
JSTokenLocation location = m_token.m_location;
if (match(IDENT) || isLETMaskedAsIDENT()) {
failIfTrue(match(LET) && (kind == DestructureToLet || kind == DestructureToConst), "Can't use 'let' as an identifier name for a LexicalDeclaration");
- propertyName = *m_token.m_data.ident;
+ propertyName = m_token.m_data.ident;
JSToken identifierToken = m_token;
next();
if (consume(COLON))
innerPattern = parseDestructuringPattern(context, kind, bindingContext, depth + 1);
else
- innerPattern = createBindingPattern(context, kind, propertyName, depth, identifierToken, bindingContext);
+ innerPattern = createBindingPattern(context, kind, *propertyName, depth, identifierToken, bindingContext);
} else {
JSTokenType tokenType = m_token.m_type;
switch (m_token.m_type) {
case DOUBLE:
case INTEGER:
- propertyName = Identifier::from(m_vm, m_token.m_data.doubleValue);
+ propertyName = &m_parserArena.identifierArena().makeNumericIdentifier(const_cast<VM*>(m_vm), m_token.m_data.doubleValue);
break;
case STRING:
- propertyName = *m_token.m_data.ident;
+ propertyName = m_token.m_data.ident;
wasString = true;
break;
default:
@@ -792,16 +792,16 @@
return 0;
failWithMessage("Expected a property name");
}
- propertyName = *m_token.m_data.ident;
+ propertyName = m_token.m_data.ident;
break;
}
next();
if (!consume(COLON)) {
if (kind == DestructureToExpressions)
return 0;
- semanticFailIfTrue(tokenType == RESERVED, "Cannot use abbreviated destructuring syntax for reserved name '", propertyName.impl(), "'");
- semanticFailIfTrue(tokenType == RESERVED_IF_STRICT, "Cannot use abbreviated destructuring syntax for reserved name '", propertyName.impl(), "' in strict mode");
- semanticFailIfTrue(tokenType & KeywordTokenFlag, "Cannot use abbreviated destructuring syntax for keyword '", propertyName.impl(), "'");
+ semanticFailIfTrue(tokenType == RESERVED, "Cannot use abbreviated destructuring syntax for reserved name '", propertyName->impl(), "'");
+ semanticFailIfTrue(tokenType == RESERVED_IF_STRICT, "Cannot use abbreviated destructuring syntax for reserved name '", propertyName->impl(), "' in strict mode");
+ semanticFailIfTrue(tokenType & KeywordTokenFlag, "Cannot use abbreviated destructuring syntax for keyword '", propertyName->impl(), "'");
failWithMessage("Expected a ':' prior to a named destructuring property");
}
@@ -812,7 +812,8 @@
failIfFalse(innerPattern, "Cannot parse this destructuring pattern");
TreeExpression defaultValue = parseDefaultValueForDestructuringPattern(context);
failIfTrue(kind == DestructureToParameters && defaultValue, "Default values in destructuring parameters are currently not supported");
- context.appendObjectPatternEntry(objectPattern, location, wasString, propertyName, innerPattern, defaultValue);
+ ASSERT(propertyName);
+ context.appendObjectPatternEntry(objectPattern, location, wasString, *propertyName, innerPattern, defaultValue);
} while (consume(COMMA));
if (kind == DestructureToExpressions && !match(CLOSEBRACE))