Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: vm/ast.h

Issue 10632009: Make the parser agnostic to the TokenStream implementation. This is the first step towards compacti… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | vm/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 virtual void Visit(AstNodeVisitor* visitor); \ 88 virtual void Visit(AstNodeVisitor* visitor); \
89 virtual const char* ShortName() const; \ 89 virtual const char* ShortName() const; \
90 virtual bool Is##type() const { return true; } \ 90 virtual bool Is##type() const { return true; } \
91 virtual type* As##type() { return this; } 91 virtual type* As##type() { return this; }
92 92
93 93
94 class AstNode : public ZoneAllocated { 94 class AstNode : public ZoneAllocated {
95 public: 95 public:
96 static const int kNoId = -1; 96 static const int kNoId = -1;
97 97
98 explicit AstNode(intptr_t token_index) 98 explicit AstNode(intptr_t token_pos)
99 : token_index_(token_index), 99 : token_pos_(token_pos),
100 id_(GetNextId()), 100 id_(GetNextId()),
101 ic_data_(ICData::ZoneHandle()), 101 ic_data_(ICData::ZoneHandle()),
102 info_(NULL) { 102 info_(NULL) {
103 ASSERT(token_index >= 0); 103 ASSERT(token_pos >= 0);
104 } 104 }
105 105
106 intptr_t token_index() const { return token_index_; } 106 intptr_t token_pos() const { return token_pos_; }
107 107
108 108
109 const ICData& ic_data() const { return ic_data_; } 109 const ICData& ic_data() const { return ic_data_; }
110 void set_ic_data(const ICData& value) { 110 void set_ic_data(const ICData& value) {
111 ic_data_ = value.raw(); 111 ic_data_ = value.raw();
112 } 112 }
113 113
114 intptr_t id() const { return id_; } 114 intptr_t id() const { return id_; }
115 115
116 void set_info(CodeGenInfo* info) { info_ = info; } 116 void set_info(CodeGenInfo* info) { info_ = info; }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 friend class ParsedFunction; 159 friend class ParsedFunction;
160 160
161 static intptr_t GetNextId() { 161 static intptr_t GetNextId() {
162 Isolate* isolate = Isolate::Current(); 162 Isolate* isolate = Isolate::Current();
163 intptr_t tmp = isolate->ast_node_id(); 163 intptr_t tmp = isolate->ast_node_id();
164 isolate->set_ast_node_id(tmp + 1); 164 isolate->set_ast_node_id(tmp + 1);
165 return tmp; 165 return tmp;
166 } 166 }
167 167
168 private: 168 private:
169 const intptr_t token_index_; 169 const intptr_t token_pos_;
170 // Unique id per function compiled, used to match AST node to a PC. 170 // Unique id per function compiled, used to match AST node to a PC.
171 const intptr_t id_; 171 const intptr_t id_;
172 // IC data collected for this node. 172 // IC data collected for this node.
173 ICData& ic_data_; 173 ICData& ic_data_;
174 // Used by optimizing compiler. 174 // Used by optimizing compiler.
175 CodeGenInfo* info_; 175 CodeGenInfo* info_;
176 DISALLOW_COPY_AND_ASSIGN(AstNode); 176 DISALLOW_COPY_AND_ASSIGN(AstNode);
177 }; 177 };
178 178
179 179
180 class SequenceNode : public AstNode { 180 class SequenceNode : public AstNode {
181 public: 181 public:
182 SequenceNode(intptr_t token_index, LocalScope* scope) 182 SequenceNode(intptr_t token_pos, LocalScope* scope)
183 : AstNode(token_index), 183 : AstNode(token_pos),
184 scope_(scope), 184 scope_(scope),
185 nodes_(4), 185 nodes_(4),
186 label_(NULL), 186 label_(NULL),
187 first_parameter_id_(AstNode::kNoId), 187 first_parameter_id_(AstNode::kNoId),
188 last_parameter_id_(AstNode::kNoId) { 188 last_parameter_id_(AstNode::kNoId) {
189 } 189 }
190 190
191 LocalScope* scope() const { return scope_; } 191 LocalScope* scope() const { return scope_; }
192 192
193 SourceLabel* label() const { return label_; } 193 SourceLabel* label() const { return label_; }
(...skipping 25 matching lines...) Expand all
219 SourceLabel* label_; 219 SourceLabel* label_;
220 intptr_t first_parameter_id_; 220 intptr_t first_parameter_id_;
221 intptr_t last_parameter_id_; 221 intptr_t last_parameter_id_;
222 222
223 DISALLOW_COPY_AND_ASSIGN(SequenceNode); 223 DISALLOW_COPY_AND_ASSIGN(SequenceNode);
224 }; 224 };
225 225
226 226
227 class CloneContextNode : public AstNode { 227 class CloneContextNode : public AstNode {
228 public: 228 public:
229 explicit CloneContextNode(intptr_t token_index) 229 explicit CloneContextNode(intptr_t token_pos)
230 : AstNode(token_index) { 230 : AstNode(token_pos) {
231 } 231 }
232 232
233 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 233 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
234 234
235 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode); 235 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode);
236 236
237 private: 237 private:
238 DISALLOW_COPY_AND_ASSIGN(CloneContextNode); 238 DISALLOW_COPY_AND_ASSIGN(CloneContextNode);
239 }; 239 };
240 240
241 241
242 class ArgumentListNode : public AstNode { 242 class ArgumentListNode : public AstNode {
243 public: 243 public:
244 explicit ArgumentListNode(intptr_t token_index) 244 explicit ArgumentListNode(intptr_t token_pos)
245 : AstNode(token_index), 245 : AstNode(token_pos),
246 nodes_(4), 246 nodes_(4),
247 names_(Array::ZoneHandle()) { 247 names_(Array::ZoneHandle()) {
248 } 248 }
249 249
250 void VisitChildren(AstNodeVisitor* visitor) const; 250 void VisitChildren(AstNodeVisitor* visitor) const;
251 251
252 void Add(AstNode* node) { 252 void Add(AstNode* node) {
253 nodes_.Add(node); 253 nodes_.Add(node);
254 } 254 }
255 intptr_t length() const { return nodes_.length(); } 255 intptr_t length() const { return nodes_.length(); }
(...skipping 11 matching lines...) Expand all
267 private: 267 private:
268 GrowableArray<AstNode*> nodes_; 268 GrowableArray<AstNode*> nodes_;
269 Array& names_; 269 Array& names_;
270 270
271 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); 271 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode);
272 }; 272 };
273 273
274 274
275 class ArrayNode : public AstNode { 275 class ArrayNode : public AstNode {
276 public: 276 public:
277 ArrayNode(intptr_t token_index, const AbstractTypeArguments& type_arguments) 277 ArrayNode(intptr_t token_pos, const AbstractTypeArguments& type_arguments)
278 : AstNode(token_index), 278 : AstNode(token_pos),
279 type_arguments_(type_arguments), 279 type_arguments_(type_arguments),
280 elements_(4) { 280 elements_(4) {
281 ASSERT(type_arguments_.IsZoneHandle()); 281 ASSERT(type_arguments_.IsZoneHandle());
282 } 282 }
283 283
284 void VisitChildren(AstNodeVisitor* visitor) const; 284 void VisitChildren(AstNodeVisitor* visitor) const;
285 285
286 intptr_t length() const { return elements_.length(); } 286 intptr_t length() const { return elements_.length(); }
287 287
288 AstNode* ElementAt(intptr_t index) const { return elements_[index]; } 288 AstNode* ElementAt(intptr_t index) const { return elements_[index]; }
(...skipping 11 matching lines...) Expand all
300 private: 300 private:
301 const AbstractTypeArguments& type_arguments_; 301 const AbstractTypeArguments& type_arguments_;
302 GrowableArray<AstNode*> elements_; 302 GrowableArray<AstNode*> elements_;
303 303
304 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); 304 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode);
305 }; 305 };
306 306
307 307
308 class LiteralNode : public AstNode { 308 class LiteralNode : public AstNode {
309 public: 309 public:
310 LiteralNode(intptr_t token_index, const Instance& literal) 310 LiteralNode(intptr_t token_pos, const Instance& literal)
311 : AstNode(token_index), literal_(literal) { 311 : AstNode(token_pos), literal_(literal) {
312 ASSERT(literal.IsZoneHandle()); 312 ASSERT(literal.IsZoneHandle());
313 #if defined(DEBUG) 313 #if defined(DEBUG)
314 if (literal.IsString()) { 314 if (literal.IsString()) {
315 String& str = String::Handle(); 315 String& str = String::Handle();
316 str ^= literal.raw(); 316 str ^= literal.raw();
317 ASSERT(str.IsSymbol()); 317 ASSERT(str.IsSymbol());
318 } 318 }
319 #endif // defined(DEBUG) 319 #endif // defined(DEBUG)
320 ASSERT(literal.IsNull() || 320 ASSERT(literal.IsNull() ||
321 Class::Handle(literal.clazz()).is_finalized() || 321 Class::Handle(literal.clazz()).is_finalized() ||
(...skipping 14 matching lines...) Expand all
336 336
337 private: 337 private:
338 const Instance& literal_; 338 const Instance& literal_;
339 339
340 DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode); 340 DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode);
341 }; 341 };
342 342
343 343
344 class TypeNode : public AstNode { 344 class TypeNode : public AstNode {
345 public: 345 public:
346 TypeNode(intptr_t token_index, const AbstractType& type) 346 TypeNode(intptr_t token_pos, const AbstractType& type)
347 : AstNode(token_index), type_(type) { 347 : AstNode(token_pos), type_(type) {
348 ASSERT(type.IsZoneHandle()); 348 ASSERT(type.IsZoneHandle());
349 ASSERT(!type.IsNull()); 349 ASSERT(!type.IsNull());
350 ASSERT(type.IsFinalized()); 350 ASSERT(type.IsFinalized());
351 } 351 }
352 352
353 const AbstractType& type() const { return type_; } 353 const AbstractType& type() const { return type_; }
354 354
355 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 355 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
356 356
357 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode); 357 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode);
358 358
359 private: 359 private:
360 const AbstractType& type_; 360 const AbstractType& type_;
361 361
362 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); 362 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode);
363 }; 363 };
364 364
365 365
366 class AssignableNode : public AstNode { 366 class AssignableNode : public AstNode {
367 public: 367 public:
368 AssignableNode(intptr_t token_index, 368 AssignableNode(intptr_t token_pos,
369 AstNode* expr, 369 AstNode* expr,
370 const AbstractType& type, 370 const AbstractType& type,
371 const String& dst_name) 371 const String& dst_name)
372 : AstNode(token_index), expr_(expr), type_(type), dst_name_(dst_name) { 372 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) {
373 ASSERT(expr_ != NULL); 373 ASSERT(expr_ != NULL);
374 ASSERT(type_.IsZoneHandle()); 374 ASSERT(type_.IsZoneHandle());
375 ASSERT(!type_.IsNull()); 375 ASSERT(!type_.IsNull());
376 ASSERT(type_.IsFinalized()); 376 ASSERT(type_.IsFinalized());
377 ASSERT(dst_name_.IsZoneHandle()); 377 ASSERT(dst_name_.IsZoneHandle());
378 } 378 }
379 379
380 AstNode* expr() const { return expr_; } 380 AstNode* expr() const { return expr_; }
381 const AbstractType& type() const { return type_; } 381 const AbstractType& type() const { return type_; }
382 const String& dst_name() const { return dst_name_; } 382 const String& dst_name() const { return dst_name_; }
383 383
384 virtual void VisitChildren(AstNodeVisitor* visitor) const { 384 virtual void VisitChildren(AstNodeVisitor* visitor) const {
385 expr()->Visit(visitor); 385 expr()->Visit(visitor);
386 } 386 }
387 387
388 DECLARE_COMMON_NODE_FUNCTIONS(AssignableNode); 388 DECLARE_COMMON_NODE_FUNCTIONS(AssignableNode);
389 389
390 private: 390 private:
391 AstNode* expr_; 391 AstNode* expr_;
392 const AbstractType& type_; 392 const AbstractType& type_;
393 const String& dst_name_; 393 const String& dst_name_;
394 394
395 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); 395 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode);
396 }; 396 };
397 397
398 398
399 class ClosureNode : public AstNode { 399 class ClosureNode : public AstNode {
400 public: 400 public:
401 ClosureNode(intptr_t token_index, 401 ClosureNode(intptr_t token_pos,
402 const Function& function, 402 const Function& function,
403 AstNode* receiver, // Non-null for implicit instance closures. 403 AstNode* receiver, // Non-null for implicit instance closures.
404 LocalScope* scope) // Null for implicit closures. 404 LocalScope* scope) // Null for implicit closures.
405 : AstNode(token_index), 405 : AstNode(token_pos),
406 function_(function), 406 function_(function),
407 receiver_(receiver), 407 receiver_(receiver),
408 scope_(scope) { 408 scope_(scope) {
409 ASSERT(function.IsZoneHandle()); 409 ASSERT(function.IsZoneHandle());
410 ASSERT((function.IsNonImplicitClosureFunction() && 410 ASSERT((function.IsNonImplicitClosureFunction() &&
411 (receiver_ == NULL) && (scope_ != NULL)) || 411 (receiver_ == NULL) && (scope_ != NULL)) ||
412 (function.IsImplicitInstanceClosureFunction() && 412 (function.IsImplicitInstanceClosureFunction() &&
413 (receiver_ != NULL) && (scope_ == NULL)) || 413 (receiver_ != NULL) && (scope_ == NULL)) ||
414 (function.IsImplicitStaticClosureFunction() && 414 (function.IsImplicitStaticClosureFunction() &&
415 (receiver_ == NULL) && (scope_ == NULL))); 415 (receiver_ == NULL) && (scope_ == NULL)));
(...skipping 19 matching lines...) Expand all
435 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); 435 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode);
436 }; 436 };
437 437
438 438
439 // Primary nodes hold identifiers or values (library, class or function) 439 // Primary nodes hold identifiers or values (library, class or function)
440 // resolved from an identifier. Primary nodes should not ever make it to the 440 // resolved from an identifier. Primary nodes should not ever make it to the
441 // code generation phase as they will be transformed into the correct call or 441 // code generation phase as they will be transformed into the correct call or
442 // field access nodes. 442 // field access nodes.
443 class PrimaryNode : public AstNode { 443 class PrimaryNode : public AstNode {
444 public: 444 public:
445 PrimaryNode(intptr_t token_index, const Object& primary) 445 PrimaryNode(intptr_t token_pos, const Object& primary)
446 : AstNode(token_index), primary_(primary) { 446 : AstNode(token_pos), primary_(primary) {
447 ASSERT(primary.IsZoneHandle()); 447 ASSERT(primary.IsZoneHandle());
448 } 448 }
449 449
450 const Object& primary() const { return primary_; } 450 const Object& primary() const { return primary_; }
451 451
452 virtual void VisitChildren(AstNodeVisitor* visitor) const; 452 virtual void VisitChildren(AstNodeVisitor* visitor) const;
453 453
454 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); 454 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode);
455 455
456 private: 456 private:
457 const Object& primary_; 457 const Object& primary_;
458 458
459 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); 459 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode);
460 }; 460 };
461 461
462 462
463 class ReturnNode : public AstNode { 463 class ReturnNode : public AstNode {
464 public: 464 public:
465 // Return from a void function returns the null object. 465 // Return from a void function returns the null object.
466 explicit ReturnNode(intptr_t token_index) 466 explicit ReturnNode(intptr_t token_pos)
467 : AstNode(token_index), 467 : AstNode(token_pos),
468 value_(new LiteralNode(token_index, Instance::ZoneHandle())), 468 value_(new LiteralNode(token_pos, Instance::ZoneHandle())),
469 inlined_finally_list_() { } 469 inlined_finally_list_() { }
470 // Return from a non-void function. 470 // Return from a non-void function.
471 ReturnNode(intptr_t token_index, 471 ReturnNode(intptr_t token_pos,
472 AstNode* value) 472 AstNode* value)
473 : AstNode(token_index), value_(value), inlined_finally_list_() { 473 : AstNode(token_pos), value_(value), inlined_finally_list_() {
474 ASSERT(value != NULL); 474 ASSERT(value != NULL);
475 } 475 }
476 476
477 AstNode* value() const { return value_; } 477 AstNode* value() const { return value_; }
478 478
479 intptr_t inlined_finally_list_length() const { 479 intptr_t inlined_finally_list_length() const {
480 return inlined_finally_list_.length(); 480 return inlined_finally_list_.length();
481 } 481 }
482 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { 482 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const {
483 return inlined_finally_list_[index]; 483 return inlined_finally_list_[index];
(...skipping 13 matching lines...) Expand all
497 private: 497 private:
498 AstNode* value_; 498 AstNode* value_;
499 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; 499 GrowableArray<InlinedFinallyNode*> inlined_finally_list_;
500 500
501 DISALLOW_COPY_AND_ASSIGN(ReturnNode); 501 DISALLOW_COPY_AND_ASSIGN(ReturnNode);
502 }; 502 };
503 503
504 504
505 class ComparisonNode : public AstNode { 505 class ComparisonNode : public AstNode {
506 public: 506 public:
507 ComparisonNode(intptr_t token_index, 507 ComparisonNode(intptr_t token_pos,
508 Token::Kind kind, 508 Token::Kind kind,
509 AstNode* left, 509 AstNode* left,
510 AstNode* right) 510 AstNode* right)
511 : AstNode(token_index), kind_(kind), left_(left), right_(right) { 511 : AstNode(token_pos), kind_(kind), left_(left), right_(right) {
512 ASSERT(left_ != NULL); 512 ASSERT(left_ != NULL);
513 ASSERT(right_ != NULL); 513 ASSERT(right_ != NULL);
514 ASSERT(IsKindValid()); 514 ASSERT(IsKindValid());
515 } 515 }
516 516
517 Token::Kind kind() const { return kind_; } 517 Token::Kind kind() const { return kind_; }
518 AstNode* left() const { return left_; } 518 AstNode* left() const { return left_; }
519 AstNode* right() const { return right_; } 519 AstNode* right() const { return right_; }
520 520
521 virtual void VisitChildren(AstNodeVisitor* visitor) const { 521 virtual void VisitChildren(AstNodeVisitor* visitor) const {
(...skipping 12 matching lines...) Expand all
534 AstNode* right_; 534 AstNode* right_;
535 535
536 bool IsKindValid() const; 536 bool IsKindValid() const;
537 537
538 DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode); 538 DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode);
539 }; 539 };
540 540
541 541
542 class BinaryOpNode : public AstNode { 542 class BinaryOpNode : public AstNode {
543 public: 543 public:
544 BinaryOpNode(intptr_t token_index, 544 BinaryOpNode(intptr_t token_pos,
545 Token::Kind kind, 545 Token::Kind kind,
546 AstNode* left, 546 AstNode* left,
547 AstNode* right) 547 AstNode* right)
548 : AstNode(token_index), kind_(kind), left_(left), right_(right) { 548 : AstNode(token_pos), kind_(kind), left_(left), right_(right) {
549 ASSERT(left_ != NULL); 549 ASSERT(left_ != NULL);
550 ASSERT(right_ != NULL); 550 ASSERT(right_ != NULL);
551 ASSERT(IsKindValid()); 551 ASSERT(IsKindValid());
552 } 552 }
553 553
554 Token::Kind kind() const { return kind_; } 554 Token::Kind kind() const { return kind_; }
555 AstNode* left() const { return left_; } 555 AstNode* left() const { return left_; }
556 AstNode* right() const { return right_; } 556 AstNode* right() const { return right_; }
557 557
558 virtual void VisitChildren(AstNodeVisitor* visitor) const { 558 virtual void VisitChildren(AstNodeVisitor* visitor) const {
(...skipping 12 matching lines...) Expand all
571 AstNode* right_; 571 AstNode* right_;
572 572
573 bool IsKindValid() const; 573 bool IsKindValid() const;
574 574
575 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode); 575 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode);
576 }; 576 };
577 577
578 578
579 class StringConcatNode : public AstNode { 579 class StringConcatNode : public AstNode {
580 public: 580 public:
581 explicit StringConcatNode(intptr_t token_index) 581 explicit StringConcatNode(intptr_t token_pos)
582 : AstNode(token_index), 582 : AstNode(token_pos),
583 values_(new ArrayNode(token_index, TypeArguments::ZoneHandle())) { 583 values_(new ArrayNode(token_pos, TypeArguments::ZoneHandle())) {
584 } 584 }
585 585
586 ArrayNode* values() const { return values_; } 586 ArrayNode* values() const { return values_; }
587 587
588 virtual const Instance* EvalConstExpr() const; 588 virtual const Instance* EvalConstExpr() const;
589 589
590 void AddExpr(AstNode* expr) const { 590 void AddExpr(AstNode* expr) const {
591 values_->AddElement(expr); 591 values_->AddElement(expr);
592 } 592 }
593 593
594 virtual void VisitChildren(AstNodeVisitor* visitor) const { 594 virtual void VisitChildren(AstNodeVisitor* visitor) const {
595 values_->Visit(visitor); 595 values_->Visit(visitor);
596 } 596 }
597 597
598 DECLARE_COMMON_NODE_FUNCTIONS(StringConcatNode); 598 DECLARE_COMMON_NODE_FUNCTIONS(StringConcatNode);
599 599
600 private: 600 private:
601 ArrayNode* values_; 601 ArrayNode* values_;
602 DISALLOW_IMPLICIT_CONSTRUCTORS(StringConcatNode); 602 DISALLOW_IMPLICIT_CONSTRUCTORS(StringConcatNode);
603 }; 603 };
604 604
605 605
606 class UnaryOpNode : public AstNode { 606 class UnaryOpNode : public AstNode {
607 public: 607 public:
608 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned. 608 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned.
609 static AstNode* UnaryOpOrLiteral(intptr_t token_index, 609 static AstNode* UnaryOpOrLiteral(intptr_t token_pos,
610 Token::Kind kind, 610 Token::Kind kind,
611 AstNode* operand); 611 AstNode* operand);
612 UnaryOpNode(intptr_t token_index, 612 UnaryOpNode(intptr_t token_pos,
613 Token::Kind kind, 613 Token::Kind kind,
614 AstNode* operand) 614 AstNode* operand)
615 : AstNode(token_index), kind_(kind), operand_(operand) { 615 : AstNode(token_pos), kind_(kind), operand_(operand) {
616 ASSERT(operand_ != NULL); 616 ASSERT(operand_ != NULL);
617 ASSERT(IsKindValid()); 617 ASSERT(IsKindValid());
618 } 618 }
619 619
620 Token::Kind kind() const { return kind_; } 620 Token::Kind kind() const { return kind_; }
621 AstNode* operand() const { return operand_; } 621 AstNode* operand() const { return operand_; }
622 622
623 virtual void VisitChildren(AstNodeVisitor* visitor) const { 623 virtual void VisitChildren(AstNodeVisitor* visitor) const {
624 operand()->Visit(visitor); 624 operand()->Visit(visitor);
625 } 625 }
626 626
627 virtual const char* Name() const; 627 virtual const char* Name() const;
628 virtual const Instance* EvalConstExpr() const; 628 virtual const Instance* EvalConstExpr() const;
629 629
630 DECLARE_COMMON_NODE_FUNCTIONS(UnaryOpNode); 630 DECLARE_COMMON_NODE_FUNCTIONS(UnaryOpNode);
631 631
632 private: 632 private:
633 const Token::Kind kind_; 633 const Token::Kind kind_;
634 AstNode* operand_; 634 AstNode* operand_;
635 635
636 bool IsKindValid() const; 636 bool IsKindValid() const;
637 637
638 DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode); 638 DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode);
639 }; 639 };
640 640
641 641
642 class ConditionalExprNode : public AstNode { 642 class ConditionalExprNode : public AstNode {
643 public: 643 public:
644 ConditionalExprNode(intptr_t token_index, 644 ConditionalExprNode(intptr_t token_pos,
645 AstNode* condition, 645 AstNode* condition,
646 AstNode* true_expr, 646 AstNode* true_expr,
647 AstNode* false_expr) 647 AstNode* false_expr)
648 : AstNode(token_index), 648 : AstNode(token_pos),
649 condition_(condition), 649 condition_(condition),
650 true_expr_(true_expr), 650 true_expr_(true_expr),
651 false_expr_(false_expr) { 651 false_expr_(false_expr) {
652 ASSERT(condition_ != NULL); 652 ASSERT(condition_ != NULL);
653 ASSERT(true_expr_ != NULL); 653 ASSERT(true_expr_ != NULL);
654 ASSERT(false_expr_ != NULL); 654 ASSERT(false_expr_ != NULL);
655 } 655 }
656 656
657 AstNode* condition() const { return condition_; } 657 AstNode* condition() const { return condition_; }
658 AstNode* true_expr() const { return true_expr_; } 658 AstNode* true_expr() const { return true_expr_; }
(...skipping 20 matching lines...) Expand all
679 AstNode* condition_; 679 AstNode* condition_;
680 AstNode* true_expr_; 680 AstNode* true_expr_;
681 AstNode* false_expr_; 681 AstNode* false_expr_;
682 682
683 DISALLOW_IMPLICIT_CONSTRUCTORS(ConditionalExprNode); 683 DISALLOW_IMPLICIT_CONSTRUCTORS(ConditionalExprNode);
684 }; 684 };
685 685
686 686
687 class IfNode : public AstNode { 687 class IfNode : public AstNode {
688 public: 688 public:
689 IfNode(intptr_t token_index, 689 IfNode(intptr_t token_pos,
690 AstNode* condition, 690 AstNode* condition,
691 SequenceNode* true_branch, 691 SequenceNode* true_branch,
692 SequenceNode* false_branch) 692 SequenceNode* false_branch)
693 : AstNode(token_index), 693 : AstNode(token_pos),
694 condition_(condition), 694 condition_(condition),
695 true_branch_(true_branch), 695 true_branch_(true_branch),
696 false_branch_(false_branch) { 696 false_branch_(false_branch) {
697 ASSERT(condition_ != NULL); 697 ASSERT(condition_ != NULL);
698 } 698 }
699 699
700 AstNode* condition() const { return condition_; } 700 AstNode* condition() const { return condition_; }
701 SequenceNode* true_branch() const { return true_branch_; } 701 SequenceNode* true_branch() const { return true_branch_; }
702 SequenceNode* false_branch() const { return false_branch_; } 702 SequenceNode* false_branch() const { return false_branch_; }
703 703
(...skipping 11 matching lines...) Expand all
715 AstNode* condition_; 715 AstNode* condition_;
716 SequenceNode* true_branch_; 716 SequenceNode* true_branch_;
717 SequenceNode* false_branch_; 717 SequenceNode* false_branch_;
718 718
719 DISALLOW_IMPLICIT_CONSTRUCTORS(IfNode); 719 DISALLOW_IMPLICIT_CONSTRUCTORS(IfNode);
720 }; 720 };
721 721
722 722
723 class CaseNode : public AstNode { 723 class CaseNode : public AstNode {
724 public: 724 public:
725 CaseNode(intptr_t token_index, 725 CaseNode(intptr_t token_pos,
726 SourceLabel* label, 726 SourceLabel* label,
727 SequenceNode* case_expressions, 727 SequenceNode* case_expressions,
728 bool contains_default, 728 bool contains_default,
729 LocalVariable* switch_expr_value, 729 LocalVariable* switch_expr_value,
730 SequenceNode* statements) 730 SequenceNode* statements)
731 : AstNode(token_index), 731 : AstNode(token_pos),
732 label_(label), 732 label_(label),
733 case_expressions_(case_expressions), 733 case_expressions_(case_expressions),
734 contains_default_(contains_default), 734 contains_default_(contains_default),
735 switch_expr_value_(switch_expr_value), 735 switch_expr_value_(switch_expr_value),
736 statements_(statements) { 736 statements_(statements) {
737 // label may be NULL. 737 // label may be NULL.
738 ASSERT(case_expressions_ != NULL); 738 ASSERT(case_expressions_ != NULL);
739 ASSERT(switch_expr_value_ != NULL); 739 ASSERT(switch_expr_value_ != NULL);
740 ASSERT(statements_ != NULL); 740 ASSERT(statements_ != NULL);
741 } 741 }
(...skipping 17 matching lines...) Expand all
759 bool contains_default_; 759 bool contains_default_;
760 LocalVariable* switch_expr_value_; 760 LocalVariable* switch_expr_value_;
761 SequenceNode* statements_; 761 SequenceNode* statements_;
762 762
763 DISALLOW_IMPLICIT_CONSTRUCTORS(CaseNode); 763 DISALLOW_IMPLICIT_CONSTRUCTORS(CaseNode);
764 }; 764 };
765 765
766 766
767 class SwitchNode : public AstNode { 767 class SwitchNode : public AstNode {
768 public: 768 public:
769 SwitchNode(intptr_t token_index, 769 SwitchNode(intptr_t token_pos,
770 SourceLabel* label, 770 SourceLabel* label,
771 SequenceNode* body) 771 SequenceNode* body)
772 : AstNode(token_index), 772 : AstNode(token_pos),
773 label_(label), 773 label_(label),
774 body_(body) { 774 body_(body) {
775 ASSERT(label_ != NULL); 775 ASSERT(label_ != NULL);
776 ASSERT(body_ != NULL); 776 ASSERT(body_ != NULL);
777 } 777 }
778 778
779 SourceLabel* label() const { return label_; } 779 SourceLabel* label() const { return label_; }
780 AstNode* body() const { return body_; } 780 AstNode* body() const { return body_; }
781 781
782 virtual void VisitChildren(AstNodeVisitor* visitor) const { 782 virtual void VisitChildren(AstNodeVisitor* visitor) const {
783 body()->Visit(visitor); 783 body()->Visit(visitor);
784 } 784 }
785 785
786 DECLARE_COMMON_NODE_FUNCTIONS(SwitchNode); 786 DECLARE_COMMON_NODE_FUNCTIONS(SwitchNode);
787 787
788 private: 788 private:
789 SourceLabel* label_; 789 SourceLabel* label_;
790 AstNode* body_; 790 AstNode* body_;
791 791
792 DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode); 792 DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode);
793 }; 793 };
794 794
795 795
796 class WhileNode : public AstNode { 796 class WhileNode : public AstNode {
797 public: 797 public:
798 WhileNode(intptr_t token_index, 798 WhileNode(intptr_t token_pos,
799 SourceLabel* label, 799 SourceLabel* label,
800 AstNode* condition, 800 AstNode* condition,
801 SequenceNode* body) 801 SequenceNode* body)
802 : AstNode(token_index), 802 : AstNode(token_pos),
803 label_(label), 803 label_(label),
804 condition_(condition), 804 condition_(condition),
805 body_(body) { 805 body_(body) {
806 ASSERT(label_ != NULL); 806 ASSERT(label_ != NULL);
807 ASSERT(condition_ != NULL); 807 ASSERT(condition_ != NULL);
808 ASSERT(body_ != NULL); 808 ASSERT(body_ != NULL);
809 } 809 }
810 810
811 SourceLabel* label() const { return label_; } 811 SourceLabel* label() const { return label_; }
812 AstNode* condition() const { return condition_; } 812 AstNode* condition() const { return condition_; }
(...skipping 10 matching lines...) Expand all
823 SourceLabel* label_; 823 SourceLabel* label_;
824 AstNode* condition_; 824 AstNode* condition_;
825 SequenceNode* body_; 825 SequenceNode* body_;
826 826
827 DISALLOW_IMPLICIT_CONSTRUCTORS(WhileNode); 827 DISALLOW_IMPLICIT_CONSTRUCTORS(WhileNode);
828 }; 828 };
829 829
830 830
831 class DoWhileNode : public AstNode { 831 class DoWhileNode : public AstNode {
832 public: 832 public:
833 DoWhileNode(intptr_t token_index, 833 DoWhileNode(intptr_t token_pos,
834 SourceLabel* label, 834 SourceLabel* label,
835 AstNode* condition, 835 AstNode* condition,
836 SequenceNode* body) 836 SequenceNode* body)
837 : AstNode(token_index), 837 : AstNode(token_pos),
838 label_(label), 838 label_(label),
839 condition_(condition), 839 condition_(condition),
840 body_(body) { 840 body_(body) {
841 ASSERT(label_ != NULL); 841 ASSERT(label_ != NULL);
842 ASSERT(condition_ != NULL); 842 ASSERT(condition_ != NULL);
843 ASSERT(body_ != NULL); 843 ASSERT(body_ != NULL);
844 } 844 }
845 845
846 SourceLabel* label() const { return label_; } 846 SourceLabel* label() const { return label_; }
847 AstNode* condition() const { return condition_; } 847 AstNode* condition() const { return condition_; }
(...skipping 11 matching lines...) Expand all
859 AstNode* condition_; 859 AstNode* condition_;
860 SequenceNode* body_; 860 SequenceNode* body_;
861 861
862 DISALLOW_IMPLICIT_CONSTRUCTORS(DoWhileNode); 862 DISALLOW_IMPLICIT_CONSTRUCTORS(DoWhileNode);
863 }; 863 };
864 864
865 865
866 // initializer, condition, increment expressions can be NULL. 866 // initializer, condition, increment expressions can be NULL.
867 class ForNode : public AstNode { 867 class ForNode : public AstNode {
868 public: 868 public:
869 ForNode(intptr_t token_index, 869 ForNode(intptr_t token_pos,
870 SourceLabel* label, 870 SourceLabel* label,
871 SequenceNode* initializer, 871 SequenceNode* initializer,
872 AstNode* condition, 872 AstNode* condition,
873 SequenceNode* increment, 873 SequenceNode* increment,
874 SequenceNode* body) 874 SequenceNode* body)
875 : AstNode(token_index), 875 : AstNode(token_pos),
876 label_(label), 876 label_(label),
877 initializer_(initializer), 877 initializer_(initializer),
878 condition_(condition), 878 condition_(condition),
879 increment_(increment), 879 increment_(increment),
880 body_(body) { 880 body_(body) {
881 ASSERT(label_ != NULL); 881 ASSERT(label_ != NULL);
882 ASSERT(initializer_ != NULL); 882 ASSERT(initializer_ != NULL);
883 ASSERT(increment_ != NULL); 883 ASSERT(increment_ != NULL);
884 ASSERT(body_ != NULL); 884 ASSERT(body_ != NULL);
885 } 885 }
(...skipping 21 matching lines...) Expand all
907 AstNode* condition_; 907 AstNode* condition_;
908 SequenceNode* increment_; 908 SequenceNode* increment_;
909 SequenceNode* body_; 909 SequenceNode* body_;
910 910
911 DISALLOW_IMPLICIT_CONSTRUCTORS(ForNode); 911 DISALLOW_IMPLICIT_CONSTRUCTORS(ForNode);
912 }; 912 };
913 913
914 914
915 class JumpNode : public AstNode { 915 class JumpNode : public AstNode {
916 public: 916 public:
917 JumpNode(intptr_t token_index, 917 JumpNode(intptr_t token_pos,
918 Token::Kind kind, 918 Token::Kind kind,
919 SourceLabel* label) 919 SourceLabel* label)
920 : AstNode(token_index), 920 : AstNode(token_pos),
921 kind_(kind), 921 kind_(kind),
922 label_(label), 922 label_(label),
923 inlined_finally_list_(NULL) { 923 inlined_finally_list_(NULL) {
924 ASSERT(label_ != NULL); 924 ASSERT(label_ != NULL);
925 ASSERT(kind_ == Token::kBREAK || kind_ == Token::kCONTINUE); 925 ASSERT(kind_ == Token::kBREAK || kind_ == Token::kCONTINUE);
926 if (kind_ == Token::kCONTINUE) { 926 if (kind_ == Token::kCONTINUE) {
927 label_->set_is_continue_target(true); 927 label_->set_is_continue_target(true);
928 } 928 }
929 } 929 }
930 930
(...skipping 19 matching lines...) Expand all
950 private: 950 private:
951 Token::Kind kind_; 951 Token::Kind kind_;
952 SourceLabel* label_; 952 SourceLabel* label_;
953 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; 953 GrowableArray<InlinedFinallyNode*> inlined_finally_list_;
954 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); 954 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode);
955 }; 955 };
956 956
957 957
958 class LoadLocalNode : public AstNode { 958 class LoadLocalNode : public AstNode {
959 public: 959 public:
960 LoadLocalNode(intptr_t token_index, const LocalVariable& local) 960 LoadLocalNode(intptr_t token_pos, const LocalVariable& local)
961 : AstNode(token_index), local_(local), pseudo_(NULL) { } 961 : AstNode(token_pos), local_(local), pseudo_(NULL) { }
962 // The pseudo node does not produce input but must be visited before 962 // The pseudo node does not produce input but must be visited before
963 // completing local load. 963 // completing local load.
964 LoadLocalNode(intptr_t token_index, 964 LoadLocalNode(intptr_t token_pos,
965 const LocalVariable& local, 965 const LocalVariable& local,
966 AstNode* pseudo) 966 AstNode* pseudo)
967 : AstNode(token_index), local_(local), pseudo_(pseudo) {} 967 : AstNode(token_pos), local_(local), pseudo_(pseudo) {}
968 968
969 const LocalVariable& local() const { return local_; } 969 const LocalVariable& local() const { return local_; }
970 AstNode* pseudo() const { return pseudo_; } // Can be NULL. 970 AstNode* pseudo() const { return pseudo_; } // Can be NULL.
971 bool HasPseudo() const { return pseudo_ != NULL; } 971 bool HasPseudo() const { return pseudo_ != NULL; }
972 972
973 virtual void VisitChildren(AstNodeVisitor* visitor) const { 973 virtual void VisitChildren(AstNodeVisitor* visitor) const {
974 if (HasPseudo()) { 974 if (HasPseudo()) {
975 pseudo()->Visit(visitor); 975 pseudo()->Visit(visitor);
976 } 976 }
977 } 977 }
978 978
979 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 979 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
980 980
981 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); 981 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode);
982 982
983 private: 983 private:
984 const LocalVariable& local_; 984 const LocalVariable& local_;
985 AstNode* pseudo_; 985 AstNode* pseudo_;
986 986
987 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); 987 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode);
988 }; 988 };
989 989
990 990
991 class StoreLocalNode : public AstNode { 991 class StoreLocalNode : public AstNode {
992 public: 992 public:
993 StoreLocalNode(intptr_t token_index, 993 StoreLocalNode(intptr_t token_pos,
994 const LocalVariable& local, 994 const LocalVariable& local,
995 AstNode* value) 995 AstNode* value)
996 : AstNode(token_index), local_(local), value_(value) { 996 : AstNode(token_pos), local_(local), value_(value) {
997 ASSERT(value_ != NULL); 997 ASSERT(value_ != NULL);
998 } 998 }
999 999
1000 const LocalVariable& local() const { return local_; } 1000 const LocalVariable& local() const { return local_; }
1001 AstNode* value() const { return value_; } 1001 AstNode* value() const { return value_; }
1002 1002
1003 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1003 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1004 value()->Visit(visitor); 1004 value()->Visit(visitor);
1005 } 1005 }
1006 1006
1007 DECLARE_COMMON_NODE_FUNCTIONS(StoreLocalNode); 1007 DECLARE_COMMON_NODE_FUNCTIONS(StoreLocalNode);
1008 1008
1009 private: 1009 private:
1010 const LocalVariable& local_; 1010 const LocalVariable& local_;
1011 AstNode* value_; 1011 AstNode* value_;
1012 1012
1013 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode); 1013 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode);
1014 }; 1014 };
1015 1015
1016 1016
1017 1017
1018 class LoadInstanceFieldNode : public AstNode { 1018 class LoadInstanceFieldNode : public AstNode {
1019 public: 1019 public:
1020 LoadInstanceFieldNode(intptr_t token_index, 1020 LoadInstanceFieldNode(intptr_t token_pos,
1021 AstNode* instance, 1021 AstNode* instance,
1022 const Field& field) 1022 const Field& field)
1023 : AstNode(token_index), instance_(instance), field_(field) { 1023 : AstNode(token_pos), instance_(instance), field_(field) {
1024 ASSERT(instance_ != NULL); 1024 ASSERT(instance_ != NULL);
1025 ASSERT(field.IsZoneHandle()); 1025 ASSERT(field.IsZoneHandle());
1026 } 1026 }
1027 1027
1028 AstNode* instance() const { return instance_; } 1028 AstNode* instance() const { return instance_; }
1029 const Field& field() const { return field_; } 1029 const Field& field() const { return field_; }
1030 1030
1031 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1031 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1032 instance()->Visit(visitor); 1032 instance()->Visit(visitor);
1033 } 1033 }
1034 1034
1035 DECLARE_COMMON_NODE_FUNCTIONS(LoadInstanceFieldNode); 1035 DECLARE_COMMON_NODE_FUNCTIONS(LoadInstanceFieldNode);
1036 1036
1037 private: 1037 private:
1038 AstNode* instance_; 1038 AstNode* instance_;
1039 const Field& field_; 1039 const Field& field_;
1040 1040
1041 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadInstanceFieldNode); 1041 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadInstanceFieldNode);
1042 }; 1042 };
1043 1043
1044 1044
1045 class StoreInstanceFieldNode : public AstNode { 1045 class StoreInstanceFieldNode : public AstNode {
1046 public: 1046 public:
1047 StoreInstanceFieldNode(intptr_t token_index, 1047 StoreInstanceFieldNode(intptr_t token_pos,
1048 AstNode* instance, 1048 AstNode* instance,
1049 const Field& field, 1049 const Field& field,
1050 AstNode* value) 1050 AstNode* value)
1051 : AstNode(token_index), 1051 : AstNode(token_pos),
1052 instance_(instance), 1052 instance_(instance),
1053 field_(field), 1053 field_(field),
1054 value_(value) { 1054 value_(value) {
1055 ASSERT(instance_ != NULL); 1055 ASSERT(instance_ != NULL);
1056 ASSERT(field.IsZoneHandle()); 1056 ASSERT(field.IsZoneHandle());
1057 ASSERT(value_ != NULL); 1057 ASSERT(value_ != NULL);
1058 } 1058 }
1059 1059
1060 AstNode* instance() const { return instance_; } 1060 AstNode* instance() const { return instance_; }
1061 const Field& field() const { return field_; } 1061 const Field& field() const { return field_; }
(...skipping 10 matching lines...) Expand all
1072 AstNode* instance_; 1072 AstNode* instance_;
1073 const Field& field_; 1073 const Field& field_;
1074 AstNode* value_; 1074 AstNode* value_;
1075 1075
1076 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreInstanceFieldNode); 1076 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreInstanceFieldNode);
1077 }; 1077 };
1078 1078
1079 1079
1080 class LoadStaticFieldNode : public AstNode { 1080 class LoadStaticFieldNode : public AstNode {
1081 public: 1081 public:
1082 LoadStaticFieldNode(intptr_t token_index, const Field& field) 1082 LoadStaticFieldNode(intptr_t token_pos, const Field& field)
1083 : AstNode(token_index), field_(field) { 1083 : AstNode(token_pos), field_(field) {
1084 ASSERT(field.IsZoneHandle()); 1084 ASSERT(field.IsZoneHandle());
1085 } 1085 }
1086 1086
1087 const Field& field() const { return field_; } 1087 const Field& field() const { return field_; }
1088 1088
1089 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 1089 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
1090 1090
1091 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1091 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1092 1092
1093 virtual const Instance* EvalConstExpr() const { 1093 virtual const Instance* EvalConstExpr() const {
1094 ASSERT(field_.is_static()); 1094 ASSERT(field_.is_static());
1095 return field_.is_final() ? &Instance::ZoneHandle(field_.value()) : NULL; 1095 return field_.is_final() ? &Instance::ZoneHandle(field_.value()) : NULL;
1096 } 1096 }
1097 1097
1098 DECLARE_COMMON_NODE_FUNCTIONS(LoadStaticFieldNode); 1098 DECLARE_COMMON_NODE_FUNCTIONS(LoadStaticFieldNode);
1099 1099
1100 private: 1100 private:
1101 const Field& field_; 1101 const Field& field_;
1102 1102
1103 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadStaticFieldNode); 1103 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadStaticFieldNode);
1104 }; 1104 };
1105 1105
1106 1106
1107 class StoreStaticFieldNode : public AstNode { 1107 class StoreStaticFieldNode : public AstNode {
1108 public: 1108 public:
1109 StoreStaticFieldNode(intptr_t token_index, const Field& field, AstNode* value) 1109 StoreStaticFieldNode(intptr_t token_pos, const Field& field, AstNode* value)
1110 : AstNode(token_index), field_(field), value_(value) { 1110 : AstNode(token_pos), field_(field), value_(value) {
1111 ASSERT(field.IsZoneHandle()); 1111 ASSERT(field.IsZoneHandle());
1112 ASSERT(value_ != NULL); 1112 ASSERT(value_ != NULL);
1113 } 1113 }
1114 1114
1115 const Field& field() const { return field_; } 1115 const Field& field() const { return field_; }
1116 AstNode* value() const { return value_; } 1116 AstNode* value() const { return value_; }
1117 1117
1118 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1118 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1119 value()->Visit(visitor); 1119 value()->Visit(visitor);
1120 } 1120 }
1121 1121
1122 DECLARE_COMMON_NODE_FUNCTIONS(StoreStaticFieldNode); 1122 DECLARE_COMMON_NODE_FUNCTIONS(StoreStaticFieldNode);
1123 1123
1124 private: 1124 private:
1125 const Field& field_; 1125 const Field& field_;
1126 AstNode* value_; 1126 AstNode* value_;
1127 1127
1128 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); 1128 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode);
1129 }; 1129 };
1130 1130
1131 1131
1132 class LoadIndexedNode : public AstNode { 1132 class LoadIndexedNode : public AstNode {
1133 public: 1133 public:
1134 LoadIndexedNode(intptr_t token_index, AstNode* array, AstNode* index) 1134 LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index)
1135 : AstNode(token_index), array_(array), index_expr_(index) { 1135 : AstNode(token_pos), array_(array), index_expr_(index) {
1136 ASSERT(array != NULL); 1136 ASSERT(array != NULL);
1137 ASSERT(index != NULL); 1137 ASSERT(index != NULL);
1138 } 1138 }
1139 1139
1140 AstNode* array() const { return array_; } 1140 AstNode* array() const { return array_; }
1141 AstNode* index_expr() const { return index_expr_; } 1141 AstNode* index_expr() const { return index_expr_; }
1142 1142
1143 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1143 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1144 array()->Visit(visitor); 1144 array()->Visit(visitor);
1145 index_expr()->Visit(visitor); 1145 index_expr()->Visit(visitor);
1146 } 1146 }
1147 1147
1148 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1148 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1149 1149
1150 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode); 1150 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode);
1151 1151
1152 private: 1152 private:
1153 AstNode* array_; 1153 AstNode* array_;
1154 AstNode* index_expr_; 1154 AstNode* index_expr_;
1155 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); 1155 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode);
1156 }; 1156 };
1157 1157
1158 1158
1159 class StoreIndexedNode : public AstNode { 1159 class StoreIndexedNode : public AstNode {
1160 public: 1160 public:
1161 StoreIndexedNode(intptr_t token_index, 1161 StoreIndexedNode(intptr_t token_pos,
1162 AstNode* array, AstNode* index, AstNode* value) 1162 AstNode* array, AstNode* index, AstNode* value)
1163 : AstNode(token_index), array_(array), index_expr_(index), value_(value) { 1163 : AstNode(token_pos), array_(array), index_expr_(index), value_(value) {
1164 ASSERT(array != NULL); 1164 ASSERT(array != NULL);
1165 ASSERT(index != NULL); 1165 ASSERT(index != NULL);
1166 ASSERT(value != NULL); 1166 ASSERT(value != NULL);
1167 } 1167 }
1168 1168
1169 AstNode* array() const { return array_; } 1169 AstNode* array() const { return array_; }
1170 AstNode* index_expr() const { return index_expr_; } 1170 AstNode* index_expr() const { return index_expr_; }
1171 AstNode* value() const { return value_; } 1171 AstNode* value() const { return value_; }
1172 1172
1173 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1173 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1174 array()->Visit(visitor); 1174 array()->Visit(visitor);
1175 index_expr()->Visit(visitor); 1175 index_expr()->Visit(visitor);
1176 value()->Visit(visitor); 1176 value()->Visit(visitor);
1177 } 1177 }
1178 1178
1179 DECLARE_COMMON_NODE_FUNCTIONS(StoreIndexedNode); 1179 DECLARE_COMMON_NODE_FUNCTIONS(StoreIndexedNode);
1180 1180
1181 private: 1181 private:
1182 AstNode* array_; 1182 AstNode* array_;
1183 AstNode* index_expr_; 1183 AstNode* index_expr_;
1184 AstNode* value_; 1184 AstNode* value_;
1185 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); 1185 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode);
1186 }; 1186 };
1187 1187
1188 1188
1189 class InstanceCallNode : public AstNode { 1189 class InstanceCallNode : public AstNode {
1190 public: 1190 public:
1191 InstanceCallNode(intptr_t token_index, 1191 InstanceCallNode(intptr_t token_pos,
1192 AstNode* receiver, 1192 AstNode* receiver,
1193 const String& function_name, 1193 const String& function_name,
1194 ArgumentListNode* arguments) 1194 ArgumentListNode* arguments)
1195 : AstNode(token_index), 1195 : AstNode(token_pos),
1196 receiver_(receiver), 1196 receiver_(receiver),
1197 function_name_(function_name), 1197 function_name_(function_name),
1198 arguments_(arguments) { 1198 arguments_(arguments) {
1199 ASSERT(receiver_ != NULL); 1199 ASSERT(receiver_ != NULL);
1200 ASSERT(function_name_.IsZoneHandle()); 1200 ASSERT(function_name_.IsZoneHandle());
1201 ASSERT(function_name_.IsSymbol()); 1201 ASSERT(function_name_.IsSymbol());
1202 ASSERT(arguments_ != NULL); 1202 ASSERT(arguments_ != NULL);
1203 } 1203 }
1204 1204
1205 AstNode* receiver() const { return receiver_; } 1205 AstNode* receiver() const { return receiver_; }
(...skipping 11 matching lines...) Expand all
1217 AstNode* receiver_; 1217 AstNode* receiver_;
1218 const String& function_name_; 1218 const String& function_name_;
1219 ArgumentListNode* arguments_; 1219 ArgumentListNode* arguments_;
1220 1220
1221 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode); 1221 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode);
1222 }; 1222 };
1223 1223
1224 1224
1225 class InstanceGetterNode : public AstNode { 1225 class InstanceGetterNode : public AstNode {
1226 public: 1226 public:
1227 InstanceGetterNode(intptr_t token_index, 1227 InstanceGetterNode(intptr_t token_pos,
1228 AstNode* receiver, 1228 AstNode* receiver,
1229 const String& field_name) 1229 const String& field_name)
1230 : AstNode(token_index), 1230 : AstNode(token_pos),
1231 receiver_(receiver), 1231 receiver_(receiver),
1232 field_name_(field_name) { 1232 field_name_(field_name) {
1233 ASSERT(receiver_ != NULL); 1233 ASSERT(receiver_ != NULL);
1234 ASSERT(field_name_.IsZoneHandle()); 1234 ASSERT(field_name_.IsZoneHandle());
1235 ASSERT(field_name_.IsSymbol()); 1235 ASSERT(field_name_.IsSymbol());
1236 } 1236 }
1237 1237
1238 AstNode* receiver() const { return receiver_; } 1238 AstNode* receiver() const { return receiver_; }
1239 const String& field_name() const { return field_name_; } 1239 const String& field_name() const { return field_name_; }
1240 1240
1241 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1241 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1242 receiver()->Visit(visitor); 1242 receiver()->Visit(visitor);
1243 } 1243 }
1244 1244
1245 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1245 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1246 1246
1247 DECLARE_COMMON_NODE_FUNCTIONS(InstanceGetterNode); 1247 DECLARE_COMMON_NODE_FUNCTIONS(InstanceGetterNode);
1248 1248
1249 private: 1249 private:
1250 AstNode* receiver_; 1250 AstNode* receiver_;
1251 const String& field_name_; 1251 const String& field_name_;
1252 1252
1253 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode); 1253 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode);
1254 }; 1254 };
1255 1255
1256 1256
1257 class InstanceSetterNode : public AstNode { 1257 class InstanceSetterNode : public AstNode {
1258 public: 1258 public:
1259 InstanceSetterNode(intptr_t token_index, 1259 InstanceSetterNode(intptr_t token_pos,
1260 AstNode* receiver, 1260 AstNode* receiver,
1261 const String& field_name, 1261 const String& field_name,
1262 AstNode* value) 1262 AstNode* value)
1263 : AstNode(token_index), 1263 : AstNode(token_pos),
1264 receiver_(receiver), 1264 receiver_(receiver),
1265 field_name_(field_name), 1265 field_name_(field_name),
1266 value_(value) { 1266 value_(value) {
1267 ASSERT(receiver_ != NULL); 1267 ASSERT(receiver_ != NULL);
1268 ASSERT(value_ != NULL); 1268 ASSERT(value_ != NULL);
1269 ASSERT(field_name_.IsZoneHandle()); 1269 ASSERT(field_name_.IsZoneHandle());
1270 ASSERT(field_name_.IsSymbol()); 1270 ASSERT(field_name_.IsSymbol());
1271 } 1271 }
1272 1272
1273 AstNode* receiver() const { return receiver_; } 1273 AstNode* receiver() const { return receiver_; }
(...skipping 11 matching lines...) Expand all
1285 AstNode* receiver_; 1285 AstNode* receiver_;
1286 const String& field_name_; 1286 const String& field_name_;
1287 AstNode* value_; 1287 AstNode* value_;
1288 1288
1289 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); 1289 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode);
1290 }; 1290 };
1291 1291
1292 1292
1293 class StaticGetterNode : public AstNode { 1293 class StaticGetterNode : public AstNode {
1294 public: 1294 public:
1295 StaticGetterNode(intptr_t token_index, 1295 StaticGetterNode(intptr_t token_pos,
1296 const Class& cls, 1296 const Class& cls,
1297 const String& field_name) 1297 const String& field_name)
1298 : AstNode(token_index), 1298 : AstNode(token_pos),
1299 cls_(cls), 1299 cls_(cls),
1300 field_name_(field_name) { 1300 field_name_(field_name) {
1301 ASSERT(cls_.IsZoneHandle()); 1301 ASSERT(cls_.IsZoneHandle());
1302 ASSERT(field_name_.IsZoneHandle()); 1302 ASSERT(field_name_.IsZoneHandle());
1303 ASSERT(field_name_.IsSymbol()); 1303 ASSERT(field_name_.IsSymbol());
1304 } 1304 }
1305 1305
1306 const Class& cls() const { return cls_; } 1306 const Class& cls() const { return cls_; }
1307 const String& field_name() const { return field_name_; } 1307 const String& field_name() const { return field_name_; }
1308 1308
1309 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 1309 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
1310 1310
1311 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1311 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1312 1312
1313 virtual const Instance* EvalConstExpr() const; 1313 virtual const Instance* EvalConstExpr() const;
1314 1314
1315 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode); 1315 DECLARE_COMMON_NODE_FUNCTIONS(StaticGetterNode);
1316 1316
1317 private: 1317 private:
1318 const Class& cls_; 1318 const Class& cls_;
1319 const String& field_name_; 1319 const String& field_name_;
1320 1320
1321 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); 1321 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode);
1322 }; 1322 };
1323 1323
1324 1324
1325 class StaticSetterNode : public AstNode { 1325 class StaticSetterNode : public AstNode {
1326 public: 1326 public:
1327 StaticSetterNode(intptr_t token_index, 1327 StaticSetterNode(intptr_t token_pos,
1328 const Class& cls, 1328 const Class& cls,
1329 const String& field_name, 1329 const String& field_name,
1330 AstNode* value) 1330 AstNode* value)
1331 : AstNode(token_index), 1331 : AstNode(token_pos),
1332 cls_(cls), 1332 cls_(cls),
1333 field_name_(field_name), 1333 field_name_(field_name),
1334 value_(value) { 1334 value_(value) {
1335 ASSERT(cls_.IsZoneHandle()); 1335 ASSERT(cls_.IsZoneHandle());
1336 ASSERT(field_name_.IsZoneHandle()); 1336 ASSERT(field_name_.IsZoneHandle());
1337 ASSERT(value != NULL); 1337 ASSERT(value != NULL);
1338 } 1338 }
1339 1339
1340 const Class& cls() const { return cls_; } 1340 const Class& cls() const { return cls_; }
1341 const String& field_name() const { return field_name_; } 1341 const String& field_name() const { return field_name_; }
1342 AstNode* value() const { return value_; } 1342 AstNode* value() const { return value_; }
1343 1343
1344 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1344 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1345 value()->Visit(visitor); 1345 value()->Visit(visitor);
1346 } 1346 }
1347 1347
1348 DECLARE_COMMON_NODE_FUNCTIONS(StaticSetterNode); 1348 DECLARE_COMMON_NODE_FUNCTIONS(StaticSetterNode);
1349 1349
1350 private: 1350 private:
1351 const Class& cls_; 1351 const Class& cls_;
1352 const String& field_name_; 1352 const String& field_name_;
1353 AstNode* value_; 1353 AstNode* value_;
1354 1354
1355 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode); 1355 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode);
1356 }; 1356 };
1357 1357
1358 1358
1359 class StaticCallNode : public AstNode { 1359 class StaticCallNode : public AstNode {
1360 public: 1360 public:
1361 StaticCallNode(intptr_t token_index, 1361 StaticCallNode(intptr_t token_pos,
1362 const Function& function, 1362 const Function& function,
1363 ArgumentListNode* arguments) 1363 ArgumentListNode* arguments)
1364 : AstNode(token_index), 1364 : AstNode(token_pos),
1365 function_(function), 1365 function_(function),
1366 arguments_(arguments) { 1366 arguments_(arguments) {
1367 ASSERT(function.IsZoneHandle()); 1367 ASSERT(function.IsZoneHandle());
1368 ASSERT(arguments_ != NULL); 1368 ASSERT(arguments_ != NULL);
1369 } 1369 }
1370 1370
1371 const Function& function() const { return function_; } 1371 const Function& function() const { return function_; }
1372 ArgumentListNode* arguments() const { return arguments_; } 1372 ArgumentListNode* arguments() const { return arguments_; }
1373 1373
1374 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1374 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1375 arguments()->Visit(visitor); 1375 arguments()->Visit(visitor);
1376 } 1376 }
1377 1377
1378 DECLARE_COMMON_NODE_FUNCTIONS(StaticCallNode); 1378 DECLARE_COMMON_NODE_FUNCTIONS(StaticCallNode);
1379 1379
1380 private: 1380 private:
1381 const Function& function_; 1381 const Function& function_;
1382 ArgumentListNode* arguments_; 1382 ArgumentListNode* arguments_;
1383 1383
1384 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCallNode); 1384 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCallNode);
1385 }; 1385 };
1386 1386
1387 1387
1388 class ClosureCallNode : public AstNode { 1388 class ClosureCallNode : public AstNode {
1389 public: 1389 public:
1390 ClosureCallNode(intptr_t token_index, 1390 ClosureCallNode(intptr_t token_pos,
1391 AstNode* closure, 1391 AstNode* closure,
1392 ArgumentListNode* arguments) 1392 ArgumentListNode* arguments)
1393 : AstNode(token_index), 1393 : AstNode(token_pos),
1394 closure_(closure), 1394 closure_(closure),
1395 arguments_(arguments) { 1395 arguments_(arguments) {
1396 ASSERT(closure_ != NULL); 1396 ASSERT(closure_ != NULL);
1397 ASSERT(arguments_ != NULL); 1397 ASSERT(arguments_ != NULL);
1398 } 1398 }
1399 1399
1400 AstNode* closure() const { return closure_; } 1400 AstNode* closure() const { return closure_; }
1401 ArgumentListNode* arguments() const { return arguments_; } 1401 ArgumentListNode* arguments() const { return arguments_; }
1402 1402
1403 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1403 virtual void VisitChildren(AstNodeVisitor* visitor) const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 // 1439 //
1440 // If the caller to the constructor or to the factory is a factory, then the 1440 // If the caller to the constructor or to the factory is a factory, then the
1441 // instantiator is the first parameter of this factory, which is already a 1441 // instantiator is the first parameter of this factory, which is already a
1442 // type argument vector. This case is identified by a null and unneeded 1442 // type argument vector. This case is identified by a null and unneeded
1443 // instantiator_class. 1443 // instantiator_class.
1444 // 1444 //
1445 // A temporary local is needed to hold the allocated value while the 1445 // A temporary local is needed to hold the allocated value while the
1446 // constructor is being called. 1446 // constructor is being called.
1447 class ConstructorCallNode : public AstNode { 1447 class ConstructorCallNode : public AstNode {
1448 public: 1448 public:
1449 ConstructorCallNode(intptr_t token_index, 1449 ConstructorCallNode(intptr_t token_pos,
1450 const AbstractTypeArguments& type_arguments, 1450 const AbstractTypeArguments& type_arguments,
1451 const Function& constructor, 1451 const Function& constructor,
1452 ArgumentListNode* arguments, 1452 ArgumentListNode* arguments,
1453 const LocalVariable& allocated_object_var) 1453 const LocalVariable& allocated_object_var)
1454 : AstNode(token_index), 1454 : AstNode(token_pos),
1455 type_arguments_(type_arguments), 1455 type_arguments_(type_arguments),
1456 constructor_(constructor), 1456 constructor_(constructor),
1457 arguments_(arguments), 1457 arguments_(arguments),
1458 allocated_object_var_(allocated_object_var) { 1458 allocated_object_var_(allocated_object_var) {
1459 ASSERT(type_arguments_.IsZoneHandle()); 1459 ASSERT(type_arguments_.IsZoneHandle());
1460 ASSERT(constructor_.IsZoneHandle()); 1460 ASSERT(constructor_.IsZoneHandle());
1461 ASSERT(arguments_ != NULL); 1461 ASSERT(arguments_ != NULL);
1462 } 1462 }
1463 1463
1464 const AbstractTypeArguments& type_arguments() const { 1464 const AbstractTypeArguments& type_arguments() const {
(...skipping 17 matching lines...) Expand all
1482 ArgumentListNode* arguments_; 1482 ArgumentListNode* arguments_;
1483 const LocalVariable& allocated_object_var_; 1483 const LocalVariable& allocated_object_var_;
1484 1484
1485 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); 1485 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode);
1486 }; 1486 };
1487 1487
1488 1488
1489 // The body of a Dart function marked as 'native' consists of this node. 1489 // The body of a Dart function marked as 'native' consists of this node.
1490 class NativeBodyNode : public AstNode { 1490 class NativeBodyNode : public AstNode {
1491 public: 1491 public:
1492 NativeBodyNode(intptr_t token_index, 1492 NativeBodyNode(intptr_t token_pos,
1493 const String& native_c_function_name, 1493 const String& native_c_function_name,
1494 NativeFunction native_c_function, 1494 NativeFunction native_c_function,
1495 int argument_count, 1495 int argument_count,
1496 bool has_optional_parameters, 1496 bool has_optional_parameters,
1497 bool is_native_instance_closure) 1497 bool is_native_instance_closure)
1498 : AstNode(token_index), 1498 : AstNode(token_pos),
1499 native_c_function_name_(native_c_function_name), 1499 native_c_function_name_(native_c_function_name),
1500 native_c_function_(native_c_function), 1500 native_c_function_(native_c_function),
1501 argument_count_(argument_count), 1501 argument_count_(argument_count),
1502 has_optional_parameters_(has_optional_parameters), 1502 has_optional_parameters_(has_optional_parameters),
1503 is_native_instance_closure_(is_native_instance_closure) { 1503 is_native_instance_closure_(is_native_instance_closure) {
1504 ASSERT(native_c_function_ != NULL); 1504 ASSERT(native_c_function_ != NULL);
1505 ASSERT(native_c_function_name_.IsZoneHandle()); 1505 ASSERT(native_c_function_name_.IsZoneHandle());
1506 ASSERT(native_c_function_name_.IsSymbol()); 1506 ASSERT(native_c_function_name_.IsSymbol());
1507 } 1507 }
1508 1508
(...skipping 21 matching lines...) Expand all
1530 const bool is_native_instance_closure_; // An implicit native closure. 1530 const bool is_native_instance_closure_; // An implicit native closure.
1531 1531
1532 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); 1532 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode);
1533 }; 1533 };
1534 1534
1535 1535
1536 class CatchClauseNode : public AstNode { 1536 class CatchClauseNode : public AstNode {
1537 public: 1537 public:
1538 static const int kInvalidTryIndex = -1; 1538 static const int kInvalidTryIndex = -1;
1539 1539
1540 CatchClauseNode(intptr_t token_index, 1540 CatchClauseNode(intptr_t token_pos,
1541 SequenceNode* catch_block, 1541 SequenceNode* catch_block,
1542 const LocalVariable& context_var, 1542 const LocalVariable& context_var,
1543 const LocalVariable& exception_var, 1543 const LocalVariable& exception_var,
1544 const LocalVariable& stacktrace_var) 1544 const LocalVariable& stacktrace_var)
1545 : AstNode(token_index), 1545 : AstNode(token_pos),
1546 try_index_(kInvalidTryIndex), 1546 try_index_(kInvalidTryIndex),
1547 catch_block_(catch_block), 1547 catch_block_(catch_block),
1548 context_var_(context_var), 1548 context_var_(context_var),
1549 exception_var_(exception_var), 1549 exception_var_(exception_var),
1550 stacktrace_var_(stacktrace_var) { 1550 stacktrace_var_(stacktrace_var) {
1551 ASSERT(catch_block != NULL); 1551 ASSERT(catch_block != NULL);
1552 } 1552 }
1553 1553
1554 int try_index() const { 1554 int try_index() const {
1555 ASSERT(try_index_ >= 0); 1555 ASSERT(try_index_ >= 0);
(...skipping 17 matching lines...) Expand all
1573 const LocalVariable& context_var_; 1573 const LocalVariable& context_var_;
1574 const LocalVariable& exception_var_; 1574 const LocalVariable& exception_var_;
1575 const LocalVariable& stacktrace_var_; 1575 const LocalVariable& stacktrace_var_;
1576 1576
1577 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); 1577 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode);
1578 }; 1578 };
1579 1579
1580 1580
1581 class TryCatchNode : public AstNode { 1581 class TryCatchNode : public AstNode {
1582 public: 1582 public:
1583 TryCatchNode(intptr_t token_index, 1583 TryCatchNode(intptr_t token_pos,
1584 SequenceNode* try_block, 1584 SequenceNode* try_block,
1585 SourceLabel* end_catch_label, 1585 SourceLabel* end_catch_label,
1586 const LocalVariable& context_var, 1586 const LocalVariable& context_var,
1587 CatchClauseNode* catch_block, 1587 CatchClauseNode* catch_block,
1588 SequenceNode* finally_block) 1588 SequenceNode* finally_block)
1589 : AstNode(token_index), 1589 : AstNode(token_pos),
1590 try_block_(try_block), 1590 try_block_(try_block),
1591 end_catch_label_(end_catch_label), 1591 end_catch_label_(end_catch_label),
1592 context_var_(context_var), 1592 context_var_(context_var),
1593 catch_block_(catch_block), 1593 catch_block_(catch_block),
1594 finally_block_(finally_block) { 1594 finally_block_(finally_block) {
1595 ASSERT(try_block != NULL); 1595 ASSERT(try_block != NULL);
1596 ASSERT(catch_block != NULL || finally_block != NULL); 1596 ASSERT(catch_block != NULL || finally_block != NULL);
1597 ASSERT(end_catch_label != NULL); 1597 ASSERT(end_catch_label != NULL);
1598 } 1598 }
1599 1599
(...skipping 21 matching lines...) Expand all
1621 const LocalVariable& context_var_; 1621 const LocalVariable& context_var_;
1622 CatchClauseNode* catch_block_; 1622 CatchClauseNode* catch_block_;
1623 SequenceNode* finally_block_; 1623 SequenceNode* finally_block_;
1624 1624
1625 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); 1625 DISALLOW_COPY_AND_ASSIGN(TryCatchNode);
1626 }; 1626 };
1627 1627
1628 1628
1629 class ThrowNode : public AstNode { 1629 class ThrowNode : public AstNode {
1630 public: 1630 public:
1631 ThrowNode(intptr_t token_index, AstNode* exception, AstNode* stacktrace) 1631 ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace)
1632 : AstNode(token_index), exception_(exception), stacktrace_(stacktrace) { 1632 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) {
1633 ASSERT(exception != NULL); 1633 ASSERT(exception != NULL);
1634 } 1634 }
1635 1635
1636 AstNode* exception() const { return exception_; } 1636 AstNode* exception() const { return exception_; }
1637 AstNode* stacktrace() const { return stacktrace_; } 1637 AstNode* stacktrace() const { return stacktrace_; }
1638 1638
1639 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1639 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1640 exception()->Visit(visitor); 1640 exception()->Visit(visitor);
1641 if (stacktrace() != NULL) { 1641 if (stacktrace() != NULL) {
1642 stacktrace()->Visit(visitor); 1642 stacktrace()->Visit(visitor);
1643 } 1643 }
1644 } 1644 }
1645 1645
1646 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode); 1646 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode);
1647 private: 1647 private:
1648 AstNode* exception_; 1648 AstNode* exception_;
1649 AstNode* stacktrace_; 1649 AstNode* stacktrace_;
1650 1650
1651 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); 1651 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode);
1652 }; 1652 };
1653 1653
1654 1654
1655 class InlinedFinallyNode : public AstNode { 1655 class InlinedFinallyNode : public AstNode {
1656 public: 1656 public:
1657 InlinedFinallyNode(intptr_t token_index, 1657 InlinedFinallyNode(intptr_t token_pos,
1658 AstNode* finally_block, 1658 AstNode* finally_block,
1659 const LocalVariable& context_var) 1659 const LocalVariable& context_var)
1660 : AstNode(token_index), 1660 : AstNode(token_pos),
1661 finally_block_(finally_block), 1661 finally_block_(finally_block),
1662 context_var_(context_var) { 1662 context_var_(context_var) {
1663 ASSERT(finally_block != NULL); 1663 ASSERT(finally_block != NULL);
1664 } 1664 }
1665 1665
1666 AstNode* finally_block() const { return finally_block_; } 1666 AstNode* finally_block() const { return finally_block_; }
1667 const LocalVariable& context_var() const { return context_var_; } 1667 const LocalVariable& context_var() const { return context_var_; }
1668 1668
1669 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1669 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1670 finally_block()->Visit(visitor); 1670 finally_block()->Visit(visitor);
1671 } 1671 }
1672 1672
1673 DECLARE_COMMON_NODE_FUNCTIONS(InlinedFinallyNode); 1673 DECLARE_COMMON_NODE_FUNCTIONS(InlinedFinallyNode);
1674 private: 1674 private:
1675 AstNode* finally_block_; 1675 AstNode* finally_block_;
1676 const LocalVariable& context_var_; 1676 const LocalVariable& context_var_;
1677 1677
1678 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1678 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1679 }; 1679 };
1680 1680
1681 } // namespace dart 1681 } // namespace dart
1682 1682
1683 #undef DECLARE_COMMON_NODE_FUNCTIONS 1683 #undef DECLARE_COMMON_NODE_FUNCTIONS
1684 1684
1685 #endif // VM_AST_H_ 1685 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698