aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_compile/lscript_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/lscript/lscript_compile/lscript_tree.cpp')
-rw-r--r--linden/indra/lscript/lscript_compile/lscript_tree.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/linden/indra/lscript/lscript_compile/lscript_tree.cpp b/linden/indra/lscript/lscript_compile/lscript_tree.cpp
index 71e7f19..f62b4e7 100644
--- a/linden/indra/lscript/lscript_compile/lscript_tree.cpp
+++ b/linden/indra/lscript/lscript_compile/lscript_tree.cpp
@@ -46,7 +46,8 @@
46 46
47static void print_cil_box(LLFILE* fp, LSCRIPTType type) 47static void print_cil_box(LLFILE* fp, LSCRIPTType type)
48{ 48{
49 switch(type) 49
50switch(type)
50 { 51 {
51 case LST_INTEGER: 52 case LST_INTEGER:
52 fprintf(fp, "box [mscorlib]System.Int32\n"); 53 fprintf(fp, "box [mscorlib]System.Int32\n");
@@ -1257,10 +1258,10 @@ static void print_cil_init_variable(LLFILE* fp, LSCRIPTType type)
1257 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); 1258 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n");
1258 break; 1259 break;
1259 case LST_QUATERNION: 1260 case LST_QUATERNION:
1260 fprintf(fp, "ldc.r8 1\n");
1261 fprintf(fp, "ldc.r8 0\n"); 1261 fprintf(fp, "ldc.r8 0\n");
1262 fprintf(fp, "ldc.r8 0\n"); 1262 fprintf(fp, "ldc.r8 0\n");
1263 fprintf(fp, "ldc.r8 0\n"); 1263 fprintf(fp, "ldc.r8 0\n");
1264 fprintf(fp, "ldc.r8 1\n");
1264 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); 1265 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n");
1265 break; 1266 break;
1266 case LST_LIST: 1267 case LST_LIST:
@@ -3517,7 +3518,7 @@ void LLScriptRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile
3517 fprintf(fp, " )\n"); 3518 fprintf(fp, " )\n");
3518 break; 3519 break;
3519 case LSCP_SCOPE_PASS1: 3520 case LSCP_SCOPE_PASS1:
3520 checkForDuplicateHandler(fp, this, scope, "rez"); 3521 checkForDuplicateHandler(fp, this, scope, "on_rez");
3521 if (scope->checkEntry(mStartParam->mName)) 3522 if (scope->checkEntry(mStartParam->mName))
3522 { 3523 {
3523 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); 3524 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME);
@@ -7885,10 +7886,10 @@ void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
7885 { 7886 {
7886 // Prefix function name with g to distinguish from 7887 // Prefix function name with g to distinguish from
7887 // event handlers. 7888 // event handlers.
7888 fprintf(fp, gScriptp->getClassName()); 7889 fprintf(fp, "%s", gScriptp->getClassName());
7889 fprintf(fp, "::'g"); 7890 fprintf(fp, "::'g");
7890 } 7891 }
7891 fprintf(fp, mIdentifier->mName); 7892 fprintf(fp, "%s", mIdentifier->mName);
7892 fprintf(fp, "'("); 7893 fprintf(fp, "'(");
7893 print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs); 7894 print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs);
7894 fprintf(fp, ")\n"); 7895 fprintf(fp, ")\n");
@@ -8689,8 +8690,12 @@ void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p
8689 break; 8690 break;
8690 case LSCP_TYPE: 8691 case LSCP_TYPE:
8691 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8692 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8693 if (type == LST_NULL)
8694 {
8695 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8696 }
8692 mType = type; 8697 mType = type;
8693 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8698 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8694 break; 8699 break;
8695 case LSCP_EMIT_BYTE_CODE: 8700 case LSCP_EMIT_BYTE_CODE:
8696 { 8701 {
@@ -8770,6 +8775,10 @@ void LLScriptIfElse::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa
8770 break; 8775 break;
8771 case LSCP_TYPE: 8776 case LSCP_TYPE:
8772 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8777 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8778 if (type == LST_NULL)
8779 {
8780 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8781 }
8773 mType = type; 8782 mType = type;
8774 mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8783 mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8775 mStatement2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8784 mStatement2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@@ -8869,6 +8878,10 @@ void LLScriptFor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass
8869 if(mSequence) 8878 if(mSequence)
8870 mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8879 mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8871 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8880 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8881 if (type == LST_NULL)
8882 {
8883 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8884 }
8872 mType = type; 8885 mType = type;
8873 if(mExpressionList) 8886 if(mExpressionList)
8874 mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8887 mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@@ -8968,6 +8981,10 @@ void LLScriptDoWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP
8968 case LSCP_TYPE: 8981 case LSCP_TYPE:
8969 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8982 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8970 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8983 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8984 if (type == LST_NULL)
8985 {
8986 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8987 }
8971 mType = type; 8988 mType = type;
8972 break; 8989 break;
8973 case LSCP_EMIT_BYTE_CODE: 8990 case LSCP_EMIT_BYTE_CODE:
@@ -9039,6 +9056,10 @@ void LLScriptWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas
9039 break; 9056 break;
9040 case LSCP_TYPE: 9057 case LSCP_TYPE:
9041 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 9058 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
9059 if (type == LST_NULL)
9060 {
9061 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
9062 }
9042 mType = type; 9063 mType = type;
9043 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 9064 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
9044 break; 9065 break;
@@ -9720,7 +9741,7 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
9720 // Allows state changing by finding handlers prefixed with new 9741 // Allows state changing by finding handlers prefixed with new
9721 // state name. Prefix disambiguates functions and event handlers. 9742 // state name. Prefix disambiguates functions and event handlers.
9722 fprintf(fp, "e"); 9743 fprintf(fp, "e");
9723 fprintf(fp, entry->mIdentifier); 9744 fprintf(fp, "%s", entry->mIdentifier);
9724 9745
9725 // Handler name and arguments. 9746 // Handler name and arguments.
9726 mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 9747 mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@@ -10152,7 +10173,7 @@ void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT
10152 fprintf(fp, ".method public hidebysig instance default "); 10173 fprintf(fp, ".method public hidebysig instance default ");
10153 print_cil_type(fp, mType ? mType->mType : LST_NULL); 10174 print_cil_type(fp, mType ? mType->mType : LST_NULL);
10154 fprintf(fp, " 'g"); 10175 fprintf(fp, " 'g");
10155 fprintf(fp, mIdentifier->mName); 10176 fprintf(fp, "%s", mIdentifier->mName);
10156 fprintf(fp, "'"); 10177 fprintf(fp, "'");
10157 if (mParameters) 10178 if (mParameters)
10158 { 10179 {