@@ -1171,73 +1171,44 @@ private IEnumerable<BslAnnotationParameter> GetAnnotationParameters(AnnotationNo
11711171
11721172 private BslAnnotationParameter MakeAnnotationParameter ( AnnotationParameterNode param )
11731173 {
1174- var constValue = MakeAnnotationParameterValueConstant ( param ) ;
1175- return new BslAnnotationParameter ( param . Name , constValue . runtimeValue ) { ConstantValueIndex = constValue . constNumber } ;
1174+ var runtimeValue = MakeAnnotationParameterValueConstant ( param ) ;
1175+ return new BslAnnotationParameter ( param . Name , runtimeValue ) ;
11761176 }
11771177
1178- private ( BslPrimitiveValue runtimeValue , int constNumber ) MakeAnnotationParameterValueConstant ( AnnotationParameterNode param )
1178+ private BslPrimitiveValue MakeAnnotationParameterValueConstant ( AnnotationParameterNode param )
11791179 {
11801180 if ( param . AnnotationNode != null )
11811181 {
1182- var constNumber = CreateAnnotationConstDefinition ( param . AnnotationNode ) ;
1183- var runtimeValue = _module . Constants [ constNumber ] ;
1184- return ( runtimeValue , constNumber ) ;
1182+ var runtimeValue = new BslAnnotationValue ( param . AnnotationNode . Name ) ;
1183+ foreach ( var child in param . AnnotationNode . Children )
1184+ {
1185+ var parameter = ( AnnotationParameterNode ) child ;
1186+ var parameterValue = MakeAnnotationParameterValueConstant ( parameter ) ;
1187+ runtimeValue . Parameters . Add ( new BslAnnotationParameter ( parameter . Name , parameterValue ) ) ;
1188+ }
1189+ var constNumber = CreateAnnotationConstDefinition ( runtimeValue ) ;
1190+ return runtimeValue ;
11851191 }
11861192 else
11871193 if ( param . Value . Type != LexemType . NotALexem )
11881194 {
11891195 var constDef = CreateConstDefinition ( param . Value ) ;
11901196 var constNumber = GetConstNumber ( constDef ) ;
11911197 var runtimeValue = _module . Constants [ constNumber ] ;
1192- return ( runtimeValue , constNumber ) ;
1198+ return runtimeValue ;
11931199 }
11941200 else
11951201 {
1196- return ( null , - 1 ) ;
1202+ return null ;
11971203 }
11981204 }
11991205
1200- private int CreateAnnotationConstDefinition ( AnnotationNode annotationNode )
1206+ private int CreateAnnotationConstDefinition ( BslAnnotationValue runtimeValue )
12011207 {
1202- var runtimeValue = new BslAnnotationValue ( annotationNode . Name ) ;
1203- var presentation = AnnotationConstPresentation ( annotationNode , runtimeValue ) ;
1204- ConstDefinition cDef = new ConstDefinition ( ) {
1205- Type = DataType . Annotation ,
1206- Presentation = presentation
1207- } ;
1208- var result = RegisterAnnotationConst ( cDef , runtimeValue ) ;
1208+ var result = RegisterAnnotationConst ( runtimeValue ) ;
12091209 return result ;
12101210 }
12111211
1212- private string AnnotationConstPresentation ( AnnotationNode annotationNode , BslAnnotationValue annotationRuntimeValue )
1213- {
1214- var sb = new StringBuilder ( "&" ) ;
1215- sb . Append ( annotationNode . Name ) ;
1216- if ( annotationNode . Children . Count > 0 )
1217- {
1218- var prefix = "(" ;
1219- foreach ( var child in annotationNode . Children )
1220- {
1221- sb . Append ( prefix ) ;
1222- prefix = "," ;
1223-
1224- var parameter = ( AnnotationParameterNode ) child ;
1225- var constValue = MakeAnnotationParameterValueConstant ( parameter ) ;
1226- sb . Append ( parameter . Name ) ;
1227- sb . Append ( "=" ) ;
1228- sb . Append ( constValue . constNumber ) ;
1229-
1230- var parameterValue = constValue . constNumber != - 1
1231- ? new BslAnnotationParameter ( parameter . Name , _module . Constants [ constValue . constNumber ] ) { ConstantValueIndex = constValue . constNumber }
1232- : new BslAnnotationParameter ( parameter . Name ) ;
1233- annotationRuntimeValue . Parameters . Add ( parameterValue ) ;
1234- }
1235- sb . Append ( ")" ) ;
1236- }
1237-
1238- return sb . ToString ( ) ;
1239- }
1240-
12411212 private IEnumerable < BslAnnotationAttribute > GetAnnotations ( AnnotatableNode parent )
12421213 {
12431214 return parent . Annotations . Select ( a =>
@@ -1297,11 +1268,10 @@ private int GetConstNumber(in ConstDefinition cDef)
12971268 return idx ;
12981269 }
12991270
1300- private int RegisterAnnotationConst ( in ConstDefinition cDef , BslAnnotationValue value )
1271+ private int RegisterAnnotationConst ( BslAnnotationValue value )
13011272 {
1302- var idx = _constMap . Count ;
1303- _constMap . Add ( cDef ) ;
1304- _module . Constants . Add ( value ) ;
1273+ var idx = _module . AnnotationValues . Count ;
1274+ _module . AnnotationValues . Add ( value ) ;
13051275 return idx ;
13061276 }
13071277
0 commit comments