File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,13 +181,38 @@ export const MemoryView = () => {
181181 } ) ;
182182 const id = getId ( ) ;
183183
184+ // Handle Array type specially
185+ let objAttributes : Record < string , Attribute > ;
186+ if ( klassName === "Array" ) {
187+ const length = window . prompt ( `Length of the array?` ) ;
188+ if ( length == null ) return ;
189+ const tempAttributes : Record < string , Attribute > = {
190+ length : {
191+ dataType : "int" ,
192+ value : Number . parseInt ( length ) ,
193+ } ,
194+ } ;
195+ for ( let i = 0 ; i < Number . parseInt ( length ) ; i ++ ) {
196+ tempAttributes [ `[${ i } ]` ] = {
197+ dataType : klassName ,
198+ value : undefined ,
199+ } ;
200+ }
201+ objAttributes = tempAttributes ;
202+ } else if ( klass ) {
203+ objAttributes = createAttributesForObject ( klass . attributes ) ;
204+ } else {
205+ // Unknown klass type, cannot create object
206+ return ;
207+ }
208+
184209 const newNode : CustomNodeType = {
185210 id,
186211 type : "object" ,
187212 position,
188213 data : {
189214 klass : klassName ,
190- attributes : createAttributesForObject ( klass . attributes ) ,
215+ attributes : objAttributes ,
191216 position,
192217 } ,
193218 } ;
You can’t perform that action at this time.
0 commit comments