Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 4fe27e2e5a364a79c103051da3159938b991e21a..59e6afdd220b385645b3e751a2961ca275334ad8 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -460,12 +460,24 @@ class ParserBase { |
return next_function_is_parenthesized_; |
} |
+ bool this_function_is_parenthesized() const { |
+ return this_function_is_parenthesized_; |
+ } |
+ |
void set_next_function_is_parenthesized(bool parenthesized) { |
next_function_is_parenthesized_ = parenthesized; |
} |
- bool this_function_is_parenthesized() const { |
- return this_function_is_parenthesized_; |
+ bool next_function_is_exclaimed() const { |
+ return next_function_is_exclaimed_; |
+ } |
+ |
+ bool this_function_is_exclaimed() const { |
+ return this_function_is_exclaimed_; |
+ } |
+ |
+ void set_next_function_is_exclaimed(bool exclaimed) { |
+ next_function_is_exclaimed_ = exclaimed; |
} |
private: |
@@ -507,12 +519,14 @@ class ParserBase { |
ZoneList<typename ExpressionClassifier::Error> reported_errors_; |
// If true, the next (and immediately following) function literal is |
- // preceded by a parenthesis. |
+ // preceded by a parenthesis / exclamation mark. |
bool next_function_is_parenthesized_; |
+ bool next_function_is_exclaimed_; |
- // The value of the parents' next_function_is_parenthesized_, as it applies |
+ // The value of the parents' next_function_is_*_, as it applies |
// to this function. Filled in by constructor. |
bool this_function_is_parenthesized_; |
+ bool this_function_is_exclaimed_; |
friend Impl; |
friend class Checkpoint; |
@@ -1464,12 +1478,17 @@ ParserBase<Impl>::FunctionState::FunctionState( |
non_patterns_to_rewrite_(0, scope->zone()), |
reported_errors_(16, scope->zone()), |
next_function_is_parenthesized_(false), |
- this_function_is_parenthesized_(false) { |
+ next_function_is_exclaimed_(false), |
+ this_function_is_parenthesized_(false), |
+ this_function_is_exclaimed_(false) { |
*function_state_stack = this; |
if (outer_function_state_) { |
this_function_is_parenthesized_ = |
outer_function_state_->next_function_is_parenthesized_; |
outer_function_state_->next_function_is_parenthesized_ = false; |
+ this_function_is_exclaimed_ = |
+ outer_function_state_->next_function_is_exclaimed_; |
+ outer_function_state_->next_function_is_exclaimed_ = false; |
vogelheim
2016/11/17 12:09:48
self-nitpick: :) All this flag handling is rather
|
} |
} |
@@ -2941,6 +2960,11 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression( |
op = Next(); |
int pos = position(); |
+ |
+ // Record occurrence of "! function ..." |
+ function_state_->set_next_function_is_exclaimed(op == Token::NOT && |
+ peek() == Token::FUNCTION); |
+ |
ExpressionT expression = ParseUnaryExpression(CHECK_OK); |
impl()->RewriteNonPattern(CHECK_OK); |