On Tue, Jun 2, 2015 at 2:42 PM, Alex Harui <aha...@adobe.com> wrote: > OK, thanks for verifying. And I think in AS, the array is not shared. > > So I think Mike has two choices: > 1) initialize everything in the constructor > 2) be smart about what can be initialized in the constructor vs the > prototype. > > I’ll leave it up to Mike to decide. We can always be smarter later. >
I think this in some incarnation will do. :) (from the other compiler...) protected void emitConstructorFieldInitializers( IFunctionDefinition definition) { IClassDefinition type = (IClassDefinition) definition .getAncestorOfType(IClassDefinition.class); // emit public fields init values List<IVariableDefinition> fields = DefinitionUtils.getFields(type, false); //final int len = fields.size(); //int i = 0; for (IVariableDefinition field : fields) { IMetaTag tag = field.getMetaTagByName("Embed"); if (tag != null) { emitEmbed(field); writeNewline(";"); continue; } if (field instanceof IAccessorDefinition) continue; // constants do not get initialized if (field instanceof IConstantDefinition) continue; if (DefinitionUtils.isVariableAParameter(field, definition.getParameters())) continue; write("this."); write(field.getBaseName()); write(" = "); String value = DefinitionUtils.returnInitialVariableValue( (IVariableNode) field.getNode(), getEmitter()); write(value); //if (i < len - 1) writeNewline(";"); //else // write(";"); } } Mike > > -Alex > > On 6/2/15, 11:36 AM, "Erik de Bruin" <e...@ixsoftware.nl> wrote: > > >> Then all instances share the one array... > >>> > >> > >> That sounds not right. I'll have to do some experimenting to disprove > >> that, but it just doesn't ring true. > >> > > > >Oh. Well, I guess you learn every day :-) A quick 'JSFiddle' shows that > >they indeed seem to share the same array :-( > > > >No more time to look into this, I'm afraid. But point taken, this needs to > >be addressed. > > > >EdB > > > > > > > >-- > >Ix Multimedia Software > > > >Jan Luykenstraat 27 > >3521 VB Utrecht > > > >T. 06-51952295 > >I. www.ixsoftware.nl > >