foam-framework / foam

Feature-Oriented Active Modeller
Apache License 2.0
787 stars 55 forks source link

Last line of code doesn't execute in a U2 template #533

Open adamvy-google opened 8 years ago

adamvy-google commented 8 years ago

Example:

CLASS({ package: 'foam.demos', name: 'Test', extends: 'foam.u2.View', templates: [ function initE() {/*#U2

((console.log("foo");))

((console.log("bar");)) */} ] });

If you run this view, you only see "foo" in the console, "bar" is never outputted. Examining the generated code shows that console.log("bar"); isn't even included.

We should either support this case, or warn if it happens.

kgrgreer commented 8 years ago

Will fix.

adamvy-google commented 8 years ago

Similarly, starting a template with a code statement throws an error as well.

kgrgreer commented 8 years ago

I'm not sure if we can allow code statements before you start an element, but if not, we should at least produce an error.

kgrgreer commented 8 years ago

The code needs to be inside a tag. We need to report template errors.