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

enum in struct #358

Open
boaks opened this issue Aug 16, 2019 · 2 comments
Open

enum in struct #358

boaks opened this issue Aug 16, 2019 · 2 comments
Labels
Bug Something isn't working good first issue Good for newcomers

Comments

@boaks
Copy link

boaks commented Aug 16, 2019

enum Feature {
    Temperature,
    Pressure,
    Humidity,
    Illuminance,
    Accelerometer,
    Gyroscope,
    Magnetometer
}

struct Sensor {
	var current : float;
	var min : float;
	var max : float;
	var init : bool;
	var feature : Feature;
}

Results in

typedef struct {
	float current;
	float min;
	float max;
	bool init;
	Feature feature;
} Sensor;

typedef enum {
	Temperature,
	Pressure,
	Humidity,
	Illuminance,
	Accelerometer,
	Gyroscope,
	Magnetometer
} Feature;

and error: "unknown type name 'Feature'"

@wegendt-bosch
Copy link
Contributor

wegendt-bosch commented Sep 5, 2019

This chould already be fixed in master since some point after the new type system. Are you using master or the XDK Workbench 3.*? Nope, not fixed.

@wegendt-bosch wegendt-bosch added Bug Something isn't working good first issue Good for newcomers labels Sep 5, 2019
@wegendt-bosch
Copy link
Contributor

We might have to do something similar to how we handle system resource initialization and create a graph of dependencies, then do a topological sort.

Since structs may reference one another via references, those have to be excluded when collecting dependencies, and forward declared when translating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants