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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 void PushName(Handle<String> name) { | 65 void PushName(Handle<String> name) { |
66 if (IsOpen()) { | 66 if (IsOpen()) { |
67 names_stack_.Add(name); | 67 names_stack_.Add(name); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void SetFuncToInfer(FunctionLiteral* func_to_infer) { | 71 void SetFuncToInfer(FunctionLiteral* func_to_infer) { |
72 if (IsOpen()) { | 72 if (IsOpen()) { |
73 ASSERT(func_to_infer_ == NULL); | 73 // If we encounter another function literal after already having |
| 74 // encountered one, the second one replaces the first. |
74 func_to_infer_ = func_to_infer; | 75 func_to_infer_ = func_to_infer; |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 void InferAndLeave() { | 79 void InferAndLeave() { |
79 ASSERT(IsOpen()); | 80 ASSERT(IsOpen()); |
80 MaybeInferFunctionName(); | 81 MaybeInferFunctionName(); |
81 Leave(); | 82 Leave(); |
82 } | 83 } |
83 | 84 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 FuncNameInferrer* inferrer_; | 118 FuncNameInferrer* inferrer_; |
118 bool is_entered_; | 119 bool is_entered_; |
119 | 120 |
120 DISALLOW_COPY_AND_ASSIGN(ScopedFuncNameInferrer); | 121 DISALLOW_COPY_AND_ASSIGN(ScopedFuncNameInferrer); |
121 }; | 122 }; |
122 | 123 |
123 | 124 |
124 } } // namespace v8::internal | 125 } } // namespace v8::internal |
125 | 126 |
126 #endif // V8_FUNC_NAME_INFERRER_H_ | 127 #endif // V8_FUNC_NAME_INFERRER_H_ |
OLD | NEW |