Ignore:
Timestamp:
Sep 8, 2010, 11:43:22 PM (15 years ago)
Author:
[email protected]
Message:

2010-09-08 Xan Lopez <[email protected]>

Reviewed by Alexey Proskuryakov.

Remove accessor for private member variable in JSParser
https://bugs.webkit.org/show_bug.cgi?id=45378

m_token is private to JSParser, so it does not seem to be useful
to have an accessor for it. On top of that, the file was both
using the accessor and directly accessing the member variable,
only one style should be used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/JSParser.cpp

    r66665 r67065  
    8686    };
    8787
    88     const JSToken& token() { return m_token; }
    8988    void next(Lexer::LexType lexType = Lexer::IdentifyReservedWords)
    9089    {
    91         m_lastLine = token().m_info.line;
    92         m_lastTokenEnd = token().m_info.endOffset;
     90        m_lastLine = m_token.m_info.line;
     91        m_lastTokenEnd = m_token.m_info.endOffset;
    9392        m_lexer->setLastLineNumber(m_lastLine);
    9493        m_token.m_type = m_lexer->lex(&m_token.m_data, &m_token.m_info, lexType);
     
    111110    int tokenStart()
    112111    {
    113         return token().m_info.startOffset;
     112        return m_token.m_info.startOffset;
    114113    }
    115114
    116115    int tokenLine()
    117116    {
    118         return token().m_info.line;
     117        return m_token.m_info.line;
    119118    }
    120119
    121120    int tokenEnd()
    122121    {
    123         return token().m_info.endOffset;
     122        return m_token.m_info.endOffset;
    124123    }
    125124
     
    169168    bool autoSemiColon()
    170169    {
    171         if (token().m_type == SEMICOLON) {
     170        if (m_token.m_type == SEMICOLON) {
    172171            next();
    173172            return true;
     
    325324        int varStart = tokenStart();
    326325        identStart = varStart;
    327         const Identifier* name = token().m_data.ident;
     326        const Identifier* name = m_token.m_data.ident;
    328327        lastIdent = name;
    329328        next();
     
    357356        next();
    358357        matchOrFail(IDENT);
    359         const Identifier* name = token().m_data.ident;
     358        const Identifier* name = m_token.m_data.ident;
    360359        next();
    361360        bool hasInitializer = match(EQUAL);
     
    483482        return context.createBreakStatement(startCol, endCol, startLine, endLine);
    484483    matchOrFail(IDENT);
    485     const Identifier* ident = token().m_data.ident;
     484    const Identifier* ident = m_token.m_data.ident;
    486485    endCol = tokenEnd();
    487486    endLine = tokenLine();
     
    503502        return context.createContinueStatement(startCol, endCol, startLine, endLine);
    504503    matchOrFail(IDENT);
    505     const Identifier* ident = token().m_data.ident;
     504    const Identifier* ident = m_token.m_data.ident;
    506505    endCol = tokenEnd();
    507506    endLine = tokenLine();
     
    655654        consumeOrFail(OPENPAREN);
    656655        matchOrFail(IDENT);
    657         ident = token().m_data.ident;
     656        ident = m_token.m_data.ident;
    658657        next();
    659658        consumeOrFail(CLOSEPAREN);
     
    706705{
    707706    failIfStackOverflow();
    708     switch (token().m_type) {
     707    switch (m_token.m_type) {
    709708    case OPENBRACE:
    710709        return parseBlockStatement(context);
     
    758757{
    759758    matchOrFail(IDENT);
    760     usesArguments = m_globalData->propertyNames->arguments == *token().m_data.ident;
    761     TreeFormalParameterList list = context.createFormalParameterList(*token().m_data.ident);
     759    usesArguments = m_globalData->propertyNames->arguments == *m_token.m_data.ident;
     760    TreeFormalParameterList list = context.createFormalParameterList(*m_token.m_data.ident);
    762761    TreeFormalParameterList tail = list;
    763762    next();
     
    765764        next();
    766765        matchOrFail(IDENT);
    767         const Identifier* ident = token().m_data.ident;
     766        const Identifier* ident = m_token.m_data.ident;
    768767        next();
    769768        usesArguments = usesArguments || m_globalData->propertyNames->arguments == *ident;
     
    785784{
    786785    if (match(IDENT)) {
    787         name = token().m_data.ident;
     786        name = m_token.m_data.ident;
    788787        next();
    789788    } else if (requirements == FunctionNeedsName)
     
    798797    matchOrFail(OPENBRACE);
    799798
    800     openBracePos = token().m_data.intValue;
     799    openBracePos = m_token.m_data.intValue;
    801800    bodyStartLine = tokenLine();
    802801    next();
     
    808807
    809808    matchOrFail(CLOSEBRACE);
    810     closeBracePos = token().m_data.intValue;
     809    closeBracePos = m_token.m_data.intValue;
    811810    next();
    812811    return true;
     
    838837    int start = tokenStart();
    839838    int startLine = tokenLine();
    840     const Identifier* ident = token().m_data.ident;
     839    const Identifier* ident = m_token.m_data.ident;
    841840    int currentToken = m_tokenCount;
    842841    TreeExpression expression = parseExpression(context);
     
    973972    bool hadAssignment = false;
    974973    while (true) {
    975         switch (token().m_type) {
     974        switch (m_token.m_type) {
    976975        case EQUAL: op = OpEqual; break;
    977976        case PLUSEQUAL: op = OpPlusEq; break;
     
    10521051
    10531052        context.appendBinaryExpressionInfo(operandStackDepth, current, exprStart, lastTokenEnd(), lastTokenEnd(), initialAssignments != m_assignmentCount);
    1054         int precedence = isBinaryOperator(token().m_type);
     1053        int precedence = isBinaryOperator(m_token.m_type);
    10551054        if (!precedence)
    10561055            break;
    10571056        m_nonLHSCount++;
    1058         int operatorToken = token().m_type;
     1057        int operatorToken = m_token.m_type;
    10591058        next();
    10601059
     
    10871086{
    10881087    bool wasIdent = false;
    1089     switch (token().m_type) {
     1088    switch (m_token.m_type) {
    10901089    namedProperty:
    10911090    case IDENT:
    10921091        wasIdent = true;
    10931092    case STRING: {
    1094         const Identifier* ident = token().m_data.ident;
     1093        const Identifier* ident = m_token.m_data.ident;
    10951094        next(Lexer::IgnoreReservedWords);
    10961095        if (match(COLON)) {
     
    11191118    }
    11201119    case NUMBER: {
    1121         double propertyName = token().m_data.doubleValue;
     1120        double propertyName = m_token.m_data.doubleValue;
    11221121        next();
    11231122        consumeOrFail(COLON);
     
    11271126    }
    11281127    default:
    1129         failIfFalse(token().m_type & KeywordTokenFlag);
     1128        failIfFalse(m_token.m_type & KeywordTokenFlag);
    11301129        goto namedProperty;
    11311130    }
     
    11341133template <class TreeBuilder> TreeExpression JSParser::parseObjectLiteral(TreeBuilder& context)
    11351134{
    1136     int startOffset = token().m_data.intValue;
     1135    int startOffset = m_token.m_data.intValue;
    11371136    consumeOrFail(OPENBRACE);
    11381137
     
    12611260template <class TreeBuilder> TreeExpression JSParser::parsePrimaryExpression(TreeBuilder& context)
    12621261{
    1263     switch (token().m_type) {
     1262    switch (m_token.m_type) {
    12641263    case OPENBRACE:
    12651264        return parseObjectLiteral(context);
     
    12811280    case IDENT: {
    12821281        int start = tokenStart();
    1283         const Identifier* ident = token().m_data.ident;
     1282        const Identifier* ident = m_token.m_data.ident;
    12841283        next();
    12851284        return context.createResolve(ident, start);
    12861285    }
    12871286    case STRING: {
    1288         const Identifier* ident = token().m_data.ident;
     1287        const Identifier* ident = m_token.m_data.ident;
    12891288        next();
    12901289        return context.createString(ident);
    12911290    }
    12921291    case NUMBER: {
    1293         double d = token().m_data.doubleValue;
     1292        double d = m_token.m_data.doubleValue;
    12941293        next();
    12951294        return context.createNumberExpr(d);
     
    13731372    failIfFalse(base);
    13741373    while (true) {
    1375         switch (token().m_type) {
     1374        switch (m_token.m_type) {
    13761375        case OPENBRACKET: {
    13771376            int expressionEnd = lastTokenEnd();
     
    14111410            next(Lexer::IgnoreReservedWords);
    14121411            matchOrFail(IDENT);
    1413             base = context.createDotAccess(base, *token().m_data.ident, expressionStart, expressionEnd, tokenEnd());
     1412            base = context.createDotAccess(base, *m_token.m_data.ident, expressionStart, expressionEnd, tokenEnd());
    14141413            next();
    14151414            break;
     
    14291428    AllowInOverride allowInOverride(this);
    14301429    int tokenStackDepth = 0;
    1431     while (isUnaryOp(token().m_type)) {
     1430    while (isUnaryOp(m_token.m_type)) {
    14321431        m_nonLHSCount++;
    1433         context.appendUnaryToken(tokenStackDepth, token().m_type, tokenStart());
     1432        context.appendUnaryToken(tokenStackDepth, m_token.m_type, tokenStart());
    14341433        next();
    14351434    }
     
    14371436    TreeExpression expr = parseMemberExpression(context);
    14381437    failIfFalse(expr);
    1439     switch (token().m_type) {
     1438    switch (m_token.m_type) {
    14401439    case PLUSPLUS:
    14411440        m_nonLHSCount++;
Note: See TracChangeset for help on using the changeset viewer.