示例#1
0
 public override bool IsEquivalent(TypeExpression otherType)
 {
     return((otherType.PrimitiveType is StringType) || (otherType is NilType));
 }
示例#2
0
 public override bool IsEquivalent(TypeExpression otherType)
 {
     return(PrimitiveType.IsEquivalent(otherType));
 }
示例#3
0
 public override TypeExpression SubscriptAt(TypeExpression index)
 {
     return(PrimitiveType.SubscriptAt(index));
 }
示例#4
0
        /*
         * Summary
         *
         * The main objective of these methods is calculated or deduce the type expression result of apply a language's operator
         *
         */


        /// <summary>
        /// the main objective of this method is calculated or deduce the type expression result of apply operator "[]"
        /// </summary>
        /// <param name="index">index type must be integer and reference an item of collection</param>
        /// <returns>type expression that be storaged in collection </returns>
        public virtual TypeExpression SubscriptAt(TypeExpression index)
        {
            return(new ErrorType(string.Format("Invalid operation. Operator \"[]\" is not supported by type {0}", Identifier)));
        }
示例#5
0
 public AliasType(TypeExpression renamedType, string targetName, long scopeId)
     : base(targetName, TypeConstructor.Alias, scopeId)
 {
     RenamedType = renamedType;
 }
示例#6
0
 /// <summary>
 /// the main objective of this method is equivalenty checking of type expressions
 /// </summary>
 public abstract bool IsEquivalent(TypeExpression otherType);
示例#7
0
 public override bool IsEquivalent(TypeExpression otherType)
 {
     return(otherType is VoidType);
 }
示例#8
0
 public override TypeExpression SubscriptAt(TypeExpression index)
 {
     return((index.PrimitiveType is IntegerType)
         ? BaseType
         : new ErrorType(string.Format("Argument type \"{0}\" is not assignable to parameter type int", index.Identifier)));
 }
示例#9
0
 public ArrayType(string identifier, TypeExpression type, long scopeId)
     : base(identifier, TypeConstructor.Array, scopeId)
 {
     BaseType = type;
 }
示例#10
0
 public override bool IsEquivalent(TypeExpression otherType)
 {
     return(otherType.PrimitiveType is IntegerType);
 }