Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: src/parsing/func-name-inferrer.h

Issue 2235423003: [parser] improve inferred function names for async arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698