OLD | NEW |
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" |
11 #include "vm/scopes.h" | 11 #include "vm/scopes.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
13 #include "vm/native_entry.h" | 13 #include "vm/native_entry.h" |
14 #include "vm/token.h" | 14 #include "vm/token.h" |
| 15 #include "vm/token_position.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
17 | 18 |
18 #define FOR_EACH_NODE(V) \ | 19 #define FOR_EACH_NODE(V) \ |
19 V(Await) \ | 20 V(Await) \ |
20 V(AwaitMarker) \ | 21 V(AwaitMarker) \ |
21 V(Return) \ | 22 V(Return) \ |
22 V(Literal) \ | 23 V(Literal) \ |
23 V(Type) \ | 24 V(Type) \ |
24 V(Assignable) \ | 25 V(Assignable) \ |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 91 |
91 | 92 |
92 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ | 93 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ |
93 virtual void Visit(AstNodeVisitor* visitor); \ | 94 virtual void Visit(AstNodeVisitor* visitor); \ |
94 virtual const char* PrettyName() const; \ | 95 virtual const char* PrettyName() const; \ |
95 virtual type* As##type() { return this; } | 96 virtual type* As##type() { return this; } |
96 | 97 |
97 | 98 |
98 class AstNode : public ZoneAllocated { | 99 class AstNode : public ZoneAllocated { |
99 public: | 100 public: |
100 explicit AstNode(intptr_t token_pos) | 101 explicit AstNode(TokenPosition token_pos) |
101 : token_pos_(token_pos) { | 102 : token_pos_(token_pos) { |
102 ASSERT(!Token::IsClassifying(token_pos_) || | 103 ASSERT(!token_pos_.IsClassifying() || |
103 (token_pos_ == ClassifyingTokenPositions::kMethodExtractor)); | 104 (token_pos_ == TokenPosition::kMethodExtractor)); |
104 } | 105 } |
105 virtual ~AstNode() { } | 106 virtual ~AstNode() { } |
106 | 107 |
107 intptr_t token_pos() const { return token_pos_; } | 108 TokenPosition token_pos() const { return token_pos_; } |
108 | 109 |
109 #define AST_TYPE_CHECK(BaseName) \ | 110 #define AST_TYPE_CHECK(BaseName) \ |
110 bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \ | 111 bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \ |
111 virtual BaseName##Node* As##BaseName##Node() { return NULL; } | 112 virtual BaseName##Node* As##BaseName##Node() { return NULL; } |
112 | 113 |
113 FOR_EACH_NODE(AST_TYPE_CHECK) | 114 FOR_EACH_NODE(AST_TYPE_CHECK) |
114 #undef AST_TYPE_CHECK | 115 #undef AST_TYPE_CHECK |
115 | 116 |
116 virtual void Visit(AstNodeVisitor* visitor) = 0; | 117 virtual void Visit(AstNodeVisitor* visitor) = 0; |
117 virtual void VisitChildren(AstNodeVisitor* visitor) const = 0; | 118 virtual void VisitChildren(AstNodeVisitor* visitor) const = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
146 // actual value of the const expression. The type of the returned value | 147 // actual value of the const expression. The type of the returned value |
147 // corresponds to the type of the const expression and is either | 148 // corresponds to the type of the const expression and is either |
148 // Number, Integer, String, Bool, or anything else (not a subtype of | 149 // Number, Integer, String, Bool, or anything else (not a subtype of |
149 // the former). | 150 // the former). |
150 virtual const Instance* EvalConstExpr() const { return NULL; } | 151 virtual const Instance* EvalConstExpr() const { return NULL; } |
151 | 152 |
152 protected: | 153 protected: |
153 friend class ParsedFunction; | 154 friend class ParsedFunction; |
154 | 155 |
155 private: | 156 private: |
156 const intptr_t token_pos_; | 157 const TokenPosition token_pos_; |
157 DISALLOW_COPY_AND_ASSIGN(AstNode); | 158 DISALLOW_COPY_AND_ASSIGN(AstNode); |
158 }; | 159 }; |
159 | 160 |
160 | 161 |
161 class AwaitNode : public AstNode { | 162 class AwaitNode : public AstNode { |
162 public: | 163 public: |
163 AwaitNode(intptr_t token_pos, | 164 AwaitNode(TokenPosition token_pos, |
164 AstNode* expr, | 165 AstNode* expr, |
165 LocalVariable* saved_try_ctx, | 166 LocalVariable* saved_try_ctx, |
166 LocalVariable* async_saved_try_ctx, | 167 LocalVariable* async_saved_try_ctx, |
167 LocalVariable* outer_saved_try_ctx, | 168 LocalVariable* outer_saved_try_ctx, |
168 LocalVariable* outer_async_saved_try_ctx, | 169 LocalVariable* outer_async_saved_try_ctx, |
169 LocalScope* scope) | 170 LocalScope* scope) |
170 : AstNode(token_pos), | 171 : AstNode(token_pos), |
171 expr_(expr), | 172 expr_(expr), |
172 saved_try_ctx_(saved_try_ctx), | 173 saved_try_ctx_(saved_try_ctx), |
173 async_saved_try_ctx_(async_saved_try_ctx), | 174 async_saved_try_ctx_(async_saved_try_ctx), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // current context. | 209 // current context. |
209 // | 210 // |
210 // It is expected (ASSERT) that an AwaitMarker is followed by | 211 // It is expected (ASSERT) that an AwaitMarker is followed by |
211 // a return node of kind kContinuationTarget. That is: | 212 // a return node of kind kContinuationTarget. That is: |
212 // <AwaitMarker> -> <other nodes> -> <kContinuationTarget> -> <other nodes> -> | 213 // <AwaitMarker> -> <other nodes> -> <kContinuationTarget> -> <other nodes> -> |
213 // <AwaitMarker> -> ... | 214 // <AwaitMarker> -> ... |
214 class AwaitMarkerNode : public AstNode { | 215 class AwaitMarkerNode : public AstNode { |
215 public: | 216 public: |
216 AwaitMarkerNode(LocalScope* async_scope, | 217 AwaitMarkerNode(LocalScope* async_scope, |
217 LocalScope* await_scope, | 218 LocalScope* await_scope, |
218 intptr_t token_pos) | 219 TokenPosition token_pos) |
219 : AstNode(token_pos), | 220 : AstNode(token_pos), |
220 async_scope_(async_scope), | 221 async_scope_(async_scope), |
221 await_scope_(await_scope) { | 222 await_scope_(await_scope) { |
222 ASSERT(async_scope != NULL); | 223 ASSERT(async_scope != NULL); |
223 ASSERT(await_scope != NULL); | 224 ASSERT(await_scope != NULL); |
224 await_scope->CaptureLocalVariables(async_scope); | 225 await_scope->CaptureLocalVariables(async_scope); |
225 } | 226 } |
226 | 227 |
227 void VisitChildren(AstNodeVisitor* visitor) const { } | 228 void VisitChildren(AstNodeVisitor* visitor) const { } |
228 | 229 |
229 LocalScope* async_scope() const { return async_scope_; } | 230 LocalScope* async_scope() const { return async_scope_; } |
230 LocalScope* await_scope() const { return await_scope_; } | 231 LocalScope* await_scope() const { return await_scope_; } |
231 | 232 |
232 DECLARE_COMMON_NODE_FUNCTIONS(AwaitMarkerNode); | 233 DECLARE_COMMON_NODE_FUNCTIONS(AwaitMarkerNode); |
233 | 234 |
234 private: | 235 private: |
235 LocalScope* async_scope_; | 236 LocalScope* async_scope_; |
236 LocalScope* await_scope_; | 237 LocalScope* await_scope_; |
237 | 238 |
238 DISALLOW_COPY_AND_ASSIGN(AwaitMarkerNode); | 239 DISALLOW_COPY_AND_ASSIGN(AwaitMarkerNode); |
239 }; | 240 }; |
240 | 241 |
241 | 242 |
242 class SequenceNode : public AstNode { | 243 class SequenceNode : public AstNode { |
243 public: | 244 public: |
244 SequenceNode(intptr_t token_pos, LocalScope* scope) | 245 SequenceNode(TokenPosition token_pos, LocalScope* scope) |
245 : AstNode(token_pos), | 246 : AstNode(token_pos), |
246 scope_(scope), | 247 scope_(scope), |
247 nodes_(4), | 248 nodes_(4), |
248 label_(NULL) { | 249 label_(NULL) { |
249 } | 250 } |
250 | 251 |
251 LocalScope* scope() const { return scope_; } | 252 LocalScope* scope() const { return scope_; } |
252 | 253 |
253 SourceLabel* label() const { return label_; } | 254 SourceLabel* label() const { return label_; } |
254 void set_label(SourceLabel* value) { label_ = value; } | 255 void set_label(SourceLabel* value) { label_ = value; } |
(...skipping 14 matching lines...) Expand all Loading... |
269 LocalScope* scope_; | 270 LocalScope* scope_; |
270 GrowableArray<AstNode*> nodes_; | 271 GrowableArray<AstNode*> nodes_; |
271 SourceLabel* label_; | 272 SourceLabel* label_; |
272 | 273 |
273 DISALLOW_COPY_AND_ASSIGN(SequenceNode); | 274 DISALLOW_COPY_AND_ASSIGN(SequenceNode); |
274 }; | 275 }; |
275 | 276 |
276 | 277 |
277 class CloneContextNode : public AstNode { | 278 class CloneContextNode : public AstNode { |
278 public: | 279 public: |
279 explicit CloneContextNode(intptr_t token_pos) | 280 explicit CloneContextNode(TokenPosition token_pos) |
280 : AstNode(token_pos) { | 281 : AstNode(token_pos) { |
281 } | 282 } |
282 | 283 |
283 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 284 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
284 | 285 |
285 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode); | 286 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode); |
286 | 287 |
287 private: | 288 private: |
288 DISALLOW_COPY_AND_ASSIGN(CloneContextNode); | 289 DISALLOW_COPY_AND_ASSIGN(CloneContextNode); |
289 }; | 290 }; |
290 | 291 |
291 | 292 |
292 class ArgumentListNode : public AstNode { | 293 class ArgumentListNode : public AstNode { |
293 public: | 294 public: |
294 explicit ArgumentListNode(intptr_t token_pos) | 295 explicit ArgumentListNode(TokenPosition token_pos) |
295 : AstNode(token_pos), | 296 : AstNode(token_pos), |
296 nodes_(4), | 297 nodes_(4), |
297 names_(Array::ZoneHandle()) { | 298 names_(Array::ZoneHandle()) { |
298 } | 299 } |
299 | 300 |
300 void VisitChildren(AstNodeVisitor* visitor) const; | 301 void VisitChildren(AstNodeVisitor* visitor) const; |
301 | 302 |
302 void Add(AstNode* node) { | 303 void Add(AstNode* node) { |
303 nodes_.Add(node); | 304 nodes_.Add(node); |
304 } | 305 } |
(...skipping 11 matching lines...) Expand all Loading... |
316 private: | 317 private: |
317 GrowableArray<AstNode*> nodes_; | 318 GrowableArray<AstNode*> nodes_; |
318 Array& names_; | 319 Array& names_; |
319 | 320 |
320 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); | 321 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); |
321 }; | 322 }; |
322 | 323 |
323 | 324 |
324 class LetNode : public AstNode { | 325 class LetNode : public AstNode { |
325 public: | 326 public: |
326 explicit LetNode(intptr_t token_pos); | 327 explicit LetNode(TokenPosition token_pos); |
327 | 328 |
328 LocalVariable* TempAt(intptr_t i) const { return vars_[i]; } | 329 LocalVariable* TempAt(intptr_t i) const { return vars_[i]; } |
329 AstNode* InitializerAt(intptr_t i) const { return initializers_[i]; } | 330 AstNode* InitializerAt(intptr_t i) const { return initializers_[i]; } |
330 | 331 |
331 virtual bool IsPotentiallyConst() const; | 332 virtual bool IsPotentiallyConst() const; |
332 virtual const Instance* EvalConstExpr() const; | 333 virtual const Instance* EvalConstExpr() const; |
333 | 334 |
334 LocalVariable* AddInitializer(AstNode* node); | 335 LocalVariable* AddInitializer(AstNode* node); |
335 | 336 |
336 const GrowableArray<AstNode*>& nodes() const { return nodes_; } | 337 const GrowableArray<AstNode*>& nodes() const { return nodes_; } |
(...skipping 12 matching lines...) Expand all Loading... |
349 GrowableArray<LocalVariable*> vars_; | 350 GrowableArray<LocalVariable*> vars_; |
350 GrowableArray<AstNode*> initializers_; | 351 GrowableArray<AstNode*> initializers_; |
351 GrowableArray<AstNode*> nodes_; | 352 GrowableArray<AstNode*> nodes_; |
352 | 353 |
353 DISALLOW_COPY_AND_ASSIGN(LetNode); | 354 DISALLOW_COPY_AND_ASSIGN(LetNode); |
354 }; | 355 }; |
355 | 356 |
356 | 357 |
357 class ArrayNode : public AstNode { | 358 class ArrayNode : public AstNode { |
358 public: | 359 public: |
359 ArrayNode(intptr_t token_pos, const AbstractType& type) | 360 ArrayNode(TokenPosition token_pos, const AbstractType& type) |
360 : AstNode(token_pos), | 361 : AstNode(token_pos), |
361 type_(type), | 362 type_(type), |
362 elements_() { | 363 elements_() { |
363 CheckFields(); | 364 CheckFields(); |
364 } | 365 } |
365 ArrayNode(intptr_t token_pos, | 366 ArrayNode(TokenPosition token_pos, |
366 const AbstractType& type, | 367 const AbstractType& type, |
367 const GrowableArray<AstNode*>& elements) | 368 const GrowableArray<AstNode*>& elements) |
368 : AstNode(token_pos), | 369 : AstNode(token_pos), |
369 type_(type), | 370 type_(type), |
370 elements_(elements.length()) { | 371 elements_(elements.length()) { |
371 CheckFields(); | 372 CheckFields(); |
372 for (intptr_t i = 0; i < elements.length(); i++) { | 373 for (intptr_t i = 0; i < elements.length(); i++) { |
373 elements_.Add(elements[i]); | 374 elements_.Add(elements[i]); |
374 } | 375 } |
375 } | 376 } |
(...skipping 24 matching lines...) Expand all Loading... |
400 ASSERT((type_.arguments() == TypeArguments::null()) || | 401 ASSERT((type_.arguments() == TypeArguments::null()) || |
401 ((TypeArguments::Handle(type_.arguments()).Length() == 1))); | 402 ((TypeArguments::Handle(type_.arguments()).Length() == 1))); |
402 } | 403 } |
403 | 404 |
404 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); | 405 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); |
405 }; | 406 }; |
406 | 407 |
407 | 408 |
408 class StringInterpolateNode : public AstNode { | 409 class StringInterpolateNode : public AstNode { |
409 public: | 410 public: |
410 StringInterpolateNode(intptr_t token_pos, ArrayNode* value) | 411 StringInterpolateNode(TokenPosition token_pos, ArrayNode* value) |
411 : AstNode(token_pos), value_(value) { } | 412 : AstNode(token_pos), value_(value) { } |
412 | 413 |
413 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 414 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
414 value_->Visit(visitor); | 415 value_->Visit(visitor); |
415 } | 416 } |
416 | 417 |
417 ArrayNode* value() const { return value_; } | 418 ArrayNode* value() const { return value_; } |
418 | 419 |
419 virtual bool IsPotentiallyConst() const; | 420 virtual bool IsPotentiallyConst() const; |
420 | 421 |
421 DECLARE_COMMON_NODE_FUNCTIONS(StringInterpolateNode); | 422 DECLARE_COMMON_NODE_FUNCTIONS(StringInterpolateNode); |
422 | 423 |
423 private: | 424 private: |
424 ArrayNode* value_; | 425 ArrayNode* value_; |
425 | 426 |
426 DISALLOW_IMPLICIT_CONSTRUCTORS(StringInterpolateNode); | 427 DISALLOW_IMPLICIT_CONSTRUCTORS(StringInterpolateNode); |
427 }; | 428 }; |
428 | 429 |
429 | 430 |
430 class LiteralNode : public AstNode { | 431 class LiteralNode : public AstNode { |
431 public: | 432 public: |
432 LiteralNode(intptr_t token_pos, const Instance& literal) | 433 LiteralNode(TokenPosition token_pos, const Instance& literal) |
433 : AstNode(token_pos), literal_(literal) { | 434 : AstNode(token_pos), literal_(literal) { |
434 ASSERT(literal_.IsNotTemporaryScopedHandle()); | 435 ASSERT(literal_.IsNotTemporaryScopedHandle()); |
435 ASSERT(literal_.IsSmi() || literal_.IsOld()); | 436 ASSERT(literal_.IsSmi() || literal_.IsOld()); |
436 #if defined(DEBUG) | 437 #if defined(DEBUG) |
437 if (literal_.IsString()) { | 438 if (literal_.IsString()) { |
438 ASSERT(String::Cast(literal_).IsSymbol()); | 439 ASSERT(String::Cast(literal_).IsSymbol()); |
439 } | 440 } |
440 #endif // defined(DEBUG) | 441 #endif // defined(DEBUG) |
441 ASSERT(literal_.IsNull() || | 442 ASSERT(literal_.IsNull() || |
442 Class::Handle(literal_.clazz()).is_finalized() || | 443 Class::Handle(literal_.clazz()).is_finalized() || |
(...skipping 15 matching lines...) Expand all Loading... |
458 | 459 |
459 private: | 460 private: |
460 const Instance& literal_; | 461 const Instance& literal_; |
461 | 462 |
462 DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode); | 463 DISALLOW_IMPLICIT_CONSTRUCTORS(LiteralNode); |
463 }; | 464 }; |
464 | 465 |
465 | 466 |
466 class TypeNode : public AstNode { | 467 class TypeNode : public AstNode { |
467 public: | 468 public: |
468 TypeNode(intptr_t token_pos, const AbstractType& type) | 469 TypeNode(TokenPosition token_pos, const AbstractType& type) |
469 : AstNode(token_pos), type_(type) { | 470 : AstNode(token_pos), type_(type) { |
470 ASSERT(type_.IsZoneHandle()); | 471 ASSERT(type_.IsZoneHandle()); |
471 ASSERT(!type_.IsNull()); | 472 ASSERT(!type_.IsNull()); |
472 ASSERT(type_.IsFinalized()); | 473 ASSERT(type_.IsFinalized()); |
473 // A wellformed literal Type must be canonical. | 474 // A wellformed literal Type must be canonical. |
474 ASSERT(!type_.IsType() || | 475 ASSERT(!type_.IsType() || |
475 type_.IsMalformedOrMalbounded() || | 476 type_.IsMalformedOrMalbounded() || |
476 type_.IsCanonical()); | 477 type_.IsCanonical()); |
477 } | 478 } |
478 | 479 |
(...skipping 14 matching lines...) Expand all Loading... |
493 | 494 |
494 private: | 495 private: |
495 const AbstractType& type_; | 496 const AbstractType& type_; |
496 | 497 |
497 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); | 498 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); |
498 }; | 499 }; |
499 | 500 |
500 | 501 |
501 class AssignableNode : public AstNode { | 502 class AssignableNode : public AstNode { |
502 public: | 503 public: |
503 AssignableNode(intptr_t token_pos, | 504 AssignableNode(TokenPosition token_pos, |
504 AstNode* expr, | 505 AstNode* expr, |
505 const AbstractType& type, | 506 const AbstractType& type, |
506 const String& dst_name) | 507 const String& dst_name) |
507 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) { | 508 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) { |
508 ASSERT(expr_ != NULL); | 509 ASSERT(expr_ != NULL); |
509 ASSERT(type_.IsZoneHandle()); | 510 ASSERT(type_.IsZoneHandle()); |
510 ASSERT(!type_.IsNull()); | 511 ASSERT(!type_.IsNull()); |
511 ASSERT(type_.IsFinalized()); | 512 ASSERT(type_.IsFinalized()); |
512 ASSERT(dst_name_.IsNotTemporaryScopedHandle()); | 513 ASSERT(dst_name_.IsNotTemporaryScopedHandle()); |
513 } | 514 } |
(...skipping 12 matching lines...) Expand all Loading... |
526 AstNode* expr_; | 527 AstNode* expr_; |
527 const AbstractType& type_; | 528 const AbstractType& type_; |
528 const String& dst_name_; | 529 const String& dst_name_; |
529 | 530 |
530 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); | 531 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); |
531 }; | 532 }; |
532 | 533 |
533 | 534 |
534 class ClosureNode : public AstNode { | 535 class ClosureNode : public AstNode { |
535 public: | 536 public: |
536 ClosureNode(intptr_t token_pos, | 537 ClosureNode(TokenPosition token_pos, |
537 const Function& function, | 538 const Function& function, |
538 AstNode* receiver, // Non-null for implicit instance closures. | 539 AstNode* receiver, // Non-null for implicit instance closures. |
539 LocalScope* scope) // Null for implicit closures. | 540 LocalScope* scope) // Null for implicit closures. |
540 : AstNode(token_pos), | 541 : AstNode(token_pos), |
541 function_(function), | 542 function_(function), |
542 receiver_(receiver), | 543 receiver_(receiver), |
543 scope_(scope), | 544 scope_(scope), |
544 is_deferred_reference_(false) { | 545 is_deferred_reference_(false) { |
545 ASSERT(function_.IsZoneHandle()); | 546 ASSERT(function_.IsZoneHandle()); |
546 ASSERT((function_.IsNonImplicitClosureFunction() && | 547 ASSERT((function_.IsNonImplicitClosureFunction() && |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); | 579 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); |
579 }; | 580 }; |
580 | 581 |
581 | 582 |
582 // Primary nodes hold identifiers or values (library, class or function) | 583 // Primary nodes hold identifiers or values (library, class or function) |
583 // resolved from an identifier. Primary nodes should not ever make it to the | 584 // resolved from an identifier. Primary nodes should not ever make it to the |
584 // code generation phase as they will be transformed into the correct call or | 585 // code generation phase as they will be transformed into the correct call or |
585 // field access nodes. | 586 // field access nodes. |
586 class PrimaryNode : public AstNode { | 587 class PrimaryNode : public AstNode { |
587 public: | 588 public: |
588 PrimaryNode(intptr_t token_pos, const Object& primary) | 589 PrimaryNode(TokenPosition token_pos, const Object& primary) |
589 : AstNode(token_pos), | 590 : AstNode(token_pos), |
590 primary_(primary), | 591 primary_(primary), |
591 is_deferred_reference_(false) { | 592 is_deferred_reference_(false) { |
592 ASSERT(primary_.IsNotTemporaryScopedHandle()); | 593 ASSERT(primary_.IsNotTemporaryScopedHandle()); |
593 } | 594 } |
594 | 595 |
595 const Object& primary() const { return primary_; } | 596 const Object& primary() const { return primary_; } |
596 | 597 |
597 void set_is_deferred(bool value) { is_deferred_reference_ = value; } | 598 void set_is_deferred(bool value) { is_deferred_reference_ = value; } |
598 bool is_deferred_reference() const { return is_deferred_reference_; } | 599 bool is_deferred_reference() const { return is_deferred_reference_; } |
(...skipping 25 matching lines...) Expand all Loading... |
624 // In synchronous functions, return nodes are always of type'kRegular' | 625 // In synchronous functions, return nodes are always of type'kRegular' |
625 class ReturnNode : public AstNode { | 626 class ReturnNode : public AstNode { |
626 public: | 627 public: |
627 enum ReturnType { | 628 enum ReturnType { |
628 kRegular, | 629 kRegular, |
629 kContinuation, | 630 kContinuation, |
630 kContinuationTarget | 631 kContinuationTarget |
631 }; | 632 }; |
632 | 633 |
633 // Return from a void function returns the null object. | 634 // Return from a void function returns the null object. |
634 explicit ReturnNode(intptr_t token_pos) | 635 explicit ReturnNode(TokenPosition token_pos) |
635 : AstNode(token_pos), | 636 : AstNode(token_pos), |
636 value_(new LiteralNode(token_pos, Instance::ZoneHandle())), | 637 value_(new LiteralNode(token_pos, Instance::ZoneHandle())), |
637 inlined_finally_list_(), | 638 inlined_finally_list_(), |
638 return_type_(kRegular) { } | 639 return_type_(kRegular) { } |
639 // Return from a non-void function. | 640 // Return from a non-void function. |
640 ReturnNode(intptr_t token_pos, | 641 ReturnNode(TokenPosition token_pos, |
641 AstNode* value) | 642 AstNode* value) |
642 : AstNode(token_pos), | 643 : AstNode(token_pos), |
643 value_(value), | 644 value_(value), |
644 inlined_finally_list_(), | 645 inlined_finally_list_(), |
645 return_type_(kRegular) { | 646 return_type_(kRegular) { |
646 ASSERT(value_ != NULL); | 647 ASSERT(value_ != NULL); |
647 } | 648 } |
648 | 649 |
649 AstNode* value() const { return value_; } | 650 AstNode* value() const { return value_; } |
650 | 651 |
(...skipping 26 matching lines...) Expand all Loading... |
677 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; | 678 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; |
678 LocalScope* scope_; | 679 LocalScope* scope_; |
679 ReturnType return_type_; | 680 ReturnType return_type_; |
680 | 681 |
681 DISALLOW_COPY_AND_ASSIGN(ReturnNode); | 682 DISALLOW_COPY_AND_ASSIGN(ReturnNode); |
682 }; | 683 }; |
683 | 684 |
684 | 685 |
685 class ComparisonNode : public AstNode { | 686 class ComparisonNode : public AstNode { |
686 public: | 687 public: |
687 ComparisonNode(intptr_t token_pos, | 688 ComparisonNode(TokenPosition token_pos, |
688 Token::Kind kind, | 689 Token::Kind kind, |
689 AstNode* left, | 690 AstNode* left, |
690 AstNode* right) | 691 AstNode* right) |
691 : AstNode(token_pos), kind_(kind), left_(left), right_(right) { | 692 : AstNode(token_pos), kind_(kind), left_(left), right_(right) { |
692 ASSERT(left_ != NULL); | 693 ASSERT(left_ != NULL); |
693 ASSERT(right_ != NULL); | 694 ASSERT(right_ != NULL); |
694 ASSERT(IsKindValid()); | 695 ASSERT(IsKindValid()); |
695 } | 696 } |
696 | 697 |
697 Token::Kind kind() const { return kind_; } | 698 Token::Kind kind() const { return kind_; } |
(...skipping 17 matching lines...) Expand all Loading... |
715 AstNode* right_; | 716 AstNode* right_; |
716 | 717 |
717 bool IsKindValid() const; | 718 bool IsKindValid() const; |
718 | 719 |
719 DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode); | 720 DISALLOW_IMPLICIT_CONSTRUCTORS(ComparisonNode); |
720 }; | 721 }; |
721 | 722 |
722 | 723 |
723 class BinaryOpNode : public AstNode { | 724 class BinaryOpNode : public AstNode { |
724 public: | 725 public: |
725 BinaryOpNode(intptr_t token_pos, | 726 BinaryOpNode(TokenPosition token_pos, |
726 Token::Kind kind, | 727 Token::Kind kind, |
727 AstNode* left, | 728 AstNode* left, |
728 AstNode* right) | 729 AstNode* right) |
729 : AstNode(token_pos), kind_(kind), left_(left), right_(right) { | 730 : AstNode(token_pos), kind_(kind), left_(left), right_(right) { |
730 ASSERT(left_ != NULL); | 731 ASSERT(left_ != NULL); |
731 ASSERT(right_ != NULL); | 732 ASSERT(right_ != NULL); |
732 ASSERT(IsKindValid()); | 733 ASSERT(IsKindValid()); |
733 } | 734 } |
734 | 735 |
735 Token::Kind kind() const { return kind_; } | 736 Token::Kind kind() const { return kind_; } |
(...skipping 23 matching lines...) Expand all Loading... |
759 AstNode* right_; | 760 AstNode* right_; |
760 | 761 |
761 bool IsKindValid() const; | 762 bool IsKindValid() const; |
762 | 763 |
763 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode); | 764 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpNode); |
764 }; | 765 }; |
765 | 766 |
766 | 767 |
767 class BinaryOpWithMask32Node : public BinaryOpNode { | 768 class BinaryOpWithMask32Node : public BinaryOpNode { |
768 public: | 769 public: |
769 BinaryOpWithMask32Node(intptr_t token_pos, | 770 BinaryOpWithMask32Node(TokenPosition token_pos, |
770 Token::Kind kind_value, | 771 Token::Kind kind_value, |
771 AstNode* left, | 772 AstNode* left, |
772 AstNode* right, | 773 AstNode* right, |
773 int64_t mask32) | 774 int64_t mask32) |
774 : BinaryOpNode(token_pos, kind_value, left, right), mask32_(mask32) { | 775 : BinaryOpNode(token_pos, kind_value, left, right), mask32_(mask32) { |
775 ASSERT(mask32 >= 0 && Utils::IsUint(32, mask32)); | 776 ASSERT(mask32 >= 0 && Utils::IsUint(32, mask32)); |
776 ASSERT((kind_value != Token::kAND) && (kind_value != Token::kOR)); | 777 ASSERT((kind_value != Token::kAND) && (kind_value != Token::kOR)); |
777 } | 778 } |
778 | 779 |
779 // The optional 32-bit mask must be a an unsigned 32-bit value. | 780 // The optional 32-bit mask must be a an unsigned 32-bit value. |
(...skipping 10 matching lines...) Expand all Loading... |
790 // Optional unsigned 32 bit mask applied on result. No mask: -1. | 791 // Optional unsigned 32 bit mask applied on result. No mask: -1. |
791 const int64_t mask32_; | 792 const int64_t mask32_; |
792 | 793 |
793 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpWithMask32Node); | 794 DISALLOW_IMPLICIT_CONSTRUCTORS(BinaryOpWithMask32Node); |
794 }; | 795 }; |
795 | 796 |
796 | 797 |
797 class UnaryOpNode : public AstNode { | 798 class UnaryOpNode : public AstNode { |
798 public: | 799 public: |
799 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned. | 800 // Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned. |
800 static AstNode* UnaryOpOrLiteral(intptr_t token_pos, | 801 static AstNode* UnaryOpOrLiteral(TokenPosition token_pos, |
801 Token::Kind kind, | 802 Token::Kind kind, |
802 AstNode* operand); | 803 AstNode* operand); |
803 UnaryOpNode(intptr_t token_pos, | 804 UnaryOpNode(TokenPosition token_pos, |
804 Token::Kind kind, | 805 Token::Kind kind, |
805 AstNode* operand) | 806 AstNode* operand) |
806 : AstNode(token_pos), kind_(kind), operand_(operand) { | 807 : AstNode(token_pos), kind_(kind), operand_(operand) { |
807 ASSERT(operand_ != NULL); | 808 ASSERT(operand_ != NULL); |
808 ASSERT(IsKindValid()); | 809 ASSERT(IsKindValid()); |
809 } | 810 } |
810 | 811 |
811 Token::Kind kind() const { return kind_; } | 812 Token::Kind kind() const { return kind_; } |
812 AstNode* operand() const { return operand_; } | 813 AstNode* operand() const { return operand_; } |
813 | 814 |
(...skipping 12 matching lines...) Expand all Loading... |
826 AstNode* operand_; | 827 AstNode* operand_; |
827 | 828 |
828 bool IsKindValid() const; | 829 bool IsKindValid() const; |
829 | 830 |
830 DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode); | 831 DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode); |
831 }; | 832 }; |
832 | 833 |
833 | 834 |
834 class ConditionalExprNode : public AstNode { | 835 class ConditionalExprNode : public AstNode { |
835 public: | 836 public: |
836 ConditionalExprNode(intptr_t token_pos, | 837 ConditionalExprNode(TokenPosition token_pos, |
837 AstNode* condition, | 838 AstNode* condition, |
838 AstNode* true_expr, | 839 AstNode* true_expr, |
839 AstNode* false_expr) | 840 AstNode* false_expr) |
840 : AstNode(token_pos), | 841 : AstNode(token_pos), |
841 condition_(condition), | 842 condition_(condition), |
842 true_expr_(true_expr), | 843 true_expr_(true_expr), |
843 false_expr_(false_expr) { | 844 false_expr_(false_expr) { |
844 ASSERT(condition_ != NULL); | 845 ASSERT(condition_ != NULL); |
845 ASSERT(true_expr_ != NULL); | 846 ASSERT(true_expr_ != NULL); |
846 ASSERT(false_expr_ != NULL); | 847 ASSERT(false_expr_ != NULL); |
(...skipping 27 matching lines...) Expand all Loading... |
874 AstNode* condition_; | 875 AstNode* condition_; |
875 AstNode* true_expr_; | 876 AstNode* true_expr_; |
876 AstNode* false_expr_; | 877 AstNode* false_expr_; |
877 | 878 |
878 DISALLOW_IMPLICIT_CONSTRUCTORS(ConditionalExprNode); | 879 DISALLOW_IMPLICIT_CONSTRUCTORS(ConditionalExprNode); |
879 }; | 880 }; |
880 | 881 |
881 | 882 |
882 class IfNode : public AstNode { | 883 class IfNode : public AstNode { |
883 public: | 884 public: |
884 IfNode(intptr_t token_pos, | 885 IfNode(TokenPosition token_pos, |
885 AstNode* condition, | 886 AstNode* condition, |
886 SequenceNode* true_branch, | 887 SequenceNode* true_branch, |
887 SequenceNode* false_branch) | 888 SequenceNode* false_branch) |
888 : AstNode(token_pos), | 889 : AstNode(token_pos), |
889 condition_(condition), | 890 condition_(condition), |
890 true_branch_(true_branch), | 891 true_branch_(true_branch), |
891 false_branch_(false_branch) { | 892 false_branch_(false_branch) { |
892 ASSERT(condition_ != NULL); | 893 ASSERT(condition_ != NULL); |
893 } | 894 } |
894 | 895 |
(...skipping 15 matching lines...) Expand all Loading... |
910 AstNode* condition_; | 911 AstNode* condition_; |
911 SequenceNode* true_branch_; | 912 SequenceNode* true_branch_; |
912 SequenceNode* false_branch_; | 913 SequenceNode* false_branch_; |
913 | 914 |
914 DISALLOW_IMPLICIT_CONSTRUCTORS(IfNode); | 915 DISALLOW_IMPLICIT_CONSTRUCTORS(IfNode); |
915 }; | 916 }; |
916 | 917 |
917 | 918 |
918 class CaseNode : public AstNode { | 919 class CaseNode : public AstNode { |
919 public: | 920 public: |
920 CaseNode(intptr_t token_pos, | 921 CaseNode(TokenPosition token_pos, |
921 SourceLabel* label, | 922 SourceLabel* label, |
922 SequenceNode* case_expressions, | 923 SequenceNode* case_expressions, |
923 bool contains_default, | 924 bool contains_default, |
924 LocalVariable* switch_expr_value, | 925 LocalVariable* switch_expr_value, |
925 SequenceNode* statements) | 926 SequenceNode* statements) |
926 : AstNode(token_pos), | 927 : AstNode(token_pos), |
927 label_(label), | 928 label_(label), |
928 case_expressions_(case_expressions), | 929 case_expressions_(case_expressions), |
929 contains_default_(contains_default), | 930 contains_default_(contains_default), |
930 switch_expr_value_(switch_expr_value), | 931 switch_expr_value_(switch_expr_value), |
(...skipping 23 matching lines...) Expand all Loading... |
954 bool contains_default_; | 955 bool contains_default_; |
955 LocalVariable* switch_expr_value_; | 956 LocalVariable* switch_expr_value_; |
956 SequenceNode* statements_; | 957 SequenceNode* statements_; |
957 | 958 |
958 DISALLOW_IMPLICIT_CONSTRUCTORS(CaseNode); | 959 DISALLOW_IMPLICIT_CONSTRUCTORS(CaseNode); |
959 }; | 960 }; |
960 | 961 |
961 | 962 |
962 class SwitchNode : public AstNode { | 963 class SwitchNode : public AstNode { |
963 public: | 964 public: |
964 SwitchNode(intptr_t token_pos, | 965 SwitchNode(TokenPosition token_pos, |
965 SourceLabel* label, | 966 SourceLabel* label, |
966 SequenceNode* body) | 967 SequenceNode* body) |
967 : AstNode(token_pos), | 968 : AstNode(token_pos), |
968 label_(label), | 969 label_(label), |
969 body_(body) { | 970 body_(body) { |
970 ASSERT(label_ != NULL); | 971 ASSERT(label_ != NULL); |
971 ASSERT(body_ != NULL); | 972 ASSERT(body_ != NULL); |
972 } | 973 } |
973 | 974 |
974 SourceLabel* label() const { return label_; } | 975 SourceLabel* label() const { return label_; } |
975 SequenceNode* body() const { return body_; } | 976 SequenceNode* body() const { return body_; } |
976 | 977 |
977 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 978 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
978 body()->Visit(visitor); | 979 body()->Visit(visitor); |
979 } | 980 } |
980 | 981 |
981 DECLARE_COMMON_NODE_FUNCTIONS(SwitchNode); | 982 DECLARE_COMMON_NODE_FUNCTIONS(SwitchNode); |
982 | 983 |
983 private: | 984 private: |
984 SourceLabel* label_; | 985 SourceLabel* label_; |
985 SequenceNode* body_; | 986 SequenceNode* body_; |
986 | 987 |
987 DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode); | 988 DISALLOW_IMPLICIT_CONSTRUCTORS(SwitchNode); |
988 }; | 989 }; |
989 | 990 |
990 | 991 |
991 class WhileNode : public AstNode { | 992 class WhileNode : public AstNode { |
992 public: | 993 public: |
993 WhileNode(intptr_t token_pos, | 994 WhileNode(TokenPosition token_pos, |
994 SourceLabel* label, | 995 SourceLabel* label, |
995 AstNode* condition, | 996 AstNode* condition, |
996 SequenceNode* condition_preamble, | 997 SequenceNode* condition_preamble, |
997 SequenceNode* body) | 998 SequenceNode* body) |
998 : AstNode(token_pos), | 999 : AstNode(token_pos), |
999 label_(label), | 1000 label_(label), |
1000 condition_(condition), | 1001 condition_(condition), |
1001 condition_preamble_(condition_preamble), | 1002 condition_preamble_(condition_preamble), |
1002 body_(body) { | 1003 body_(body) { |
1003 ASSERT(label_ != NULL); | 1004 ASSERT(label_ != NULL); |
(...skipping 21 matching lines...) Expand all Loading... |
1025 AstNode* condition_; | 1026 AstNode* condition_; |
1026 SequenceNode* condition_preamble_; | 1027 SequenceNode* condition_preamble_; |
1027 SequenceNode* body_; | 1028 SequenceNode* body_; |
1028 | 1029 |
1029 DISALLOW_IMPLICIT_CONSTRUCTORS(WhileNode); | 1030 DISALLOW_IMPLICIT_CONSTRUCTORS(WhileNode); |
1030 }; | 1031 }; |
1031 | 1032 |
1032 | 1033 |
1033 class DoWhileNode : public AstNode { | 1034 class DoWhileNode : public AstNode { |
1034 public: | 1035 public: |
1035 DoWhileNode(intptr_t token_pos, | 1036 DoWhileNode(TokenPosition token_pos, |
1036 SourceLabel* label, | 1037 SourceLabel* label, |
1037 AstNode* condition, | 1038 AstNode* condition, |
1038 SequenceNode* body) | 1039 SequenceNode* body) |
1039 : AstNode(token_pos), | 1040 : AstNode(token_pos), |
1040 label_(label), | 1041 label_(label), |
1041 condition_(condition), | 1042 condition_(condition), |
1042 body_(body) { | 1043 body_(body) { |
1043 ASSERT(label_ != NULL); | 1044 ASSERT(label_ != NULL); |
1044 ASSERT(condition_ != NULL); | 1045 ASSERT(condition_ != NULL); |
1045 ASSERT(body_ != NULL); | 1046 ASSERT(body_ != NULL); |
(...skipping 15 matching lines...) Expand all Loading... |
1061 AstNode* condition_; | 1062 AstNode* condition_; |
1062 SequenceNode* body_; | 1063 SequenceNode* body_; |
1063 | 1064 |
1064 DISALLOW_IMPLICIT_CONSTRUCTORS(DoWhileNode); | 1065 DISALLOW_IMPLICIT_CONSTRUCTORS(DoWhileNode); |
1065 }; | 1066 }; |
1066 | 1067 |
1067 | 1068 |
1068 // The condition can be NULL. | 1069 // The condition can be NULL. |
1069 class ForNode : public AstNode { | 1070 class ForNode : public AstNode { |
1070 public: | 1071 public: |
1071 ForNode(intptr_t token_pos, | 1072 ForNode(TokenPosition token_pos, |
1072 SourceLabel* label, | 1073 SourceLabel* label, |
1073 SequenceNode* initializer, | 1074 SequenceNode* initializer, |
1074 AstNode* condition, | 1075 AstNode* condition, |
1075 SequenceNode* condition_preamble, | 1076 SequenceNode* condition_preamble, |
1076 SequenceNode* increment, | 1077 SequenceNode* increment, |
1077 SequenceNode* body) | 1078 SequenceNode* body) |
1078 : AstNode(token_pos), | 1079 : AstNode(token_pos), |
1079 label_(label), | 1080 label_(label), |
1080 initializer_(initializer), | 1081 initializer_(initializer), |
1081 condition_(condition), | 1082 condition_(condition), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 AstNode* condition_preamble_; | 1118 AstNode* condition_preamble_; |
1118 SequenceNode* increment_; | 1119 SequenceNode* increment_; |
1119 SequenceNode* body_; | 1120 SequenceNode* body_; |
1120 | 1121 |
1121 DISALLOW_IMPLICIT_CONSTRUCTORS(ForNode); | 1122 DISALLOW_IMPLICIT_CONSTRUCTORS(ForNode); |
1122 }; | 1123 }; |
1123 | 1124 |
1124 | 1125 |
1125 class JumpNode : public AstNode { | 1126 class JumpNode : public AstNode { |
1126 public: | 1127 public: |
1127 JumpNode(intptr_t token_pos, | 1128 JumpNode(TokenPosition token_pos, |
1128 Token::Kind kind, | 1129 Token::Kind kind, |
1129 SourceLabel* label) | 1130 SourceLabel* label) |
1130 : AstNode(token_pos), | 1131 : AstNode(token_pos), |
1131 kind_(kind), | 1132 kind_(kind), |
1132 label_(label), | 1133 label_(label), |
1133 inlined_finally_list_() { | 1134 inlined_finally_list_() { |
1134 ASSERT(label_ != NULL); | 1135 ASSERT(label_ != NULL); |
1135 ASSERT(kind_ == Token::kBREAK || kind_ == Token::kCONTINUE); | 1136 ASSERT(kind_ == Token::kBREAK || kind_ == Token::kCONTINUE); |
1136 } | 1137 } |
1137 | 1138 |
(...skipping 20 matching lines...) Expand all Loading... |
1158 Token::Kind kind_; | 1159 Token::Kind kind_; |
1159 SourceLabel* label_; | 1160 SourceLabel* label_; |
1160 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; | 1161 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; |
1161 | 1162 |
1162 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); | 1163 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); |
1163 }; | 1164 }; |
1164 | 1165 |
1165 | 1166 |
1166 class StopNode : public AstNode { | 1167 class StopNode : public AstNode { |
1167 public: | 1168 public: |
1168 StopNode(intptr_t token_pos, const char* message) | 1169 StopNode(TokenPosition token_pos, const char* message) |
1169 : AstNode(token_pos), | 1170 : AstNode(token_pos), |
1170 message_(message) { | 1171 message_(message) { |
1171 ASSERT(message != NULL); | 1172 ASSERT(message != NULL); |
1172 } | 1173 } |
1173 | 1174 |
1174 const char* message() const { return message_; } | 1175 const char* message() const { return message_; } |
1175 | 1176 |
1176 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1177 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
1177 | 1178 |
1178 DECLARE_COMMON_NODE_FUNCTIONS(StopNode); | 1179 DECLARE_COMMON_NODE_FUNCTIONS(StopNode); |
1179 | 1180 |
1180 private: | 1181 private: |
1181 const char* message_; | 1182 const char* message_; |
1182 | 1183 |
1183 DISALLOW_IMPLICIT_CONSTRUCTORS(StopNode); | 1184 DISALLOW_IMPLICIT_CONSTRUCTORS(StopNode); |
1184 }; | 1185 }; |
1185 | 1186 |
1186 | 1187 |
1187 class LoadLocalNode : public AstNode { | 1188 class LoadLocalNode : public AstNode { |
1188 public: | 1189 public: |
1189 LoadLocalNode(intptr_t token_pos, const LocalVariable* local) | 1190 LoadLocalNode(TokenPosition token_pos, const LocalVariable* local) |
1190 : AstNode(token_pos), local_(*local) { | 1191 : AstNode(token_pos), local_(*local) { |
1191 ASSERT(local != NULL); | 1192 ASSERT(local != NULL); |
1192 } | 1193 } |
1193 | 1194 |
1194 const LocalVariable& local() const { return local_; } | 1195 const LocalVariable& local() const { return local_; } |
1195 | 1196 |
1196 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1197 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
1197 | 1198 |
1198 virtual const Instance* EvalConstExpr() const; | 1199 virtual const Instance* EvalConstExpr() const; |
1199 virtual bool IsPotentiallyConst() const; | 1200 virtual bool IsPotentiallyConst() const; |
1200 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 1201 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
1201 | 1202 |
1202 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); | 1203 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); |
1203 | 1204 |
1204 private: | 1205 private: |
1205 const LocalVariable& local_; | 1206 const LocalVariable& local_; |
1206 | 1207 |
1207 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); | 1208 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); |
1208 }; | 1209 }; |
1209 | 1210 |
1210 | 1211 |
1211 class StoreLocalNode : public AstNode { | 1212 class StoreLocalNode : public AstNode { |
1212 public: | 1213 public: |
1213 StoreLocalNode(intptr_t token_pos, const LocalVariable* local, AstNode* value) | 1214 StoreLocalNode(TokenPosition token_pos, |
| 1215 const LocalVariable* local, |
| 1216 AstNode* value) |
1214 : AstNode(token_pos), local_(*local), value_(value) { | 1217 : AstNode(token_pos), local_(*local), value_(value) { |
1215 ASSERT(local != NULL); | 1218 ASSERT(local != NULL); |
1216 ASSERT(value_ != NULL); | 1219 ASSERT(value_ != NULL); |
1217 } | 1220 } |
1218 | 1221 |
1219 const LocalVariable& local() const { return local_; } | 1222 const LocalVariable& local() const { return local_; } |
1220 AstNode* value() const { return value_; } | 1223 AstNode* value() const { return value_; } |
1221 | 1224 |
1222 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1225 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1223 value()->Visit(visitor); | 1226 value()->Visit(visitor); |
1224 } | 1227 } |
1225 | 1228 |
1226 DECLARE_COMMON_NODE_FUNCTIONS(StoreLocalNode); | 1229 DECLARE_COMMON_NODE_FUNCTIONS(StoreLocalNode); |
1227 | 1230 |
1228 private: | 1231 private: |
1229 const LocalVariable& local_; | 1232 const LocalVariable& local_; |
1230 AstNode* value_; | 1233 AstNode* value_; |
1231 | 1234 |
1232 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode); | 1235 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreLocalNode); |
1233 }; | 1236 }; |
1234 | 1237 |
1235 | 1238 |
1236 class LoadInstanceFieldNode : public AstNode { | 1239 class LoadInstanceFieldNode : public AstNode { |
1237 public: | 1240 public: |
1238 LoadInstanceFieldNode(intptr_t token_pos, | 1241 LoadInstanceFieldNode(TokenPosition token_pos, |
1239 AstNode* instance, | 1242 AstNode* instance, |
1240 const Field& field) | 1243 const Field& field) |
1241 : AstNode(token_pos), instance_(instance), field_(field) { | 1244 : AstNode(token_pos), instance_(instance), field_(field) { |
1242 ASSERT(instance_ != NULL); | 1245 ASSERT(instance_ != NULL); |
1243 ASSERT(field_.IsZoneHandle()); | 1246 ASSERT(field_.IsZoneHandle()); |
1244 } | 1247 } |
1245 | 1248 |
1246 AstNode* instance() const { return instance_; } | 1249 AstNode* instance() const { return instance_; } |
1247 const Field& field() const { return field_; } | 1250 const Field& field() const { return field_; } |
1248 | 1251 |
1249 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1252 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1250 instance()->Visit(visitor); | 1253 instance()->Visit(visitor); |
1251 } | 1254 } |
1252 | 1255 |
1253 DECLARE_COMMON_NODE_FUNCTIONS(LoadInstanceFieldNode); | 1256 DECLARE_COMMON_NODE_FUNCTIONS(LoadInstanceFieldNode); |
1254 | 1257 |
1255 private: | 1258 private: |
1256 AstNode* instance_; | 1259 AstNode* instance_; |
1257 const Field& field_; | 1260 const Field& field_; |
1258 | 1261 |
1259 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadInstanceFieldNode); | 1262 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadInstanceFieldNode); |
1260 }; | 1263 }; |
1261 | 1264 |
1262 | 1265 |
1263 class StoreInstanceFieldNode : public AstNode { | 1266 class StoreInstanceFieldNode : public AstNode { |
1264 public: | 1267 public: |
1265 StoreInstanceFieldNode(intptr_t token_pos, | 1268 StoreInstanceFieldNode(TokenPosition token_pos, |
1266 AstNode* instance, | 1269 AstNode* instance, |
1267 const Field& field, | 1270 const Field& field, |
1268 AstNode* value) | 1271 AstNode* value) |
1269 : AstNode(token_pos), | 1272 : AstNode(token_pos), |
1270 instance_(instance), | 1273 instance_(instance), |
1271 field_(field), | 1274 field_(field), |
1272 value_(value) { | 1275 value_(value) { |
1273 ASSERT(instance_ != NULL); | 1276 ASSERT(instance_ != NULL); |
1274 ASSERT(field_.IsZoneHandle()); | 1277 ASSERT(field_.IsZoneHandle()); |
1275 ASSERT(value_ != NULL); | 1278 ASSERT(value_ != NULL); |
(...skipping 14 matching lines...) Expand all Loading... |
1290 AstNode* instance_; | 1293 AstNode* instance_; |
1291 const Field& field_; | 1294 const Field& field_; |
1292 AstNode* value_; | 1295 AstNode* value_; |
1293 | 1296 |
1294 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreInstanceFieldNode); | 1297 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreInstanceFieldNode); |
1295 }; | 1298 }; |
1296 | 1299 |
1297 | 1300 |
1298 class LoadStaticFieldNode : public AstNode { | 1301 class LoadStaticFieldNode : public AstNode { |
1299 public: | 1302 public: |
1300 LoadStaticFieldNode(intptr_t token_pos, const Field& field) | 1303 LoadStaticFieldNode(TokenPosition token_pos, const Field& field) |
1301 : AstNode(token_pos), field_(field), is_deferred_reference_(false) { | 1304 : AstNode(token_pos), field_(field), is_deferred_reference_(false) { |
1302 ASSERT(field_.IsZoneHandle()); | 1305 ASSERT(field_.IsZoneHandle()); |
1303 } | 1306 } |
1304 | 1307 |
1305 const Field& field() const { return field_; } | 1308 const Field& field() const { return field_; } |
1306 void set_is_deferred(bool value) { is_deferred_reference_ = value; } | 1309 void set_is_deferred(bool value) { is_deferred_reference_ = value; } |
1307 bool is_deferred_reference() const { return is_deferred_reference_; } | 1310 bool is_deferred_reference() const { return is_deferred_reference_; } |
1308 | 1311 |
1309 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1312 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
1310 | 1313 |
(...skipping 15 matching lines...) Expand all Loading... |
1326 private: | 1329 private: |
1327 const Field& field_; | 1330 const Field& field_; |
1328 bool is_deferred_reference_; | 1331 bool is_deferred_reference_; |
1329 | 1332 |
1330 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadStaticFieldNode); | 1333 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadStaticFieldNode); |
1331 }; | 1334 }; |
1332 | 1335 |
1333 | 1336 |
1334 class StoreStaticFieldNode : public AstNode { | 1337 class StoreStaticFieldNode : public AstNode { |
1335 public: | 1338 public: |
1336 StoreStaticFieldNode(intptr_t token_pos, const Field& field, AstNode* value) | 1339 StoreStaticFieldNode(TokenPosition token_pos, |
| 1340 const Field& field, |
| 1341 AstNode* value) |
1337 : AstNode(token_pos), field_(field), value_(value) { | 1342 : AstNode(token_pos), field_(field), value_(value) { |
1338 ASSERT(field_.IsZoneHandle()); | 1343 ASSERT(field_.IsZoneHandle()); |
1339 ASSERT(value_ != NULL); | 1344 ASSERT(value_ != NULL); |
1340 } | 1345 } |
1341 | 1346 |
1342 const Field& field() const { return field_; } | 1347 const Field& field() const { return field_; } |
1343 AstNode* value() const { return value_; } | 1348 AstNode* value() const { return value_; } |
1344 | 1349 |
1345 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1350 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1346 value()->Visit(visitor); | 1351 value()->Visit(visitor); |
1347 } | 1352 } |
1348 | 1353 |
1349 DECLARE_COMMON_NODE_FUNCTIONS(StoreStaticFieldNode); | 1354 DECLARE_COMMON_NODE_FUNCTIONS(StoreStaticFieldNode); |
1350 | 1355 |
1351 private: | 1356 private: |
1352 const Field& field_; | 1357 const Field& field_; |
1353 AstNode* value_; | 1358 AstNode* value_; |
1354 | 1359 |
1355 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); | 1360 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); |
1356 }; | 1361 }; |
1357 | 1362 |
1358 | 1363 |
1359 class LoadIndexedNode : public AstNode { | 1364 class LoadIndexedNode : public AstNode { |
1360 public: | 1365 public: |
1361 LoadIndexedNode(intptr_t token_pos, | 1366 LoadIndexedNode(TokenPosition token_pos, |
1362 AstNode* array, | 1367 AstNode* array, |
1363 AstNode* index, | 1368 AstNode* index, |
1364 const Class& super_class) | 1369 const Class& super_class) |
1365 : AstNode(token_pos), | 1370 : AstNode(token_pos), |
1366 array_(array), | 1371 array_(array), |
1367 index_expr_(index), | 1372 index_expr_(index), |
1368 super_class_(super_class) { | 1373 super_class_(super_class) { |
1369 ASSERT(array_ != NULL); | 1374 ASSERT(array_ != NULL); |
1370 ASSERT(index_expr_ != NULL); | 1375 ASSERT(index_expr_ != NULL); |
1371 ASSERT(super_class_.IsZoneHandle()); | 1376 ASSERT(super_class_.IsZoneHandle()); |
(...skipping 16 matching lines...) Expand all Loading... |
1388 private: | 1393 private: |
1389 AstNode* array_; | 1394 AstNode* array_; |
1390 AstNode* index_expr_; | 1395 AstNode* index_expr_; |
1391 const Class& super_class_; | 1396 const Class& super_class_; |
1392 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); | 1397 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); |
1393 }; | 1398 }; |
1394 | 1399 |
1395 | 1400 |
1396 class StoreIndexedNode : public AstNode { | 1401 class StoreIndexedNode : public AstNode { |
1397 public: | 1402 public: |
1398 StoreIndexedNode(intptr_t token_pos, | 1403 StoreIndexedNode(TokenPosition token_pos, |
1399 AstNode* array, | 1404 AstNode* array, |
1400 AstNode* index, | 1405 AstNode* index, |
1401 AstNode* value, | 1406 AstNode* value, |
1402 const Class& super_class) | 1407 const Class& super_class) |
1403 : AstNode(token_pos), | 1408 : AstNode(token_pos), |
1404 array_(array), | 1409 array_(array), |
1405 index_expr_(index), | 1410 index_expr_(index), |
1406 value_(value), | 1411 value_(value), |
1407 super_class_(super_class) { | 1412 super_class_(super_class) { |
1408 ASSERT(array_ != NULL); | 1413 ASSERT(array_ != NULL); |
(...skipping 20 matching lines...) Expand all Loading... |
1429 AstNode* array_; | 1434 AstNode* array_; |
1430 AstNode* index_expr_; | 1435 AstNode* index_expr_; |
1431 AstNode* value_; | 1436 AstNode* value_; |
1432 const Class& super_class_; | 1437 const Class& super_class_; |
1433 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); | 1438 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); |
1434 }; | 1439 }; |
1435 | 1440 |
1436 | 1441 |
1437 class InstanceCallNode : public AstNode { | 1442 class InstanceCallNode : public AstNode { |
1438 public: | 1443 public: |
1439 InstanceCallNode(intptr_t token_pos, | 1444 InstanceCallNode(TokenPosition token_pos, |
1440 AstNode* receiver, | 1445 AstNode* receiver, |
1441 const String& function_name, | 1446 const String& function_name, |
1442 ArgumentListNode* arguments, | 1447 ArgumentListNode* arguments, |
1443 bool is_conditional = false) | 1448 bool is_conditional = false) |
1444 : AstNode(token_pos), | 1449 : AstNode(token_pos), |
1445 receiver_(receiver), | 1450 receiver_(receiver), |
1446 function_name_(function_name), | 1451 function_name_(function_name), |
1447 arguments_(arguments), | 1452 arguments_(arguments), |
1448 is_conditional_(is_conditional) { | 1453 is_conditional_(is_conditional) { |
1449 ASSERT(receiver_ != NULL); | 1454 ASSERT(receiver_ != NULL); |
(...skipping 19 matching lines...) Expand all Loading... |
1469 const String& function_name_; | 1474 const String& function_name_; |
1470 ArgumentListNode* arguments_; | 1475 ArgumentListNode* arguments_; |
1471 const bool is_conditional_; | 1476 const bool is_conditional_; |
1472 | 1477 |
1473 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode); | 1478 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode); |
1474 }; | 1479 }; |
1475 | 1480 |
1476 | 1481 |
1477 class InstanceGetterNode : public AstNode { | 1482 class InstanceGetterNode : public AstNode { |
1478 public: | 1483 public: |
1479 InstanceGetterNode(intptr_t token_pos, | 1484 InstanceGetterNode(TokenPosition token_pos, |
1480 AstNode* receiver, | 1485 AstNode* receiver, |
1481 const String& field_name, | 1486 const String& field_name, |
1482 bool is_conditional = false) | 1487 bool is_conditional = false) |
1483 : AstNode(token_pos), | 1488 : AstNode(token_pos), |
1484 receiver_(receiver), | 1489 receiver_(receiver), |
1485 field_name_(field_name), | 1490 field_name_(field_name), |
1486 is_conditional_(is_conditional) { | 1491 is_conditional_(is_conditional) { |
1487 ASSERT(receiver_ != NULL); | 1492 ASSERT(receiver_ != NULL); |
1488 ASSERT(field_name_.IsNotTemporaryScopedHandle()); | 1493 ASSERT(field_name_.IsNotTemporaryScopedHandle()); |
1489 ASSERT(field_name_.IsSymbol()); | 1494 ASSERT(field_name_.IsSymbol()); |
(...skipping 18 matching lines...) Expand all Loading... |
1508 AstNode* receiver_; | 1513 AstNode* receiver_; |
1509 const String& field_name_; | 1514 const String& field_name_; |
1510 const bool is_conditional_; | 1515 const bool is_conditional_; |
1511 | 1516 |
1512 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode); | 1517 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode); |
1513 }; | 1518 }; |
1514 | 1519 |
1515 | 1520 |
1516 class InstanceSetterNode : public AstNode { | 1521 class InstanceSetterNode : public AstNode { |
1517 public: | 1522 public: |
1518 InstanceSetterNode(intptr_t token_pos, | 1523 InstanceSetterNode(TokenPosition token_pos, |
1519 AstNode* receiver, | 1524 AstNode* receiver, |
1520 const String& field_name, | 1525 const String& field_name, |
1521 AstNode* value, | 1526 AstNode* value, |
1522 bool is_conditional = false) | 1527 bool is_conditional = false) |
1523 : AstNode(token_pos), | 1528 : AstNode(token_pos), |
1524 receiver_(receiver), | 1529 receiver_(receiver), |
1525 field_name_(field_name), | 1530 field_name_(field_name), |
1526 value_(value), | 1531 value_(value), |
1527 is_conditional_(is_conditional) { | 1532 is_conditional_(is_conditional) { |
1528 ASSERT(receiver_ != NULL); | 1533 ASSERT(receiver_ != NULL); |
(...skipping 19 matching lines...) Expand all Loading... |
1548 const String& field_name_; | 1553 const String& field_name_; |
1549 AstNode* value_; | 1554 AstNode* value_; |
1550 const bool is_conditional_; | 1555 const bool is_conditional_; |
1551 | 1556 |
1552 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); | 1557 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); |
1553 }; | 1558 }; |
1554 | 1559 |
1555 | 1560 |
1556 class InitStaticFieldNode : public AstNode { | 1561 class InitStaticFieldNode : public AstNode { |
1557 public: | 1562 public: |
1558 InitStaticFieldNode(intptr_t token_pos, const Field& field) | 1563 InitStaticFieldNode(TokenPosition token_pos, const Field& field) |
1559 : AstNode(token_pos), field_(field) { | 1564 : AstNode(token_pos), field_(field) { |
1560 ASSERT(field_.IsZoneHandle()); | 1565 ASSERT(field_.IsZoneHandle()); |
1561 } | 1566 } |
1562 | 1567 |
1563 const Field& field() const { return field_; } | 1568 const Field& field() const { return field_; } |
1564 | 1569 |
1565 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1570 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
1566 | 1571 |
1567 DECLARE_COMMON_NODE_FUNCTIONS(InitStaticFieldNode); | 1572 DECLARE_COMMON_NODE_FUNCTIONS(InitStaticFieldNode); |
1568 | 1573 |
1569 private: | 1574 private: |
1570 const Field& field_; | 1575 const Field& field_; |
1571 | 1576 |
1572 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldNode); | 1577 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldNode); |
1573 }; | 1578 }; |
1574 | 1579 |
1575 | 1580 |
1576 class StaticGetterNode : public AstNode { | 1581 class StaticGetterNode : public AstNode { |
1577 public: | 1582 public: |
1578 StaticGetterNode(intptr_t token_pos, | 1583 StaticGetterNode(TokenPosition token_pos, |
1579 AstNode* receiver, | 1584 AstNode* receiver, |
1580 const Class& cls, | 1585 const Class& cls, |
1581 const String& field_name) | 1586 const String& field_name) |
1582 : AstNode(token_pos), | 1587 : AstNode(token_pos), |
1583 receiver_(receiver), | 1588 receiver_(receiver), |
1584 owner_(Object::ZoneHandle(cls.raw())), | 1589 owner_(Object::ZoneHandle(cls.raw())), |
1585 cls_(cls), | 1590 cls_(cls), |
1586 field_name_(field_name), | 1591 field_name_(field_name), |
1587 is_deferred_reference_(false) { | 1592 is_deferred_reference_(false) { |
1588 ASSERT(cls_.IsZoneHandle()); | 1593 ASSERT(cls_.IsZoneHandle()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 const String& field_name_; | 1630 const String& field_name_; |
1626 bool is_deferred_reference_; | 1631 bool is_deferred_reference_; |
1627 | 1632 |
1628 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); | 1633 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticGetterNode); |
1629 }; | 1634 }; |
1630 | 1635 |
1631 | 1636 |
1632 class StaticSetterNode : public AstNode { | 1637 class StaticSetterNode : public AstNode { |
1633 public: | 1638 public: |
1634 // Static setter with resolved setter function. | 1639 // Static setter with resolved setter function. |
1635 StaticSetterNode(intptr_t token_pos, | 1640 StaticSetterNode(TokenPosition token_pos, |
1636 AstNode* receiver, | 1641 AstNode* receiver, |
1637 const String& field_name, | 1642 const String& field_name, |
1638 const Function& function, | 1643 const Function& function, |
1639 AstNode* value) | 1644 AstNode* value) |
1640 : AstNode(token_pos), | 1645 : AstNode(token_pos), |
1641 receiver_(receiver), | 1646 receiver_(receiver), |
1642 cls_(Class::ZoneHandle(function.Owner())), | 1647 cls_(Class::ZoneHandle(function.Owner())), |
1643 field_name_(field_name), | 1648 field_name_(field_name), |
1644 function_(function), | 1649 function_(function), |
1645 value_(value) { | 1650 value_(value) { |
1646 ASSERT(function_.IsZoneHandle()); | 1651 ASSERT(function_.IsZoneHandle()); |
1647 ASSERT(function.is_static() || receiver != NULL); | 1652 ASSERT(function.is_static() || receiver != NULL); |
1648 ASSERT(field_name_.IsZoneHandle()); | 1653 ASSERT(field_name_.IsZoneHandle()); |
1649 ASSERT(value_ != NULL); | 1654 ASSERT(value_ != NULL); |
1650 } | 1655 } |
1651 | 1656 |
1652 // For unresolved setters. | 1657 // For unresolved setters. |
1653 StaticSetterNode(intptr_t token_pos, | 1658 StaticSetterNode(TokenPosition token_pos, |
1654 AstNode* receiver, | 1659 AstNode* receiver, |
1655 const Class& cls, | 1660 const Class& cls, |
1656 const String& field_name, | 1661 const String& field_name, |
1657 AstNode* value) | 1662 AstNode* value) |
1658 : AstNode(token_pos), | 1663 : AstNode(token_pos), |
1659 receiver_(receiver), | 1664 receiver_(receiver), |
1660 cls_(cls), | 1665 cls_(cls), |
1661 field_name_(field_name), | 1666 field_name_(field_name), |
1662 function_(Function::ZoneHandle()), | 1667 function_(Function::ZoneHandle()), |
1663 value_(value) { | 1668 value_(value) { |
(...skipping 23 matching lines...) Expand all Loading... |
1687 const String& field_name_; | 1692 const String& field_name_; |
1688 const Function& function_; | 1693 const Function& function_; |
1689 AstNode* value_; | 1694 AstNode* value_; |
1690 | 1695 |
1691 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode); | 1696 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticSetterNode); |
1692 }; | 1697 }; |
1693 | 1698 |
1694 | 1699 |
1695 class StaticCallNode : public AstNode { | 1700 class StaticCallNode : public AstNode { |
1696 public: | 1701 public: |
1697 StaticCallNode(intptr_t token_pos, | 1702 StaticCallNode(TokenPosition token_pos, |
1698 const Function& function, | 1703 const Function& function, |
1699 ArgumentListNode* arguments) | 1704 ArgumentListNode* arguments) |
1700 : AstNode(token_pos), | 1705 : AstNode(token_pos), |
1701 function_(function), | 1706 function_(function), |
1702 arguments_(arguments) { | 1707 arguments_(arguments) { |
1703 ASSERT(function_.IsZoneHandle()); | 1708 ASSERT(function_.IsZoneHandle()); |
1704 ASSERT(arguments_ != NULL); | 1709 ASSERT(arguments_ != NULL); |
1705 } | 1710 } |
1706 | 1711 |
1707 const Function& function() const { return function_; } | 1712 const Function& function() const { return function_; } |
(...skipping 10 matching lines...) Expand all Loading... |
1718 private: | 1723 private: |
1719 const Function& function_; | 1724 const Function& function_; |
1720 ArgumentListNode* arguments_; | 1725 ArgumentListNode* arguments_; |
1721 | 1726 |
1722 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCallNode); | 1727 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCallNode); |
1723 }; | 1728 }; |
1724 | 1729 |
1725 | 1730 |
1726 class ClosureCallNode : public AstNode { | 1731 class ClosureCallNode : public AstNode { |
1727 public: | 1732 public: |
1728 ClosureCallNode(intptr_t token_pos, | 1733 ClosureCallNode(TokenPosition token_pos, |
1729 AstNode* closure, | 1734 AstNode* closure, |
1730 ArgumentListNode* arguments) | 1735 ArgumentListNode* arguments) |
1731 : AstNode(token_pos), | 1736 : AstNode(token_pos), |
1732 closure_(closure), | 1737 closure_(closure), |
1733 arguments_(arguments) { | 1738 arguments_(arguments) { |
1734 ASSERT(closure_ != NULL); | 1739 ASSERT(closure_ != NULL); |
1735 ASSERT(arguments_ != NULL); | 1740 ASSERT(arguments_ != NULL); |
1736 } | 1741 } |
1737 | 1742 |
1738 AstNode* closure() const { return closure_; } | 1743 AstNode* closure() const { return closure_; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 // the class of the caller), the code at run time extracts the type arguments of | 1779 // the class of the caller), the code at run time extracts the type arguments of |
1775 // the receiver at an offset in the receiver specified by the provided | 1780 // the receiver at an offset in the receiver specified by the provided |
1776 // instantiator_class. | 1781 // instantiator_class. |
1777 // | 1782 // |
1778 // If the caller to the constructor or to the factory is a factory, then the | 1783 // If the caller to the constructor or to the factory is a factory, then the |
1779 // instantiator is the first parameter of this factory, which is already a | 1784 // instantiator is the first parameter of this factory, which is already a |
1780 // type argument vector. This case is identified by a null and unneeded | 1785 // type argument vector. This case is identified by a null and unneeded |
1781 // instantiator_class. | 1786 // instantiator_class. |
1782 class ConstructorCallNode : public AstNode { | 1787 class ConstructorCallNode : public AstNode { |
1783 public: | 1788 public: |
1784 ConstructorCallNode(intptr_t token_pos, | 1789 ConstructorCallNode(TokenPosition token_pos, |
1785 const TypeArguments& type_arguments, | 1790 const TypeArguments& type_arguments, |
1786 const Function& constructor, | 1791 const Function& constructor, |
1787 ArgumentListNode* arguments) | 1792 ArgumentListNode* arguments) |
1788 : AstNode(token_pos), | 1793 : AstNode(token_pos), |
1789 type_arguments_(type_arguments), | 1794 type_arguments_(type_arguments), |
1790 constructor_(constructor), | 1795 constructor_(constructor), |
1791 arguments_(arguments) { | 1796 arguments_(arguments) { |
1792 ASSERT(type_arguments_.IsZoneHandle()); | 1797 ASSERT(type_arguments_.IsZoneHandle()); |
1793 ASSERT(constructor_.IsZoneHandle()); | 1798 ASSERT(constructor_.IsZoneHandle()); |
1794 ASSERT(arguments_ != NULL); | 1799 ASSERT(arguments_ != NULL); |
(...skipping 16 matching lines...) Expand all Loading... |
1811 const Function& constructor_; | 1816 const Function& constructor_; |
1812 ArgumentListNode* arguments_; | 1817 ArgumentListNode* arguments_; |
1813 | 1818 |
1814 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); | 1819 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); |
1815 }; | 1820 }; |
1816 | 1821 |
1817 | 1822 |
1818 // The body of a Dart function marked as 'native' consists of this node. | 1823 // The body of a Dart function marked as 'native' consists of this node. |
1819 class NativeBodyNode : public AstNode { | 1824 class NativeBodyNode : public AstNode { |
1820 public: | 1825 public: |
1821 NativeBodyNode(intptr_t token_pos, | 1826 NativeBodyNode(TokenPosition token_pos, |
1822 const Function& function, | 1827 const Function& function, |
1823 const String& native_c_function_name, | 1828 const String& native_c_function_name, |
1824 LocalScope* scope, | 1829 LocalScope* scope, |
1825 bool link_lazily = false) | 1830 bool link_lazily = false) |
1826 : AstNode(token_pos), | 1831 : AstNode(token_pos), |
1827 function_(function), | 1832 function_(function), |
1828 native_c_function_name_(native_c_function_name), | 1833 native_c_function_name_(native_c_function_name), |
1829 scope_(scope), | 1834 scope_(scope), |
1830 link_lazily_(link_lazily) { | 1835 link_lazily_(link_lazily) { |
1831 ASSERT(function_.IsZoneHandle()); | 1836 ASSERT(function_.IsZoneHandle()); |
(...skipping 20 matching lines...) Expand all Loading... |
1852 const bool link_lazily_; | 1857 const bool link_lazily_; |
1853 | 1858 |
1854 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); | 1859 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); |
1855 }; | 1860 }; |
1856 | 1861 |
1857 | 1862 |
1858 class CatchClauseNode : public AstNode { | 1863 class CatchClauseNode : public AstNode { |
1859 public: | 1864 public: |
1860 static const intptr_t kInvalidTryIndex = -1; | 1865 static const intptr_t kInvalidTryIndex = -1; |
1861 | 1866 |
1862 CatchClauseNode(intptr_t token_pos, | 1867 CatchClauseNode(TokenPosition token_pos, |
1863 SequenceNode* catch_block, | 1868 SequenceNode* catch_block, |
1864 const Array& handler_types, | 1869 const Array& handler_types, |
1865 const LocalVariable* context_var, | 1870 const LocalVariable* context_var, |
1866 const LocalVariable* exception_var, | 1871 const LocalVariable* exception_var, |
1867 const LocalVariable* stacktrace_var, | 1872 const LocalVariable* stacktrace_var, |
1868 const LocalVariable* rethrow_exception_var, | 1873 const LocalVariable* rethrow_exception_var, |
1869 const LocalVariable* rethrow_stacktrace_var, | 1874 const LocalVariable* rethrow_stacktrace_var, |
1870 intptr_t catch_handler_index, | 1875 intptr_t catch_handler_index, |
1871 bool needs_stacktrace) | 1876 bool needs_stacktrace) |
1872 : AstNode(token_pos), | 1877 : AstNode(token_pos), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 const LocalVariable& rethrow_stacktrace_var_; | 1920 const LocalVariable& rethrow_stacktrace_var_; |
1916 const intptr_t catch_handler_index_; | 1921 const intptr_t catch_handler_index_; |
1917 const bool needs_stacktrace_; | 1922 const bool needs_stacktrace_; |
1918 | 1923 |
1919 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); | 1924 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); |
1920 }; | 1925 }; |
1921 | 1926 |
1922 | 1927 |
1923 class TryCatchNode : public AstNode { | 1928 class TryCatchNode : public AstNode { |
1924 public: | 1929 public: |
1925 TryCatchNode(intptr_t token_pos, | 1930 TryCatchNode(TokenPosition token_pos, |
1926 SequenceNode* try_block, | 1931 SequenceNode* try_block, |
1927 const LocalVariable* context_var, | 1932 const LocalVariable* context_var, |
1928 CatchClauseNode* catch_block, | 1933 CatchClauseNode* catch_block, |
1929 SequenceNode* finally_block, | 1934 SequenceNode* finally_block, |
1930 intptr_t try_index, | 1935 intptr_t try_index, |
1931 SequenceNode* rethrow_clause) | 1936 SequenceNode* rethrow_clause) |
1932 : AstNode(token_pos), | 1937 : AstNode(token_pos), |
1933 try_block_(try_block), | 1938 try_block_(try_block), |
1934 context_var_(*context_var), | 1939 context_var_(*context_var), |
1935 catch_block_(catch_block), | 1940 catch_block_(catch_block), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 SequenceNode* finally_block_; | 1973 SequenceNode* finally_block_; |
1969 const intptr_t try_index_; | 1974 const intptr_t try_index_; |
1970 SequenceNode* rethrow_clause_; | 1975 SequenceNode* rethrow_clause_; |
1971 | 1976 |
1972 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); | 1977 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); |
1973 }; | 1978 }; |
1974 | 1979 |
1975 | 1980 |
1976 class ThrowNode : public AstNode { | 1981 class ThrowNode : public AstNode { |
1977 public: | 1982 public: |
1978 ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace) | 1983 ThrowNode(TokenPosition token_pos, AstNode* exception, AstNode* stacktrace) |
1979 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) { | 1984 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) { |
1980 ASSERT(exception_ != NULL); | 1985 ASSERT(exception_ != NULL); |
1981 } | 1986 } |
1982 | 1987 |
1983 AstNode* exception() const { return exception_; } | 1988 AstNode* exception() const { return exception_; } |
1984 AstNode* stacktrace() const { return stacktrace_; } | 1989 AstNode* stacktrace() const { return stacktrace_; } |
1985 | 1990 |
1986 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1991 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1987 exception()->Visit(visitor); | 1992 exception()->Visit(visitor); |
1988 if (stacktrace() != NULL) { | 1993 if (stacktrace() != NULL) { |
1989 stacktrace()->Visit(visitor); | 1994 stacktrace()->Visit(visitor); |
1990 } | 1995 } |
1991 } | 1996 } |
1992 | 1997 |
1993 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode); | 1998 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode); |
1994 | 1999 |
1995 private: | 2000 private: |
1996 AstNode* exception_; | 2001 AstNode* exception_; |
1997 AstNode* stacktrace_; | 2002 AstNode* stacktrace_; |
1998 | 2003 |
1999 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); | 2004 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); |
2000 }; | 2005 }; |
2001 | 2006 |
2002 | 2007 |
2003 class InlinedFinallyNode : public AstNode { | 2008 class InlinedFinallyNode : public AstNode { |
2004 public: | 2009 public: |
2005 InlinedFinallyNode(intptr_t token_pos, | 2010 InlinedFinallyNode(TokenPosition token_pos, |
2006 SequenceNode* finally_block, | 2011 SequenceNode* finally_block, |
2007 const LocalVariable* context_var, | 2012 const LocalVariable* context_var, |
2008 intptr_t try_index) | 2013 intptr_t try_index) |
2009 : AstNode(token_pos), | 2014 : AstNode(token_pos), |
2010 finally_block_(finally_block), | 2015 finally_block_(finally_block), |
2011 context_var_(*context_var), | 2016 context_var_(*context_var), |
2012 try_index_(try_index) { | 2017 try_index_(try_index) { |
2013 ASSERT(finally_block_ != NULL); | 2018 ASSERT(finally_block_ != NULL); |
2014 ASSERT(context_var != NULL); | 2019 ASSERT(context_var != NULL); |
2015 } | 2020 } |
(...skipping 14 matching lines...) Expand all Loading... |
2030 const intptr_t try_index_; | 2035 const intptr_t try_index_; |
2031 | 2036 |
2032 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 2037 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
2033 }; | 2038 }; |
2034 | 2039 |
2035 } // namespace dart | 2040 } // namespace dart |
2036 | 2041 |
2037 #undef DECLARE_COMMON_NODE_FUNCTIONS | 2042 #undef DECLARE_COMMON_NODE_FUNCTIONS |
2038 | 2043 |
2039 #endif // VM_AST_H_ | 2044 #endif // VM_AST_H_ |
OLD | NEW |