OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 RUNTIME_VM_KERNEL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_H_ |
6 #define RUNTIME_VM_KERNEL_H_ | 6 #define RUNTIME_VM_KERNEL_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 481 |
482 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 482 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
483 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0; | 483 virtual void AcceptClassVisitor(ClassVisitor* visitor) = 0; |
484 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor) = 0; | 484 virtual void AcceptReferenceVisitor(ClassReferenceVisitor* visitor) = 0; |
485 | 485 |
486 Library* parent() { return parent_; } | 486 Library* parent() { return parent_; } |
487 String* name() { return name_; } | 487 String* name() { return name_; } |
488 intptr_t source_uri_index() { return source_uri_index_; } | 488 intptr_t source_uri_index() { return source_uri_index_; } |
489 bool is_abstract() { return is_abstract_; } | 489 bool is_abstract() { return is_abstract_; } |
490 List<Expression>& annotations() { return annotations_; } | 490 List<Expression>& annotations() { return annotations_; } |
| 491 TokenPosition position() { return position_; } |
491 | 492 |
492 virtual List<TypeParameter>& type_parameters() = 0; | 493 virtual List<TypeParameter>& type_parameters() = 0; |
493 virtual List<InterfaceType>& implemented_classes() = 0; | 494 virtual List<InterfaceType>& implemented_classes() = 0; |
494 virtual List<Field>& fields() = 0; | 495 virtual List<Field>& fields() = 0; |
495 virtual List<Constructor>& constructors() = 0; | 496 virtual List<Constructor>& constructors() = 0; |
496 virtual List<Procedure>& procedures() = 0; | 497 virtual List<Procedure>& procedures() = 0; |
497 | 498 |
498 protected: | 499 protected: |
499 Class() : is_abstract_(false) {} | 500 Class() : is_abstract_(false), position_(TokenPosition::kNoSource) {} |
500 | 501 |
501 private: | 502 private: |
502 template <typename T> | 503 template <typename T> |
503 friend class List; | 504 friend class List; |
504 | 505 |
505 Ref<Library> parent_; | 506 Ref<Library> parent_; |
506 Ref<String> name_; | 507 Ref<String> name_; |
507 intptr_t source_uri_index_; | 508 intptr_t source_uri_index_; |
508 bool is_abstract_; | 509 bool is_abstract_; |
509 List<Expression> annotations_; | 510 List<Expression> annotations_; |
| 511 TokenPosition position_; |
510 | 512 |
511 DISALLOW_COPY_AND_ASSIGN(Class); | 513 DISALLOW_COPY_AND_ASSIGN(Class); |
512 }; | 514 }; |
513 | 515 |
514 | 516 |
515 class NormalClass : public Class { | 517 class NormalClass : public Class { |
516 public: | 518 public: |
517 NormalClass* ReadFrom(Reader* reader); | 519 NormalClass* ReadFrom(Reader* reader); |
518 void WriteTo(Writer* writer); | 520 void WriteTo(Writer* writer); |
519 | 521 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 602 |
601 DEFINE_CASTING_OPERATIONS(Member); | 603 DEFINE_CASTING_OPERATIONS(Member); |
602 | 604 |
603 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 605 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
604 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; | 606 virtual void AcceptMemberVisitor(MemberVisitor* visitor) = 0; |
605 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0; | 607 virtual void AcceptReferenceVisitor(MemberReferenceVisitor* visitor) = 0; |
606 | 608 |
607 TreeNode* parent() { return parent_; } | 609 TreeNode* parent() { return parent_; } |
608 Name* name() { return name_; } | 610 Name* name() { return name_; } |
609 List<Expression>& annotations() { return annotations_; } | 611 List<Expression>& annotations() { return annotations_; } |
| 612 TokenPosition position() { return position_; } |
| 613 TokenPosition end_position() { return end_position_; } |
610 | 614 |
611 protected: | 615 protected: |
612 Member() {} | 616 Member() |
| 617 : position_(TokenPosition::kNoSource), |
| 618 end_position_(TokenPosition::kNoSource) {} |
613 | 619 |
614 template <typename T> | 620 template <typename T> |
615 friend class List; | 621 friend class List; |
616 | 622 |
617 Ref<TreeNode> parent_; | 623 Ref<TreeNode> parent_; |
618 Child<Name> name_; | 624 Child<Name> name_; |
619 List<Expression> annotations_; | 625 List<Expression> annotations_; |
| 626 TokenPosition position_; |
| 627 TokenPosition end_position_; |
620 | 628 |
621 private: | 629 private: |
622 DISALLOW_COPY_AND_ASSIGN(Member); | 630 DISALLOW_COPY_AND_ASSIGN(Member); |
623 }; | 631 }; |
624 | 632 |
625 | 633 |
626 class Field : public Member { | 634 class Field : public Member { |
627 public: | 635 public: |
628 enum Flags { | 636 enum Flags { |
629 kFlagFinal = 1 << 0, | 637 kFlagFinal = 1 << 0, |
(...skipping 13 matching lines...) Expand all Loading... |
643 virtual void VisitChildren(Visitor* visitor); | 651 virtual void VisitChildren(Visitor* visitor); |
644 | 652 |
645 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } | 653 bool IsConst() { return (flags_ & kFlagConst) == kFlagConst; } |
646 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } | 654 bool IsFinal() { return (flags_ & kFlagFinal) == kFlagFinal; } |
647 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } | 655 bool IsStatic() { return (flags_ & kFlagStatic) == kFlagStatic; } |
648 intptr_t source_uri_index() { return source_uri_index_; } | 656 intptr_t source_uri_index() { return source_uri_index_; } |
649 | 657 |
650 DartType* type() { return type_; } | 658 DartType* type() { return type_; } |
651 InferredValue* inferred_value() { return inferred_value_; } | 659 InferredValue* inferred_value() { return inferred_value_; } |
652 Expression* initializer() { return initializer_; } | 660 Expression* initializer() { return initializer_; } |
653 TokenPosition position() { return position_; } | |
654 | 661 |
655 private: | 662 private: |
656 Field() : position_(TokenPosition::kNoSource) {} | 663 Field() {} |
657 | 664 |
658 template <typename T> | 665 template <typename T> |
659 friend class List; | 666 friend class List; |
660 | 667 |
661 word flags_; | 668 word flags_; |
662 intptr_t source_uri_index_; | 669 intptr_t source_uri_index_; |
663 Child<DartType> type_; | 670 Child<DartType> type_; |
664 Child<InferredValue> inferred_value_; | 671 Child<InferredValue> inferred_value_; |
665 Child<Expression> initializer_; | 672 Child<Expression> initializer_; |
666 TokenPosition position_; | |
667 | 673 |
668 DISALLOW_COPY_AND_ASSIGN(Field); | 674 DISALLOW_COPY_AND_ASSIGN(Field); |
669 }; | 675 }; |
670 | 676 |
671 | 677 |
672 class Constructor : public Member { | 678 class Constructor : public Member { |
673 public: | 679 public: |
674 enum Flags { | 680 enum Flags { |
675 kFlagConst = 1 << 0, | 681 kFlagConst = 1 << 0, |
676 kFlagExternal = 1 << 1, | 682 kFlagExternal = 1 << 1, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 void WriteTo(Writer* writer); | 918 void WriteTo(Writer* writer); |
913 | 919 |
914 virtual ~FunctionNode(); | 920 virtual ~FunctionNode(); |
915 | 921 |
916 DEFINE_CASTING_OPERATIONS(FunctionNode); | 922 DEFINE_CASTING_OPERATIONS(FunctionNode); |
917 | 923 |
918 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 924 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
919 virtual void VisitChildren(Visitor* visitor); | 925 virtual void VisitChildren(Visitor* visitor); |
920 | 926 |
921 AsyncMarker async_marker() { return async_marker_; } | 927 AsyncMarker async_marker() { return async_marker_; } |
| 928 bool debuggable() { return debuggable_; } |
922 TypeParameterList& type_parameters() { return type_parameters_; } | 929 TypeParameterList& type_parameters() { return type_parameters_; } |
923 int required_parameter_count() { return required_parameter_count_; } | 930 int required_parameter_count() { return required_parameter_count_; } |
924 List<VariableDeclaration>& positional_parameters() { | 931 List<VariableDeclaration>& positional_parameters() { |
925 return positional_parameters_; | 932 return positional_parameters_; |
926 } | 933 } |
927 List<VariableDeclaration>& named_parameters() { return named_parameters_; } | 934 List<VariableDeclaration>& named_parameters() { return named_parameters_; } |
928 DartType* return_type() { return return_type_; } | 935 DartType* return_type() { return return_type_; } |
929 InferredValue* inferred_return_value() { return inferred_return_value_; } | 936 InferredValue* inferred_return_value() { return inferred_return_value_; } |
930 Statement* body() { return body_; } | 937 Statement* body() { return body_; } |
| 938 TokenPosition position() { return position_; } |
| 939 TokenPosition end_position() { return end_position_; } |
931 | 940 |
932 private: | 941 private: |
933 FunctionNode() {} | 942 FunctionNode() |
| 943 : position_(TokenPosition::kNoSource), |
| 944 end_position_(TokenPosition::kNoSource) {} |
934 | 945 |
935 AsyncMarker async_marker_; | 946 AsyncMarker async_marker_; |
| 947 bool debuggable_; |
936 TypeParameterList type_parameters_; | 948 TypeParameterList type_parameters_; |
937 int required_parameter_count_; | 949 int required_parameter_count_; |
938 List<VariableDeclaration> positional_parameters_; | 950 List<VariableDeclaration> positional_parameters_; |
939 List<VariableDeclaration> named_parameters_; | 951 List<VariableDeclaration> named_parameters_; |
940 Child<DartType> return_type_; | 952 Child<DartType> return_type_; |
941 Child<InferredValue> inferred_return_value_; | 953 Child<InferredValue> inferred_return_value_; |
942 Child<Statement> body_; | 954 Child<Statement> body_; |
| 955 TokenPosition position_; |
| 956 TokenPosition end_position_; |
943 | 957 |
944 DISALLOW_COPY_AND_ASSIGN(FunctionNode); | 958 DISALLOW_COPY_AND_ASSIGN(FunctionNode); |
945 }; | 959 }; |
946 | 960 |
947 | 961 |
948 class Expression : public TreeNode { | 962 class Expression : public TreeNode { |
949 public: | 963 public: |
950 static Expression* ReadFrom(Reader* reader); | 964 static Expression* ReadFrom(Reader* reader); |
951 virtual void WriteTo(Writer* writer) = 0; | 965 virtual void WriteTo(Writer* writer) = 0; |
952 | 966 |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 | 1900 |
1887 virtual ~Let(); | 1901 virtual ~Let(); |
1888 | 1902 |
1889 DEFINE_CASTING_OPERATIONS(Let); | 1903 DEFINE_CASTING_OPERATIONS(Let); |
1890 | 1904 |
1891 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1905 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
1892 virtual void VisitChildren(Visitor* visitor); | 1906 virtual void VisitChildren(Visitor* visitor); |
1893 | 1907 |
1894 VariableDeclaration* variable() { return variable_; } | 1908 VariableDeclaration* variable() { return variable_; } |
1895 Expression* body() { return body_; } | 1909 Expression* body() { return body_; } |
| 1910 TokenPosition position() { return position_; } |
| 1911 TokenPosition end_position() { return end_position_; } |
1896 | 1912 |
1897 private: | 1913 private: |
1898 Let() {} | 1914 Let() |
| 1915 : position_(TokenPosition::kNoSource), |
| 1916 end_position_(TokenPosition::kNoSource) {} |
1899 | 1917 |
1900 Child<VariableDeclaration> variable_; | 1918 Child<VariableDeclaration> variable_; |
1901 Child<Expression> body_; | 1919 Child<Expression> body_; |
| 1920 TokenPosition position_; |
| 1921 TokenPosition end_position_; |
1902 | 1922 |
1903 DISALLOW_COPY_AND_ASSIGN(Let); | 1923 DISALLOW_COPY_AND_ASSIGN(Let); |
1904 }; | 1924 }; |
1905 | 1925 |
1906 | 1926 |
1907 class Statement : public TreeNode { | 1927 class Statement : public TreeNode { |
1908 public: | 1928 public: |
1909 static Statement* ReadFrom(Reader* reader); | 1929 static Statement* ReadFrom(Reader* reader); |
1910 virtual void WriteTo(Writer* writer) = 0; | 1930 virtual void WriteTo(Writer* writer) = 0; |
1911 | 1931 |
1912 virtual ~Statement(); | 1932 virtual ~Statement(); |
1913 | 1933 |
1914 DEFINE_CASTING_OPERATIONS(Statement); | 1934 DEFINE_CASTING_OPERATIONS(Statement); |
1915 | 1935 |
1916 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 1936 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
1917 virtual void AcceptStatementVisitor(StatementVisitor* visitor) = 0; | 1937 virtual void AcceptStatementVisitor(StatementVisitor* visitor) = 0; |
| 1938 TokenPosition position() { return position_; } |
1918 | 1939 |
1919 protected: | 1940 protected: |
1920 Statement() {} | 1941 Statement() : position_(TokenPosition::kNoSource) {} |
| 1942 TokenPosition position_; |
1921 | 1943 |
1922 private: | 1944 private: |
1923 DISALLOW_COPY_AND_ASSIGN(Statement); | 1945 DISALLOW_COPY_AND_ASSIGN(Statement); |
1924 }; | 1946 }; |
1925 | 1947 |
1926 | 1948 |
1927 class InvalidStatement : public Statement { | 1949 class InvalidStatement : public Statement { |
1928 public: | 1950 public: |
1929 static InvalidStatement* ReadFrom(Reader* reader); | 1951 static InvalidStatement* ReadFrom(Reader* reader); |
1930 virtual void WriteTo(Writer* writer); | 1952 virtual void WriteTo(Writer* writer); |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3238 }; | 3260 }; |
3239 | 3261 |
3240 | 3262 |
3241 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); | 3263 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); |
3242 | 3264 |
3243 | 3265 |
3244 } // namespace dart | 3266 } // namespace dart |
3245 | 3267 |
3246 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3268 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
3247 #endif // RUNTIME_VM_KERNEL_H_ | 3269 #endif // RUNTIME_VM_KERNEL_H_ |
OLD | NEW |