Changeset 178888 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Jan 21, 2015, 10:39:31 PM (10 years ago)
Author:
[email protected]
Message:

Consolidate out arguments of parseFunctionInfo into a struct
https://bugs.webkit.org/show_bug.cgi?id=140754

Reviewed by Oliver Hunt.

Introduced ParserFunctionInfo for storing out arguments of parseFunctionInfo.

(JSC::ASTBuilder::createFunctionExpr):
(JSC::ASTBuilder::createGetterOrSetterProperty): This one takes a property name in addition to
ParserFunctionInfo since the property name and the function name could differ.
(JSC::ASTBuilder::createFuncDeclStatement):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parseMemberExpression):

  • parser/Parser.h:
  • parser/ParserFunctionInfo.h: Added.
  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::createFunctionExpr):
(JSC::SyntaxChecker::createFuncDeclStatement):
(JSC::SyntaxChecker::createClassDeclStatement):
(JSC::SyntaxChecker::createGetterOrSetterProperty):

Location:
trunk/Source/JavaScriptCore
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r178884 r178888  
     12015-01-21  Ryosuke Niwa  <[email protected]>
     2
     3        Consolidate out arguments of parseFunctionInfo into a struct
     4        https://bugs.webkit.org/show_bug.cgi?id=140754
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Introduced ParserFunctionInfo for storing out arguments of parseFunctionInfo.
     9
     10        * JavaScriptCore.xcodeproj/project.pbxproj:
     11        * parser/ASTBuilder.h:
     12        (JSC::ASTBuilder::createFunctionExpr):
     13        (JSC::ASTBuilder::createGetterOrSetterProperty): This one takes a property name in addition to
     14        ParserFunctionInfo since the property name and the function name could differ.
     15        (JSC::ASTBuilder::createFuncDeclStatement):
     16        * parser/Parser.cpp:
     17        (JSC::Parser<LexerType>::parseFunctionInfo):
     18        (JSC::Parser<LexerType>::parseFunctionDeclaration):
     19        (JSC::Parser<LexerType>::parseProperty):
     20        (JSC::Parser<LexerType>::parseMemberExpression):
     21        * parser/Parser.h:
     22        * parser/ParserFunctionInfo.h: Added.
     23        * parser/SyntaxChecker.h:
     24        (JSC::SyntaxChecker::createFunctionExpr):
     25        (JSC::SyntaxChecker::createFuncDeclStatement):
     26        (JSC::SyntaxChecker::createClassDeclStatement):
     27        (JSC::SyntaxChecker::createGetterOrSetterProperty):
     28
    1292015-01-21  Mark Hahnenberg  <[email protected]>
    230
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r178714 r178888  
    27832783                99E45A2218A1B2590026D88F /* InputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputCursor.h; sourceTree = "<group>"; };
    27842784                99E45A2318A1B2590026D88F /* NondeterministicInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NondeterministicInput.h; sourceTree = "<group>"; };
     2785                9B4954E81A6640DB002815A6 /* ParserFunctionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserFunctionInfo.h; sourceTree = "<group>"; };
    27852786                9E729409190F0306001A91B5 /* BundlePath.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundlePath.mm; sourceTree = "<group>"; };
    27862787                9E72940A190F0514001A91B5 /* BundlePath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BundlePath.h; sourceTree = "<group>"; };
     
    41464147                                93052C330FB792190048FDC3 /* ParserArena.h */,
    41474148                                0FCCAE4316D0CF6E00D0C65B /* ParserError.h */,
     4149                                9B4954E81A6640DB002815A6 /* ParserFunctionInfo.h */,
    41484150                                A77F18241641925400640A47 /* ParserModes.h */,
    41494151                                65303D631447B9E100D3F904 /* ParserTokens.h */,
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r177001 r178888  
    274274    }
    275275
    276     ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned startColumn, unsigned functionKeywordStart)
    277     {
    278         FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *name, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, startColumn), parameters);
    279         body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset);
    280         body->setFunctionKeywordStart(functionKeywordStart);
     276    ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info, unsigned functionKeywordStart)
     277    {
     278        FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *info.name, info.body,
     279            m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
     280        info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     281        info.body->setFunctionKeywordStart(functionKeywordStart);
    281282        return result;
    282283    }
     
    292293    }
    293294   
    294     NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool, const Identifier* name, ParameterNode* params, FunctionBodyNode* body, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned bodyStartColumn, unsigned getOrSetStartOffset)
     295    NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool,
     296        const Identifier* name, const ParserFunctionInfo<ASTBuilder>& info, unsigned getOrSetStartOffset)
    295297    {
    296298        ASSERT(name);
    297         body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset);
    298         body->setInferredName(*name);
    299         body->setFunctionKeywordStart(getOrSetStartOffset);
    300         return new (m_parserArena) PropertyNode(*name, new (m_parserArena) FuncExprNode(location, m_vm->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn), params), type);
    301     }
    302    
    303     NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool, double name, ParameterNode* params, FunctionBodyNode* body, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned bodyStartColumn, unsigned getOrSetStartOffset)
    304     {
    305         body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset);
    306         body->setFunctionKeywordStart(getOrSetStartOffset);
    307         return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, name), new (m_parserArena) FuncExprNode(location, vm->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn), params), type);
     299        info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     300        info.body->setInferredName(*name);
     301        info.body->setFunctionKeywordStart(getOrSetStartOffset);
     302        return new (m_parserArena) PropertyNode(*name, new (m_parserArena) FuncExprNode(location, m_vm->propertyNames->nullIdentifier,
     303            info.body, m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters), type);
     304    }
     305   
     306    NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool, double name, const ParserFunctionInfo<ASTBuilder>& info, unsigned getOrSetStartOffset)
     307    {
     308        info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     309        info.body->setFunctionKeywordStart(getOrSetStartOffset);
     310        const Identifier& ident = parserArena.identifierArena().makeNumericIdentifier(vm, name);
     311        return new (m_parserArena) PropertyNode(ident, new (m_parserArena) FuncExprNode(location, vm->propertyNames->nullIdentifier,
     312            info.body, m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters), type);
    308313    }
    309314
     
    337342    ClauseListNode* createClauseList(ClauseListNode* tail, CaseClauseNode* clause) { return new (m_parserArena) ClauseListNode(tail, clause); }
    338343
    339     StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned bodyStartColumn, unsigned functionKeywordStart)
    340     {
    341         FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *name, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn), parameters);
    342         if (*name == m_vm->propertyNames->arguments)
     344    StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info, unsigned functionKeywordStart)
     345    {
     346        FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *info.name, info.body,
     347            m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
     348        if (*info.name == m_vm->propertyNames->arguments)
    343349            usesArguments();
    344350        m_scope.m_funcDeclarations.append(decl->body());
    345         body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset);
    346         body->setFunctionKeywordStart(functionKeywordStart);
     351        info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
     352        info.body->setFunctionKeywordStart(functionKeywordStart);
    347353        return decl;
    348354    }
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r178692 r178888  
    12741274
    12751275template <typename LexerType>
    1276 template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, const Identifier*& name, TreeFormalParameterList& parameters, TreeFunctionBody& body, unsigned& openBraceOffset, unsigned& closeBraceOffset, int& bodyStartLine, unsigned& bodyStartColumn)
     1276template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ParserFunctionInfo<TreeBuilder>& info)
    12771277{
    12781278    AutoPopScopeRef functionScope(this, pushScope());
     
    12821282    m_lastFunctionName = nullptr;
    12831283    if (match(IDENT)) {
    1284         name = m_token.m_data.ident;
    1285         m_lastFunctionName = name;
     1284        info.name = m_token.m_data.ident;
     1285        m_lastFunctionName = info.name;
    12861286        next();
    12871287        if (!nameIsInContainingScope)
    1288             failIfFalseIfStrict(functionScope->declareVariable(name), "'", name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode");
     1288            failIfFalseIfStrict(functionScope->declareVariable(info.name), "'", info.name->impl(), "' is not a valid ", stringForFunctionMode(mode), " name in strict mode");
    12891289    } else if (requirements == FunctionNeedsName) {
    12901290        if (match(OPENPAREN) && mode == FunctionMode)
     
    12991299    }
    13001300    if (!match(CLOSEPAREN)) {
    1301         parameters = parseFormalParameters(context);
    1302         failIfFalse(parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode));
     1301        info.parameters = parseFormalParameters(context);
     1302        failIfFalse(info.parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode));
    13031303    }
    13041304    consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration");
    13051305    matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body");
    13061306   
    1307     openBraceOffset = m_token.m_data.offset;
    1308     bodyStartLine = tokenLine();
    1309     bodyStartColumn = m_token.m_data.offset - m_token.m_data.lineStartOffset;
     1307    info.openBraceOffset = m_token.m_data.offset;
     1308    info.bodyStartLine = tokenLine();
     1309    info.bodyStartColumn = m_token.m_data.offset - m_token.m_data.lineStartOffset;
    13101310    JSTokenLocation startLocation(tokenLocation());
    13111311   
    13121312    // If we know about this function already, we can use the cached info and skip the parser to the end of the function.
    1313     if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(openBraceOffset) : 0) {
     1313    if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(info.openBraceOffset) : 0) {
    13141314        // If we're in a strict context, the cached function info must say it was strict too.
    13151315        ASSERT(!strictMode() || cachedInfo->strictMode);
     
    13201320        endLocation.lineStartOffset = cachedInfo->closeBraceLineStartOffset;
    13211321
    1322         bool endColumnIsOnStartLine = (endLocation.line == bodyStartLine);
     1322        bool endColumnIsOnStartLine = (endLocation.line == info.bodyStartLine);
    13231323        ASSERT(endLocation.startOffset >= endLocation.lineStartOffset);
    13241324        unsigned bodyEndColumn = endColumnIsOnStartLine ?
     
    13271327        unsigned currentLineStartOffset = m_token.m_location.lineStartOffset;
    13281328
    1329         body = context.createFunctionBody(startLocation, endLocation, bodyStartColumn, bodyEndColumn, cachedInfo->strictMode);
     1329        info.body = context.createFunctionBody(startLocation, endLocation, info.bodyStartColumn, bodyEndColumn, cachedInfo->strictMode);
    13301330       
    13311331        functionScope->restoreFromSourceProviderCache(cachedInfo);
    13321332        failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), "Parser error");
    13331333       
    1334         closeBraceOffset = cachedInfo->closeBraceOffset;
    1335 
    1336         context.setFunctionNameStart(body, functionNameStart);
     1334        info.closeBraceOffset = cachedInfo->closeBraceOffset;
     1335
     1336        context.setFunctionNameStart(info.body, functionNameStart);
    13371337        m_token = cachedInfo->closeBraceToken();
    13381338        if (endColumnIsOnStartLine)
     
    13421342        m_lexer->setLineNumber(m_token.m_location.line);
    13431343
    1344         context.setEndOffset(body, m_lexer->currentOffset());
     1344        context.setEndOffset(info.body, m_lexer->currentOffset());
    13451345       
    13461346        next();
     1347        info.bodyEndLine = m_lastTokenEndPosition.line;
    13471348        return true;
    13481349    }
    13491350    m_lastFunctionName = lastFunctionName;
    13501351    ParserState oldState = saveState();
    1351     body = parseFunctionBody(context);
     1352    info.body = parseFunctionBody(context);
    13521353    restoreState(oldState);
    1353     failIfFalse(body, "Cannot parse the body of this ", stringForFunctionMode(mode));
    1354     context.setEndOffset(body, m_lexer->currentOffset());
    1355     if (functionScope->strictMode() && name) {
     1354    failIfFalse(info.body, "Cannot parse the body of this ", stringForFunctionMode(mode));
     1355    context.setEndOffset(info.body, m_lexer->currentOffset());
     1356    if (functionScope->strictMode() && info.name) {
    13561357        RELEASE_ASSERT(mode == FunctionMode);
    1357         semanticFailIfTrue(m_vm->propertyNames->arguments == *name, "'", name->impl(), "' is not a valid function name in strict mode");
    1358         semanticFailIfTrue(m_vm->propertyNames->eval == *name, "'", name->impl(), "' is not a valid function name in strict mode");
    1359     }
    1360     closeBraceOffset = m_token.m_data.offset;
     1358        semanticFailIfTrue(m_vm->propertyNames->arguments == *info.name, "'", info.name->impl(), "' is not a valid function name in strict mode");
     1359        semanticFailIfTrue(m_vm->propertyNames->eval == *info.name, "'", info.name->impl(), "' is not a valid function name in strict mode");
     1360    }
     1361    info.closeBraceOffset = m_token.m_data.offset;
    13611362    unsigned closeBraceLine = m_token.m_data.line;
    13621363    unsigned closeBraceLineStartOffset = m_token.m_data.lineStartOffset;
     
    13661367    static const int minimumFunctionLengthToCache = 16;
    13671368    std::unique_ptr<SourceProviderCacheItem> newInfo;
    1368     int functionLength = closeBraceOffset - openBraceOffset;
     1369    int functionLength = info.closeBraceOffset - info.openBraceOffset;
    13691370    if (TreeBuilder::CanUseFunctionCache && m_functionCache && functionLength > minimumFunctionLengthToCache) {
    13701371        SourceProviderCacheItemCreationParameters parameters;
    13711372        parameters.functionNameStart = functionNameStart;
    13721373        parameters.closeBraceLine = closeBraceLine;
    1373         parameters.closeBraceOffset = closeBraceOffset;
     1374        parameters.closeBraceOffset = info.closeBraceOffset;
    13741375        parameters.closeBraceLineStartOffset = closeBraceLineStartOffset;
    13751376        functionScope->fillParametersForSourceProviderCache(parameters);
     
    13771378
    13781379    }
    1379     context.setFunctionNameStart(body, functionNameStart);
     1380    context.setFunctionNameStart(info.body, functionNameStart);
    13801381   
    13811382    failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), "Parser error");
     
    13831384   
    13841385    if (newInfo)
    1385         m_functionCache->add(openBraceOffset, WTF::move(newInfo));
     1386        m_functionCache->add(info.openBraceOffset, WTF::move(newInfo));
    13861387   
    13871388    next();
     1389    info.bodyEndLine = m_lastTokenEndPosition.line;
    13881390    return true;
    13891391}
     
    13961398    unsigned functionKeywordStart = tokenStart();
    13971399    next();
    1398     const Identifier* name = 0;
    1399     TreeFormalParameterList parameters = 0;
    1400     TreeFunctionBody body = 0;
    1401     unsigned openBraceOffset = 0;
    1402     unsigned closeBraceOffset = 0;
    1403     int bodyStartLine = 0;
    1404     unsigned bodyStartColumn = 0;
    1405     failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, true, name, parameters, body, openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn)), "Cannot parse this function");
    1406     failIfFalse(name, "Function statements must have a name");
    1407     failIfFalseIfStrict(declareVariable(name), "Cannot declare a function named '", name->impl(), "' in strict mode");
    1408     return context.createFuncDeclStatement(location, name, body, parameters, openBraceOffset, closeBraceOffset, bodyStartLine, m_lastTokenEndPosition.line, bodyStartColumn, functionKeywordStart);
     1400    ParserFunctionInfo<TreeBuilder> info;
     1401    failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, true, info)), "Cannot parse this function");
     1402    failIfFalse(info.name, "Function statements must have a name");
     1403    failIfFalseIfStrict(declareVariable(info.name), "Cannot declare a function named '", info.name->impl(), "' in strict mode");
     1404    return context.createFuncDeclStatement(location, info, functionKeywordStart);
    14091405}
    14101406
     
    18001796        }
    18011797        failIfFalse(wasIdent, "Expected an identifier as property name");
    1802         const Identifier* accessorName = 0;
    1803         TreeFormalParameterList parameters = 0;
    1804         TreeFunctionBody body = 0;
    1805         unsigned openBraceOffset = 0;
    1806         unsigned closeBraceOffset = 0;
    1807         int bodyStartLine = 0;
    1808         unsigned bodyStartColumn = 0;
    18091798        PropertyNode::Type type;
    18101799        if (*ident == m_vm->propertyNames->get)
     
    18241813        JSTokenLocation location(tokenLocation());
    18251814        next();
     1815        ParserFunctionInfo<TreeBuilder> info;
    18261816        if (type == PropertyNode::Getter) {
    18271817            failIfFalse(match(OPENPAREN), "Expected a parameter list for getter definition");
    1828             failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, GetterMode, false, accessorName, parameters, body, openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn)), "Cannot parse getter definition");
     1818            failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, GetterMode, false, info)), "Cannot parse getter definition");
    18291819        } else {
    18301820            failIfFalse(match(OPENPAREN), "Expected a parameter list for setter definition");
    1831             failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SetterMode, false, accessorName, parameters, body, openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn)), "Cannot parse setter definition");
     1821            failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SetterMode, false, info)), "Cannot parse setter definition");
    18321822        }
    18331823        if (stringPropertyName)
    1834             return context.createGetterOrSetterProperty(location, type, complete, stringPropertyName, parameters, body, openBraceOffset, closeBraceOffset, bodyStartLine, m_lastTokenEndPosition.line, bodyStartColumn, getterOrSetterStartOffset);
    1835         return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, complete, numericPropertyName, parameters, body, openBraceOffset, closeBraceOffset, bodyStartLine, m_lastTokenEndPosition.line, bodyStartColumn, getterOrSetterStartOffset);
     1824            return context.createGetterOrSetterProperty(location, type, complete, stringPropertyName, info, getterOrSetterStartOffset);
     1825        return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, complete, numericPropertyName, info, getterOrSetterStartOffset);
    18361826    }
    18371827    case NUMBER: {
     
    21732163        newCount++;
    21742164    }
    2175    
     2165
    21762166    if (match(FUNCTION)) {
    2177         const Identifier* name = &m_vm->propertyNames->nullIdentifier;
    2178         TreeFormalParameterList parameters = 0;
    2179         TreeFunctionBody body = 0;
    2180         unsigned openBraceOffset = 0;
    2181         unsigned closeBraceOffset = 0;
    2182         int bodyStartLine = 0;
    2183         unsigned bodyStartColumn = 0;
    21842167        unsigned functionKeywordStart = tokenStart();
    21852168        location = tokenLocation();
    21862169        next();
    2187         failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, name, parameters, body, openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn)), "Cannot parse function expression");
    2188         base = context.createFunctionExpr(location, name, body, parameters, openBraceOffset, closeBraceOffset, bodyStartLine, m_lastTokenEndPosition.line, bodyStartColumn, functionKeywordStart);
     2170        ParserFunctionInfo<TreeBuilder> info;
     2171        info.name = &m_vm->propertyNames->nullIdentifier;
     2172        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, info)), "Cannot parse function expression");
     2173        base = context.createFunctionExpr(location, info, functionKeywordStart);
    21892174    } else
    21902175        base = parsePrimaryExpression(context);
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r177316 r178888  
    3232#include "ParserArena.h"
    3333#include "ParserError.h"
     34#include "ParserFunctionInfo.h"
    3435#include "ParserTokens.h"
    3536#include "SourceProvider.h"
     
    734735    template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern parseDeconstructionPattern(TreeBuilder&, DeconstructionKind, int depth = 0);
    735736    template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern tryParseDeconstructionPatternExpression(TreeBuilder&);
    736     template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, const Identifier*&, TreeFormalParameterList&, TreeFunctionBody&, unsigned& openBraceOffset, unsigned& closeBraceOffset, int& bodyStartLine, unsigned& bodyStartColumn);
     737
     738    template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ParserFunctionInfo<TreeBuilder>&);
     739
    737740    ALWAYS_INLINE int isBinaryOperator(JSTokenType);
    738741    bool allowAutomaticSemicolon();
  • trunk/Source/JavaScriptCore/parser/SyntaxChecker.h

    r177001 r178888  
    2828
    2929#include "Lexer.h"
     30#include "ParserFunctionInfo.h"
    3031#include "YarrSyntaxChecker.h"
    3132
     
    160161    ExpressionType createAssignResolve(const JSTokenLocation&, const Identifier&, ExpressionType, int, int, int) { return AssignmentExpr; }
    161162    ExpressionType createEmptyVarExpression(const JSTokenLocation&, const Identifier&) { return AssignmentExpr; }
    162     ExpressionType createFunctionExpr(const JSTokenLocation&, const Identifier*, int, int, int, int, int, int, int, int) { return FunctionExpr; }
     163    ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&, int) { return FunctionExpr; }
    163164    int createFunctionBody(const JSTokenLocation&, const JSTokenLocation&, int, int, bool) { return FunctionBodyResult; }
    164165    void setFunctionNameStart(int, int) { }
     
    194195    int createClauseList(int) { return ClauseListResult; }
    195196    int createClauseList(int, int) { return ClauseListResult; }
    196     int createFuncDeclStatement(const JSTokenLocation&, const Identifier*, int, int, int, int, int, int, int, int) { return StatementResult; }
     197    int createFuncDeclStatement(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&, int) { return StatementResult; }
     198    int createClassDeclStatement(const JSTokenLocation&, const Identifier&, ExpressionType, ExpressionType, PropertyList, PropertyList, int, int) { return StatementResult; }
    197199    int createBlockStatement(const JSTokenLocation&, int, int, int) { return StatementResult; }
    198200    int createExprStatement(const JSTokenLocation&, int, int, int) { return StatementResult; }
     
    219221    int createConstStatement(const JSTokenLocation&, int, int, int) { return StatementResult; }
    220222    int appendConstDecl(const JSTokenLocation&, int, const Identifier*, int) { return StatementResult; }
    221     Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool strict, const Identifier* name, int, int, int, int, int, int, int, int)
     223    Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool strict, const Identifier* name, const ParserFunctionInfo<SyntaxChecker>&, unsigned)
    222224    {
    223225        ASSERT(name);
     
    226228        return Property(name, type);
    227229    }
    228     Property createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation&, PropertyNode::Type type, bool strict, double name, int, int, int, int, int, int, int, int)
     230    Property createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation&, PropertyNode::Type type, bool strict, double name, const ParserFunctionInfo<SyntaxChecker>&, unsigned)
    229231    {
    230232        if (!strict)
Note: See TracChangeset for help on using the changeset viewer.