Пример #1
0
    public ES_NamespaceData(EchelonScriptEnvironment env, ArrayPointer <byte> name)
    {
        environment   = env;
        namespaceName = name;

        types     = new List <Pointer <ES_TypeInfo> > ();
        functions = new Dictionary <ArrayPointer <byte>, Pointer <ES_FunctionData> > ();
    }
Пример #2
0
        public Builder(
            [DisallowNull] EchelonScriptEnvironment env, [DisallowNull] EchelonScriptEnvironment.Builder envBuilder,
            [DisallowNull] ES_NamespaceData nm
            )
        {
            this.env        = env;
            this.envBuilder = envBuilder;

            NamespaceData = nm;

            ClassBuilders  = new PooledDictionary <ArrayPointer <byte>, ES_ClassData.Builder> ();
            StructBuilders = new PooledDictionary <ArrayPointer <byte>, ES_StructData.Builder> ();
            EnumBuilders   = new PooledDictionary <ArrayPointer <byte>, ES_EnumData.Builder> ();
        }
Пример #3
0
    internal static bool UnaryOpCompat(
        EchelonScriptEnvironment env,
        ES_TypeInfo *exprType,
        SimpleUnaryExprType op,
        out ES_TypeInfo *finalType,
        out bool isConst
        )
    {
        finalType = env.TypeUnknownValue;
        isConst   = false;

        return(exprType->TypeTag switch {
            ES_TypeTag.Int => UnaryOpCompat_Int(env, exprType, op, out finalType, out isConst),
            ES_TypeTag.Bool => UnaryOpCompat_Bool(env, exprType, op, out finalType, out isConst),
            ES_TypeTag.Float => UnaryOpCompat_Float(env, exprType, op, out finalType, out isConst),
            ES_TypeTag.Reference => UnaryOpCompat_Ref(env, exprType, op, out finalType, out isConst),

            _ => false,
        });
Пример #4
0
    public static bool BinaryOpCompat(
        EchelonScriptEnvironment env,
        ES_TypeInfo *lhsType, ES_TypeInfo *rhsType,
        SimpleBinaryExprType exprType,
        out ES_TypeInfo *finalType,
        out bool isConst
        )
    {
        finalType = env.TypeUnknownValue;

        if (lhsType->TypeTag == ES_TypeTag.UNKNOWN || rhsType->TypeTag == ES_TypeTag.UNKNOWN)
        {
            isConst = false;
            return(true);
        }

        if (lhsType->TypeTag == ES_TypeTag.Null || rhsType->TypeTag == ES_TypeTag.Null)
        {
            return(BinaryOpCompat_Null(env, lhsType, rhsType, exprType, out finalType, out isConst));
        }

        return((lhsType->TypeTag, rhsType->TypeTag) switch {
            (ES_TypeTag.Int, ES_TypeTag.Int) =>
            BinaryOpCompat_IntInt(env, lhsType, rhsType, exprType, out finalType, out isConst),

            (ES_TypeTag.Bool, ES_TypeTag.Bool) =>
            BinaryOpCompat_BoolBool(env, lhsType, rhsType, exprType, out finalType, out isConst),

            (ES_TypeTag.Float, ES_TypeTag.Float) =>
            BinaryOpCompat_FloatFloat(env, lhsType, rhsType, exprType, out finalType, out isConst),

            (ES_TypeTag.Float, ES_TypeTag.Int) =>
            BinaryOpCompat_FloatInt(env, lhsType, rhsType, exprType, out finalType, out isConst),

            (ES_TypeTag.Reference, ES_TypeTag.Reference) =>
            BinaryOpCompat_RefRef(env, lhsType, rhsType, exprType, out finalType, out isConst),

            (ES_TypeTag.Array, ES_TypeTag.Array) =>
            BinaryOpCompat_ArrayArray(env, lhsType, rhsType, exprType, out finalType, out isConst),

            _ => isConst = false,
        });