Changeset 168107 in webkit for trunk/Source/JavaScriptCore/parser/Parser.cpp
- Timestamp:
- May 1, 2014, 10:26:24 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.cpp
r167964 r168107 1249 1249 return false; 1250 1250 } 1251 JSTokenLocation openParen = tokenLocation();1252 1251 if (!consume(OPENPAREN)) { 1253 1252 semanticFailureDueToKeyword(stringForFunctionMode(mode), " name"); … … 1258 1257 failIfFalse(parameters, "Cannot parse parameters for this ", stringForFunctionMode(mode)); 1259 1258 } 1260 JSTokenLocation endParen = m_token.m_location;1261 1259 consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration"); 1262 1260 matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body"); … … 1284 1282 1285 1283 body = context.createFunctionBody(startLocation, endLocation, bodyStartColumn, bodyEndColumn, cachedInfo->strictMode); 1286 context.setFunctionBodyParameters(body, openParen, endParen);1284 1287 1285 functionScope->restoreFromSourceProviderCache(cachedInfo); 1288 1286 failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), "Parser error"); … … 1304 1302 restoreState(oldState); 1305 1303 failIfFalse(body, "Cannot parse the body of this ", stringForFunctionMode(mode)); 1306 context.setFunctionBodyParameters(body, openParen, endParen);1307 1304 if (functionScope->strictMode() && name) { 1308 1305 RELEASE_ASSERT(mode == FunctionMode); … … 2408 2405 } 2409 2406 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 2429 2407 // Instantiate the two flavors of Parser we need instead of putting most of this file in Parser.h 2430 2408 template class Parser<Lexer<LChar>>;
Note:
See TracChangeset
for help on using the changeset viewer.