Example #1
0
 protected override bool Load(FunctionData funcData)
 {
     if (funcData.IsHighOrder)
     {
         var cd = funcData.LowerOrderFunction;
         LoadCall(cd);
     }
     else if (funcData.HaveParam())
     {
         LoadCall(funcData);
     }
     if (funcData.HaveStatement())
     {
         foreach (var comp in funcData.Params)
         {
             var fcd = comp as Dsl.FunctionData;
             if (null != fcd)
             {
                 var        key = fcd.GetId();
                 StoryValue val = new StoryValue();
                 val.InitFromDsl(fcd.GetParam(0));
                 m_LoadedOptArgs[key] = val;
             }
         }
     }
     return(true);
 }
Example #2
0
 private AbstractSyntaxComponent simplifyStatement(FunctionData data)
 {
     if (!data.HaveStatement() && !data.HaveExternScript())
     {
         //没有语句部分的函数退化为函数调用(再按函数调用进一步退化)。
         CallData call = data.Call;
         if (null != call)
         {
             call.CopyComments(data);
             return(simplifyStatement(call));
         }
         else
         {
             //error
             return(NullSyntax.Instance);
         }
     }
     return(data);
 }
Example #3
0
 private ISyntaxComponent simplifyStatement(FunctionData data)
 {
     if (!data.HaveStatement())
     {
         //没有语句部分的函数退化为函数调用(再按函数调用进一步退化)。
         CallData call = data.Call;
         if (null != call)
         {
             return(simplifyStatement(call));
         }
         else
         {
             //error
             return(NullSyntax.Instance);
         }
     }
     else
     {
         //包含语句则不会退化,只进行化简
         simplifyFunctionData(data);
         return(data);
     }
 }
Example #4
0
 private void simplifyFunctionData(FunctionData data)
 {
     if (null != data.Call)
     {
         simplifyCallData(data.Call);
     }
     if (data.HaveStatement())
     {
         int ct = data.GetStatementNum();
         for (int i = 0; i < ct; ++i)
         {
             ISyntaxComponent temp      = data.GetStatement(i);
             StatementData    statement = temp as StatementData;
             if (null != statement)
             {
                 data.SetStatement(i, simplifyStatement(statement));
             }
             else
             {
                 FunctionData func = temp as FunctionData;
                 if (null != func)
                 {
                     data.SetStatement(i, simplifyStatement(func));
                 }
                 else
                 {
                     CallData call = temp as CallData;
                     if (null != call)
                     {
                         data.SetStatement(i, simplifyStatement(call));
                     }
                 }
             }
         }
     }
 }
Example #5
0
 private AbstractSyntaxComponent simplifyStatement(FunctionData data)
 {
     if (!data.HaveStatement() && !data.HaveExternScript()) {
         //没有语句部分的函数退化为函数调用(再按函数调用进一步退化)。
         CallData call = data.Call;
         if (null != call) {
             call.CopyComments(data);
             return simplifyStatement(call);
         } else {
             //error
             return NullSyntax.Instance;
         }
     } else {
         //包含语句则不会退化,只进行化简
         simplifyFunctionData(data);
         return data;
     }
 }
Example #6
0
 private void simplifyFunctionData(FunctionData data)
 {
     if (null != data.Call) {
         simplifyCallData(data.Call);
     }
     if (data.HaveStatement()) {
         int ct = data.GetStatementNum();
         for (int i = 0; i < ct; ++i) {
             ISyntaxComponent temp = data.GetStatement(i);
             StatementData statement = temp as StatementData;
             if (null != statement) {
                 data.SetStatement(i, simplifyStatement(statement));
             } else {
                 FunctionData func = temp as FunctionData;
                 if (null != func) {
                     data.SetStatement(i, simplifyStatement(func));
                 } else {
                     CallData call = temp as CallData;
                     if (null != call) {
                         data.SetStatement(i, simplifyStatement(call));
                     }
                 }
             }
         }
     }
 }