| 1 | /* |
| 2 | * Copyright (C) 2009-2018 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include "Nodes.h" |
| 24 | #include "Opcode.h" |
| 25 | |
| 26 | namespace JSC { |
| 27 | |
| 28 | inline void* ParserArenaFreeable::operator new(size_t size, ParserArena& parserArena) |
| 29 | { |
| 30 | return parserArena.allocateFreeable(size); |
| 31 | } |
| 32 | |
| 33 | template<typename T> |
| 34 | inline void* ParserArenaDeletable::operator new(size_t size, ParserArena& parserArena) |
| 35 | { |
| 36 | return parserArena.allocateDeletable<T>(size); |
| 37 | } |
| 38 | |
| 39 | inline ParserArenaRoot::ParserArenaRoot(ParserArena& parserArena) |
| 40 | { |
| 41 | m_arena.swap(parserArena); |
| 42 | } |
| 43 | |
| 44 | inline Node::Node(const JSTokenLocation& location) |
| 45 | : m_position(location.line, location.startOffset, location.lineStartOffset) |
| 46 | { |
| 47 | ASSERT(location.startOffset >= location.lineStartOffset); |
| 48 | } |
| 49 | |
| 50 | inline ExpressionNode::ExpressionNode(const JSTokenLocation& location, ResultType resultType) |
| 51 | : Node(location) |
| 52 | , m_resultType(resultType) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | inline StatementNode::StatementNode(const JSTokenLocation& location) |
| 57 | : Node(location) |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | inline ConstantNode::ConstantNode(const JSTokenLocation& location, ResultType resultType) |
| 62 | : ExpressionNode(location, resultType) |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | inline NullNode::NullNode(const JSTokenLocation& location) |
| 67 | : ConstantNode(location, ResultType::nullType()) |
| 68 | { |
| 69 | } |
| 70 | |
| 71 | inline BooleanNode::BooleanNode(const JSTokenLocation& location, bool value) |
| 72 | : ConstantNode(location, ResultType::booleanType()) |
| 73 | , m_value(value) |
| 74 | { |
| 75 | } |
| 76 | |
| 77 | inline NumberNode::NumberNode(const JSTokenLocation& location, double value) |
| 78 | : ConstantNode(location, JSValue(value).isInt32() ? ResultType::numberTypeIsInt32() : ResultType::numberType()) |
| 79 | , m_value(value) |
| 80 | { |
| 81 | } |
| 82 | |
| 83 | inline DoubleNode::DoubleNode(const JSTokenLocation& location, double value) |
| 84 | : NumberNode(location, value) |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | inline IntegerNode::IntegerNode(const JSTokenLocation& location, double value) |
| 89 | : DoubleNode(location, value) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | inline BigIntNode::BigIntNode(const JSTokenLocation& location, const Identifier& value, uint8_t radix) |
| 94 | : ConstantNode(location, ResultType::bigIntType()) |
| 95 | , m_value(value) |
| 96 | , m_radix(radix) |
| 97 | , m_sign(false) |
| 98 | { |
| 99 | } |
| 100 | |
| 101 | inline BigIntNode::BigIntNode(const JSTokenLocation& location, const Identifier& value, uint8_t radix, bool sign) |
| 102 | : ConstantNode(location, ResultType::bigIntType()) |
| 103 | , m_value(value) |
| 104 | , m_radix(radix) |
| 105 | , m_sign(sign) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | inline StringNode::StringNode(const JSTokenLocation& location, const Identifier& value) |
| 110 | : ConstantNode(location, ResultType::stringType()) |
| 111 | , m_value(value) |
| 112 | { |
| 113 | } |
| 114 | |
| 115 | inline TemplateExpressionListNode::TemplateExpressionListNode(ExpressionNode* node) |
| 116 | : m_node(node) |
| 117 | { |
| 118 | } |
| 119 | |
| 120 | inline TemplateExpressionListNode::TemplateExpressionListNode(TemplateExpressionListNode* previous, ExpressionNode* node) |
| 121 | : m_node(node) |
| 122 | { |
| 123 | previous->m_next = this; |
| 124 | } |
| 125 | |
| 126 | inline TemplateStringNode::TemplateStringNode(const JSTokenLocation& location, const Identifier* cooked, const Identifier* raw) |
| 127 | : ExpressionNode(location) |
| 128 | , m_cooked(cooked) |
| 129 | , m_raw(raw) |
| 130 | { |
| 131 | } |
| 132 | |
| 133 | inline TemplateStringListNode::TemplateStringListNode(TemplateStringNode* node) |
| 134 | : m_node(node) |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | inline TemplateStringListNode::TemplateStringListNode(TemplateStringListNode* previous, TemplateStringNode* node) |
| 139 | : m_node(node) |
| 140 | { |
| 141 | previous->m_next = this; |
| 142 | } |
| 143 | |
| 144 | inline TemplateLiteralNode::TemplateLiteralNode(const JSTokenLocation& location, TemplateStringListNode* templateStrings) |
| 145 | : ExpressionNode(location) |
| 146 | , m_templateStrings(templateStrings) |
| 147 | , m_templateExpressions(nullptr) |
| 148 | { |
| 149 | } |
| 150 | |
| 151 | inline TemplateLiteralNode::TemplateLiteralNode(const JSTokenLocation& location, TemplateStringListNode* templateStrings, TemplateExpressionListNode* templateExpressions) |
| 152 | : ExpressionNode(location) |
| 153 | , m_templateStrings(templateStrings) |
| 154 | , m_templateExpressions(templateExpressions) |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | inline TaggedTemplateNode::TaggedTemplateNode(const JSTokenLocation& location, ExpressionNode* tag, TemplateLiteralNode* templateLiteral) |
| 159 | : ExpressionNode(location) |
| 160 | , m_tag(tag) |
| 161 | , m_templateLiteral(templateLiteral) |
| 162 | { |
| 163 | } |
| 164 | |
| 165 | inline RegExpNode::RegExpNode(const JSTokenLocation& location, const Identifier& pattern, const Identifier& flags) |
| 166 | : ExpressionNode(location) |
| 167 | , m_pattern(pattern) |
| 168 | , m_flags(flags) |
| 169 | { |
| 170 | } |
| 171 | |
| 172 | inline ThisNode::ThisNode(const JSTokenLocation& location) |
| 173 | : ExpressionNode(location) |
| 174 | { |
| 175 | } |
| 176 | |
| 177 | inline SuperNode::SuperNode(const JSTokenLocation& location) |
| 178 | : ExpressionNode(location) |
| 179 | { |
| 180 | } |
| 181 | |
| 182 | inline ImportNode::ImportNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 183 | : ExpressionNode(location) |
| 184 | , m_expr(expr) |
| 185 | { |
| 186 | } |
| 187 | |
| 188 | inline MetaPropertyNode::MetaPropertyNode(const JSTokenLocation& location) |
| 189 | : ExpressionNode(location) |
| 190 | { |
| 191 | } |
| 192 | |
| 193 | inline NewTargetNode::NewTargetNode(const JSTokenLocation& location) |
| 194 | : MetaPropertyNode(location) |
| 195 | { |
| 196 | } |
| 197 | |
| 198 | inline ImportMetaNode::ImportMetaNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 199 | : MetaPropertyNode(location) |
| 200 | , m_expr(expr) |
| 201 | { |
| 202 | } |
| 203 | |
| 204 | inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifier& ident, const JSTextPosition& start) |
| 205 | : ExpressionNode(location) |
| 206 | , m_ident(ident) |
| 207 | , m_start(start) |
| 208 | { |
| 209 | ASSERT(m_start.offset >= m_start.lineStartOffset); |
| 210 | } |
| 211 | |
| 212 | inline ElementNode::ElementNode(int elision, ExpressionNode* node) |
| 213 | : m_node(node) |
| 214 | , m_elision(elision) |
| 215 | { |
| 216 | } |
| 217 | |
| 218 | inline ElementNode::ElementNode(ElementNode* l, int elision, ExpressionNode* node) |
| 219 | : m_node(node) |
| 220 | , m_elision(elision) |
| 221 | { |
| 222 | l->m_next = this; |
| 223 | } |
| 224 | |
| 225 | inline ArrayNode::ArrayNode(const JSTokenLocation& location, int elision) |
| 226 | : ExpressionNode(location) |
| 227 | , m_element(nullptr) |
| 228 | , m_elision(elision) |
| 229 | , m_optional(true) |
| 230 | { |
| 231 | } |
| 232 | |
| 233 | inline ArrayNode::ArrayNode(const JSTokenLocation& location, ElementNode* element) |
| 234 | : ExpressionNode(location) |
| 235 | , m_element(element) |
| 236 | , m_elision(0) |
| 237 | , m_optional(false) |
| 238 | { |
| 239 | } |
| 240 | |
| 241 | inline ArrayNode::ArrayNode(const JSTokenLocation& location, int elision, ElementNode* element) |
| 242 | : ExpressionNode(location) |
| 243 | , m_element(element) |
| 244 | , m_elision(elision) |
| 245 | , m_optional(true) |
| 246 | { |
| 247 | } |
| 248 | |
| 249 | inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, ClassElementTag tag) |
| 250 | : m_name(&name) |
| 251 | , m_assign(assign) |
| 252 | , m_type(type) |
| 253 | , m_needsSuperBinding(superBinding == SuperBinding::Needed) |
| 254 | , m_putType(putType) |
| 255 | , m_classElementTag(static_cast<unsigned>(tag)) |
| 256 | , m_isOverriddenByDuplicate(false) |
| 257 | { |
| 258 | } |
| 259 | |
| 260 | inline PropertyNode::PropertyNode(ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, ClassElementTag tag) |
| 261 | : m_name(nullptr) |
| 262 | , m_assign(assign) |
| 263 | , m_type(type) |
| 264 | , m_needsSuperBinding(superBinding == SuperBinding::Needed) |
| 265 | , m_putType(putType) |
| 266 | , m_classElementTag(static_cast<unsigned>(tag)) |
| 267 | , m_isOverriddenByDuplicate(false) |
| 268 | { |
| 269 | } |
| 270 | |
| 271 | inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, ClassElementTag tag) |
| 272 | : m_name(nullptr) |
| 273 | , m_expression(name) |
| 274 | , m_assign(assign) |
| 275 | , m_type(type) |
| 276 | , m_needsSuperBinding(superBinding == SuperBinding::Needed) |
| 277 | , m_putType(putType) |
| 278 | , m_classElementTag(static_cast<unsigned>(tag)) |
| 279 | , m_isOverriddenByDuplicate(false) |
| 280 | { |
| 281 | } |
| 282 | |
| 283 | inline PropertyListNode::PropertyListNode(const JSTokenLocation& location, PropertyNode* node) |
| 284 | : ExpressionNode(location) |
| 285 | , m_node(node) |
| 286 | { |
| 287 | } |
| 288 | |
| 289 | inline PropertyListNode::PropertyListNode(const JSTokenLocation& location, PropertyNode* node, PropertyListNode* list) |
| 290 | : ExpressionNode(location) |
| 291 | , m_node(node) |
| 292 | { |
| 293 | list->m_next = this; |
| 294 | } |
| 295 | |
| 296 | inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation& location) |
| 297 | : ExpressionNode(location) |
| 298 | , m_list(nullptr) |
| 299 | { |
| 300 | } |
| 301 | |
| 302 | inline ObjectLiteralNode::ObjectLiteralNode(const JSTokenLocation& location, PropertyListNode* list) |
| 303 | : ExpressionNode(location) |
| 304 | , m_list(list) |
| 305 | { |
| 306 | } |
| 307 | |
| 308 | inline BracketAccessorNode::BracketAccessorNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments) |
| 309 | : ExpressionNode(location) |
| 310 | , m_base(base) |
| 311 | , m_subscript(subscript) |
| 312 | , m_subscriptHasAssignments(subscriptHasAssignments) |
| 313 | { |
| 314 | } |
| 315 | |
| 316 | inline DotAccessorNode::DotAccessorNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident) |
| 317 | : ExpressionNode(location) |
| 318 | , m_base(base) |
| 319 | , m_ident(ident) |
| 320 | { |
| 321 | } |
| 322 | |
| 323 | |
| 324 | inline SpreadExpressionNode::SpreadExpressionNode(const JSTokenLocation& location, ExpressionNode* expression) |
| 325 | : ExpressionNode(location) |
| 326 | , m_expression(expression) |
| 327 | { |
| 328 | } |
| 329 | |
| 330 | inline ObjectSpreadExpressionNode::ObjectSpreadExpressionNode(const JSTokenLocation& location, ExpressionNode* expression) |
| 331 | : ExpressionNode(location) |
| 332 | , m_expression(expression) |
| 333 | { |
| 334 | } |
| 335 | |
| 336 | inline ArgumentListNode::ArgumentListNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 337 | : ExpressionNode(location) |
| 338 | , m_expr(expr) |
| 339 | { |
| 340 | } |
| 341 | |
| 342 | inline ArgumentListNode::ArgumentListNode(const JSTokenLocation& location, ArgumentListNode* listNode, ExpressionNode* expr) |
| 343 | : ExpressionNode(location) |
| 344 | , m_expr(expr) |
| 345 | { |
| 346 | listNode->m_next = this; |
| 347 | } |
| 348 | |
| 349 | inline ArgumentsNode::ArgumentsNode() |
| 350 | : m_listNode(nullptr) |
| 351 | { |
| 352 | } |
| 353 | |
| 354 | inline ArgumentsNode::ArgumentsNode(ArgumentListNode* listNode) |
| 355 | : m_listNode(listNode) |
| 356 | { |
| 357 | } |
| 358 | |
| 359 | inline NewExprNode::NewExprNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 360 | : ExpressionNode(location) |
| 361 | , m_expr(expr) |
| 362 | , m_args(nullptr) |
| 363 | { |
| 364 | } |
| 365 | |
| 366 | inline NewExprNode::NewExprNode(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* args) |
| 367 | : ExpressionNode(location) |
| 368 | , m_expr(expr) |
| 369 | , m_args(args) |
| 370 | { |
| 371 | } |
| 372 | |
| 373 | inline EvalFunctionCallNode::EvalFunctionCallNode(const JSTokenLocation& location, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 374 | : ExpressionNode(location) |
| 375 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 376 | , m_args(args) |
| 377 | { |
| 378 | } |
| 379 | |
| 380 | inline FunctionCallValueNode::FunctionCallValueNode(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 381 | : ExpressionNode(location) |
| 382 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 383 | , m_expr(expr) |
| 384 | , m_args(args) |
| 385 | { |
| 386 | ASSERT(divot.offset >= divotStart.offset); |
| 387 | } |
| 388 | |
| 389 | inline FunctionCallResolveNode::FunctionCallResolveNode(const JSTokenLocation& location, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 390 | : ExpressionNode(location) |
| 391 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 392 | , m_ident(ident) |
| 393 | , m_args(args) |
| 394 | { |
| 395 | } |
| 396 | |
| 397 | inline FunctionCallBracketNode::FunctionCallBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, bool subscriptHasAssignments, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 398 | : ExpressionNode(location) |
| 399 | , ThrowableSubExpressionData(divot, divotStart, divotEnd) |
| 400 | , m_base(base) |
| 401 | , m_subscript(subscript) |
| 402 | , m_args(args) |
| 403 | , m_subscriptHasAssignments(subscriptHasAssignments) |
| 404 | { |
| 405 | } |
| 406 | |
| 407 | inline FunctionCallDotNode::FunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 408 | : ExpressionNode(location) |
| 409 | , ThrowableSubExpressionData(divot, divotStart, divotEnd) |
| 410 | , m_base(base) |
| 411 | , m_ident(ident) |
| 412 | , m_args(args) |
| 413 | { |
| 414 | } |
| 415 | |
| 416 | inline BytecodeIntrinsicNode::BytecodeIntrinsicNode(Type type, const JSTokenLocation& location, EmitterType emitter, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 417 | : ExpressionNode(location) |
| 418 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 419 | , m_emitter(emitter) |
| 420 | , m_ident(ident) |
| 421 | , m_args(args) |
| 422 | , m_type(type) |
| 423 | { |
| 424 | } |
| 425 | |
| 426 | inline CallFunctionCallDotNode::CallFunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd, size_t distanceToInnermostCallOrApply) |
| 427 | : FunctionCallDotNode(location, base, ident, args, divot, divotStart, divotEnd) |
| 428 | , m_distanceToInnermostCallOrApply(distanceToInnermostCallOrApply) |
| 429 | { |
| 430 | } |
| 431 | |
| 432 | inline ApplyFunctionCallDotNode::ApplyFunctionCallDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd, size_t distanceToInnermostCallOrApply) |
| 433 | : FunctionCallDotNode(location, base, ident, args, divot, divotStart, divotEnd) |
| 434 | , m_distanceToInnermostCallOrApply(distanceToInnermostCallOrApply) |
| 435 | { |
| 436 | } |
| 437 | |
| 438 | inline PostfixNode::PostfixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator oper, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 439 | : PrefixNode(location, expr, oper, divot, divotStart, divotEnd) |
| 440 | { |
| 441 | } |
| 442 | |
| 443 | inline DeleteResolveNode::DeleteResolveNode(const JSTokenLocation& location, const Identifier& ident, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 444 | : ExpressionNode(location) |
| 445 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 446 | , m_ident(ident) |
| 447 | { |
| 448 | } |
| 449 | |
| 450 | inline DeleteBracketNode::DeleteBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 451 | : ExpressionNode(location) |
| 452 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 453 | , m_base(base) |
| 454 | , m_subscript(subscript) |
| 455 | { |
| 456 | } |
| 457 | |
| 458 | inline DeleteDotNode::DeleteDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 459 | : ExpressionNode(location) |
| 460 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 461 | , m_base(base) |
| 462 | , m_ident(ident) |
| 463 | { |
| 464 | } |
| 465 | |
| 466 | inline DeleteValueNode::DeleteValueNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 467 | : ExpressionNode(location) |
| 468 | , m_expr(expr) |
| 469 | { |
| 470 | } |
| 471 | |
| 472 | inline VoidNode::VoidNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 473 | : ExpressionNode(location) |
| 474 | , m_expr(expr) |
| 475 | { |
| 476 | } |
| 477 | |
| 478 | inline TypeOfResolveNode::TypeOfResolveNode(const JSTokenLocation& location, const Identifier& ident) |
| 479 | : ExpressionNode(location, ResultType::stringType()) |
| 480 | , m_ident(ident) |
| 481 | { |
| 482 | } |
| 483 | |
| 484 | inline TypeOfValueNode::TypeOfValueNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 485 | : ExpressionNode(location, ResultType::stringType()) |
| 486 | , m_expr(expr) |
| 487 | { |
| 488 | } |
| 489 | |
| 490 | inline PrefixNode::PrefixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator oper, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 491 | : ExpressionNode(location) |
| 492 | , ThrowablePrefixedSubExpressionData(divot, divotStart, divotEnd) |
| 493 | , m_expr(expr) |
| 494 | , m_operator(oper) |
| 495 | { |
| 496 | } |
| 497 | |
| 498 | inline UnaryOpNode::UnaryOpNode(const JSTokenLocation& location, ResultType type, ExpressionNode* expr, OpcodeID opcodeID) |
| 499 | : ExpressionNode(location, type) |
| 500 | , m_expr(expr) |
| 501 | , m_opcodeID(opcodeID) |
| 502 | { |
| 503 | } |
| 504 | |
| 505 | inline UnaryPlusNode::UnaryPlusNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 506 | : UnaryOpNode(location, ResultType::numberType(), expr, op_to_number) |
| 507 | { |
| 508 | } |
| 509 | |
| 510 | inline NegateNode::NegateNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 511 | : UnaryOpNode(location, ResultType::numberType(), expr, op_negate) |
| 512 | { |
| 513 | } |
| 514 | |
| 515 | inline BitwiseNotNode::BitwiseNotNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 516 | : UnaryOpNode(location, ResultType::forBitOp(), expr, op_bitnot) |
| 517 | { |
| 518 | } |
| 519 | |
| 520 | inline LogicalNotNode::LogicalNotNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 521 | : UnaryOpNode(location, ResultType::booleanType(), expr, op_not) |
| 522 | { |
| 523 | } |
| 524 | |
| 525 | inline BinaryOpNode::BinaryOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) |
| 526 | : ExpressionNode(location) |
| 527 | , m_rightHasAssignments(rightHasAssignments) |
| 528 | , m_opcodeID(opcodeID) |
| 529 | , m_expr1(expr1) |
| 530 | , m_expr2(expr2) |
| 531 | { |
| 532 | } |
| 533 | |
| 534 | inline BinaryOpNode::BinaryOpNode(const JSTokenLocation& location, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) |
| 535 | : ExpressionNode(location, type) |
| 536 | , m_rightHasAssignments(rightHasAssignments) |
| 537 | , m_opcodeID(opcodeID) |
| 538 | , m_expr1(expr1) |
| 539 | , m_expr2(expr2) |
| 540 | { |
| 541 | } |
| 542 | |
| 543 | inline PowNode::PowNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 544 | : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_pow, rightHasAssignments) |
| 545 | { |
| 546 | } |
| 547 | |
| 548 | inline MultNode::MultNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 549 | : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_mul, rightHasAssignments) |
| 550 | { |
| 551 | } |
| 552 | |
| 553 | inline DivNode::DivNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 554 | : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_div, rightHasAssignments) |
| 555 | { |
| 556 | } |
| 557 | |
| 558 | |
| 559 | inline ModNode::ModNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 560 | : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_mod, rightHasAssignments) |
| 561 | { |
| 562 | } |
| 563 | |
| 564 | inline AddNode::AddNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 565 | : BinaryOpNode(location, ResultType::forAdd(expr1->resultDescriptor(), expr2->resultDescriptor()), expr1, expr2, op_add, rightHasAssignments) |
| 566 | { |
| 567 | } |
| 568 | |
| 569 | inline SubNode::SubNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 570 | : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_sub, rightHasAssignments) |
| 571 | { |
| 572 | } |
| 573 | |
| 574 | inline LeftShiftNode::LeftShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 575 | : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_lshift, rightHasAssignments) |
| 576 | { |
| 577 | } |
| 578 | |
| 579 | inline RightShiftNode::RightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 580 | : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_rshift, rightHasAssignments) |
| 581 | { |
| 582 | } |
| 583 | |
| 584 | inline UnsignedRightShiftNode::UnsignedRightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 585 | : BinaryOpNode(location, ResultType::numberType(), expr1, expr2, op_urshift, rightHasAssignments) |
| 586 | { |
| 587 | } |
| 588 | |
| 589 | inline LessNode::LessNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 590 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_less, rightHasAssignments) |
| 591 | { |
| 592 | } |
| 593 | |
| 594 | inline GreaterNode::GreaterNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 595 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_greater, rightHasAssignments) |
| 596 | { |
| 597 | } |
| 598 | |
| 599 | inline LessEqNode::LessEqNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 600 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_lesseq, rightHasAssignments) |
| 601 | { |
| 602 | } |
| 603 | |
| 604 | inline GreaterEqNode::GreaterEqNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 605 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_greatereq, rightHasAssignments) |
| 606 | { |
| 607 | } |
| 608 | |
| 609 | inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation& location, ResultType type, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) |
| 610 | : BinaryOpNode(location, type, expr1, expr2, opcodeID, rightHasAssignments) |
| 611 | { |
| 612 | } |
| 613 | |
| 614 | inline ThrowableBinaryOpNode::ThrowableBinaryOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID opcodeID, bool rightHasAssignments) |
| 615 | : BinaryOpNode(location, expr1, expr2, opcodeID, rightHasAssignments) |
| 616 | { |
| 617 | } |
| 618 | |
| 619 | inline InstanceOfNode::InstanceOfNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 620 | : ThrowableBinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_instanceof, rightHasAssignments) |
| 621 | { |
| 622 | } |
| 623 | |
| 624 | inline InNode::InNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 625 | : ThrowableBinaryOpNode(location, expr1, expr2, op_in_by_val, rightHasAssignments) |
| 626 | { |
| 627 | } |
| 628 | |
| 629 | inline EqualNode::EqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 630 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_eq, rightHasAssignments) |
| 631 | { |
| 632 | } |
| 633 | |
| 634 | inline NotEqualNode::NotEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 635 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_neq, rightHasAssignments) |
| 636 | { |
| 637 | } |
| 638 | |
| 639 | inline StrictEqualNode::StrictEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 640 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_stricteq, rightHasAssignments) |
| 641 | { |
| 642 | } |
| 643 | |
| 644 | inline NotStrictEqualNode::NotStrictEqualNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 645 | : BinaryOpNode(location, ResultType::booleanType(), expr1, expr2, op_nstricteq, rightHasAssignments) |
| 646 | { |
| 647 | } |
| 648 | |
| 649 | inline BitAndNode::BitAndNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 650 | : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitand, rightHasAssignments) |
| 651 | { |
| 652 | } |
| 653 | |
| 654 | inline BitOrNode::BitOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 655 | : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitor, rightHasAssignments) |
| 656 | { |
| 657 | } |
| 658 | |
| 659 | inline BitXOrNode::BitXOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 660 | : BinaryOpNode(location, ResultType::forBitOp(), expr1, expr2, op_bitxor, rightHasAssignments) |
| 661 | { |
| 662 | } |
| 663 | |
| 664 | inline LogicalOpNode::LogicalOpNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator oper) |
| 665 | : ExpressionNode(location, ResultType::forLogicalOp(expr1->resultDescriptor(), expr2->resultDescriptor())) |
| 666 | , m_operator(oper) |
| 667 | , m_expr1(expr1) |
| 668 | , m_expr2(expr2) |
| 669 | { |
| 670 | } |
| 671 | |
| 672 | inline ConditionalNode::ConditionalNode(const JSTokenLocation& location, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2) |
| 673 | : ExpressionNode(location) |
| 674 | , m_logical(logical) |
| 675 | , m_expr1(expr1) |
| 676 | , m_expr2(expr2) |
| 677 | { |
| 678 | } |
| 679 | |
| 680 | inline ReadModifyResolveNode::ReadModifyResolveNode(const JSTokenLocation& location, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 681 | : ExpressionNode(location) |
| 682 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 683 | , m_ident(ident) |
| 684 | , m_right(right) |
| 685 | , m_operator(oper) |
| 686 | , m_rightHasAssignments(rightHasAssignments) |
| 687 | { |
| 688 | } |
| 689 | |
| 690 | inline AssignResolveNode::AssignResolveNode(const JSTokenLocation& location, const Identifier& ident, ExpressionNode* right, AssignmentContext assignmentContext) |
| 691 | : ExpressionNode(location) |
| 692 | , m_ident(ident) |
| 693 | , m_right(right) |
| 694 | , m_assignmentContext(assignmentContext) |
| 695 | { |
| 696 | } |
| 697 | |
| 698 | |
| 699 | inline ReadModifyBracketNode::ReadModifyBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, Operator oper, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 700 | : ExpressionNode(location) |
| 701 | , ThrowableSubExpressionData(divot, divotStart, divotEnd) |
| 702 | , m_base(base) |
| 703 | , m_subscript(subscript) |
| 704 | , m_right(right) |
| 705 | , m_operator(oper) |
| 706 | , m_subscriptHasAssignments(subscriptHasAssignments) |
| 707 | , m_rightHasAssignments(rightHasAssignments) |
| 708 | { |
| 709 | } |
| 710 | |
| 711 | inline AssignBracketNode::AssignBracketNode(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* subscript, ExpressionNode* right, bool subscriptHasAssignments, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 712 | : ExpressionNode(location) |
| 713 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 714 | , m_base(base) |
| 715 | , m_subscript(subscript) |
| 716 | , m_right(right) |
| 717 | , m_subscriptHasAssignments(subscriptHasAssignments) |
| 718 | , m_rightHasAssignments(rightHasAssignments) |
| 719 | { |
| 720 | } |
| 721 | |
| 722 | inline AssignDotNode::AssignDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 723 | : ExpressionNode(location) |
| 724 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 725 | , m_base(base) |
| 726 | , m_ident(ident) |
| 727 | , m_right(right) |
| 728 | , m_rightHasAssignments(rightHasAssignments) |
| 729 | { |
| 730 | } |
| 731 | |
| 732 | inline ReadModifyDotNode::ReadModifyDotNode(const JSTokenLocation& location, ExpressionNode* base, const Identifier& ident, Operator oper, ExpressionNode* right, bool rightHasAssignments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 733 | : ExpressionNode(location) |
| 734 | , ThrowableSubExpressionData(divot, divotStart, divotEnd) |
| 735 | , m_base(base) |
| 736 | , m_ident(ident) |
| 737 | , m_right(right) |
| 738 | , m_operator(oper) |
| 739 | , m_rightHasAssignments(rightHasAssignments) |
| 740 | { |
| 741 | } |
| 742 | |
| 743 | inline AssignErrorNode::AssignErrorNode(const JSTokenLocation& location, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) |
| 744 | : ExpressionNode(location) |
| 745 | , ThrowableExpressionData(divot, divotStart, divotEnd) |
| 746 | { |
| 747 | } |
| 748 | |
| 749 | inline CommaNode::CommaNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 750 | : ExpressionNode(location) |
| 751 | , m_expr(expr) |
| 752 | { |
| 753 | } |
| 754 | |
| 755 | inline SourceElements::SourceElements() |
| 756 | { |
| 757 | } |
| 758 | |
| 759 | inline EmptyStatementNode::EmptyStatementNode(const JSTokenLocation& location) |
| 760 | : StatementNode(location) |
| 761 | { |
| 762 | } |
| 763 | |
| 764 | inline DebuggerStatementNode::DebuggerStatementNode(const JSTokenLocation& location) |
| 765 | : StatementNode(location) |
| 766 | { |
| 767 | } |
| 768 | |
| 769 | inline ExprStatementNode::ExprStatementNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 770 | : StatementNode(location) |
| 771 | , m_expr(expr) |
| 772 | { |
| 773 | } |
| 774 | |
| 775 | inline DeclarationStatement::DeclarationStatement(const JSTokenLocation& location, ExpressionNode* expr) |
| 776 | : StatementNode(location) |
| 777 | , m_expr(expr) |
| 778 | { |
| 779 | } |
| 780 | |
| 781 | inline ModuleDeclarationNode::ModuleDeclarationNode(const JSTokenLocation& location) |
| 782 | : StatementNode(location) |
| 783 | { |
| 784 | } |
| 785 | |
| 786 | inline ModuleNameNode::ModuleNameNode(const JSTokenLocation& location, const Identifier& moduleName) |
| 787 | : Node(location) |
| 788 | , m_moduleName(moduleName) |
| 789 | { |
| 790 | } |
| 791 | |
| 792 | inline ImportSpecifierNode::ImportSpecifierNode(const JSTokenLocation& location, const Identifier& importedName, const Identifier& localName) |
| 793 | : Node(location) |
| 794 | , m_importedName(importedName) |
| 795 | , m_localName(localName) |
| 796 | { |
| 797 | } |
| 798 | |
| 799 | inline ImportDeclarationNode::ImportDeclarationNode(const JSTokenLocation& location, ImportSpecifierListNode* importSpecifierList, ModuleNameNode* moduleName) |
| 800 | : ModuleDeclarationNode(location) |
| 801 | , m_specifierList(importSpecifierList) |
| 802 | , m_moduleName(moduleName) |
| 803 | { |
| 804 | } |
| 805 | |
| 806 | inline ExportAllDeclarationNode::ExportAllDeclarationNode(const JSTokenLocation& location, ModuleNameNode* moduleName) |
| 807 | : ModuleDeclarationNode(location) |
| 808 | , m_moduleName(moduleName) |
| 809 | { |
| 810 | } |
| 811 | |
| 812 | inline ExportDefaultDeclarationNode::ExportDefaultDeclarationNode(const JSTokenLocation& location, StatementNode* declaration, const Identifier& localName) |
| 813 | : ModuleDeclarationNode(location) |
| 814 | , m_declaration(declaration) |
| 815 | , m_localName(localName) |
| 816 | { |
| 817 | } |
| 818 | |
| 819 | inline ExportLocalDeclarationNode::ExportLocalDeclarationNode(const JSTokenLocation& location, StatementNode* declaration) |
| 820 | : ModuleDeclarationNode(location) |
| 821 | , m_declaration(declaration) |
| 822 | { |
| 823 | } |
| 824 | |
| 825 | inline ExportNamedDeclarationNode::ExportNamedDeclarationNode(const JSTokenLocation& location, ExportSpecifierListNode* exportSpecifierList, ModuleNameNode* moduleName) |
| 826 | : ModuleDeclarationNode(location) |
| 827 | , m_specifierList(exportSpecifierList) |
| 828 | , m_moduleName(moduleName) |
| 829 | { |
| 830 | } |
| 831 | |
| 832 | inline ExportSpecifierNode::ExportSpecifierNode(const JSTokenLocation& location, const Identifier& localName, const Identifier& exportedName) |
| 833 | : Node(location) |
| 834 | , m_localName(localName) |
| 835 | , m_exportedName(exportedName) |
| 836 | { |
| 837 | } |
| 838 | |
| 839 | inline EmptyVarExpression::EmptyVarExpression(const JSTokenLocation& location, const Identifier& ident) |
| 840 | : ExpressionNode(location) |
| 841 | , m_ident(ident) |
| 842 | { |
| 843 | } |
| 844 | |
| 845 | inline EmptyLetExpression::EmptyLetExpression(const JSTokenLocation& location, const Identifier& ident) |
| 846 | : ExpressionNode(location) |
| 847 | , m_ident(ident) |
| 848 | { |
| 849 | } |
| 850 | |
| 851 | inline IfElseNode::IfElseNode(const JSTokenLocation& location, ExpressionNode* condition, StatementNode* ifBlock, StatementNode* elseBlock) |
| 852 | : StatementNode(location) |
| 853 | , m_condition(condition) |
| 854 | , m_ifBlock(ifBlock) |
| 855 | , m_elseBlock(elseBlock) |
| 856 | { |
| 857 | } |
| 858 | |
| 859 | inline DoWhileNode::DoWhileNode(const JSTokenLocation& location, StatementNode* statement, ExpressionNode* expr) |
| 860 | : StatementNode(location) |
| 861 | , m_statement(statement) |
| 862 | , m_expr(expr) |
| 863 | { |
| 864 | } |
| 865 | |
| 866 | inline WhileNode::WhileNode(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement) |
| 867 | : StatementNode(location) |
| 868 | , m_expr(expr) |
| 869 | , m_statement(statement) |
| 870 | { |
| 871 | } |
| 872 | |
| 873 | inline ForNode::ForNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode* statement, VariableEnvironment& lexicalVariables) |
| 874 | : StatementNode(location) |
| 875 | , VariableEnvironmentNode(lexicalVariables) |
| 876 | , m_expr1(expr1) |
| 877 | , m_expr2(expr2) |
| 878 | , m_expr3(expr3) |
| 879 | , m_statement(statement) |
| 880 | { |
| 881 | ASSERT(statement); |
| 882 | } |
| 883 | |
| 884 | inline ContinueNode::ContinueNode(const JSTokenLocation& location, const Identifier& ident) |
| 885 | : StatementNode(location) |
| 886 | , m_ident(ident) |
| 887 | { |
| 888 | } |
| 889 | |
| 890 | inline BreakNode::BreakNode(const JSTokenLocation& location, const Identifier& ident) |
| 891 | : StatementNode(location) |
| 892 | , m_ident(ident) |
| 893 | { |
| 894 | } |
| 895 | |
| 896 | inline ReturnNode::ReturnNode(const JSTokenLocation& location, ExpressionNode* value) |
| 897 | : StatementNode(location) |
| 898 | , m_value(value) |
| 899 | { |
| 900 | } |
| 901 | |
| 902 | inline WithNode::WithNode(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement, const JSTextPosition& divot, uint32_t expressionLength) |
| 903 | : StatementNode(location) |
| 904 | , m_expr(expr) |
| 905 | , m_statement(statement) |
| 906 | , m_divot(divot) |
| 907 | , m_expressionLength(expressionLength) |
| 908 | { |
| 909 | } |
| 910 | |
| 911 | inline LabelNode::LabelNode(const JSTokenLocation& location, const Identifier& name, StatementNode* statement) |
| 912 | : StatementNode(location) |
| 913 | , m_name(name) |
| 914 | , m_statement(statement) |
| 915 | { |
| 916 | } |
| 917 | |
| 918 | inline ThrowNode::ThrowNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 919 | : StatementNode(location) |
| 920 | , m_expr(expr) |
| 921 | { |
| 922 | } |
| 923 | |
| 924 | inline TryNode::TryNode(const JSTokenLocation& location, StatementNode* tryBlock, DestructuringPatternNode* catchPattern, StatementNode* catchBlock, VariableEnvironment& catchEnvironment, StatementNode* finallyBlock) |
| 925 | : StatementNode(location) |
| 926 | , VariableEnvironmentNode(catchEnvironment) |
| 927 | , m_tryBlock(tryBlock) |
| 928 | , m_catchPattern(catchPattern) |
| 929 | , m_catchBlock(catchBlock) |
| 930 | , m_finallyBlock(finallyBlock) |
| 931 | { |
| 932 | } |
| 933 | |
| 934 | inline FunctionParameters::FunctionParameters() |
| 935 | { |
| 936 | } |
| 937 | |
| 938 | |
| 939 | inline BaseFuncExprNode::BaseFuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionMetadataNode* metadata, const SourceCode& source, FunctionMode functionMode) |
| 940 | : ExpressionNode(location) |
| 941 | , m_metadata(metadata) |
| 942 | { |
| 943 | m_metadata->finishParsing(source, ident, functionMode); |
| 944 | } |
| 945 | |
| 946 | inline FuncExprNode::FuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionMetadataNode* metadata, const SourceCode& source) |
| 947 | : BaseFuncExprNode(location, ident, metadata, source, FunctionMode::FunctionExpression) |
| 948 | { |
| 949 | } |
| 950 | |
| 951 | inline FuncExprNode::FuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionMetadataNode* metadata, const SourceCode& source, FunctionMode functionMode) |
| 952 | : BaseFuncExprNode(location, ident, metadata, source, functionMode) |
| 953 | { |
| 954 | } |
| 955 | |
| 956 | inline FuncDeclNode::FuncDeclNode(const JSTokenLocation& location, const Identifier& ident, FunctionMetadataNode* metadata, const SourceCode& source) |
| 957 | : StatementNode(location) |
| 958 | , m_metadata(metadata) |
| 959 | { |
| 960 | m_metadata->finishParsing(source, ident, FunctionMode::FunctionDeclaration); |
| 961 | } |
| 962 | |
| 963 | inline ArrowFuncExprNode::ArrowFuncExprNode(const JSTokenLocation& location, const Identifier& ident, FunctionMetadataNode* metadata, const SourceCode& source) |
| 964 | : BaseFuncExprNode(location, ident, metadata, source, FunctionMode::FunctionExpression) |
| 965 | { |
| 966 | } |
| 967 | |
| 968 | inline MethodDefinitionNode::MethodDefinitionNode(const JSTokenLocation& location, const Identifier& ident, FunctionMetadataNode* metadata, const SourceCode& source) |
| 969 | : FuncExprNode(location, ident, metadata, source, FunctionMode::MethodDefinition) |
| 970 | { |
| 971 | } |
| 972 | |
| 973 | inline YieldExprNode::YieldExprNode(const JSTokenLocation& location, ExpressionNode* argument, bool delegate) |
| 974 | : ExpressionNode(location) |
| 975 | , m_argument(argument) |
| 976 | , m_delegate(delegate) |
| 977 | { |
| 978 | } |
| 979 | |
| 980 | inline AwaitExprNode::AwaitExprNode(const JSTokenLocation& location, ExpressionNode* argument) |
| 981 | : ExpressionNode(location) |
| 982 | , m_argument(argument) |
| 983 | { |
| 984 | } |
| 985 | |
| 986 | inline ClassDeclNode::ClassDeclNode(const JSTokenLocation& location, ExpressionNode* classDeclaration) |
| 987 | : StatementNode(location) |
| 988 | , m_classDeclaration(classDeclaration) |
| 989 | { |
| 990 | } |
| 991 | |
| 992 | inline ClassExprNode::ClassExprNode(const JSTokenLocation& location, const Identifier& name, const SourceCode& classSource, VariableEnvironment& classEnvironment, ExpressionNode* constructorExpression, ExpressionNode* classHeritage, PropertyListNode* classElements) |
| 993 | : ExpressionNode(location) |
| 994 | , VariableEnvironmentNode(classEnvironment) |
| 995 | , m_classSource(classSource) |
| 996 | , m_name(name) |
| 997 | , m_ecmaName(&name) |
| 998 | , m_constructorExpression(constructorExpression) |
| 999 | , m_classHeritage(classHeritage) |
| 1000 | , m_classElements(classElements) |
| 1001 | { |
| 1002 | } |
| 1003 | |
| 1004 | inline CaseClauseNode::CaseClauseNode(ExpressionNode* expr, SourceElements* statements) |
| 1005 | : m_expr(expr) |
| 1006 | , m_statements(statements) |
| 1007 | { |
| 1008 | } |
| 1009 | |
| 1010 | inline ClauseListNode::ClauseListNode(CaseClauseNode* clause) |
| 1011 | : m_clause(clause) |
| 1012 | { |
| 1013 | } |
| 1014 | |
| 1015 | inline ClauseListNode::ClauseListNode(ClauseListNode* clauseList, CaseClauseNode* clause) |
| 1016 | : m_clause(clause) |
| 1017 | { |
| 1018 | clauseList->m_next = this; |
| 1019 | } |
| 1020 | |
| 1021 | inline CaseBlockNode::CaseBlockNode(ClauseListNode* list1, CaseClauseNode* defaultClause, ClauseListNode* list2) |
| 1022 | : m_list1(list1) |
| 1023 | , m_defaultClause(defaultClause) |
| 1024 | , m_list2(list2) |
| 1025 | { |
| 1026 | } |
| 1027 | |
| 1028 | inline SwitchNode::SwitchNode(const JSTokenLocation& location, ExpressionNode* expr, CaseBlockNode* block, VariableEnvironment& lexicalVariables, FunctionStack&& functionStack) |
| 1029 | : StatementNode(location) |
| 1030 | , VariableEnvironmentNode(lexicalVariables, WTFMove(functionStack)) |
| 1031 | , m_expr(expr) |
| 1032 | , m_block(block) |
| 1033 | { |
| 1034 | } |
| 1035 | |
| 1036 | inline BlockNode::BlockNode(const JSTokenLocation& location, SourceElements* statements, VariableEnvironment& lexicalVariables, FunctionStack&& functionStack) |
| 1037 | : StatementNode(location) |
| 1038 | , VariableEnvironmentNode(lexicalVariables, WTFMove(functionStack)) |
| 1039 | , m_statements(statements) |
| 1040 | { |
| 1041 | } |
| 1042 | |
| 1043 | inline EnumerationNode::EnumerationNode(const JSTokenLocation& location, ExpressionNode* lexpr, ExpressionNode* expr, StatementNode* statement, VariableEnvironment& lexicalVariables) |
| 1044 | : StatementNode(location) |
| 1045 | , VariableEnvironmentNode(lexicalVariables) |
| 1046 | , m_lexpr(lexpr) |
| 1047 | , m_expr(expr) |
| 1048 | , m_statement(statement) |
| 1049 | { |
| 1050 | ASSERT(lexpr); |
| 1051 | } |
| 1052 | |
| 1053 | inline ForInNode::ForInNode(const JSTokenLocation& location, ExpressionNode* lexpr, ExpressionNode* expr, StatementNode* statement, VariableEnvironment& lexicalVariables) |
| 1054 | : EnumerationNode(location, lexpr, expr, statement, lexicalVariables) |
| 1055 | { |
| 1056 | } |
| 1057 | |
| 1058 | inline ForOfNode::ForOfNode(bool isForAwait, const JSTokenLocation& location, ExpressionNode* lexpr, ExpressionNode* expr, StatementNode* statement, VariableEnvironment& lexicalVariables) |
| 1059 | : EnumerationNode(location, lexpr, expr, statement, lexicalVariables) |
| 1060 | , m_isForAwait(isForAwait) |
| 1061 | { |
| 1062 | } |
| 1063 | |
| 1064 | inline DestructuringPatternNode::DestructuringPatternNode() |
| 1065 | { |
| 1066 | } |
| 1067 | |
| 1068 | inline ArrayPatternNode::ArrayPatternNode() |
| 1069 | : DestructuringPatternNode() |
| 1070 | { |
| 1071 | } |
| 1072 | |
| 1073 | inline ObjectPatternNode::ObjectPatternNode() |
| 1074 | : DestructuringPatternNode() |
| 1075 | { |
| 1076 | } |
| 1077 | |
| 1078 | inline BindingNode::BindingNode(const Identifier& boundProperty, const JSTextPosition& start, const JSTextPosition& end, AssignmentContext context) |
| 1079 | : DestructuringPatternNode() |
| 1080 | , m_divotStart(start) |
| 1081 | , m_divotEnd(end) |
| 1082 | , m_boundProperty(boundProperty) |
| 1083 | , m_bindingContext(context) |
| 1084 | { |
| 1085 | } |
| 1086 | |
| 1087 | inline AssignmentElementNode::AssignmentElementNode(ExpressionNode* assignmentTarget, const JSTextPosition& start, const JSTextPosition& end) |
| 1088 | : DestructuringPatternNode() |
| 1089 | , m_divotStart(start) |
| 1090 | , m_divotEnd(end) |
| 1091 | , m_assignmentTarget(assignmentTarget) |
| 1092 | { |
| 1093 | } |
| 1094 | |
| 1095 | inline RestParameterNode::RestParameterNode(DestructuringPatternNode* pattern, unsigned numParametersToSkip) |
| 1096 | : DestructuringPatternNode() |
| 1097 | , m_pattern(pattern) |
| 1098 | , m_numParametersToSkip(numParametersToSkip) |
| 1099 | { |
| 1100 | ASSERT(!pattern->isRestParameter()); |
| 1101 | } |
| 1102 | |
| 1103 | inline DestructuringAssignmentNode::DestructuringAssignmentNode(const JSTokenLocation& location, DestructuringPatternNode* bindings, ExpressionNode* initializer) |
| 1104 | : ExpressionNode(location) |
| 1105 | , m_bindings(bindings) |
| 1106 | , m_initializer(initializer) |
| 1107 | { |
| 1108 | } |
| 1109 | |
| 1110 | } // namespace JSC |
| 1111 | |