Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tree.elements.forEach(function(elementTree) {
if (elementTree.type === PROPERTY_METHOD_ASSIGNMENT &&
!elementTree.isStatic &&
propName(elementTree) === CONSTRUCTOR) {
// Store constructor argument types,
// so that we can use them to set the types of simple-assigned fields.
elementTree.parameterList.parameters.forEach(function(p) {
var binding = p.parameter.binding;
if (binding.identifierToken) {
argumentTypesMap[binding.identifierToken.value] = p.typeAnnotation;
}
});
// Rename "constructor" to the class name.
elementTree.name.literalToken.value = className;
// Collect all fields, defined in the constructor.
elementTree.body.statements.forEach(function(statement) {
if (statement.expression.type === BINARY_EXPRESSION &&
tree.elements.forEach(function(elementTree, index) {
if (elementTree.type === PROPERTY_METHOD_ASSIGNMENT &&
!elementTree.isStatic &&
propName(elementTree) === CONSTRUCTOR) {
hasConstructor = true;
isConst = elementTree.annotations.some(that._isConstAnnotation);
// Store constructor argument types,
// so that we can use them to set the types of simple-assigned fields.
elementTree.parameterList.parameters.forEach(function(p) {
var binding = p.parameter.binding;
if (binding && binding.identifierToken) {
argumentTypesMap[binding.identifierToken.value] = p.typeAnnotation;
}
});
// Rename "constructor" to the class name.
elementTree.name.literalToken.value = className;