OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PARSING_FUNC_NAME_INFERRER_H_ | 5 #ifndef V8_PARSING_FUNC_NAME_INFERRER_H_ |
6 #define V8_PARSING_FUNC_NAME_INFERRER_H_ | 6 #define V8_PARSING_FUNC_NAME_INFERRER_H_ |
7 | 7 |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 funcs_to_infer_.Add(func_to_infer, zone()); | 64 funcs_to_infer_.Add(func_to_infer, zone()); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 void RemoveLastFunction() { | 68 void RemoveLastFunction() { |
69 if (IsOpen() && !funcs_to_infer_.is_empty()) { | 69 if (IsOpen() && !funcs_to_infer_.is_empty()) { |
70 funcs_to_infer_.RemoveLast(); | 70 funcs_to_infer_.RemoveLast(); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
| 74 int LastNameIndex() const { return this->names_stack_.length() - 1; } |
| 75 |
| 76 void RemoveNameAtIndex(int index) { |
| 77 DCHECK(index >= 0); |
| 78 DCHECK(index < names_stack_.length()); |
| 79 names_stack_.Remove(index); |
| 80 } |
| 81 |
| 82 void RemoveLastName() { |
| 83 DCHECK(names_stack_.length() > 0); |
| 84 RemoveNameAtIndex(names_stack_.length() - 1); |
| 85 } |
| 86 |
74 // Infers a function name and leaves names collection state. | 87 // Infers a function name and leaves names collection state. |
75 void Infer() { | 88 void Infer() { |
76 DCHECK(IsOpen()); | 89 DCHECK(IsOpen()); |
77 if (!funcs_to_infer_.is_empty()) { | 90 if (!funcs_to_infer_.is_empty()) { |
78 InferFunctionsNames(); | 91 InferFunctionsNames(); |
79 } | 92 } |
80 } | 93 } |
81 | 94 |
82 private: | 95 private: |
83 enum NameType { | 96 enum NameType { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 Zone* zone_; | 131 Zone* zone_; |
119 | 132 |
120 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); | 133 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); |
121 }; | 134 }; |
122 | 135 |
123 | 136 |
124 } // namespace internal | 137 } // namespace internal |
125 } // namespace v8 | 138 } // namespace v8 |
126 | 139 |
127 #endif // V8_PARSING_FUNC_NAME_INFERRER_H_ | 140 #endif // V8_PARSING_FUNC_NAME_INFERRER_H_ |
OLD | NEW |