Пример #1
0
std::vector<Type*> FunctionReference::getTargetArguments() {
    std::vector<Type*> args;

    for (unsigned int i = 0; i < getArgTypes().size(); i++) {
        if (getArgTypes()[i].get() == nullptr) {
            args.push_back(getTypeManager().getType(TypeUnresolved));
        } else {
            args.push_back(getArgTypes()[i]->type());
        }
    }

    return args;
}
Пример #2
0
Any Serializer::deserializeAsClass(IClassMeta* classMeta)
{
    auto serializeConstructor = findSerializeConstructor(classMeta);
    if (serializeConstructor != nullptr)
    {
        auto argType = serializeConstructor->getArgTypes()[0];
        auto arg = deserialize(argType);
        return serializeConstructor->invoke(arg);
    }

    auto object = classMeta->create();
    auto pointer = classMeta->makePointer(object);
    deserializeClassFields(pointer, classMeta);
    return object;
}
Пример #3
0
void SemanticsVisitor::visit(CallingNode& cn) {
	cn.getFunctionName()->accept(*this);
	try {
		if (FunctionAttributes* attr =
				dynamic_cast<FunctionAttributes*>(
						currentSymbolTable().retrieveSymbol(cn.getFunctionName()->name()))) {
			if (applicable(
					attr->getSignature(),
					getArgTypes(cn.getArgList()))) {

			} else {
				errorLog() << "Provided parameter not applicable. Expected: " << cn.getFunctionName()->name() << "\n"; // TODO expected...print signature
				cn.setType(0); // NOTICE by design, null attribute and error type is 0.
			}
		} else {
			errorLog() << cn.getFunctionName()->name() << " is not a function name.\n";
			cn.setType(0); // NOTICE by design, null attribute and error type is 0.
		}
	} catch (std::runtime_error& e) {
		errorLog() << "Function " << cn.getFunctionName()->name() << " undeclared.\n";
		cn.setType(0); // NOTICE by design, null attribute and error type is 0.
	}
}