| 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_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
| 6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| 11 #include "platform/globals.h" | 11 #include "platform/globals.h" |
| 12 #include "lib/invocation_mirror.h" | 12 #include "lib/invocation_mirror.h" |
| 13 #include "vm/allocation.h" | 13 #include "vm/allocation.h" |
| 14 #include "vm/ast.h" | 14 #include "vm/ast.h" |
| 15 #include "vm/class_finalizer.h" | 15 #include "vm/class_finalizer.h" |
| 16 #include "vm/compiler_stats.h" | 16 #include "vm/compiler_stats.h" |
| 17 #include "vm/object.h" | 17 #include "vm/object.h" |
| 18 #include "vm/raw_object.h" | 18 #include "vm/raw_object.h" |
| 19 #include "vm/token.h" | 19 #include "vm/token.h" |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 // Forward declarations. | 23 // Forward declarations. |
| 24 class ArgumentsDescriptor; | 24 class ArgumentsDescriptor; |
| 25 class Isolate; | 25 class Isolate; |
| 26 class LocalScope; | 26 class LocalScope; |
| 27 class LocalVariable; | 27 class LocalVariable; |
| 28 class SourceLabel; | 28 class SourceLabel; |
| 29 template <typename T> class GrowableArray; | 29 template <typename T> class GrowableArray; |
| 30 class Parser; |
| 30 | 31 |
| 31 struct CatchParamDesc; | 32 struct CatchParamDesc; |
| 32 class ClassDesc; | 33 class ClassDesc; |
| 33 struct MemberDesc; | 34 struct MemberDesc; |
| 34 struct ParamList; | 35 struct ParamList; |
| 35 struct QualIdent; | 36 struct QualIdent; |
| 36 struct TopLevel; | 37 struct TopLevel; |
| 37 | 38 |
| 38 // The class ParsedFunction holds the result of parsing a function. | 39 // The class ParsedFunction holds the result of parsing a function. |
| 39 class ParsedFunction : public ZoneAllocated { | 40 class ParsedFunction : public ZoneAllocated { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 125 } |
| 125 void AddDeferredPrefix(const LibraryPrefix& prefix); | 126 void AddDeferredPrefix(const LibraryPrefix& prefix); |
| 126 | 127 |
| 127 int first_parameter_index() const { return first_parameter_index_; } | 128 int first_parameter_index() const { return first_parameter_index_; } |
| 128 int first_stack_local_index() const { return first_stack_local_index_; } | 129 int first_stack_local_index() const { return first_stack_local_index_; } |
| 129 int num_copied_params() const { return num_copied_params_; } | 130 int num_copied_params() const { return num_copied_params_; } |
| 130 int num_stack_locals() const { return num_stack_locals_; } | 131 int num_stack_locals() const { return num_stack_locals_; } |
| 131 | 132 |
| 132 void AllocateVariables(); | 133 void AllocateVariables(); |
| 133 | 134 |
| 134 void record_await() { | 135 void record_await() { have_seen_await_expr_ = true; } |
| 135 have_seen_await_expr_ = true; | |
| 136 } | |
| 137 void reset_have_seen_await() { have_seen_await_expr_ = false; } | |
| 138 bool have_seen_await() const { return have_seen_await_expr_; } | 136 bool have_seen_await() const { return have_seen_await_expr_; } |
| 139 | 137 |
| 140 void set_saved_try_ctx(LocalVariable* saved_try_ctx) { | 138 void set_saved_try_ctx(LocalVariable* saved_try_ctx) { |
| 141 ASSERT((saved_try_ctx == NULL) || !saved_try_ctx->is_captured()); | 139 ASSERT((saved_try_ctx == NULL) || !saved_try_ctx->is_captured()); |
| 142 saved_try_ctx_ = saved_try_ctx; | 140 saved_try_ctx_ = saved_try_ctx; |
| 143 } | 141 } |
| 144 LocalVariable* saved_try_ctx() const { return saved_try_ctx_; } | 142 LocalVariable* saved_try_ctx() const { return saved_try_ctx_; } |
| 145 | 143 |
| 146 void set_async_saved_try_ctx_name(const String& async_saved_try_ctx_name) { | 144 void set_async_saved_try_ctx_name(const String& async_saved_try_ctx_name) { |
| 147 async_saved_try_ctx_name_ = async_saved_try_ctx_name.raw(); | 145 async_saved_try_ctx_name_ = async_saved_try_ctx_name.raw(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 171 int first_parameter_index_; | 169 int first_parameter_index_; |
| 172 int first_stack_local_index_; | 170 int first_stack_local_index_; |
| 173 int num_copied_params_; | 171 int num_copied_params_; |
| 174 int num_stack_locals_; | 172 int num_stack_locals_; |
| 175 bool have_seen_await_expr_; | 173 bool have_seen_await_expr_; |
| 176 LocalVariable* saved_try_ctx_; | 174 LocalVariable* saved_try_ctx_; |
| 177 String& async_saved_try_ctx_name_; | 175 String& async_saved_try_ctx_name_; |
| 178 | 176 |
| 179 Isolate* isolate_; | 177 Isolate* isolate_; |
| 180 | 178 |
| 179 friend class Parser; |
| 181 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 180 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 182 }; | 181 }; |
| 183 | 182 |
| 184 | 183 |
| 185 class Parser : public ValueObject { | 184 class Parser : public ValueObject { |
| 186 public: | 185 public: |
| 187 // Parse the top level of a whole script file and register declared classes | 186 // Parse the top level of a whole script file and register declared classes |
| 188 // in the given library. | 187 // in the given library. |
| 189 static void ParseCompilationUnit(const Library& library, | 188 static void ParseCompilationUnit(const Library& library, |
| 190 const Script& script); | 189 const Script& script); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 bool unregister_pending_function_; | 805 bool unregister_pending_function_; |
| 807 | 806 |
| 808 LocalScope* async_temp_scope_; | 807 LocalScope* async_temp_scope_; |
| 809 | 808 |
| 810 DISALLOW_COPY_AND_ASSIGN(Parser); | 809 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 811 }; | 810 }; |
| 812 | 811 |
| 813 } // namespace dart | 812 } // namespace dart |
| 814 | 813 |
| 815 #endif // VM_PARSER_H_ | 814 #endif // VM_PARSER_H_ |
| OLD | NEW |