コード例 #1
0
ファイル: ExecuteAction.cs プロジェクト: nasa03/Jasonity
        public ExecuteAction Clone()
        {
            ExecuteAction ae = new ExecuteAction((Pred)action.Clone(), intention.Clone());

            ae.result = result;
            return(ae);
        }
コード例 #2
0
    public virtual Differences VisitLiteral(Literal literal1, Literal literal2){
      Differences differences = new Differences(literal1, literal2);
      if (literal1 == null || literal2 == null){
        if (literal1 != literal2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Literal changes = (Literal)literal2.Clone();
      Literal deletions = (Literal)literal2.Clone();
      Literal insertions = (Literal)literal2.Clone();

      if (literal1.Value == literal2.Value || (literal1.Value != null && literal1.Value.Equals(literal2.Value)))
        differences.NumberOfSimilarities++;
      else
        differences.NumberOfDifferences++;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
コード例 #3
0
 public override Expression VisitLiteral(Literal literal){
   if (literal == null) return null;
   TypeNode t = literal.Value as TypeNode;
   if (t != null && literal.Type == CoreSystemTypes.Type)
     return new Literal(this.VisitTypeReference(t), literal.Type, literal.SourceContext);
   return (Literal)literal.Clone();
 }
コード例 #4
0
ファイル: Duplicator.cs プロジェクト: hnlshzx/DotNetOpenAuth
 public override Expression VisitLiteral(Literal literal)
 {
     if (literal == null) return null;
     TypeNode t = literal.Value as TypeNode;
     if (t != null)
         return new Literal(this.VisitTypeReference(t), literal.Type, literal.SourceContext);
     ArrayType at = literal.Type as ArrayType;
     if (at != null && at.ElementType is TypeNode)
     {
         TypeNode cloneType = this.VisitTypeReference(literal.Type);
         TypeNode[] val = literal.Value as TypeNode[];
         int len = val == null ? 0 : val.Length;
         TypeNode[] newVal = val == null ? null : new TypeNode[len];
         for (int i = 0; i < len; i++)
         {
             newVal[i] = this.VisitTypeReference(val[i]);
         }
         return new Literal(newVal, cloneType);
     }
     return (Literal)literal.Clone();
 }
コード例 #5
0
ファイル: Duplicator.cs プロジェクト: modulexcite/IL2JS
 public override Expression VisitLiteral(Literal literal){
   if (literal == null) return null;
   TypeNode cloneType = this.VisitTypeReference(literal.Type);
   TypeNode t = literal.Value as TypeNode;
   if (t != null)
     return new Literal(this.VisitTypeReference(t), cloneType, literal.SourceContext);
   TypeNode[] tarr = literal.Value as TypeNode[];
   if (tarr != null) {
     int len = tarr == null ? 0 : tarr.Length;
     TypeNode[] newarr = tarr == null ? null : new TypeNode[len];
     for (int i = 0; i < len; i++) newarr[i] = this.VisitTypeReference(tarr[i]);
     return new Literal(newarr, cloneType);
   }
   object[] arr = literal.Value as object[];
   if (arr != null) {
     int len = arr.Length;
     object[] newarr = new object[len];
     for (int i = 0; i < len; i++) {
       Literal litelt = arr[i] as Literal;
       if (litelt != null)
         newarr[i] = VisitLiteral(litelt);
       else
         newarr[i] = arr[i];
     }
     return new Literal(newarr, cloneType);
   }
   Literal result = (Literal)literal.Clone();
   result.Type = cloneType;
   return result;
 }