Ejemplo n.º 1
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "MatrixType" /> class.
 /// </summary>
 public MatrixType()
     : base("matrix", 3)
 {
     ParameterTypes.Add(typeof(TypeBase));
     ParameterTypes.Add(typeof(Literal));
     ParameterTypes.Add(typeof(Literal));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// FormalRest -> , Type IdT FormalRest | ε
 /// </summary>
 private void FormalRest()
 {
     if (Token == Tokens.CommaT)
     {
         Match(Tokens.CommaT);
         Type();
         TableEntry entry = symbolTable.CreateTableEntry();
         BpOffsetName = $"_bp+{ParameterVarsSize}";
         symbolTable.ConvertEntryToVariable(entry);
         ParameterTypes.Add(TypeVar);
         ParameterNum++;
         ParameterVarsSize += Size;
         Offset            += Size;
         Match(Tokens.IdT);
         FormalRest();
     }
     else if (Types.Contains(Token) || Token == Tokens.IdT)
     {
         ErrorHandler.LogError($"expected \",\", found \"{Lexeme}\"");
     }
 }
Ejemplo n.º 3
0
        internal BfMethod(BfCache cache, MethodDefinition methodDef, BfType type)
            : base(cache, methodDef, type)
        {
            _methodDefinition = methodDef;
            _methodName       = GetSignature(_methodDefinition);

            if (!type.IsInCoreAssembly)
            {
                return;
            }

            ReturnType = cache.GetBfType(methodDef.ReturnType);

            _typesUsed.AddRange(_cache.GetTypeCollection(methodDef.ReturnType));
            _typesUsed.Add(ReturnType);
            _typesUsed.AddRange(_cache.GetTypeCollection(_methodDefinition));

            if (methodDef.Body != null)
            {
                foreach (var variableDefinition in methodDef.Body.Variables)
                {
                    _typesUsed.AddRange(_cache.GetTypeCollection(variableDefinition.VariableType));
                    _typesUsed.Add(_cache.GetBfType(variableDefinition.VariableType));
                }
            }

            foreach (var parameterDefinition in methodDef.Parameters)
            {
                _typesUsed.AddRange(_cache.GetTypeCollection(parameterDefinition.ParameterType));
                _typesUsed.Add(_cache.GetBfType(parameterDefinition.ParameterType));

                ParameterTypes.AddRange(_cache.GetTypeCollection(parameterDefinition.ParameterType));
                ParameterTypes.Add(_cache.GetBfType(parameterDefinition.ParameterType));
            }

            ParameterTypes.Clear();
        }
 /// <summary>
 ///   Initializes a new instance of the <see cref = "VectorType" /> class.
 /// </summary>
 public VectorType()
     : base("vector", 2)
 {
     ParameterTypes.Add(typeof(TypeBase));
     ParameterTypes.Add(typeof(Literal));
 }
Ejemplo n.º 5
0
 public void AddParameter(TypeDescriptor typeDescriptor)
 {
     ParameterTypes.Add(typeDescriptor);
 }
Ejemplo n.º 6
0
        void ParseParameterLine(string rawParameters)
        {
            var reader = new StringReader(rawParameters);

            bool processingObjectName     = false;
            bool previousCharArrayBracket = false;

            var objectNameSb = new StringBuilder();

            int nextChar;

            while ((nextChar = reader.Read()) != -1)
            {
                char c = (char)nextChar;
                objectNameSb.Append(c);

                if (processingObjectName)
                {
                    if (previousCharArrayBracket)
                    {
                        if (c == '[')
                        {
                            previousCharArrayBracket = true;
                        }
                        else if (!IsObjectTypeTrueObject(c.ToString()))
                        {
                            processingObjectName = false;
                            var name = objectNameSb.ToString();
                            objectNameSb.Clear();
                            ParameterTypes.Add(name);

                            previousCharArrayBracket = false;
                        }
                        else
                        {
                            previousCharArrayBracket = false;
                        }
                    }
                    else if (c == ';')
                    {
                        processingObjectName = false;
                        var name = objectNameSb.ToString();
                        objectNameSb.Clear();
                        ParameterTypes.Add(name);
                    }
                }
                else
                {
                    if (c == '[')
                    {
                        processingObjectName     = true;
                        previousCharArrayBracket = true;
                    }
                    else if (IsObjectTypeTrueObject(c.ToString()))
                    {
                        processingObjectName     = true;
                        previousCharArrayBracket = false;
                    }
                    else
                    {
                        var name = objectNameSb.ToString();
                        objectNameSb.Clear();
                        ParameterTypes.Add(name);
                    }
                }
            }
        }