kocienda | 66a6d36 | 2001-08-24 14:24:45 +0000 | [diff] [blame] | 1 | /* |
weinig@apple.com | a443641 | 2008-01-28 20:50:45 +0000 | [diff] [blame] | 2 | * Copyright (C) 1999-2002 Harri Porten (porten@kde.org) |
| 3 | * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
mark.lam@apple.com | 47c2f14 | 2016-03-16 18:16:32 +0000 | [diff] [blame] | 4 | * Copyright (C) 2003-2009, 2013, 2016 Apple Inc. All rights reserved. |
weinig@apple.com | a443641 | 2008-01-28 20:50:45 +0000 | [diff] [blame] | 5 | * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) |
| 6 | * Copyright (C) 2007 Maks Orlovich |
| 7 | * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 8 | * |
| 9 | * This library is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU Library General Public |
| 11 | * License as published by the Free Software Foundation; either |
| 12 | * version 2 of the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This library is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Library General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU Library General Public License |
| 20 | * along with this library; see the file COPYING.LIB. If not, write to |
| 21 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 | * Boston, MA 02110-1301, USA. |
| 23 | * |
| 24 | */ |
kocienda | 66a6d36 | 2001-08-24 14:24:45 +0000 | [diff] [blame] | 25 | |
mjs | b64c50a | 2005-10-03 21:13:12 +0000 | [diff] [blame] | 26 | #include "config.h" |
cwzwarich@webkit.org | 3ff0e6a | 2008-11-07 00:18:07 +0000 | [diff] [blame] | 27 | #include "Nodes.h" |
darin@apple.com | d7f6822 | 2009-05-06 17:10:22 +0000 | [diff] [blame] | 28 | #include "NodeConstructors.h" |
kocienda | 66a6d36 | 2001-08-24 14:24:45 +0000 | [diff] [blame] | 29 | |
ggaren@apple.com | 5169fc9 | 2008-11-17 22:11:26 +0000 | [diff] [blame] | 30 | #include "CallFrame.h" |
darin@apple.com | e615d31 | 2009-05-05 23:09:52 +0000 | [diff] [blame] | 31 | #include "Debugger.h" |
oliver@apple.com | 4d51a9b | 2009-05-05 12:31:13 +0000 | [diff] [blame] | 32 | #include "JIT.h" |
oliver@apple.com | fee5d6b | 2009-05-05 12:22:33 +0000 | [diff] [blame] | 33 | #include "JSFunction.h" |
mjs | 0778195 | 2007-10-25 07:16:49 +0000 | [diff] [blame] | 34 | #include "JSGlobalObject.h" |
ggaren@apple.com | 4dbab80 | 2008-10-31 19:59:08 +0000 | [diff] [blame] | 35 | #include "LabelScope.h" |
weinig@apple.com | 72d6349 | 2009-05-06 01:22:42 +0000 | [diff] [blame] | 36 | #include "Lexer.h" |
fpizlo@apple.com | fb7eff2 | 2014-02-11 01:45:50 +0000 | [diff] [blame] | 37 | #include "JSCInlines.h" |
ggaren@apple.com | c700666 | 2007-12-08 00:39:50 +0000 | [diff] [blame] | 38 | #include "Parser.h" |
darin | bd80a2a | 2007-10-23 07:00:37 +0000 | [diff] [blame] | 39 | #include "PropertyNameArray.h" |
cwzwarich@webkit.org | 12b8add | 2008-06-17 08:45:03 +0000 | [diff] [blame] | 40 | #include "RegExpObject.h" |
ggaren | 7213ee0 | 2007-10-16 23:25:33 +0000 | [diff] [blame] | 41 | #include <wtf/Assertions.h> |
slewis@apple.com | a7615ca | 2008-07-12 05:51:33 +0000 | [diff] [blame] | 42 | #include <wtf/RefCountedLeakCounter.h> |
ap@webkit.org | 66868c0 | 2008-06-24 09:51:07 +0000 | [diff] [blame] | 43 | #include <wtf/Threading.h> |
kocienda | 66a6d36 | 2001-08-24 14:24:45 +0000 | [diff] [blame] | 44 | |
sfalken@apple.com | 861f938 | 2008-06-24 19:50:50 +0000 | [diff] [blame] | 45 | using namespace WTF; |
| 46 | |
cwzwarich@webkit.org | 3f782f6 | 2008-09-08 01:28:33 +0000 | [diff] [blame] | 47 | namespace JSC { |
kocienda | 66a6d36 | 2001-08-24 14:24:45 +0000 | [diff] [blame] | 48 | |
darin@apple.com | 85a65c3 | 2009-08-22 06:40:53 +0000 | [diff] [blame] | 49 | |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 50 | // ------------------------------ StatementNode -------------------------------- |
darin | 98e2860 | 2005-08-16 00:47:46 +0000 | [diff] [blame] | 51 | |
mark.lam@apple.com | 5b45f90 | 2013-07-09 16:15:12 +0000 | [diff] [blame] | 52 | void StatementNode::setLoc(unsigned firstLine, unsigned lastLine, int startOffset, int lineStartOffset) |
commit-queue@webkit.org | 1b331cb | 2012-08-06 03:16:46 +0000 | [diff] [blame] | 53 | { |
commit-queue@webkit.org | 1b331cb | 2012-08-06 03:16:46 +0000 | [diff] [blame] | 54 | m_lastLine = lastLine; |
mark.lam@apple.com | 3b256ca | 2013-07-30 17:01:40 +0000 | [diff] [blame] | 55 | m_position = JSTextPosition(firstLine, startOffset, lineStartOffset); |
| 56 | ASSERT(m_position.offset >= m_position.lineStartOffset); |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 57 | } |
| 58 | |
darin@apple.com | 5e49bae | 2007-12-21 21:54:51 +0000 | [diff] [blame] | 59 | // ------------------------------ SourceElements -------------------------------- |
| 60 | |
darin@apple.com | 59c3715 | 2009-05-10 22:32:34 +0000 | [diff] [blame] | 61 | void SourceElements::append(StatementNode* statement) |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 62 | { |
mjs@apple.com | d0af829 | 2007-12-24 10:13:00 +0000 | [diff] [blame] | 63 | if (statement->isEmptyStatement()) |
| 64 | return; |
ggaren@apple.com | 86cb7be | 2014-12-09 01:53:53 +0000 | [diff] [blame] | 65 | |
| 66 | if (!m_head) { |
| 67 | m_head = statement; |
| 68 | m_tail = statement; |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | m_tail->setNext(statement); |
| 73 | m_tail = statement; |
darin@apple.com | 5e49bae | 2007-12-21 21:54:51 +0000 | [diff] [blame] | 74 | } |
| 75 | |
barraclough@apple.com | b467c4c | 2010-07-13 20:34:11 +0000 | [diff] [blame] | 76 | StatementNode* SourceElements::singleStatement() const |
darin@apple.com | 85a65c3 | 2009-08-22 06:40:53 +0000 | [diff] [blame] | 77 | { |
ggaren@apple.com | 86cb7be | 2014-12-09 01:53:53 +0000 | [diff] [blame] | 78 | return m_head == m_tail ? m_head : nullptr; |
darin@apple.com | 85a65c3 | 2009-08-22 06:40:53 +0000 | [diff] [blame] | 79 | } |
| 80 | |
wingo@igalia.com | 08f0e4c | 2012-03-07 10:18:43 +0000 | [diff] [blame] | 81 | // ------------------------------ ScopeNode ----------------------------- |
mjs | 6f821c8 | 2002-03-22 00:31:57 +0000 | [diff] [blame] | 82 | |
ggaren@apple.com | c0ccae0 | 2014-12-03 23:23:56 +0000 | [diff] [blame] | 83 | ScopeNode::ScopeNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, bool inStrictContext) |
mark.lam@apple.com | faa5393 | 2013-03-20 09:09:38 +0000 | [diff] [blame] | 84 | : StatementNode(endLocation) |
ggaren@apple.com | 9e5d58e | 2014-12-05 00:59:33 +0000 | [diff] [blame] | 85 | , ParserArenaRoot(parserArena) |
mark.lam@apple.com | faa5393 | 2013-03-20 09:09:38 +0000 | [diff] [blame] | 86 | , m_startLineNumber(startLocation.line) |
mark.lam@apple.com | 5b45f90 | 2013-07-09 16:15:12 +0000 | [diff] [blame] | 87 | , m_startStartOffset(startLocation.startOffset) |
| 88 | , m_startLineStartOffset(startLocation.lineStartOffset) |
oliver@apple.com | 6bc1137 | 2012-05-07 23:35:52 +0000 | [diff] [blame] | 89 | , m_features(inStrictContext ? StrictModeFeature : NoFeatures) |
gskachkov@gmail.com | a198dd1 | 2016-02-28 19:14:26 +0000 | [diff] [blame] | 90 | , m_innerArrowFunctionCodeFeatures(NoInnerArrowFunctionFeatures) |
wingo@igalia.com | 08f0e4c | 2012-03-07 10:18:43 +0000 | [diff] [blame] | 91 | , m_numConstants(0) |
| 92 | , m_statements(0) |
kocienda | 66a6d36 | 2001-08-24 14:24:45 +0000 | [diff] [blame] | 93 | { |
wingo@igalia.com | 08f0e4c | 2012-03-07 10:18:43 +0000 | [diff] [blame] | 94 | } |
| 95 | |
sbarati@apple.com | 432a3c9 | 2016-04-03 19:45:05 +0000 | [diff] [blame] | 96 | ScopeNode::ScopeNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, const SourceCode& source, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack&& funcStack, VariableEnvironment& lexicalVariables, UniquedStringImplPtrSet&& sloppyModeHoistedFunctions, CodeFeatures features, InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures, int numConstants) |
mark.lam@apple.com | faa5393 | 2013-03-20 09:09:38 +0000 | [diff] [blame] | 97 | : StatementNode(endLocation) |
ggaren@apple.com | 9e5d58e | 2014-12-05 00:59:33 +0000 | [diff] [blame] | 98 | , ParserArenaRoot(parserArena) |
sbarati@apple.com | 8e614bd | 2016-03-10 02:04:20 +0000 | [diff] [blame] | 99 | , VariableEnvironmentNode(lexicalVariables, WTFMove(funcStack)) |
mark.lam@apple.com | faa5393 | 2013-03-20 09:09:38 +0000 | [diff] [blame] | 100 | , m_startLineNumber(startLocation.line) |
mark.lam@apple.com | 5b45f90 | 2013-07-09 16:15:12 +0000 | [diff] [blame] | 101 | , m_startStartOffset(startLocation.startOffset) |
| 102 | , m_startLineStartOffset(startLocation.lineStartOffset) |
oliver@apple.com | 6bc1137 | 2012-05-07 23:35:52 +0000 | [diff] [blame] | 103 | , m_features(features) |
gskachkov@gmail.com | a198dd1 | 2016-02-28 19:14:26 +0000 | [diff] [blame] | 104 | , m_innerArrowFunctionCodeFeatures(innerArrowFunctionCodeFeatures) |
wingo@igalia.com | 08f0e4c | 2012-03-07 10:18:43 +0000 | [diff] [blame] | 105 | , m_source(source) |
sbarati@apple.com | 432a3c9 | 2016-04-03 19:45:05 +0000 | [diff] [blame] | 106 | , m_sloppyModeHoistedFunctions(WTFMove(sloppyModeHoistedFunctions)) |
wingo@igalia.com | 08f0e4c | 2012-03-07 10:18:43 +0000 | [diff] [blame] | 107 | , m_numConstants(numConstants) |
| 108 | , m_statements(children) |
| 109 | { |
saambarati1@gmail.com | 144f17c | 2015-07-15 21:41:08 +0000 | [diff] [blame] | 110 | m_varDeclarations.swap(varEnvironment); |
weinig@apple.com | 9b5bf06 | 2008-11-20 23:23:59 +0000 | [diff] [blame] | 111 | } |
| 112 | |
darin@apple.com | 85a65c3 | 2009-08-22 06:40:53 +0000 | [diff] [blame] | 113 | StatementNode* ScopeNode::singleStatement() const |
| 114 | { |
wingo@igalia.com | 08f0e4c | 2012-03-07 10:18:43 +0000 | [diff] [blame] | 115 | return m_statements ? m_statements->singleStatement() : 0; |
darin@apple.com | 85a65c3 | 2009-08-22 06:40:53 +0000 | [diff] [blame] | 116 | } |
| 117 | |
darin@apple.com | 1076ac2 | 2008-01-27 09:38:01 +0000 | [diff] [blame] | 118 | // ------------------------------ ProgramNode ----------------------------- |
| 119 | |
sbarati@apple.com | 432a3c9 | 2016-04-03 19:45:05 +0000 | [diff] [blame] | 120 | ProgramNode::ProgramNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack&& funcStack, VariableEnvironment& lexicalVariables, UniquedStringImplPtrSet&& sloppyModeHoistedFunctions, FunctionParameters*, const SourceCode& source, CodeFeatures features, InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures, int numConstants) |
| 121 | : ScopeNode(parserArena, startLocation, endLocation, source, children, varEnvironment, WTFMove(funcStack), lexicalVariables, WTFMove(sloppyModeHoistedFunctions), features, innerArrowFunctionCodeFeatures, numConstants) |
mark.lam@apple.com | 5b45f90 | 2013-07-09 16:15:12 +0000 | [diff] [blame] | 122 | , m_startColumn(startColumn) |
mark.lam@apple.com | fa35e78 | 2013-11-19 21:55:16 +0000 | [diff] [blame] | 123 | , m_endColumn(endColumn) |
ggaren@apple.com | e65a290 | 2007-12-11 05:47:41 +0000 | [diff] [blame] | 124 | { |
| 125 | } |
| 126 | |
utatane.tea@gmail.com | 9f9c975 | 2015-08-04 21:26:49 +0000 | [diff] [blame] | 127 | // ------------------------------ ModuleProgramNode ----------------------------- |
| 128 | |
sbarati@apple.com | 432a3c9 | 2016-04-03 19:45:05 +0000 | [diff] [blame] | 129 | ModuleProgramNode::ModuleProgramNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack&& funcStack, VariableEnvironment& lexicalVariables, UniquedStringImplPtrSet&& sloppyModeHoistedFunctions, FunctionParameters*, const SourceCode& source, CodeFeatures features, InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures, int numConstants) |
| 130 | : ScopeNode(parserArena, startLocation, endLocation, source, children, varEnvironment, WTFMove(funcStack), lexicalVariables, WTFMove(sloppyModeHoistedFunctions), features, innerArrowFunctionCodeFeatures, numConstants) |
utatane.tea@gmail.com | 9f9c975 | 2015-08-04 21:26:49 +0000 | [diff] [blame] | 131 | , m_startColumn(startColumn) |
| 132 | , m_endColumn(endColumn) |
| 133 | { |
| 134 | } |
| 135 | |
darin@apple.com | 1076ac2 | 2008-01-27 09:38:01 +0000 | [diff] [blame] | 136 | // ------------------------------ EvalNode ----------------------------- |
| 137 | |
sbarati@apple.com | 432a3c9 | 2016-04-03 19:45:05 +0000 | [diff] [blame] | 138 | EvalNode::EvalNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack&& funcStack, VariableEnvironment& lexicalVariables, UniquedStringImplPtrSet&& sloppyModeHoistedFunctions, FunctionParameters*, const SourceCode& source, CodeFeatures features, InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures, int numConstants) |
| 139 | : ScopeNode(parserArena, startLocation, endLocation, source, children, varEnvironment, WTFMove(funcStack), lexicalVariables, WTFMove(sloppyModeHoistedFunctions), features, innerArrowFunctionCodeFeatures, numConstants) |
mark.lam@apple.com | fa35e78 | 2013-11-19 21:55:16 +0000 | [diff] [blame] | 140 | , m_endColumn(endColumn) |
ggaren@apple.com | e65a290 | 2007-12-11 05:47:41 +0000 | [diff] [blame] | 141 | { |
| 142 | } |
| 143 | |
ggaren@apple.com | e7afe40 | 2015-08-10 20:24:35 +0000 | [diff] [blame] | 144 | // ------------------------------ FunctionMetadataNode ----------------------------- |
darin@apple.com | 1076ac2 | 2008-01-27 09:38:01 +0000 | [diff] [blame] | 145 | |
ggaren@apple.com | e7afe40 | 2015-08-10 20:24:35 +0000 | [diff] [blame] | 146 | FunctionMetadataNode::FunctionMetadataNode( |
ggaren@apple.com | d3e1f86 | 2015-03-20 23:37:51 +0000 | [diff] [blame] | 147 | ParserArena&, const JSTokenLocation& startLocation, |
| 148 | const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, |
saambarati1@gmail.com | c497d15 | 2015-07-17 18:48:30 +0000 | [diff] [blame] | 149 | int functionKeywordStart, int functionNameStart, int parametersStart, bool isInStrictContext, |
commit-queue@webkit.org | abdc617 | 2016-02-24 20:46:44 +0000 | [diff] [blame] | 150 | ConstructorKind constructorKind, SuperBinding superBinding, unsigned parameterCount, SourceParseMode mode, bool isArrowFunctionBodyExpression) |
ggaren@apple.com | e7afe40 | 2015-08-10 20:24:35 +0000 | [diff] [blame] | 151 | : Node(endLocation) |
ggaren@apple.com | d3e1f86 | 2015-03-20 23:37:51 +0000 | [diff] [blame] | 152 | , m_startColumn(startColumn) |
| 153 | , m_endColumn(endColumn) |
| 154 | , m_functionKeywordStart(functionKeywordStart) |
| 155 | , m_functionNameStart(functionNameStart) |
| 156 | , m_parametersStart(parametersStart) |
| 157 | , m_startStartOffset(startLocation.startOffset) |
saambarati1@gmail.com | c497d15 | 2015-07-17 18:48:30 +0000 | [diff] [blame] | 158 | , m_parameterCount(parameterCount) |
| 159 | , m_parseMode(mode) |
ggaren@apple.com | d3e1f86 | 2015-03-20 23:37:51 +0000 | [diff] [blame] | 160 | , m_isInStrictContext(isInStrictContext) |
utatane.tea@gmail.com | fdd9bf4 | 2015-12-02 03:16:28 +0000 | [diff] [blame] | 161 | , m_superBinding(static_cast<unsigned>(superBinding)) |
ggaren@apple.com | d3e1f86 | 2015-03-20 23:37:51 +0000 | [diff] [blame] | 162 | , m_constructorKind(static_cast<unsigned>(constructorKind)) |
commit-queue@webkit.org | 04b2447 | 2015-08-25 19:10:29 +0000 | [diff] [blame] | 163 | , m_isArrowFunctionBodyExpression(isArrowFunctionBodyExpression) |
weinig@apple.com | 9b5bf06 | 2008-11-20 23:23:59 +0000 | [diff] [blame] | 164 | { |
utatane.tea@gmail.com | fdd9bf4 | 2015-12-02 03:16:28 +0000 | [diff] [blame] | 165 | ASSERT(m_superBinding == static_cast<unsigned>(superBinding)); |
rniwa@webkit.org | e6f8349 | 2015-03-13 23:01:51 +0000 | [diff] [blame] | 166 | ASSERT(m_constructorKind == static_cast<unsigned>(constructorKind)); |
weinig@apple.com | 9b5bf06 | 2008-11-20 23:23:59 +0000 | [diff] [blame] | 167 | } |
| 168 | |
mark.lam@apple.com | 89ae998 | 2016-03-17 20:38:56 +0000 | [diff] [blame] | 169 | void FunctionMetadataNode::finishParsing(const SourceCode& source, const Identifier& ident, FunctionMode functionMode) |
ggaren@apple.com | 6f851d7 | 2014-12-04 23:47:49 +0000 | [diff] [blame] | 170 | { |
| 171 | m_source = source; |
ggaren@apple.com | 6f851d7 | 2014-12-04 23:47:49 +0000 | [diff] [blame] | 172 | m_ident = ident; |
| 173 | m_functionMode = functionMode; |
| 174 | } |
| 175 | |
ggaren@apple.com | e7afe40 | 2015-08-10 20:24:35 +0000 | [diff] [blame] | 176 | void FunctionMetadataNode::setEndPosition(JSTextPosition position) |
ggaren@apple.com | 6f851d7 | 2014-12-04 23:47:49 +0000 | [diff] [blame] | 177 | { |
| 178 | m_lastLine = position.line; |
| 179 | m_endColumn = position.offset - position.lineStartOffset; |
| 180 | } |
| 181 | |
ggaren@apple.com | 9e5d58e | 2014-12-05 00:59:33 +0000 | [diff] [blame] | 182 | // ------------------------------ FunctionNode ----------------------------- |
ggaren@apple.com | 6f851d7 | 2014-12-04 23:47:49 +0000 | [diff] [blame] | 183 | |
sbarati@apple.com | 432a3c9 | 2016-04-03 19:45:05 +0000 | [diff] [blame] | 184 | FunctionNode::FunctionNode(ParserArena& parserArena, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, SourceElements* children, VariableEnvironment& varEnvironment, FunctionStack&& funcStack, VariableEnvironment& lexicalVariables, UniquedStringImplPtrSet&& sloppyModeHoistedFunctions, FunctionParameters* parameters, const SourceCode& sourceCode, CodeFeatures features, InnerArrowFunctionCodeFeatures innerArrowFunctionCodeFeatures, int numConstants) |
| 185 | : ScopeNode(parserArena, startLocation, endLocation, sourceCode, children, varEnvironment, WTFMove(funcStack), lexicalVariables, WTFMove(sloppyModeHoistedFunctions), features, innerArrowFunctionCodeFeatures, numConstants) |
saambarati1@gmail.com | c497d15 | 2015-07-17 18:48:30 +0000 | [diff] [blame] | 186 | , m_parameters(parameters) |
mark.lam@apple.com | 5b45f90 | 2013-07-09 16:15:12 +0000 | [diff] [blame] | 187 | , m_startColumn(startColumn) |
mark.lam@apple.com | fa35e78 | 2013-11-19 21:55:16 +0000 | [diff] [blame] | 188 | , m_endColumn(endColumn) |
ggaren@apple.com | e65a290 | 2007-12-11 05:47:41 +0000 | [diff] [blame] | 189 | { |
| 190 | } |
| 191 | |
mark.lam@apple.com | 89ae998 | 2016-03-17 20:38:56 +0000 | [diff] [blame] | 192 | void FunctionNode::finishParsing(const Identifier& ident, FunctionMode functionMode) |
mark.lam@apple.com | fa35e78 | 2013-11-19 21:55:16 +0000 | [diff] [blame] | 193 | { |
ggaren@apple.com | 6f851d7 | 2014-12-04 23:47:49 +0000 | [diff] [blame] | 194 | ASSERT(!source().isNull()); |
ggaren@apple.com | 6f851d7 | 2014-12-04 23:47:49 +0000 | [diff] [blame] | 195 | m_ident = ident; |
| 196 | m_functionMode = functionMode; |
mark.lam@apple.com | fa35e78 | 2013-11-19 21:55:16 +0000 | [diff] [blame] | 197 | } |
| 198 | |
mark.lam@apple.com | 47c2f14 | 2016-03-16 18:16:32 +0000 | [diff] [blame] | 199 | bool PropertyListNode::hasStaticallyNamedProperty(const Identifier& propName) |
| 200 | { |
| 201 | PropertyListNode* list = this; |
| 202 | while (list) { |
| 203 | const Identifier* currentNodeName = list->m_node->name(); |
| 204 | if (currentNodeName && *currentNodeName == propName) |
| 205 | return true; |
| 206 | list = list->m_next; |
| 207 | } |
| 208 | return false; |
| 209 | } |
| 210 | |
saambarati1@gmail.com | 144f17c | 2015-07-15 21:41:08 +0000 | [diff] [blame] | 211 | VariableEnvironmentNode::VariableEnvironmentNode(VariableEnvironment& lexicalVariables) |
| 212 | { |
| 213 | m_lexicalVariables.swap(lexicalVariables); |
| 214 | } |
| 215 | |
sbarati@apple.com | 8e614bd | 2016-03-10 02:04:20 +0000 | [diff] [blame] | 216 | VariableEnvironmentNode::VariableEnvironmentNode(VariableEnvironment& lexicalVariables, FunctionStack&& functionStack) |
| 217 | { |
| 218 | m_lexicalVariables.swap(lexicalVariables); |
| 219 | m_functionStack = WTFMove(functionStack); |
| 220 | } |
| 221 | |
cwzwarich@webkit.org | 3f782f6 | 2008-09-08 01:28:33 +0000 | [diff] [blame] | 222 | } // namespace JSC |