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" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // Therefore, the statements being parsed may or may not belong to the body | 331 // Therefore, the statements being parsed may or may not belong to the body |
332 // of the current_function(); they may belong to nested functions. | 332 // of the current_function(); they may belong to nested functions. |
333 // innermost_function() is the function that is currently being parsed. | 333 // innermost_function() is the function that is currently being parsed. |
334 // It is either the same as current_function(), or a lexically nested | 334 // It is either the same as current_function(), or a lexically nested |
335 // function. | 335 // function. |
336 // The function level of the current parsing scope reflects the function | 336 // The function level of the current parsing scope reflects the function |
337 // nesting. The function level is zero while parsing the body of the | 337 // nesting. The function level is zero while parsing the body of the |
338 // current_function(), but is greater than zero while parsing the body of | 338 // current_function(), but is greater than zero while parsing the body of |
339 // local functions nested in current_function(). | 339 // local functions nested in current_function(). |
340 | 340 |
| 341 // FunctionLevel is 0 when parsing code of current_function(), and denotes |
| 342 // the relative nesting level when parsing a nested function. |
| 343 int FunctionLevel() const; |
| 344 |
341 // The class being parsed. | 345 // The class being parsed. |
342 const Class& current_class() const; | 346 const Class& current_class() const; |
343 void set_current_class(const Class& value); | 347 void set_current_class(const Class& value); |
344 | 348 |
345 // ParsedFunction accessor. | 349 // ParsedFunction accessor. |
346 ParsedFunction* parsed_function() const { | 350 ParsedFunction* parsed_function() const { |
347 return parsed_function_; | 351 return parsed_function_; |
348 } | 352 } |
349 | 353 |
350 const Script& script() const { return script_; } | 354 const Script& script() const { return script_; } |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 985 |
982 intptr_t recursion_counter_; | 986 intptr_t recursion_counter_; |
983 friend class RecursionChecker; | 987 friend class RecursionChecker; |
984 | 988 |
985 DISALLOW_COPY_AND_ASSIGN(Parser); | 989 DISALLOW_COPY_AND_ASSIGN(Parser); |
986 }; | 990 }; |
987 | 991 |
988 } // namespace dart | 992 } // namespace dart |
989 | 993 |
990 #endif // VM_PARSER_H_ | 994 #endif // VM_PARSER_H_ |
OLD | NEW |