Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orange error checking invalid #47

Open
Aphexus opened this issue May 27, 2018 · 1 comment
Open

Orange error checking invalid #47

Aphexus opened this issue May 27, 2018 · 1 comment

Comments

@Aphexus
Copy link

Aphexus commented May 27, 2018

The error handling routine is broke. Uses goto error: and static if where the error label is not defined in the errored branch.

These lines occur around
1200 in serializer.d

    else static if (isPointer!(T))
    {
        static if (isFunctionPointer!(T))
		{
            goto error;
		}

        return deserializePointer!(T)(keyOrId, id).value;
    }

    else static if (isEnum!(T))
        return deserializeEnum!(T)(keyOrId, id);

    else
    {
        error:
        error(format!(`The type "`, T, `" cannot be deserialized.`));
    }
}

simply removing the final else should solve the problem and be sufficient.

Actually it doesn't and causes a serialization error to occur for obvious reasons. Better just to put in the error(...) directly and avoid the goto.

  1. Does not handle delegate types properly and craps out after a lot of code.

"Error: new can only create structs, dynamic arrays or class objects, not bool(a,b)'s

This occurs around 1500:

    auto pointer = new UnqualfiedBaseType;

But starts earlier. I can see that

instantiated from here: deserializeInternal!(bool function(a, b)
......\D\Libraries\orange\serialization\Serializer.d(1272): instantiated from here: objectStructDeserializeHelper!(Del!(bool function(a, b)))
......\D\Libraries\orange\serialization\Serializer.d(1175): instantiated from here: deserializeObject!(Del!(bool function(a, b))
......\D\Libraries\orange\serialization\Serializer.d(1689): instantiated from here: deserializeInternal!(Del!(bool function(a, b))
......\D\Libraries\orange\serialization\Serializer.d(1720): instantiated from here: objectStructDeserializeHelper!(Item)

It might be better to handle these better. If they need to be serialized somehow then a custom serializer would need to be used.

@jacob-carlborg
Copy link
Owner

What are you exactly doing? Is there an example you're compiling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants