Пример #1
0
        public override string ToString()
        {
            var ret = "is(";

            if (TestedType != null)
            {
                ret += TestedType.ToString();
            }

            if (TypeAliasIdentifierHash != 0)
            {
                ret += ' ' + TypeAliasIdentifier;
            }

            if (TypeSpecialization != null || TypeSpecializationToken != 0)
            {
                ret += (EqualityTest ? "==" : ":") + (TypeSpecialization != null ?
                                                      TypeSpecialization.ToString() :                   // Either the specialization declaration
                                                      DTokens.GetTokenString(TypeSpecializationToken)); // or the spec token
            }
            if (TemplateParameterList != null)
            {
                ret += ",";
                foreach (var p in TemplateParameterList)
                {
                    ret += p.ToString() + ",";
                }
            }

            return(ret.TrimEnd(' ', ',') + ")");
        }
Пример #2
0
        public override string ToString(bool IncludesBase)
        {
            var ret = "";

            if (IncludesBase && ValueType != null)
            {
                ret = ValueType.ToString();
            }

            ret += "[";

            if (!ClampsEmpty)
            {
                if (KeyExpression != null)
                {
                    ret += KeyExpression.ToString();
                }
                else if (KeyType != null)
                {
                    ret += KeyType.ToString();
                }
            }

            return(ret + "]");
        }
Пример #3
0
 public override string ToString(bool IncludesBase)
 {
     return((IncludesBase && ValueType != null ? ValueType.ToString() : "") + "[" + (
                KeyExpression != null? KeyExpression.ToString():
                (KeyType != null ? KeyType.ToString() : "")) +
            "]");
 }
Пример #4
0
            public override string ToString()
            {
                var r = ModuleAlias == null ? "":(ModuleAlias.Id + " = ");

                if (ModuleIdentifier != null)
                {
                    r += ModuleIdentifier.ToString();
                }

                return(r);
            }
Пример #5
0
            public override string ToString()
            {
                var r = string.IsNullOrEmpty(ModuleAlias) ? "":(ModuleAlias + " = ");

                if (ModuleIdentifier != null)
                {
                    r += ModuleIdentifier.ToString();
                }

                return(r);
            }
Пример #6
0
        public sealed override string ToString()
        {
            var ret = Name;

            if (Specialization != null)
            {
                ret += ":" + Specialization.ToString();
            }

            if (Default != null)
            {
                ret += "=" + Default.ToString();
            }

            return(ret);
        }
Пример #7
0
        public override string ToCode()
        {
            var r = "mixin";

            if (Qualifier != null)
            {
                r += " " + Qualifier.ToString();
            }

            if (!string.IsNullOrEmpty(MixinId))
            {
                r += ' ' + MixinId;
            }

            return(r + ';');
        }
Пример #8
0
        public override string ToString(bool IncludesBase)
        {
            var sb = new StringBuilder();

            if (ModuleScopedIdentifier)
            {
                sb.Append('.');
            }

            if (IncludesBase && InnerDeclaration != null)
            {
                sb.Append(InnerDeclaration.ToString()).Append('.');
            }

            if (Identifier != null)
            {
                sb.Append(Identifier.ToString());
            }

            sb.Append('!');

            if (Arguments != null)
            {
                if (Arguments.Length > 1)
                {
                    sb.Append('(');
                    foreach (var e in Arguments)
                    {
                        if (e != null)
                        {
                            sb.Append(e.ToString()).Append(',');
                        }
                    }
                    if (sb[sb.Length - 1] == ',')
                    {
                        sb.Remove(sb.Length - 1, 1);
                    }
                    sb.Append(')');
                }
                else if (Arguments.Length == 1 && Arguments[0] != null)
                {
                    sb.Append(Arguments[0].ToString());
                }
            }

            return(sb.ToString());
        }
        public static ITypeDeclaration FindMatchingType(ITypeDeclaration tdec, ITypeReference tref)
        {
            ITypeDeclaration result = null;

            if (tdec.ToString() == tref.ToString())
            {
                return(tdec);
            }
            else
            {
                foreach (ITypeDeclaration idec in tdec.NestedTypes)
                {
                    result = FindMatchingType(idec, tref);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }
            return(null);
        }
Пример #10
0
        public override string ToCode()
        {
            var ret = "with(";

            if (WithExpression != null)
            {
                ret += WithExpression.ToString();
            }
            else if (WithSymbol != null)
            {
                ret += WithSymbol.ToString();
            }

            ret += ')';

            if (ScopedStatement != null)
            {
                ret += ScopedStatement.ToCode();
            }

            return(ret);
        }
Пример #11
0
 public static IReturnType ToDomType(ITypeDeclaration td)
 {
     return td == null ? null : new DomReturnType(td.ToString());
 }
Пример #12
0
 public override string ToString()
 {
     return((Type != null ? (Type.ToString() + " ") : "") + Name /*+ (SpecializationExpression!=null?(":"+SpecializationExpression.ToString()):"")+
                                                                  * (DefaultExpression!=null?("="+DefaultExpression.ToString()):"")*/);
 }
Пример #13
0
 public static IReturnType ToDomType(ITypeDeclaration td)
 {
     return(td == null ? null : new DomReturnType(td.ToString()));
 }
Пример #14
0
 public override string ToString(bool IncludesBase)
 {
     return((IncludesBase && InnerDeclaration != null ? (InnerDeclaration.ToString() + " ") : "") + DTokens.GetTokenString(Modifier) + "(" + (InnerType != null ? InnerType.ToString() : "") + ")");
 }
Пример #15
0
    /// <summary>
    /// Adds the new object.
    /// </summary>
    /// <param name="typeDeclaration">The type declaration.</param>
    /// <param name="startType">The start type.</param>
    /// <param name="includeBase">if set to <c>true</c> include base type info.</param>
    /// <returns>
    /// The base type declaration of the given type declaration; null if not within the same namespace or not found.
    /// </returns>
    internal ITypeDeclaration AddNewObject(ITypeDeclaration typeDeclaration, string startType, bool includeBase)
    {
      // Remove the current type from the additional load list.
      if (this.AdditionalLoadList.Find(typeInfo => typeInfo == typeDeclaration) != null)
      {
        this.AdditionalLoadList.Remove(typeDeclaration);
      }

      if (this.TypeDataList.Find(typeInfo => string.Compare(typeInfo.TypeName, typeDeclaration.Name, StringComparison.Ordinal) == 0) != null)
      {
        // Type already added
        Logger.Current.Info("The type has already been added to the list..." + typeDeclaration.ToString());
        return null;
      }

      ITypeDeclaration baseType = null;
      ClassTypeInfo typeData = new ClassTypeInfo
      {
        StartTypeName = startType,
        Namespace = typeDeclaration.Namespace,
        TypeName = typeDeclaration.Name,
        Modifier = ReflectorHelper.DetermineModifier(typeDeclaration)
      };

      // base type
      if (typeDeclaration.BaseType != null && string.Compare(ReflectorHelper.GetNameWithResolutionScope(typeDeclaration.BaseType), "System.Object", StringComparison.Ordinal) != 0)
      {
        baseType = typeDeclaration.BaseType.Resolve();
        ClassTypeInfo baseTypeData = new ClassTypeInfo
        {
          StartTypeName = startType,
          Namespace = baseType.Namespace,
          TypeName = baseType.Name,
          Modifier = ReflectorHelper.DetermineModifier(baseType),
        };

        if (baseType.GenericType != null)
        {
          ITypeReference genericBaseType = baseType.GenericType;
          if (baseType.GenericArguments != null)
          {
            foreach (IType item in baseType.GenericArguments)
            {
              baseTypeData.GenericParameters.Add(new ClassTypeInfo
              {
                StartTypeName = startType,
                Namespace = typeDeclaration.Namespace,
                TypeName = item.ToString(),
                Modifier = ReflectorHelper.DetermineModifier(null)
              });
            }
          }

          baseType = genericBaseType.Resolve();
        }

        typeData.BaseType = baseTypeData;
      }

      // interfaces
      foreach (ITypeReference item in typeDeclaration.Interfaces)
      {
        ITypeDeclaration interfaceDeclaration = item.Resolve();
        typeData.Interfaces.Add(new ClassTypeInfo
        {
          StartTypeName = startType,
          Namespace = interfaceDeclaration.Namespace,
          TypeName = ReflectorHelper.GetName(interfaceDeclaration),
          Modifier = ReflectorHelper.DetermineModifier(interfaceDeclaration)
        });
      }

      // generic parameters
      foreach (var item in typeDeclaration.GenericArguments)
      {
        ITypeReference reference = item as ITypeReference;
        if (reference != null)
        {
          typeData.GenericParameters.Add(new ClassTypeInfo
          {
            StartTypeName = startType,
            Namespace = reference.Namespace,
            TypeName = reference.Name,
            Modifier = ReflectorHelper.DetermineModifier(reference.Resolve())
          });
        }
        else
        {
          typeData.GenericParameters.Add(new ClassTypeInfo
          {
            StartTypeName = startType,
            Namespace = typeDeclaration.Namespace,
            TypeName = item.ToString(),
            Modifier = ReflectorHelper.DetermineModifier(null)
          });
        }
      }

      //if (Settings.ShowAssociations)
      //{
      //  // properties
      //  foreach (IPropertyDeclaration item in typeDeclaration.Properties)
      //  {
      //    ITypeReference typeReference = item.PropertyType as ITypeReference;
      //    if (typeReference != null && string.Compare(typeDeclaration.Namespace, typeReference.Namespace, StringComparison.Ordinal) == 0)
      //    {
      //      ClassTypeInfo typeInfo = new ClassTypeInfo
      //      {
      //        StartTypeName = startType,
      //        Namespace = typeReference.Namespace,
      //        TypeName = typeReference.Name,
      //        Modifier = ReflectorHelper.DetermineModifier(typeReference.Resolve())
      //      };
      //      typeData.PropertyList.Add(ReflectorHelper.GetName(item), typeInfo);

      //      // Add type to the Additional load list, if it has not been loaded already.
      //      this.AddAdditionalType(typeReference);
      //    }
      //  }
      //}

      this.TypeDataList.Add(typeData);

      if (includeBase && baseType != null && string.Compare(baseType.Namespace, typeDeclaration.Namespace, StringComparison.Ordinal) == 0)
      {
        // also parse base type...
        return baseType;
      }

      return null;
    }
Пример #16
0
 public override string ToString()
 {
     return(Type != null?Type.ToString(false) : AssignExpression.ToString());
 }
Пример #17
0
        public static ResolveResult[] ResolveType(ITypeDeclaration declaration,
		                                          ResolverContext ctxt,
												  IBlockNode currentScopeOverride = null)
        {
            if (ctxt == null)
                return null;

            var ctxtOverride=ctxt;

            if(currentScopeOverride!=null && currentScopeOverride!=ctxt.ScopedBlock){
                ctxtOverride=new ResolverContext();
                ctxtOverride.ApplyFrom(ctxt);
                ctxtOverride.ScopedBlock = currentScopeOverride;
                ctxtOverride.ScopedStatement = null;
            }

            if(ctxtOverride.ScopedBlock!=null &&( ctxtOverride.ImportCache==null || ctxtOverride.ScopedBlock.NodeRoot!=ctxt.ScopedBlock.NodeRoot))
            {
                ctxtOverride.ImportCache=ResolveImports(ctxtOverride.ScopedBlock.NodeRoot as DModule,ctxt.ParseCache);
            }

            if (currentScopeOverride == null)
                currentScopeOverride = ctxt.ScopedBlock;

            if (ctxt == null || declaration == null)
                return null;

            ResolveResult[] preRes = null;
            object scopeObj = null;

            if (ctxtOverride.ScopedStatement != null)
            {
                var curStmtLevel=ctxtOverride.ScopedStatement;

                while (curStmtLevel != null && !(curStmtLevel is BlockStatement))
                    curStmtLevel = curStmtLevel.Parent;

                if(curStmtLevel is BlockStatement)
                    scopeObj = curStmtLevel;
            }

            if (scopeObj == null)
                scopeObj = ctxtOverride.ScopedBlock;

            // Check if already resolved once
            if (ctxtOverride.TryGetAlreadyResolvedType(declaration.ToString(), out preRes, scopeObj))
                return preRes;

            var returnedResults = new List<ResolveResult>();

            // Walk down recursively to resolve everything from the very first to declaration's base type declaration.
            ResolveResult[] rbases = null;
            if (declaration.InnerDeclaration != null)
                rbases = ResolveType(declaration.InnerDeclaration, ctxtOverride);

            // If it's a template, resolve the template id first
            if (declaration is TemplateInstanceExpression)
                declaration = (declaration as TemplateInstanceExpression).TemplateIdentifier;

            /*
             * If there is no parent resolve context (what usually means we are searching the type named like the first identifier in the entire declaration),
             * search the very first type declaration by walking along the current block scope hierarchy.
             * If there wasn't any item found in that procedure, search in the global parse cache
             */
            #region Search initial member/type/module/whatever
            if (rbases == null)
            {
                #region IdentifierDeclaration
                if (declaration is IdentifierDeclaration)
                {
                    string searchIdentifier = (declaration as IdentifierDeclaration).Value as string;

                    if (string.IsNullOrEmpty(searchIdentifier))
                        return null;

                    // Try to convert the identifier into a token
                    int searchToken = string.IsNullOrEmpty(searchIdentifier) ? 0 : DTokens.GetTokenID(searchIdentifier);

                    // References current class scope
                    if (searchToken == DTokens.This)
                    {
                        var classDef = ctxt.ScopedBlock;

                        while (!(classDef is DClassLike) && classDef != null)
                            classDef = classDef.Parent as IBlockNode;

                        if (classDef is DClassLike)
                        {
                            var res = HandleNodeMatch(classDef, ctxtOverride, typeBase: declaration);

                            if (res != null)
                                returnedResults.Add(res);
                        }
                    }
                    // References super type of currently scoped class declaration
                    else if (searchToken == DTokens.Super)
                    {
                        var classDef = currentScopeOverride;

                        while (!(classDef is DClassLike) && classDef != null)
                            classDef = classDef.Parent as IBlockNode;

                        if (classDef != null)
                        {
                            var baseClassDefs = ResolveBaseClass(classDef as DClassLike, ctxtOverride);

                            if (baseClassDefs != null)
                            {
                                // Important: Overwrite type decl base with 'super' token
                                foreach (var bc in baseClassDefs)
                                    bc.TypeDeclarationBase = declaration;

                                returnedResults.AddRange(baseClassDefs);
                            }
                        }
                    }
                    // If we found a base type, return a static-type-result
                    else if (searchToken > 0)
                    {
                        if (DTokens.BasicTypes[searchToken])
                            returnedResults.Add(new StaticTypeResult()
                            {
                                BaseTypeToken = searchToken,
                                TypeDeclarationBase = declaration
                            });
                        // anything else is just a key word, not a type
                    }
                    // (As usual) Go on searching in the local&global scope(s)
                    else
                    {
                        var matches = new List<INode>();

                        // Search in current statement's declarations (if possible)
                        var decls = BlockStatement.GetItemHierarchy(ctxt.ScopedStatement, declaration.Location);

                        if(decls!=null)
                            foreach (var decl in decls)
                                if (decl != null && decl.Name == searchIdentifier)
                                    matches.Add(decl);

                        // First search along the hierarchy in the current module
                        var curScope = ctxtOverride.ScopedBlock;
                        while (curScope != null)
                        {
                            /*
                             * If anonymous enum, skip that one, because in the following ScanForNodeIdentifier call,
                             * its children already become added to the match list
                             */
                            if (curScope is DEnum && curScope.Name == "")
                                curScope = curScope.Parent as IBlockNode;

                            if (curScope is DMethod)
                            {
                                var dm = curScope as DMethod;

                                // If the method is a nested method,
                                // this method won't be 'linked' to the parent statement tree directly -
                                // so, we've to gather the parent method and add its locals to the return list
                                if (dm.Parent is DMethod)
                                {
                                    var parDM = dm.Parent as DMethod;
                                    var nestedBlock = parDM.GetSubBlockAt(declaration.Location);
                                    if (nestedBlock != null)
                                    {
                                        // Search for the deepest statement scope and test all declarations done in the entire scope hierarchy
                                        decls = BlockStatement.GetItemHierarchy(nestedBlock.SearchStatementDeeply(declaration.Location), declaration.Location);

                                        foreach (var decl in decls)
                                            // ... Add them if match was found
                                            if (decl != null && decl.Name == searchIdentifier)
                                                matches.Add(decl);
                                    }
                                }

                                // Do not check further method's children but its (template) parameters
                                foreach (var p in dm.Parameters)
                                    if (p.Name == searchIdentifier)
                                        matches.Add(p);

                                if (dm.TemplateParameters != null)
                                    foreach (var tp in dm.TemplateParameterNodes)
                                        if (tp.Name == searchIdentifier)
                                            matches.Add(tp);
                            }
                            else
                            {
                                var m = ScanNodeForIdentifier(curScope, searchIdentifier, ctxtOverride);

                                if (m != null)
                                    matches.AddRange(m);

                                var mod = curScope as IAbstractSyntaxTree;
                                if (mod != null)
                                {
                                    var modNameParts = mod.ModuleName.Split('.');
                                    if (!string.IsNullOrEmpty(mod.ModuleName) && modNameParts[0] == searchIdentifier)
                                        matches.Add(curScope);
                                }
                            }
                            curScope = curScope.Parent as IBlockNode;
                        }

                        // Then go on searching in the global scope
                        var ThisModule =
                            currentScopeOverride is IAbstractSyntaxTree ?
                                currentScopeOverride as IAbstractSyntaxTree :
                                currentScopeOverride.NodeRoot as IAbstractSyntaxTree;
                        if (ctxt.ParseCache != null)
                            foreach (var mod in ctxt.ParseCache)
                            {
                                if (mod == ThisModule)
                                    continue;

                                var modNameParts = mod.ModuleName.Split('.');

                                if (modNameParts[0] == searchIdentifier)
                                    matches.Add(mod);
                            }

                        if (ctxtOverride.ImportCache != null)
                            foreach (var mod in ctxtOverride.ImportCache)
                            {
                                var m = ScanNodeForIdentifier(mod, searchIdentifier, null);
                                if (m != null)
                                    matches.AddRange(m);
                            }

                        var results = HandleNodeMatches(matches, ctxtOverride, TypeDeclaration: declaration);
                        if (results != null)
                            returnedResults.AddRange(results);
                    }
                }
                #endregion

                #region TypeOfDeclaration
                else if(declaration is TypeOfDeclaration)
                {
                    var typeOf=declaration as TypeOfDeclaration;

                    // typeof(return)
                    if(typeOf.InstanceId is TokenExpression && (typeOf.InstanceId as TokenExpression).Token==DTokens.Return)
                    {
                        var m= HandleNodeMatch(currentScopeOverride,ctxt,currentScopeOverride,null,declaration);
                        if(m!=null)
                            returnedResults.Add(m);
                    }
                    // typeOf(myInt) === int
                    else if(typeOf.InstanceId!=null)
                    {
                        var wantedTypes=ResolveType(typeOf.InstanceId.ExpressionTypeRepresentation,ctxt,currentScopeOverride);

                        // Scan down for variable's base types
                        var c1=new List<ResolveResult>(wantedTypes);
                        var c2=new List<ResolveResult>();

                        while(c1.Count>0)
                        {
                            foreach(var t in c1)
                            {
                                if(t is MemberResult)
                                    c2.AddRange((t as MemberResult).MemberBaseTypes);
                                else
                                    returnedResults.Add(t);
                            }

                            c1.Clear();
                            c1.AddRange(c2);
                            c2.Clear();
                        }
                    }
                }
                #endregion

                else
                    returnedResults.Add(new StaticTypeResult() { TypeDeclarationBase = declaration });
            }
            #endregion

            #region Search in further, deeper levels
            else foreach (var rbase in rbases)
                {
                    #region Identifier
                    if (declaration is IdentifierDeclaration)
                    {
                        string searchIdentifier = (declaration as IdentifierDeclaration).Value as string;

                        // Scan for static properties
                        var staticProp = StaticPropertyResolver.TryResolveStaticProperties(
                            rbase,
                            declaration as IdentifierDeclaration,
                            ctxtOverride);
                        if (staticProp != null)
                        {
                            returnedResults.Add(staticProp);
                            continue;
                        }

                        var scanResults = new List<ResolveResult>();
                        scanResults.Add(rbase);
                        var nextResults = new List<ResolveResult>();

                        while (scanResults.Count > 0)
                        {
                            foreach (var scanResult in scanResults)
                            {
                                // First filter out all alias and member results..so that there will be only (Static-)Type or Module results left..
                                if (scanResult is MemberResult)
                                {
                                    var _m = (scanResult as MemberResult).MemberBaseTypes;
                                    if (_m != null) nextResults.AddRange(_m);
                                }

                                else if (scanResult is TypeResult)
                                {
                                    var tr=scanResult as TypeResult;
                                    var nodeMatches=ScanNodeForIdentifier(tr.ResolvedTypeDefinition, searchIdentifier, ctxtOverride);

                                    var results = HandleNodeMatches(
                                        nodeMatches,
                                        ctxtOverride,
                                        tr.ResolvedTypeDefinition,
                                        resultBase: rbase,
                                        TypeDeclaration: declaration);

                                    if (results != null)
                                        returnedResults.AddRange(results);
                                }
                                else if (scanResult is ModuleResult)
                                {
                                    var modRes = (scanResult as ModuleResult);

                                    if (modRes.IsOnlyModuleNamePartTyped())
                                    {
                                        var modNameParts = modRes.ResolvedModule.ModuleName.Split('.');

                                        if (modNameParts[modRes.AlreadyTypedModuleNameParts] == searchIdentifier)
                                        {
                                            returnedResults.Add(new ModuleResult()
                                            {
                                                ResolvedModule = modRes.ResolvedModule,
                                                AlreadyTypedModuleNameParts = modRes.AlreadyTypedModuleNameParts + 1,
                                                ResultBase = modRes,
                                                TypeDeclarationBase = declaration
                                            });
                                        }
                                    }
                                    else
                                    {
                                        var results = HandleNodeMatches(
                                        ScanNodeForIdentifier((scanResult as ModuleResult).ResolvedModule, searchIdentifier, ctxtOverride),
                                        ctxtOverride, currentScopeOverride, rbase, TypeDeclaration: declaration);
                                        if (results != null)
                                            returnedResults.AddRange(results);
                                    }
                                }
                                else if (scanResult is StaticTypeResult)
                                {

                                }
                            }

                            scanResults = nextResults;
                            nextResults = new List<ResolveResult>();
                        }
                    }
                    #endregion

                    else if (declaration is ArrayDecl || declaration is PointerDecl)
                    {
                        returnedResults.Add(new StaticTypeResult() { TypeDeclarationBase = declaration, ResultBase = rbase });
                    }

                    else if (declaration is DExpressionDecl)
                    {
                        var expr = (declaration as DExpressionDecl).Expression;

                        /*
                         * Note: Assume e.g. foo.bar.myArray in foo.bar.myArray[0] has been resolved!
                         * So, we just have to take the last postfix expression
                         */

                        /*
                         * After we've done this, we reduce the stack..
                         * Target of this action is to retrieve the value type:
                         *
                         * int[string][] myArray; // Is an array that holds an associative array, whereas the value type is 'int', and key type is 'string'
                         *
                         * auto mySubArray=myArray[0]; // returns a reference to an int[string] array
                         *
                         * auto myElement=mySubArray["abcd"]; // returns the most basic value type: 'int'
                         */
                        if (rbase is StaticTypeResult)
                        {
                            var str = rbase as StaticTypeResult;

                            if (str.TypeDeclarationBase is ArrayDecl && expr is PostfixExpression_Index)
                            {
                                returnedResults.Add(new StaticTypeResult() { TypeDeclarationBase = (str.TypeDeclarationBase as ArrayDecl).ValueType });
                            }
                        }
                        else if (rbase is MemberResult)
                        {
                            var mr = rbase as MemberResult;
                            if (mr.MemberBaseTypes != null && mr.MemberBaseTypes.Length > 0)
                                foreach (var memberType in TryRemoveAliasesFromResult(mr.MemberBaseTypes))
                                {
                                    if (expr is PostfixExpression_Index)
                                    {
                                        var str = (memberType as StaticTypeResult);
                                        /*
                                         * If the member's type is an array, and if our expression contains an index-expression (e.g. myArray[0]),
                                         * take the value type of the
                                         */
                                        // For array and pointer declarations, the StaticTypeResult object contains the array's value type / pointer base type.
                                        if (str != null && (str.TypeDeclarationBase is ArrayDecl || str.TypeDeclarationBase is PointerDecl))
                                            returnedResults.AddRange(TryRemoveAliasesFromResult(str.ResultBase));
                                    }
                                    else
                                        returnedResults.Add(memberType);
                                }
                        }
                    }
                }
            #endregion

            if (returnedResults.Count > 0)
            {
                ctxt.TryAddResults(declaration.ToString(), returnedResults.ToArray(), ctxtOverride.ScopedBlock);

                return returnedResults.ToArray();
            }

            return null;
        }
Пример #18
0
 public override string ToString()
 {
     return(Declaration != null?Declaration.ToString() : "");
 }
Пример #19
0
 public override string ToString()
 {
     return("typeid(" + (Type != null ? Type.ToString() : Expression.ToString()) + ")");
 }
Пример #20
0
 public override string ToCode()
 {
     return("module " + (ModuleName == null ? "" : ModuleName.ToString()));
 }
Пример #21
0
 public static ITypeDeclaration FindMatchingType(ITypeDeclaration tdec, ITypeReference tref)
 {
     return(tdec.ToString() == tref.ToString() ? tdec : (tdec.NestedTypes.Cast <ITypeDeclaration>().Select(idec => FindMatchingType(idec, tref))).FirstOrDefault(result => result != null));
 }