Пример #1
0
            // Only import symbol aliases are allowed to search in the parse cache
            public AbstractType Visit(ImportSymbolNode importSymbolNode)
            {
                AbstractType ret = null;

                var modAlias = importSymbolNode is ModuleAliasNode;

                if (modAlias ? importSymbolNode.Type != null : importSymbolNode.Type.InnerDeclaration != null)
                {
                    var mods = new List <DModule>();
                    var td   = modAlias ? importSymbolNode.Type : importSymbolNode.Type.InnerDeclaration;
                    foreach (var mod in ctxt.ParseCache.LookupModuleName(td.ToString()))
                    {
                        mods.Add(mod);
                    }
                    if (mods.Count == 0)
                    {
                        ctxt.LogError(new NothingFoundError(importSymbolNode.Type));
                    }
                    else
                    if (mods.Count > 1)
                    {
                        var m__ = new List <ISemantic>();
                        foreach (var mod in mods)
                        {
                            m__.Add(new ModuleSymbol(mod, importSymbolNode.Type));
                        }
                        ctxt.LogError(new AmbiguityError(importSymbolNode.Type, m__));
                    }
                    var bt = mods.Count != 0 ? (AbstractType) new ModuleSymbol(mods[0], td) : null;
                    //TODO: Is this correct behaviour?
                    if (!modAlias)
                    {
                        var furtherId = ResolveFurtherTypeIdentifier(importSymbolNode.Type.ToString(false), new[] {
                            bt
                        }, ctxt, importSymbolNode.Type);
                        ctxt.CheckForSingleResult(furtherId, importSymbolNode.Type);
                        if (furtherId != null && furtherId.Length != 0)
                        {
                            bt = furtherId[0];
                        }
                        else
                        {
                            bt = null;
                        }
                    }
                    ret = new AliasedType(importSymbolNode, bt, importSymbolNode.Type);
                }
                return(ret);
            }
Пример #2
0
 public string Visit(ImportSymbolNode importSymbolNode)
 {
     return("VAR");
 }
 public virtual void Visit(ImportSymbolNode n)
 {
 }
Пример #4
0
 public IconId Visit(ImportSymbolNode n)
 {
     return(Visit(n as DVariable));
 }
		static AbstractType HandleImportSymbolMatch (ImportSymbolNode importSymbolNode,ResolutionContext ctxt)
		{
			AbstractType ret = null;

			var modAlias = importSymbolNode is ModuleAliasNode;
			if (modAlias ? importSymbolNode.Type != null : importSymbolNode.Type.InnerDeclaration != null) {
				var mods = new List<DModule> ();
				var td = modAlias ? importSymbolNode.Type : importSymbolNode.Type.InnerDeclaration;
				foreach (var mod in ctxt.ParseCache.LookupModuleName (td.ToString ()))
					mods.Add (mod);
				if (mods.Count == 0)
					ctxt.LogError (new NothingFoundError (importSymbolNode.Type));
				else
					if (mods.Count > 1) {
						var m__ = new List<ISemantic> ();
						foreach (var mod in mods)
							m__.Add (new ModuleSymbol (mod, importSymbolNode.Type));
						ctxt.LogError (new AmbiguityError (importSymbolNode.Type, m__));
					}
				var bt = mods.Count != 0 ? (AbstractType)new ModuleSymbol (mods [0], td) : null;
				//TODO: Is this correct behaviour?
				if (!modAlias) {
					var furtherId = ResolveFurtherTypeIdentifier (importSymbolNode.Type.ToString (false), new[] {
						bt
					}, ctxt, importSymbolNode.Type);
					ctxt.CheckForSingleResult (furtherId, importSymbolNode.Type);
					if (furtherId != null && furtherId.Length != 0)
						bt = furtherId [0];
					else
						bt = null;
				}
				ret = new AliasedType (importSymbolNode, bt, importSymbolNode.Type);
			}
			return ret;
		}
Пример #6
0
 public ulong Visit(ImportSymbolNode importSymbolNode)
 {
     return(1000253);
 }
Пример #7
0
 public CompletionItemKind Visit(ImportSymbolNode n)
 {
     return(CompletionItemKind.Reference);
 }
Пример #8
0
 public byte Visit(ImportSymbolNode importSymbolNode)
 {
     return((byte)TypeReferenceKind.Alias);
 }