@@ -856,11 +856,13 @@ private void GlobalCall(CallNode call, bool asFunction)
856856 else
857857 {
858858 // can be defined later
859- var forwarded = new ForwardedMethodDecl ( ) ;
860- forwarded . identifier = identifier ;
861- forwarded . asFunction = asFunction ;
862- forwarded . location = identifierNode . Location ;
863- forwarded . factArguments = argList ;
859+ var forwarded = new ForwardedMethodDecl
860+ {
861+ identifier = identifier ,
862+ asFunction = asFunction ,
863+ location = identifierNode . Location ,
864+ factArguments = argList
865+ } ;
864866
865867 PushCallArguments ( call . ArgumentList ) ;
866868
@@ -878,17 +880,17 @@ private void PushCallArguments(BslSyntaxNode argList)
878880
879881 private void PushArgumentsList ( BslSyntaxNode argList )
880882 {
881- for ( int i = 0 ; i < argList . Children . Count ; i ++ )
883+ var arguments = argList . Children ;
884+ for ( int i = 0 ; i < arguments . Count ; i ++ )
882885 {
883- var passedArg = argList . Children [ i ] ;
884- VisitCallArgument ( passedArg ) ;
886+ VisitCallArgument ( arguments [ i ] ) ;
885887 }
886888 }
887889
888890 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
889891 private void VisitCallArgument ( BslSyntaxNode passedArg )
890892 {
891- if ( passedArg . Children . Count > 0 )
893+ if ( passedArg . Children . Count != 0 )
892894 {
893895 VisitExpression ( passedArg . Children [ 0 ] ) ;
894896 }
@@ -1061,21 +1063,17 @@ private void MakeNewObjectDynamic(NewObjectNode node)
10611063
10621064 private void MakeNewObjectStatic ( NewObjectNode node )
10631065 {
1064- var cDef = new ConstDefinition ( )
1065- {
1066- Type = DataType . String ,
1067- Presentation = node . TypeNameNode . GetIdentifier ( )
1068- } ;
1069- AddCommand ( OperationCode . PushConst , GetConstNumber ( cDef ) ) ;
1070-
1071- var callArgs = 0 ;
10721066 if ( node . ConstructorArguments != default )
10731067 {
1074- PushArgumentsList ( node . ConstructorArguments ) ;
1075- callArgs = node . ConstructorArguments . Children . Count ;
1068+ PushCallArguments ( node . ConstructorArguments ) ;
1069+ }
1070+ else
1071+ {
1072+ AddCommand ( OperationCode . ArgNum , 0 ) ;
10761073 }
10771074
1078- AddCommand ( OperationCode . NewInstance , callArgs ) ;
1075+ var idNum = GetIdentNumber ( node . TypeNameNode . GetIdentifier ( ) ) ;
1076+ AddCommand ( OperationCode . NewInstance , idNum ) ;
10791077 }
10801078
10811079 private void ExitTryBlocks ( )
@@ -1322,8 +1320,7 @@ private int GetConstNumber(in ConstDefinition cDef)
13221320 }
13231321
13241322 private int GetIdentNumber ( string ident )
1325- {
1326-
1323+ {
13271324 var idx = _module . Identifiers . IndexOf ( ident ) ;
13281325 if ( idx < 0 )
13291326 {
0 commit comments