@@ -2649,60 +2649,61 @@ public class ProgramBuilder {
26492649 b. emit ( EndClassConstructor ( ) )
26502650 }
26512651
2652+
26522653 public func addInstanceProperty( _ name: String , value: Variable ? = nil ) {
26532654 let inputs = value != nil ? [ value!] : [ ]
2654- b. emit ( ClassAddInstanceProperty ( propertyName: name, hasValue: value != nil ) , withInputs: inputs)
2655+ b. emit ( ClassAddProperty ( propertyName: name, hasValue: value != nil , isStatic : false ) , withInputs: inputs)
26552656 }
26562657
26572658 public func addInstanceElement( _ index: Int64 , value: Variable ? = nil ) {
26582659 let inputs = value != nil ? [ value!] : [ ]
2659- b. emit ( ClassAddInstanceElement ( index: index, hasValue: value != nil ) , withInputs: inputs)
2660+ b. emit ( ClassAddElement ( index: index, hasValue: value != nil , isStatic : false ) , withInputs: inputs)
26602661 }
26612662
26622663 public func addInstanceComputedProperty( _ name: Variable , value: Variable ? = nil ) {
26632664 let inputs = value != nil ? [ name, value!] : [ name]
2664- b. emit ( ClassAddInstanceComputedProperty ( hasValue: value != nil ) , withInputs: inputs)
2665+ b. emit ( ClassAddComputedProperty ( hasValue: value != nil , isStatic : false ) , withInputs: inputs)
26652666 }
26662667
26672668 public func addInstanceMethod( _ name: String , with descriptor: SubroutineDescriptor , _ body: ( [ Variable ] ) -> ( ) ) {
26682669 b. setParameterTypesForNextSubroutine ( descriptor. parameterTypes)
2669- let instr = b. emit ( BeginClassInstanceMethod ( methodName: name, parameters: descriptor. parameters) )
2670+ let instr = b. emit ( BeginClassMethod ( methodName: name, parameters: descriptor. parameters, isStatic : false ) )
26702671 body ( Array ( instr. innerOutputs) )
2671- b. emit ( EndClassInstanceMethod ( ) )
2672+ b. emit ( EndClassMethod ( ) )
26722673 }
26732674
26742675 public func addInstanceComputedMethod( _ name: Variable , with descriptor: SubroutineDescriptor , _ body: ( [ Variable ] ) -> ( ) ) {
26752676 b. setParameterTypesForNextSubroutine ( descriptor. parameterTypes)
2676- let instr = b. emit ( BeginClassInstanceComputedMethod ( parameters: descriptor. parameters) , withInputs: [ name] )
2677+ let instr = b. emit ( BeginClassComputedMethod ( parameters: descriptor. parameters, isStatic : false ) , withInputs: [ name] )
26772678 body ( Array ( instr. innerOutputs) )
2678- b. emit ( EndClassInstanceComputedMethod ( ) )
2679+ b. emit ( EndClassComputedMethod ( ) )
26792680 }
26802681
26812682 public func addInstanceGetter( for name: String , _ body: ( _ this: Variable ) -> ( ) ) {
2682- let instr = b. emit ( BeginClassInstanceGetter ( propertyName: name) )
2683+ let instr = b. emit ( BeginClassGetter ( propertyName: name, isStatic : false ) )
26832684 body ( instr. innerOutput)
2684- b. emit ( EndClassInstanceGetter ( ) )
2685+ b. emit ( EndClassGetter ( ) )
26852686 }
26862687
26872688 public func addInstanceSetter( for name: String , _ body: ( _ this: Variable , _ val: Variable ) -> ( ) ) {
2688- let instr = b. emit ( BeginClassInstanceSetter ( propertyName: name) )
2689+ let instr = b. emit ( BeginClassSetter ( propertyName: name, isStatic : false ) )
26892690 body ( instr. innerOutput ( 0 ) , instr. innerOutput ( 1 ) )
2690- b. emit ( EndClassInstanceSetter ( ) )
2691+ b. emit ( EndClassSetter ( ) )
26912692 }
26922693
26932694 public func addStaticProperty( _ name: String , value: Variable ? = nil ) {
26942695 let inputs = value != nil ? [ value!] : [ ]
2695- b. emit ( ClassAddStaticProperty ( propertyName: name, hasValue: value != nil ) , withInputs: inputs)
2696+ b. emit ( ClassAddProperty ( propertyName: name, hasValue: value != nil , isStatic : true ) , withInputs: inputs)
26962697 }
26972698
26982699 public func addStaticElement( _ index: Int64 , value: Variable ? = nil ) {
26992700 let inputs = value != nil ? [ value!] : [ ]
2700- b. emit ( ClassAddStaticElement ( index: index, hasValue: value != nil ) , withInputs: inputs)
2701+ b. emit ( ClassAddElement ( index: index, hasValue: value != nil , isStatic : true ) , withInputs: inputs)
27012702 }
27022703
27032704 public func addStaticComputedProperty( _ name: Variable , value: Variable ? = nil ) {
27042705 let inputs = value != nil ? [ name, value!] : [ name]
2705- b. emit ( ClassAddStaticComputedProperty ( hasValue: value != nil ) , withInputs: inputs)
2706+ b. emit ( ClassAddComputedProperty ( hasValue: value != nil , isStatic : true ) , withInputs: inputs)
27062707 }
27072708
27082709 public func addStaticInitializer( _ body: ( Variable ) -> ( ) ) {
@@ -2713,52 +2714,52 @@ public class ProgramBuilder {
27132714
27142715 public func addStaticMethod( _ name: String , with descriptor: SubroutineDescriptor , _ body: ( [ Variable ] ) -> ( ) ) {
27152716 b. setParameterTypesForNextSubroutine ( descriptor. parameterTypes)
2716- let instr = b. emit ( BeginClassStaticMethod ( methodName: name, parameters: descriptor. parameters) )
2717+ let instr = b. emit ( BeginClassMethod ( methodName: name, parameters: descriptor. parameters, isStatic : true ) )
27172718 body ( Array ( instr. innerOutputs) )
2718- b. emit ( EndClassStaticMethod ( ) )
2719+ b. emit ( EndClassMethod ( ) )
27192720 }
27202721
27212722 public func addStaticComputedMethod( _ name: Variable , with descriptor: SubroutineDescriptor , _ body: ( [ Variable ] ) -> ( ) ) {
27222723 b. setParameterTypesForNextSubroutine ( descriptor. parameterTypes)
2723- let instr = b. emit ( BeginClassStaticComputedMethod ( parameters: descriptor. parameters) , withInputs: [ name] )
2724+ let instr = b. emit ( BeginClassComputedMethod ( parameters: descriptor. parameters, isStatic : true ) , withInputs: [ name] )
27242725 body ( Array ( instr. innerOutputs) )
2725- b. emit ( EndClassStaticComputedMethod ( ) )
2726+ b. emit ( EndClassComputedMethod ( ) )
27262727 }
27272728
27282729 public func addStaticGetter( for name: String , _ body: ( _ this: Variable ) -> ( ) ) {
2729- let instr = b. emit ( BeginClassStaticGetter ( propertyName: name) )
2730+ let instr = b. emit ( BeginClassGetter ( propertyName: name, isStatic : true ) )
27302731 body ( instr. innerOutput)
2731- b. emit ( EndClassStaticGetter ( ) )
2732+ b. emit ( EndClassGetter ( ) )
27322733 }
27332734
27342735 public func addStaticSetter( for name: String , _ body: ( _ this: Variable , _ val: Variable ) -> ( ) ) {
2735- let instr = b. emit ( BeginClassStaticSetter ( propertyName: name) )
2736+ let instr = b. emit ( BeginClassSetter ( propertyName: name, isStatic : true ) )
27362737 body ( instr. innerOutput ( 0 ) , instr. innerOutput ( 1 ) )
2737- b. emit ( EndClassStaticSetter ( ) )
2738+ b. emit ( EndClassSetter ( ) )
27382739 }
27392740
27402741 public func addPrivateInstanceProperty( _ name: String , value: Variable ? = nil ) {
27412742 let inputs = value != nil ? [ value!] : [ ]
2742- b. emit ( ClassAddPrivateInstanceProperty ( propertyName: name, hasValue: value != nil ) , withInputs: inputs)
2743+ b. emit ( ClassAddPrivateProperty ( propertyName: name, hasValue: value != nil , isStatic : false ) , withInputs: inputs)
27432744 }
27442745
27452746 public func addPrivateInstanceMethod( _ name: String , with descriptor: SubroutineDescriptor , _ body: ( [ Variable ] ) -> ( ) ) {
27462747 b. setParameterTypesForNextSubroutine ( descriptor. parameterTypes)
2747- let instr = b. emit ( BeginClassPrivateInstanceMethod ( methodName: name, parameters: descriptor. parameters) )
2748+ let instr = b. emit ( BeginClassPrivateMethod ( methodName: name, parameters: descriptor. parameters, isStatic : false ) )
27482749 body ( Array ( instr. innerOutputs) )
2749- b. emit ( EndClassPrivateInstanceMethod ( ) )
2750+ b. emit ( EndClassPrivateMethod ( ) )
27502751 }
27512752
27522753 public func addPrivateStaticProperty( _ name: String , value: Variable ? = nil ) {
27532754 let inputs = value != nil ? [ value!] : [ ]
2754- b. emit ( ClassAddPrivateStaticProperty ( propertyName: name, hasValue: value != nil ) , withInputs: inputs)
2755+ b. emit ( ClassAddPrivateProperty ( propertyName: name, hasValue: value != nil , isStatic : true ) , withInputs: inputs)
27552756 }
27562757
27572758 public func addPrivateStaticMethod( _ name: String , with descriptor: SubroutineDescriptor , _ body: ( [ Variable ] ) -> ( ) ) {
27582759 b. setParameterTypesForNextSubroutine ( descriptor. parameterTypes)
2759- let instr = b. emit ( BeginClassPrivateStaticMethod ( methodName: name, parameters: descriptor. parameters) )
2760+ let instr = b. emit ( BeginClassPrivateMethod ( methodName: name, parameters: descriptor. parameters, isStatic : true ) )
27602761 body ( Array ( instr. innerOutputs) )
2761- b. emit ( EndClassPrivateStaticMethod ( ) )
2762+ b. emit ( EndClassPrivateMethod ( ) )
27622763 }
27632764 }
27642765
@@ -4963,41 +4964,51 @@ public class ProgramBuilder {
49634964 activeClassDefinitions. push ( ClassDefinition ( in: self , isDerived: op. hasSuperclass) )
49644965 case . beginClassConstructor:
49654966 activeClassDefinitions. top. hasConstructor = true
4966- case . classAddInstanceProperty( let op) :
4967- activeClassDefinitions. top. instanceProperties. append ( op. propertyName)
4968- case . classAddInstanceElement( let op) :
4969- activeClassDefinitions. top. instanceElements. append ( op. index)
4970- case . classAddInstanceComputedProperty:
4971- activeClassDefinitions. top. instanceComputedProperties. append ( instr. input ( 0 ) )
4972- case . beginClassInstanceMethod( let op) :
4973- activeClassDefinitions. top. instanceMethods. append ( op. methodName)
4974- case . beginClassInstanceComputedMethod:
4975- activeClassDefinitions. top. instanceComputedMethods. append ( instr. input ( 0 ) )
4976- case . beginClassInstanceGetter( let op) :
4977- activeClassDefinitions. top. instanceGetters. append ( op. propertyName)
4978- case . beginClassInstanceSetter( let op) :
4979- activeClassDefinitions. top. instanceSetters. append ( op. propertyName)
4980- case . classAddStaticProperty( let op) :
4981- activeClassDefinitions. top. staticProperties. append ( op. propertyName)
4982- case . classAddStaticElement( let op) :
4983- activeClassDefinitions. top. staticElements. append ( op. index)
4984- case . classAddStaticComputedProperty:
4985- activeClassDefinitions. top. staticComputedProperties. append ( instr. input ( 0 ) )
4986- case . beginClassStaticMethod( let op) :
4987- activeClassDefinitions. top. staticMethods. append ( op. methodName)
4988- case . beginClassStaticComputedMethod:
4989- activeClassDefinitions. top. staticComputedMethods. append ( instr. input ( 0 ) )
4990- case . beginClassStaticGetter( let op) :
4991- activeClassDefinitions. top. staticGetters. append ( op. propertyName)
4992- case . beginClassStaticSetter( let op) :
4993- activeClassDefinitions. top. staticSetters. append ( op. propertyName)
4994- case . classAddPrivateInstanceProperty( let op) :
4995- activeClassDefinitions. top. privateProperties. append ( op. propertyName)
4996- case . beginClassPrivateInstanceMethod( let op) :
4997- activeClassDefinitions. top. privateMethods. append ( op. methodName)
4998- case . classAddPrivateStaticProperty( let op) :
4967+ case . classAddProperty( let op) :
4968+ if op. isStatic {
4969+ activeClassDefinitions. top. staticProperties. append ( op. propertyName)
4970+ } else {
4971+ activeClassDefinitions. top. instanceProperties. append ( op. propertyName)
4972+ }
4973+ case . classAddElement( let op) :
4974+ if op. isStatic {
4975+ activeClassDefinitions. top. staticElements. append ( op. index)
4976+ } else {
4977+ activeClassDefinitions. top. instanceElements. append ( op. index)
4978+ }
4979+ case . classAddComputedProperty( let op) :
4980+ if op. isStatic {
4981+ activeClassDefinitions. top. staticComputedProperties. append ( instr. input ( 0 ) )
4982+ } else {
4983+ activeClassDefinitions. top. instanceComputedProperties. append ( instr. input ( 0 ) )
4984+ }
4985+ case . beginClassMethod( let op) :
4986+ if op. isStatic {
4987+ activeClassDefinitions. top. staticMethods. append ( op. methodName)
4988+ } else {
4989+ activeClassDefinitions. top. instanceMethods. append ( op. methodName)
4990+ }
4991+ case . beginClassComputedMethod( let op) :
4992+ if op. isStatic {
4993+ activeClassDefinitions. top. staticComputedMethods. append ( instr. input ( 0 ) )
4994+ } else {
4995+ activeClassDefinitions. top. instanceComputedMethods. append ( instr. input ( 0 ) )
4996+ }
4997+ case . beginClassGetter( let op) :
4998+ if op. isStatic {
4999+ activeClassDefinitions. top. staticGetters. append ( op. propertyName)
5000+ } else {
5001+ activeClassDefinitions. top. instanceGetters. append ( op. propertyName)
5002+ }
5003+ case . beginClassSetter( let op) :
5004+ if op. isStatic {
5005+ activeClassDefinitions. top. staticSetters. append ( op. propertyName)
5006+ } else {
5007+ activeClassDefinitions. top. instanceSetters. append ( op. propertyName)
5008+ }
5009+ case . classAddPrivateProperty( let op) :
49995010 activeClassDefinitions. top. privateProperties. append ( op. propertyName)
5000- case . beginClassPrivateStaticMethod ( let op) :
5011+ case . beginClassPrivateMethod ( let op) :
50015012 activeClassDefinitions. top. privateMethods. append ( op. methodName)
50025013 case . beginClassStaticInitializer:
50035014 break
0 commit comments