瀏覽代碼

Use a new local variable when creating an array from data.

woollybah 11 年之前
父節點
當前提交
0f263e92df
共有 1 個文件被更改,包括 9 次插入4 次删除
  1. 9 4
      ctranslator.bmx

+ 9 - 4
ctranslator.bmx

@@ -974,8 +974,11 @@ Type TCTranslator Extends TTranslator
 	Method TransArrayExpr$( expr:TArrayExpr )
 		Local elemType:TType=TArrayType( expr.exprType ).elemType
 
-		Local tmp:TLocalDecl =New TLocalDecl.Create( "",TType.voidType,Null )
-		MungDecl tmp
+		Local tmpData:TLocalDecl =New TLocalDecl.Create( "",TType.voidType,Null )
+		MungDecl tmpData
+
+		Local tmpArray:TLocalDecl =New TLocalDecl.Create( "",TType.voidType,Null )
+		MungDecl tmpArray
 		
 		Local t$
 		Local count:Int
@@ -988,9 +991,11 @@ Type TCTranslator Extends TTranslator
 		Local tt$
 '		If Not _env tt="static "
 
-		Emit tt+TransType( elemType, tmp.munged )+" "+tmp.munged+"[]={"+t+"};"
+		Emit tt+TransType( elemType, tmpData.munged )+" "+tmpData.munged+"[]={"+t+"};"
+		Emit "BBARRAY " + tmpArray.munged + " = bbArrayFromData" + Bra(TransArrayType(elemType) + "," + count + "," + tmpData.munged ) + ";"
 
-		Return "bbArrayFromData" + Bra(TransArrayType(elemType) + "," + count + "," + tmp.munged )
+		Return tmpArray.munged
+		'Return "bbArrayFromData" + Bra(TransArrayType(elemType) + "," + count + "," + tmp.munged )
 		'Return "Array<"+TransRefType( elemType, "MM" )+" >("+tmp.munged+","+expr.exprs.Length+")"
 	End Method