Changeset 167964 in webkit for trunk/Source/JavaScriptCore/parser/Parser.cpp
- Timestamp:
- Apr 29, 2014, 3:23:17 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.cpp
r167313 r167964 1249 1249 return false; 1250 1250 } 1251 JSTokenLocation openParen = tokenLocation(); 1251 1252 if (!consume(OPENPAREN)) { 1252 1253 semanticFailureDueToKeyword(stringForFunctionMode(mode), " name"); … … 1257 1258 failIfFalse(parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode)); 1258 1259 } 1260 JSTokenLocation endParen = m_token.m_location; 1259 1261 consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration"); 1260 1262 matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body"); … … 1282 1284 1283 1285 body = context.createFunctionBody(startLocation, endLocation, bodyStartColumn, bodyEndColumn, cachedInfo->strictMode); 1284 1286 context.setFunctionBodyParameters(body, openParen, endParen); 1285 1287 functionScope->restoreFromSourceProviderCache(cachedInfo); 1286 1288 failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), "Parser error"); … … 1302 1304 restoreState(oldState); 1303 1305 failIfFalse(body, "Cannot parse the body of this ", stringForFunctionMode(mode)); 1306 context.setFunctionBodyParameters(body, openParen, endParen); 1304 1307 if (functionScope->strictMode() && name) { 1305 1308 RELEASE_ASSERT(mode == FunctionMode); … … 2405 2408 } 2406 2409 2410 PassRefPtr<FunctionParameters> parseParameters(VM* vm, const SourceCode& source, JSParserStrictness strictness) 2411 { 2412 SamplingRegion samplingRegion("Parsing parameters"); 2413 ParameterNode* parameters = 0; 2414 ASSERT(!source.provider()->source().isNull()); 2415 if (source.provider()->source().is8Bit()) { 2416 Parser<Lexer<LChar>> parser(vm, source, 0, Identifier(), strictness, JSParseFunctionCode); 2417 ASTBuilder builder(vm, &source); 2418 parameters = parser.parseFormalParameters(builder); 2419 } else { 2420 Parser<Lexer<UChar>> parser(vm, source, 0, Identifier(), strictness, JSParseFunctionCode); 2421 ASTBuilder builder(vm, &source); 2422 parameters = parser.parseFormalParameters(builder); 2423 } 2424 if (!parameters) 2425 return nullptr; 2426 return FunctionParameters::create(parameters); 2427 } 2428 2407 2429 // Instantiate the two flavors of Parser we need instead of putting most of this file in Parser.h 2408 2430 template class Parser<Lexer<LChar>>;
Note:
See TracChangeset
for help on using the changeset viewer.