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

If an entity does not have generics no ports are detected #4

Closed
svenn71 opened this issue Jul 28, 2016 · 2 comments
Closed

If an entity does not have generics no ports are detected #4

svenn71 opened this issue Jul 28, 2016 · 2 comments

Comments

@svenn71
Copy link

svenn71 commented Jul 28, 2016

remove the generic part of an entity and there will be no port map generated

@sneakypete81
Copy link
Owner

What we really need is a little unit testing! Thanks for reporting these issues.

@svenn71
Copy link
Author

svenn71 commented Jul 28, 2016

I have cloned your repository and started hacking a bit on my own. Found that testing for generic array length > 0 would skip creation of generics if they do not exist in the entity

diff --git a/lib/templates.js b/lib/templates.js
index ad9c748..d146854 100644
--- a/lib/templates.js
+++ b/lib/templates.js
@@ -51,7 +51,7 @@ function componentTemplate(entity) {

 function instanceTemplate(entity) {
   text = `${entity.name}_i : ${entity.name}\n`
-  if (entity.generics) {
+  if (entity.generics > 0) {
     text += `generic map (\n`
     longest = longestinArray(entity.generics, "name")
     for (generic of entity.generics) {

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