void synthesizeConstructors(Program& program) { FindAllTypes findAllTypes; findAllTypes.checkErrorAndVisit(program); auto m_unnamedTypes = findAllTypes.takeUnnamedTypes(); auto m_namedTypes = findAllTypes.takeNamedTypes(); bool isOperator = true; for (auto& unnamedType : m_unnamedTypes) { AST::VariableDeclaration variableDeclaration(Lexer::Token(unnamedType.get().origin()), AST::Qualifiers(), { unnamedType.get().clone() }, String(), WTF::nullopt, WTF::nullopt); AST::VariableDeclarations parameters; parameters.append(WTFMove(variableDeclaration)); AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.get().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator)); program.append(WTFMove(copyConstructor)); AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.get().clone(), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator)); program.append(WTFMove(defaultConstructor)); } for (auto& namedType : m_namedTypes) { AST::VariableDeclaration variableDeclaration(Lexer::Token(namedType.get().origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()) }, String(), WTF::nullopt, WTF::nullopt); AST::VariableDeclarations parameters; parameters.append(WTFMove(variableDeclaration)); AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator)); program.append(WTFMove(copyConstructor)); AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator)); program.append(WTFMove(defaultConstructor)); } }
void TestVector::all() { emptyConstructor(); paramConstructor(); copyConstructor(); assignmentOperator(); get(); getSize(); getMaxSize(); insert(); clear(); empty(); increaseSize(); }
ArrayList::ArrayList(const ArrayList& pattern, bool deepCopy) { copyConstructor(pattern, deepCopy); }
ArrayList::ArrayList(const ArrayList& pattern) { copyConstructor(pattern); }