Changeset 180518 in webkit for trunk/Source/JavaScriptCore/parser/Parser.cpp
- Timestamp:
- Feb 23, 2015, 2:10:51 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.cpp
r179873 r180518 1116 1116 ASSERT(match(OPENBRACE)); 1117 1117 JSTokenLocation location(tokenLocation()); 1118 int startOffset = m_token.m_data.offset; 1118 1119 int start = tokenLine(); 1119 1120 next(); 1120 1121 if (match(CLOSEBRACE)) { 1121 unsigned endOffset = m_lexer->currentOffset();1122 int endOffset = m_token.m_data.offset; 1122 1123 next(); 1123 1124 TreeStatement result = context.createBlockStatement(location, 0, start, m_lastTokenEndPosition.line); 1125 context.setStartOffset(result, startOffset); 1124 1126 context.setEndOffset(result, endOffset); 1125 1127 return result; … … 1128 1130 failIfFalse(subtree, "Cannot parse the body of the block statement"); 1129 1131 matchOrFail(CLOSEBRACE, "Expected a closing '}' at the end of a block statement"); 1130 unsigned endOffset = m_lexer->currentOffset();1132 int endOffset = m_token.m_data.offset; 1131 1133 next(); 1132 1134 TreeStatement result = context.createBlockStatement(location, subtree, start, m_lastTokenEndPosition.line); 1135 context.setStartOffset(result, startOffset); 1133 1136 context.setEndOffset(result, endOffset); 1134 1137 return result; … … 1144 1147 failIfStackOverflow(); 1145 1148 TreeStatement result = 0; 1149 bool shouldSetEndOffset = true; 1146 1150 switch (m_token.m_type) { 1147 1151 case OPENBRACE: 1148 1152 result = parseBlockStatement(context); 1153 shouldSetEndOffset = false; 1149 1154 break; 1150 1155 case VAR: … … 1229 1234 } 1230 1235 1231 if (result )1236 if (result && shouldSetEndOffset) 1232 1237 context.setEndOffset(result, m_lastTokenEndPosition.offset); 1233 1238 return result; … … 2313 2318 JSTextPosition expressionStart = tokenStartPosition(); 2314 2319 int newCount = 0; 2320 JSTokenLocation startLocation = tokenLocation(); 2315 2321 JSTokenLocation location; 2316 2322 while (match(NEW)) { … … 2351 2357 TreeArguments arguments = parseArguments(context, AllowSpread); 2352 2358 failIfFalse(arguments, "Cannot parse call arguments"); 2353 base = context.makeFunctionCallNode( location, base, arguments, expressionStart, expressionEnd, lastTokenEndPosition());2359 base = context.makeFunctionCallNode(startLocation, base, arguments, expressionStart, expressionEnd, lastTokenEndPosition()); 2354 2360 } 2355 2361 m_nonLHSCount = nonLHSCount;
Note:
See TracChangeset
for help on using the changeset viewer.