Changeset 178888 in webkit for trunk/Source/JavaScriptCore/parser/ASTBuilder.h
- Timestamp:
- Jan 21, 2015, 10:39:31 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r177001 r178888 274 274 } 275 275 276 ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned startColumn, unsigned functionKeywordStart) 277 { 278 FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *name, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, startColumn), parameters); 279 body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset); 280 body->setFunctionKeywordStart(functionKeywordStart); 276 ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info, unsigned functionKeywordStart) 277 { 278 FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *info.name, info.body, 279 m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters); 280 info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset); 281 info.body->setFunctionKeywordStart(functionKeywordStart); 281 282 return result; 282 283 } … … 292 293 } 293 294 294 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool, const Identifier* name, ParameterNode* params, FunctionBodyNode* body, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned bodyStartColumn, unsigned getOrSetStartOffset) 295 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool, 296 const Identifier* name, const ParserFunctionInfo<ASTBuilder>& info, unsigned getOrSetStartOffset) 295 297 { 296 298 ASSERT(name); 297 body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset); 298 body->setInferredName(*name); 299 body->setFunctionKeywordStart(getOrSetStartOffset); 300 return new (m_parserArena) PropertyNode(*name, new (m_parserArena) FuncExprNode(location, m_vm->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn), params), type); 301 } 302 303 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool, double name, ParameterNode* params, FunctionBodyNode* body, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned bodyStartColumn, unsigned getOrSetStartOffset) 304 { 305 body->setLoc(bodyStartLine, bodyEndLine, location.startOffset, location.lineStartOffset); 306 body->setFunctionKeywordStart(getOrSetStartOffset); 307 return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, name), new (m_parserArena) FuncExprNode(location, vm->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn), params), type); 299 info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset); 300 info.body->setInferredName(*name); 301 info.body->setFunctionKeywordStart(getOrSetStartOffset); 302 return new (m_parserArena) PropertyNode(*name, new (m_parserArena) FuncExprNode(location, m_vm->propertyNames->nullIdentifier, 303 info.body, m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters), type); 304 } 305 306 NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool, double name, const ParserFunctionInfo<ASTBuilder>& info, unsigned getOrSetStartOffset) 307 { 308 info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset); 309 info.body->setFunctionKeywordStart(getOrSetStartOffset); 310 const Identifier& ident = parserArena.identifierArena().makeNumericIdentifier(vm, name); 311 return new (m_parserArena) PropertyNode(ident, new (m_parserArena) FuncExprNode(location, vm->propertyNames->nullIdentifier, 312 info.body, m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters), type); 308 313 } 309 314 … … 337 342 ClauseListNode* createClauseList(ClauseListNode* tail, CaseClauseNode* clause) { return new (m_parserArena) ClauseListNode(tail, clause); } 338 343 339 StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, unsigned openBraceOffset, unsigned closeBraceOffset, int bodyStartLine, int bodyEndLine, unsigned bodyStartColumn, unsigned functionKeywordStart) 340 { 341 FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *name, body, m_sourceCode->subExpression(openBraceOffset, closeBraceOffset, bodyStartLine, bodyStartColumn), parameters); 342 if (*name == m_vm->propertyNames->arguments) 344 StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const ParserFunctionInfo<ASTBuilder>& info, unsigned functionKeywordStart) 345 { 346 FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *info.name, info.body, 347 m_sourceCode->subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters); 348 if (*info.name == m_vm->propertyNames->arguments) 343 349 usesArguments(); 344 350 m_scope.m_funcDeclarations.append(decl->body()); 345 body->setLoc(bodyStartLine,bodyEndLine, location.startOffset, location.lineStartOffset);346 body->setFunctionKeywordStart(functionKeywordStart);351 info.body->setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset); 352 info.body->setFunctionKeywordStart(functionKeywordStart); 347 353 return decl; 348 354 }
Note:
See TracChangeset
for help on using the changeset viewer.