Changeset 67065 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 8, 2010, 11:43:22 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r67062 r67065 1 2010-09-08 Xan Lopez <[email protected]> 2 3 Reviewed by Alexey Proskuryakov. 4 5 Remove accessor for private member variable in JSParser 6 https://bugs.webkit.org/show_bug.cgi?id=45378 7 8 m_token is private to JSParser, so it does not seem to be useful 9 to have an accessor for it. On top of that, the file was both 10 using the accessor and directly accessing the member variable, 11 only one style should be used. 12 1 13 2010-09-08 Csaba Osztrogonác <[email protected]> 2 14 -
trunk/JavaScriptCore/parser/JSParser.cpp
r66665 r67065 86 86 }; 87 87 88 const JSToken& token() { return m_token; }89 88 void next(Lexer::LexType lexType = Lexer::IdentifyReservedWords) 90 89 { 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; 93 92 m_lexer->setLastLineNumber(m_lastLine); 94 93 m_token.m_type = m_lexer->lex(&m_token.m_data, &m_token.m_info, lexType); … … 111 110 int tokenStart() 112 111 { 113 return token().m_info.startOffset;112 return m_token.m_info.startOffset; 114 113 } 115 114 116 115 int tokenLine() 117 116 { 118 return token().m_info.line;117 return m_token.m_info.line; 119 118 } 120 119 121 120 int tokenEnd() 122 121 { 123 return token().m_info.endOffset;122 return m_token.m_info.endOffset; 124 123 } 125 124 … … 169 168 bool autoSemiColon() 170 169 { 171 if ( token().m_type == SEMICOLON) {170 if (m_token.m_type == SEMICOLON) { 172 171 next(); 173 172 return true; … … 325 324 int varStart = tokenStart(); 326 325 identStart = varStart; 327 const Identifier* name = token().m_data.ident;326 const Identifier* name = m_token.m_data.ident; 328 327 lastIdent = name; 329 328 next(); … … 357 356 next(); 358 357 matchOrFail(IDENT); 359 const Identifier* name = token().m_data.ident;358 const Identifier* name = m_token.m_data.ident; 360 359 next(); 361 360 bool hasInitializer = match(EQUAL); … … 483 482 return context.createBreakStatement(startCol, endCol, startLine, endLine); 484 483 matchOrFail(IDENT); 485 const Identifier* ident = token().m_data.ident;484 const Identifier* ident = m_token.m_data.ident; 486 485 endCol = tokenEnd(); 487 486 endLine = tokenLine(); … … 503 502 return context.createContinueStatement(startCol, endCol, startLine, endLine); 504 503 matchOrFail(IDENT); 505 const Identifier* ident = token().m_data.ident;504 const Identifier* ident = m_token.m_data.ident; 506 505 endCol = tokenEnd(); 507 506 endLine = tokenLine(); … … 655 654 consumeOrFail(OPENPAREN); 656 655 matchOrFail(IDENT); 657 ident = token().m_data.ident;656 ident = m_token.m_data.ident; 658 657 next(); 659 658 consumeOrFail(CLOSEPAREN); … … 706 705 { 707 706 failIfStackOverflow(); 708 switch ( token().m_type) {707 switch (m_token.m_type) { 709 708 case OPENBRACE: 710 709 return parseBlockStatement(context); … … 758 757 { 759 758 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); 762 761 TreeFormalParameterList tail = list; 763 762 next(); … … 765 764 next(); 766 765 matchOrFail(IDENT); 767 const Identifier* ident = token().m_data.ident;766 const Identifier* ident = m_token.m_data.ident; 768 767 next(); 769 768 usesArguments = usesArguments || m_globalData->propertyNames->arguments == *ident; … … 785 784 { 786 785 if (match(IDENT)) { 787 name = token().m_data.ident;786 name = m_token.m_data.ident; 788 787 next(); 789 788 } else if (requirements == FunctionNeedsName) … … 798 797 matchOrFail(OPENBRACE); 799 798 800 openBracePos = token().m_data.intValue;799 openBracePos = m_token.m_data.intValue; 801 800 bodyStartLine = tokenLine(); 802 801 next(); … … 808 807 809 808 matchOrFail(CLOSEBRACE); 810 closeBracePos = token().m_data.intValue;809 closeBracePos = m_token.m_data.intValue; 811 810 next(); 812 811 return true; … … 838 837 int start = tokenStart(); 839 838 int startLine = tokenLine(); 840 const Identifier* ident = token().m_data.ident;839 const Identifier* ident = m_token.m_data.ident; 841 840 int currentToken = m_tokenCount; 842 841 TreeExpression expression = parseExpression(context); … … 973 972 bool hadAssignment = false; 974 973 while (true) { 975 switch ( token().m_type) {974 switch (m_token.m_type) { 976 975 case EQUAL: op = OpEqual; break; 977 976 case PLUSEQUAL: op = OpPlusEq; break; … … 1052 1051 1053 1052 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); 1055 1054 if (!precedence) 1056 1055 break; 1057 1056 m_nonLHSCount++; 1058 int operatorToken = token().m_type;1057 int operatorToken = m_token.m_type; 1059 1058 next(); 1060 1059 … … 1087 1086 { 1088 1087 bool wasIdent = false; 1089 switch ( token().m_type) {1088 switch (m_token.m_type) { 1090 1089 namedProperty: 1091 1090 case IDENT: 1092 1091 wasIdent = true; 1093 1092 case STRING: { 1094 const Identifier* ident = token().m_data.ident;1093 const Identifier* ident = m_token.m_data.ident; 1095 1094 next(Lexer::IgnoreReservedWords); 1096 1095 if (match(COLON)) { … … 1119 1118 } 1120 1119 case NUMBER: { 1121 double propertyName = token().m_data.doubleValue;1120 double propertyName = m_token.m_data.doubleValue; 1122 1121 next(); 1123 1122 consumeOrFail(COLON); … … 1127 1126 } 1128 1127 default: 1129 failIfFalse( token().m_type & KeywordTokenFlag);1128 failIfFalse(m_token.m_type & KeywordTokenFlag); 1130 1129 goto namedProperty; 1131 1130 } … … 1134 1133 template <class TreeBuilder> TreeExpression JSParser::parseObjectLiteral(TreeBuilder& context) 1135 1134 { 1136 int startOffset = token().m_data.intValue;1135 int startOffset = m_token.m_data.intValue; 1137 1136 consumeOrFail(OPENBRACE); 1138 1137 … … 1261 1260 template <class TreeBuilder> TreeExpression JSParser::parsePrimaryExpression(TreeBuilder& context) 1262 1261 { 1263 switch ( token().m_type) {1262 switch (m_token.m_type) { 1264 1263 case OPENBRACE: 1265 1264 return parseObjectLiteral(context); … … 1281 1280 case IDENT: { 1282 1281 int start = tokenStart(); 1283 const Identifier* ident = token().m_data.ident;1282 const Identifier* ident = m_token.m_data.ident; 1284 1283 next(); 1285 1284 return context.createResolve(ident, start); 1286 1285 } 1287 1286 case STRING: { 1288 const Identifier* ident = token().m_data.ident;1287 const Identifier* ident = m_token.m_data.ident; 1289 1288 next(); 1290 1289 return context.createString(ident); 1291 1290 } 1292 1291 case NUMBER: { 1293 double d = token().m_data.doubleValue;1292 double d = m_token.m_data.doubleValue; 1294 1293 next(); 1295 1294 return context.createNumberExpr(d); … … 1373 1372 failIfFalse(base); 1374 1373 while (true) { 1375 switch ( token().m_type) {1374 switch (m_token.m_type) { 1376 1375 case OPENBRACKET: { 1377 1376 int expressionEnd = lastTokenEnd(); … … 1411 1410 next(Lexer::IgnoreReservedWords); 1412 1411 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()); 1414 1413 next(); 1415 1414 break; … … 1429 1428 AllowInOverride allowInOverride(this); 1430 1429 int tokenStackDepth = 0; 1431 while (isUnaryOp( token().m_type)) {1430 while (isUnaryOp(m_token.m_type)) { 1432 1431 m_nonLHSCount++; 1433 context.appendUnaryToken(tokenStackDepth, token().m_type, tokenStart());1432 context.appendUnaryToken(tokenStackDepth, m_token.m_type, tokenStart()); 1434 1433 next(); 1435 1434 } … … 1437 1436 TreeExpression expr = parseMemberExpression(context); 1438 1437 failIfFalse(expr); 1439 switch ( token().m_type) {1438 switch (m_token.m_type) { 1440 1439 case PLUSPLUS: 1441 1440 m_nonLHSCount++;
Note:
See TracChangeset
for help on using the changeset viewer.