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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 Handle<String> dot_; | 92 Handle<String> dot_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); | 94 DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer); |
95 }; | 95 }; |
96 | 96 |
97 | 97 |
98 // A wrapper class that automatically calls InferAndLeave when | 98 // A wrapper class that automatically calls InferAndLeave when |
99 // leaving scope. | 99 // leaving scope. |
100 class ScopedFuncNameInferrer BASE_EMBEDDED { | 100 class ScopedFuncNameInferrer BASE_EMBEDDED { |
101 public: | 101 public: |
102 ScopedFuncNameInferrer(FuncNameInferrer* inferrer) : inferrer_(inferrer), | 102 explicit ScopedFuncNameInferrer(FuncNameInferrer* inferrer) : |
103 is_entered_(false) {}; | 103 inferrer_(inferrer), |
| 104 is_entered_(false) {} |
104 ~ScopedFuncNameInferrer() { | 105 ~ScopedFuncNameInferrer() { |
105 if (is_entered_) { | 106 if (is_entered_) { |
106 inferrer_->InferAndLeave(); | 107 inferrer_->InferAndLeave(); |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 void Enter() { | 111 void Enter() { |
111 inferrer_->Enter(); | 112 inferrer_->Enter(); |
112 is_entered_ = true; | 113 is_entered_ = true; |
113 } | 114 } |
114 | 115 |
115 private: | 116 private: |
116 FuncNameInferrer* inferrer_; | 117 FuncNameInferrer* inferrer_; |
117 bool is_entered_; | 118 bool is_entered_; |
118 | 119 |
119 DISALLOW_COPY_AND_ASSIGN(ScopedFuncNameInferrer); | 120 DISALLOW_COPY_AND_ASSIGN(ScopedFuncNameInferrer); |
120 }; | 121 }; |
121 | 122 |
122 | 123 |
123 } } // namespace v8::internal | 124 } } // namespace v8::internal |
124 | 125 |
125 #endif // V8_FUNC_NAME_INFERRER_H_ | 126 #endif // V8_FUNC_NAME_INFERRER_H_ |
OLD | NEW |