Changeset 127810 in webkit for trunk/Source/JavaScriptCore/parser
- Timestamp:
- Sep 6, 2012, 6:42:53 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore/parser
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/NodeConstructors.h
r127654 r127810 750 750 , m_body(body) 751 751 { 752 m_body->finishParsing(source, parameter, ident );752 m_body->finishParsing(source, parameter, ident, FunctionNameIsInScope); 753 753 } 754 754 … … 757 757 , m_body(body) 758 758 { 759 m_body->finishParsing(source, parameter, ident );759 m_body->finishParsing(source, parameter, ident, FunctionNameIsNotInScope); 760 760 } 761 761 -
trunk/Source/JavaScriptCore/parser/Nodes.cpp
r126893 r127810 168 168 } 169 169 170 void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident )170 void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident, FunctionNameIsInScopeToggle functionNameIsInScopeToggle) 171 171 { 172 172 setSource(source); 173 finishParsing(FunctionParameters::create(firstParameter), ident );174 } 175 176 void FunctionBodyNode::finishParsing(PassRefPtr<FunctionParameters> parameters, const Identifier& ident )173 finishParsing(FunctionParameters::create(firstParameter), ident, functionNameIsInScopeToggle); 174 } 175 176 void FunctionBodyNode::finishParsing(PassRefPtr<FunctionParameters> parameters, const Identifier& ident, FunctionNameIsInScopeToggle functionNameIsInScopeToggle) 177 177 { 178 178 ASSERT(!source().isNull()); 179 179 m_parameters = parameters; 180 180 m_ident = ident; 181 m_functionNameIsInScopeToggle = functionNameIsInScopeToggle; 181 182 } 182 183 -
trunk/Source/JavaScriptCore/parser/Nodes.h
r127666 r127810 1404 1404 }; 1405 1405 1406 enum FunctionNameIsInScopeToggle { FunctionNameIsNotInScope, FunctionNameIsInScope }; 1406 1407 class FunctionBodyNode : public ScopeNode { 1407 1408 public: … … 1415 1416 virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0); 1416 1417 1417 void finishParsing(const SourceCode&, ParameterNode*, const Identifier& );1418 void finishParsing(PassRefPtr<FunctionParameters>, const Identifier& );1418 void finishParsing(const SourceCode&, ParameterNode*, const Identifier&, FunctionNameIsInScopeToggle); 1419 void finishParsing(PassRefPtr<FunctionParameters>, const Identifier&, FunctionNameIsInScopeToggle); 1419 1420 1420 1421 const Identifier& ident() { return m_ident; } … … 1422 1423 const Identifier& inferredName() { return m_inferredName.isEmpty() ? m_ident : m_inferredName; } 1423 1424 1425 bool functionNameIsInScope() { return m_functionNameIsInScopeToggle == FunctionNameIsInScope; } 1426 FunctionNameIsInScopeToggle functionNameIsInScopeToggle() { return m_functionNameIsInScopeToggle; } 1427 1424 1428 static const bool scopeIsFunction = true; 1425 1429 … … 1430 1434 Identifier m_ident; 1431 1435 Identifier m_inferredName; 1436 FunctionNameIsInScopeToggle m_functionNameIsInScopeToggle; 1432 1437 RefPtr<FunctionParameters> m_parameters; 1433 1438 }; -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r127774 r127810 41 41 42 42 template <typename LexerType> 43 Parser<LexerType>::Parser(JSGlobalData* globalData, const SourceCode& source, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode)43 Parser<LexerType>::Parser(JSGlobalData* globalData, const SourceCode& source, FunctionParameters* parameters, const Identifier& name, JSParserStrictness strictness, JSParserMode parserMode) 44 44 : m_globalData(globalData) 45 45 , m_source(&source) … … 72 72 scope->declareParameter(¶meters->at(i)); 73 73 } 74 if (!name.isNull()) 75 scope->declareCallee(&name); 74 76 next(); 75 77 m_lexer->setLastLineNumber(tokenLine()); -
trunk/Source/JavaScriptCore/parser/Parser.h
r127774 r127810 209 209 bool isFunctionBoundary() { return m_isFunctionBoundary; } 210 210 211 void declareCallee(const Identifier* ident) 212 { 213 m_declaredVariables.add(ident->ustring().impl()); 214 } 215 211 216 bool declareVariable(const Identifier* ident) 212 217 { … … 383 388 384 389 public: 385 Parser(JSGlobalData*, const SourceCode&, FunctionParameters*, JSParserStrictness, JSParserMode);390 Parser(JSGlobalData*, const SourceCode&, FunctionParameters*, const Identifier&, JSParserStrictness, JSParserMode); 386 391 ~Parser(); 387 392 … … 1021 1026 1022 1027 template <class ParsedNode> 1023 PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, JSGlobalObject* lexicalGlobalObject, const SourceCode& source, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode, Debugger* debugger, ExecState* execState, JSObject** exception)1028 PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, JSGlobalObject* lexicalGlobalObject, const SourceCode& source, FunctionParameters* parameters, const Identifier& name, JSParserStrictness strictness, JSParserMode parserMode, Debugger* debugger, ExecState* execState, JSObject** exception) 1024 1029 { 1025 1030 SamplingRegion samplingRegion("Parsing"); … … 1028 1033 1029 1034 if (source.provider()->data()->is8Bit()) { 1030 Parser< Lexer<LChar> > parser(globalData, source, parameters, strictness, parserMode);1035 Parser< Lexer<LChar> > parser(globalData, source, parameters, name, strictness, parserMode); 1031 1036 return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception); 1032 1037 } 1033 Parser< Lexer<UChar> > parser(globalData, source, parameters, strictness, parserMode);1038 Parser< Lexer<UChar> > parser(globalData, source, parameters, name, strictness, parserMode); 1034 1039 return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception); 1035 1040 }
Note:
See TracChangeset
for help on using the changeset viewer.