summaryrefslogtreecommitdiffstats
path: root/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/src')
-rw-r--r--js/src/frontend/Parser.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index c34e4d563..5a42b75b0 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -6578,24 +6578,6 @@ JSOpFromPropertyType(PropertyType propType)
}
}
-static GeneratorKind
-GeneratorKindFromPropertyType(PropertyType propType)
-{
- if (propType == PropertyType::GeneratorMethod)
- return StarGenerator;
- if (propType == PropertyType::AsyncMethod)
- return StarGenerator;
- return NotGenerator;
-}
-
-static FunctionAsyncKind
-AsyncKindFromPropertyType(PropertyType propType)
-{
- if (propType == PropertyType::AsyncMethod)
- return AsyncFunction;
- return SyncFunction;
-}
-
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
@@ -9437,8 +9419,15 @@ Parser<ParseHandler>::methodDefinition(uint32_t preludeStart, PropertyType propT
MOZ_CRASH("Parser: methodDefinition: unexpected property type");
}
- GeneratorKind generatorKind = GeneratorKindFromPropertyType(propType);
- FunctionAsyncKind asyncKind = AsyncKindFromPropertyType(propType);
+ GeneratorKind generatorKind = (propType == PropertyType::GeneratorMethod ||
+ propType == PropertyType::AsyncMethod)
+ ? StarGenerator
+ : NotGenerator;
+
+ FunctionAsyncKind asyncKind = (propType == PropertyType::AsyncMethod)
+ ? AsyncFunction
+ : SyncFunction;
+
YieldHandling yieldHandling = GetYieldHandling(generatorKind, asyncKind);
Node pn = handler.newFunctionExpression();