diff --git a/view/tree2/class/props.ts b/view/tree2/class/props.ts index ffee5224820..0809cff5152 100644 --- a/view/tree2/class/props.ts +++ b/view/tree2/class/props.ts @@ -18,7 +18,15 @@ namespace $ { }) ) - const props_inner = [] as $mol_tree2[] + const props_inner = {} as Record + + const add_inner = ( prop: $mol_tree2 ) => { + const prev = props_inner[prop.type] + if (prev && prev.kids[0]?.type !== prop.kids[0]?.type) { + this.$mol_fail(err`Different kids ${prev.span} vs ${prop.span}`) + } + props_inner[prop.type] = prop + } const props_root = props.hack({ @@ -27,7 +35,7 @@ namespace $ { const prop = this.$mol_view_tree2_child( operator ) const defs = prop.hack( belt ) - if( defs.length ) props_inner.push( prop.clone( defs ) ) + if( defs.length ) add_inner( prop.clone( defs ) ) return [ operator.clone([ prop.clone([]) ]) ] }, @@ -37,7 +45,7 @@ namespace $ { const prop = this.$mol_view_tree2_child( operator ) const defs = prop.hack( belt ) - if( defs.length ) props_inner.push( prop.clone( defs ) ) + if( defs.length ) add_inner( prop.clone( defs ) ) return [ operator.clone([ prop.clone([]) ]) ] }, @@ -46,14 +54,14 @@ namespace $ { if (operator.kids.length === 0) return [ operator ] const prop = this.$mol_view_tree2_child( operator ) const defs = prop.hack( belt ) - if( defs.length ) props_inner.push( prop.clone( defs ) ) + if( defs.length ) add_inner( prop.clone( defs ) ) return [ operator.clone([ prop.clone([]) ]) ] } }) - return [ ... props_root , ... props_inner ] + return [ ... props_root , ... Object.values(props_inner) ] } } diff --git a/view/tree2/to/dts/dts.ts b/view/tree2/to/dts/dts.ts index c35c9b36d0d..a8ccecff9b9 100644 --- a/view/tree2/to/dts/dts.ts +++ b/view/tree2/to/dts/dts.ts @@ -32,7 +32,6 @@ namespace $ { for( const klass of descr.kids ) { - const methods = new Set() const parent = klass.kids[0] const props = this.$mol_view_tree2_class_props(klass) const aliases = [] as $mol_tree2[] @@ -48,9 +47,7 @@ namespace $ { ... props.map( prop => { const name = name_of.call(this, prop) - if (methods.has(name)) return undefined - methods.add(name) const bind_res = ( bind: $mol_tree2 )=> [ bind.data( 'ReturnType< ' ), klass.data( klass.type ), diff --git a/view/tree2/to/js/js.ts b/view/tree2/to/js/js.ts index 3f96d379e36..042b302b188 100644 --- a/view/tree2/to/js/js.ts +++ b/view/tree2/to/js/js.ts @@ -57,17 +57,12 @@ namespace $ { klass: $mol_tree2 addons: $mol_tree2[] members: $mol_tree2[] - methods: Map }, prop: $mol_tree2 ) { - const { klass, members, addons, methods } = acc + const { klass, members, addons } = acc const { name, key, next } = this.$mol_view_tree2_prop_parts(prop) - if (methods.has(name)) return acc - - methods.set(name, prop) - const decorate = ()=> { return prop.struct( '()', [ prop.struct( key ? '$mol_mem_key' : '$mol_mem' ), @@ -288,7 +283,7 @@ namespace $ { const props = this.$mol_view_tree2_class_props( klass ) const addons = [] as $mol_tree2[] const members = [] as $mol_tree2[] - const acc = { klass, addons, members, methods: new Map() } + const acc = { klass, addons, members } for( const prop of props ) { try {