public ErrArg(SYMKIND sk) { Debug.Assert(sk != SYMKIND.SK_AssemblyQualifiedNamespaceSymbol); this.eaf = ErrArgFlags.None; this.eak = ErrArgKind.SymKind; this.sk = sk; } // NSAIDSYMs are treated differently based on the Symbol not the SK
private ErrArg(SYMKIND sk) { Debug.Assert(sk != SYMKIND.SK_AssemblyQualifiedNamespaceSymbol); this.eaf = ErrArgFlags.None; this.eak = ErrArgKind.SymKind; this.sk = sk; } // NSAIDSYMs are treated differently based on the Symbol not the SK
private void ErrSK(out string psz, SYMKIND sk) { MessageID id; switch (sk) { case SYMKIND.SK_MethodSymbol: id = MessageID.SK_METHOD; break; case SYMKIND.SK_AggregateSymbol: id = MessageID.SK_CLASS; break; case SYMKIND.SK_NamespaceSymbol: id = MessageID.SK_NAMESPACE; break; case SYMKIND.SK_FieldSymbol: id = MessageID.SK_FIELD; break; case SYMKIND.SK_LocalVariableSymbol: id = MessageID.SK_VARIABLE; break; case SYMKIND.SK_PropertySymbol: id = MessageID.SK_PROPERTY; break; case SYMKIND.SK_EventSymbol: id = MessageID.SK_EVENT; break; case SYMKIND.SK_TypeParameterSymbol: id = MessageID.SK_TYVAR; break; case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: Debug.Assert(false, "Illegal sk"); id = MessageID.SK_ALIAS; break; default: Debug.Assert(false, "impossible sk"); id = MessageID.SK_UNKNOWN; break; } ErrId(out psz, id); }
public ExprMemberGroup(CType type, EXPRFLAG flags, Name name, TypeArray typeArgs, SYMKIND symKind, CType parentType, MethodOrPropertySymbol pMPS, Expr optionalObject, CMemberLookupResults memberLookupResults) : base(ExpressionKind.MemberGroup, type) { Debug.Assert( (flags & ~(EXPRFLAG.EXF_CTOR | EXPRFLAG.EXF_INDEXER | EXPRFLAG.EXF_OPERATOR | EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_BASECALL | EXPRFLAG.EXF_DELEGATE | EXPRFLAG.EXF_USERCALLABLE | EXPRFLAG.EXF_MASK_ANY)) == 0); Flags = flags; Name = name; TypeArgs = typeArgs ?? BSYMMGR.EmptyTypeArray(); SymKind = symKind; ParentType = parentType; OptionalObject = optionalObject; MemberLookupResults = memberLookupResults; }
private static string ErrSK(SYMKIND sk) { MessageID id; switch (sk) { case SYMKIND.SK_MethodSymbol: id = MessageID.SK_METHOD; break; case SYMKIND.SK_AggregateSymbol: id = MessageID.SK_CLASS; break; case SYMKIND.SK_NamespaceSymbol: id = MessageID.SK_NAMESPACE; break; case SYMKIND.SK_FieldSymbol: id = MessageID.SK_FIELD; break; case SYMKIND.SK_LocalVariableSymbol: id = MessageID.SK_VARIABLE; break; case SYMKIND.SK_PropertySymbol: id = MessageID.SK_PROPERTY; break; case SYMKIND.SK_EventSymbol: id = MessageID.SK_EVENT; break; case SYMKIND.SK_TypeParameterSymbol: id = MessageID.SK_TYVAR; break; default: Debug.Assert(false, "impossible sk"); id = MessageID.SK_UNKNOWN; break; } return(ErrId(id)); }
protected void ErrSK(out string psz, SYMKIND sk) { MessageID id; switch (sk) { case SYMKIND.SK_MethodSymbol: id = MessageID.SK_METHOD; break; case SYMKIND.SK_AggregateSymbol: id = MessageID.SK_CLASS; break; case SYMKIND.SK_NamespaceSymbol: id = MessageID.SK_NAMESPACE; break; case SYMKIND.SK_FieldSymbol: id = MessageID.SK_FIELD; break; case SYMKIND.SK_LocalVariableSymbol: id = MessageID.SK_VARIABLE; break; case SYMKIND.SK_PropertySymbol: id = MessageID.SK_PROPERTY; break; case SYMKIND.SK_EventSymbol: id = MessageID.SK_EVENT; break; case SYMKIND.SK_TypeParameterSymbol: id = MessageID.SK_TYVAR; break; case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: Debug.Assert(false, "Illegal sk"); id = MessageID.SK_ALIAS; break; default: Debug.Assert(false, "impossible sk"); id = MessageID.SK_UNKNOWN; break; } ErrId(out psz, id); }
public void setKind(SYMKIND kind) { this.kind = kind; }
public void setKind(SYMKIND kind) { _kind = kind; }
public EXPRMEMGRP CreateMemGroup(EXPRFLAG nFlags, Name pName, TypeArray pTypeArgs, SYMKIND symKind, CType pTypePar, MethodOrPropertySymbol pMPS, EXPR pObject, CMemberLookupResults memberLookupResults) { Debug.Assert(0 == (nFlags & ~( EXPRFLAG.EXF_CTOR | EXPRFLAG.EXF_INDEXER | EXPRFLAG.EXF_OPERATOR | EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_BASECALL | EXPRFLAG.EXF_DELEGATE | EXPRFLAG.EXF_USERCALLABLE | EXPRFLAG.EXF_MASK_ANY ) )); EXPRMEMGRP rval = new EXPRMEMGRP(); rval.kind = ExpressionKind.EK_MEMGRP; rval.type = GetTypes().GetMethGrpType(); rval.flags = nFlags; rval.name = pName; rval.typeArgs = pTypeArgs; rval.sk = symKind; rval.SetParentType(pTypePar); rval.SetOptionalObject(pObject); rval.SetMemberLookupResults(memberLookupResults); rval.SetOptionalLHS(null); if (rval.typeArgs == null) { rval.typeArgs = BSYMMGR.EmptyTypeArray(); } Debug.Assert(rval != null); return (rval); }
protected Symbol newBasicSym( SYMKIND kind, Name name, ParentSymbol parent) { // The parser creates names with PN_MISSING when attempting to recover from errors // To prevent spurious errors, we create SYMs with a different name (PN_MISSINGSYM) // so that they are never found when doing lookup. if (name == m_pMissingNameNode) { name = m_pMissingNameSym; } Symbol sym; switch (kind) { case SYMKIND.SK_NamespaceSymbol: sym = new NamespaceSymbol(); sym.name = name; break; case SYMKIND.SK_NamespaceDeclaration: sym = new NamespaceDeclaration(); sym.name = name; break; case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: sym = new AssemblyQualifiedNamespaceSymbol(); sym.name = name; break; case SYMKIND.SK_AggregateSymbol: sym = new AggregateSymbol(); sym.name = name; break; case SYMKIND.SK_AggregateDeclaration: sym = new AggregateDeclaration(); sym.name = name; break; case SYMKIND.SK_TypeParameterSymbol: sym = new TypeParameterSymbol(); sym.name = name; break; case SYMKIND.SK_FieldSymbol: sym = new FieldSymbol(); sym.name = name; break; case SYMKIND.SK_LocalVariableSymbol: sym = new LocalVariableSymbol(); sym.name = name; break; case SYMKIND.SK_MethodSymbol: sym = new MethodSymbol(); sym.name = name; break; case SYMKIND.SK_PropertySymbol: sym = new PropertySymbol(); sym.name = name; break; case SYMKIND.SK_EventSymbol: sym = new EventSymbol(); sym.name = name; break; case SYMKIND.SK_TransparentIdentifierMemberSymbol: sym = new TransparentIdentifierMemberSymbol(); sym.name = name; break; case SYMKIND.SK_Scope: sym = new Scope(); sym.name = name; break; case SYMKIND.SK_LabelSymbol: sym = new LabelSymbol(); sym.name = name; break; case SYMKIND.SK_GlobalAttributeDeclaration: sym = new GlobalAttributeDeclaration(); sym.name = name; break; case SYMKIND.SK_UnresolvedAggregateSymbol: sym = new UnresolvedAggregateSymbol(); sym.name = name; break; case SYMKIND.SK_InterfaceImplementationMethodSymbol: sym = new InterfaceImplementationMethodSymbol(); sym.name = name; break; case SYMKIND.SK_IndexerSymbol: sym = new IndexerSymbol(); sym.name = name; break; case SYMKIND.SK_ParentSymbol: sym = new ParentSymbol(); sym.name = name; break; case SYMKIND.SK_IteratorFinallyMethodSymbol: sym = new IteratorFinallyMethodSymbol(); sym.name = name; break; default: throw Error.InternalCompilerError(); } sym.setKind(kind); if (parent != null) { // Set the parent element of the child symbol. parent.AddToChildList(sym); m_pSymTable.InsertChild(parent, sym); } return (sym); }
public static ExprMemberGroup CreateMemGroup(EXPRFLAG flags, Name name, TypeArray typeArgs, SYMKIND symKind, CType parentType, Expr obj, CMemberLookupResults memberLookupResults) => new ExprMemberGroup(flags, name, typeArgs, symKind, parentType, obj, memberLookupResults);
public EXPRMEMGRP CreateMemGroup(EXPRFLAG nFlags, Name pName, TypeArray pTypeArgs, SYMKIND symKind, CType pTypePar, MethodOrPropertySymbol pMPS, EXPR pObject, CMemberLookupResults memberLookupResults) { Debug.Assert(0 == (nFlags & ~( EXPRFLAG.EXF_CTOR | EXPRFLAG.EXF_INDEXER | EXPRFLAG.EXF_OPERATOR | EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_BASECALL | EXPRFLAG.EXF_DELEGATE | EXPRFLAG.EXF_USERCALLABLE | EXPRFLAG.EXF_MASK_ANY ) )); EXPRMEMGRP rval = new EXPRMEMGRP(); rval.kind = ExpressionKind.EK_MEMGRP; rval.type = GetTypes().GetMethGrpType(); rval.flags = nFlags; rval.name = pName; rval.typeArgs = pTypeArgs; rval.sk = symKind; rval.SetParentType(pTypePar); rval.SetOptionalObject(pObject); rval.SetMemberLookupResults(memberLookupResults); rval.SetOptionalLHS(null); if (rval.typeArgs == null) { rval.typeArgs = BSYMMGR.EmptyTypeArray(); } Debug.Assert(rval != null); return(rval); }
public ExprMemberGroup CreateMemGroup(EXPRFLAG flags, Name name, TypeArray typeArgs, SYMKIND symKind, CType parentType, MethodOrPropertySymbol memberSymbol, Expr obj, CMemberLookupResults memberLookupResults) => new ExprMemberGroup(Types.GetMethGrpType(), flags, name, typeArgs, symKind, parentType, memberSymbol, obj, memberLookupResults);
protected Symbol newBasicSym( SYMKIND kind, Name name, ParentSymbol parent) { // The parser creates names with PN_MISSING when attempting to recover from errors // To prevent spurious errors, we create SYMs with a different name (PN_MISSINGSYM) // so that they are never found when doing lookup. if (name == m_pMissingNameNode) { name = m_pMissingNameSym; } Symbol sym; switch (kind) { case SYMKIND.SK_NamespaceSymbol: sym = new NamespaceSymbol(); sym.name = name; break; case SYMKIND.SK_NamespaceDeclaration: sym = new NamespaceDeclaration(); sym.name = name; break; case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: sym = new AssemblyQualifiedNamespaceSymbol(); sym.name = name; break; case SYMKIND.SK_AggregateSymbol: sym = new AggregateSymbol(); sym.name = name; break; case SYMKIND.SK_AggregateDeclaration: sym = new AggregateDeclaration(); sym.name = name; break; case SYMKIND.SK_TypeParameterSymbol: sym = new TypeParameterSymbol(); sym.name = name; break; case SYMKIND.SK_FieldSymbol: sym = new FieldSymbol(); sym.name = name; break; case SYMKIND.SK_LocalVariableSymbol: sym = new LocalVariableSymbol(); sym.name = name; break; case SYMKIND.SK_MethodSymbol: sym = new MethodSymbol(); sym.name = name; break; case SYMKIND.SK_PropertySymbol: sym = new PropertySymbol(); sym.name = name; break; case SYMKIND.SK_EventSymbol: sym = new EventSymbol(); sym.name = name; break; case SYMKIND.SK_TransparentIdentifierMemberSymbol: sym = new TransparentIdentifierMemberSymbol(); sym.name = name; break; case SYMKIND.SK_Scope: sym = new Scope(); sym.name = name; break; case SYMKIND.SK_LabelSymbol: sym = new LabelSymbol(); sym.name = name; break; case SYMKIND.SK_GlobalAttributeDeclaration: sym = new GlobalAttributeDeclaration(); sym.name = name; break; case SYMKIND.SK_UnresolvedAggregateSymbol: sym = new UnresolvedAggregateSymbol(); sym.name = name; break; case SYMKIND.SK_InterfaceImplementationMethodSymbol: sym = new InterfaceImplementationMethodSymbol(); sym.name = name; break; case SYMKIND.SK_IndexerSymbol: sym = new IndexerSymbol(); sym.name = name; break; case SYMKIND.SK_ParentSymbol: sym = new ParentSymbol(); sym.name = name; break; case SYMKIND.SK_IteratorFinallyMethodSymbol: sym = new IteratorFinallyMethodSymbol(); sym.name = name; break; default: throw Error.InternalCompilerError(); } sym.setKind(kind); if (parent != null) { // Set the parent element of the child symbol. parent.AddToChildList(sym); m_pSymTable.InsertChild(parent, sym); } return(sym); }
///////////////////////////////////////////////////////////////////////////////// private EXPRMEMGRP CreateMemberGroupEXPR( string Name, IList<Type> typeArguments, EXPR callingObject, SYMKIND kind) { Name name = SymbolTable.GetName(Name, _semanticChecker.GetNameManager()); AggregateType callingType; if (callingObject.type.IsArrayType()) { callingType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_ARRAY); } else if (callingObject.type.IsNullableType()) { callingType = callingObject.type.AsNullableType().GetAts(_semanticChecker.GetSymbolLoader().GetErrorContext()); } else if (callingObject.type.IsAggregateType()) { callingType = callingObject.type.AsAggregateType(); } else { callingType = null; Debug.Assert(false, "MemberGroup on non-array, non-aggregate"); } List<CType> callingTypes = new List<CType>(); // The C# binder expects that only the base virtual method is inserted // into the list of candidates, and only the type containing the base // virtual method is inserted into the list of types. However, since we // don't want to do all the logic, we're just going to insert every type // that has a member of the given name, and allow the C# binder to filter // out all overrides. // // Find that set of types now. symbmask_t mask = symbmask_t.MASK_MethodSymbol; switch (kind) { case SYMKIND.SK_PropertySymbol: case SYMKIND.SK_IndexerSymbol: mask = symbmask_t.MASK_PropertySymbol; break; case SYMKIND.SK_MethodSymbol: mask = symbmask_t.MASK_MethodSymbol; break; default: Debug.Assert(false, "Unhandled kind"); break; } // If we have a constructor, only find its type. bool bIsConstructor = name == SymbolLoader.GetNameManager().GetPredefinedName(PredefinedName.PN_CTOR); for (AggregateType t = callingType; t != null; t = t.GetBaseClass()) { if (_symbolTable.AggregateContainsMethod(t.GetOwningAggregate(), Name, mask)) { callingTypes.Add(t); } // If we have a constructor, run the loop once for the constructor's type, and thats it. if (bIsConstructor) { break; } } // If this is a WinRT type we have to add all collection interfaces that have this method // as well so that overload resolution can find them. if (callingType.IsWindowsRuntimeType()) { TypeArray collectioniFaces = callingType.GetWinRTCollectionIfacesAll(SymbolLoader); for (int i = 0; i < collectioniFaces.size; i++) { CType t = collectioniFaces.Item(i); // Collection interfaces will be aggregates. Debug.Assert(t.IsAggregateType()); if (_symbolTable.AggregateContainsMethod(t.AsAggregateType().GetOwningAggregate(), Name, mask)) { callingTypes.Add(t); } } } EXPRFLAG flags = EXPRFLAG.EXF_USERCALLABLE; // If its a delegate, mark that on the memgroup. if (Name == SpecialNames.Invoke && callingObject.type.isDelegateType()) { flags |= EXPRFLAG.EXF_DELEGATE; } // For a constructor, we need to seed the memgroup with the constructor flag. if (Name == SpecialNames.Constructor) { flags |= EXPRFLAG.EXF_CTOR; } // If we have an indexer, mark that. if (Name == SpecialNames.Indexer) { flags |= EXPRFLAG.EXF_INDEXER; } TypeArray typeArgumentsAsTypeArray = BSYMMGR.EmptyTypeArray(); if (typeArguments != null && typeArguments.Count > 0) { typeArgumentsAsTypeArray = _semanticChecker.getBSymmgr().AllocParams( _symbolTable.GetCTypeArrayFromTypes(typeArguments)); } EXPRMEMGRP memgroup = _exprFactory.CreateMemGroup(// Tree flags, name, typeArgumentsAsTypeArray, kind, callingType, null, null, new CMemberLookupResults( _semanticChecker.getBSymmgr().AllocParams(callingTypes.Count, callingTypes.ToArray()), name)); if (callingObject.isCLASS()) { memgroup.SetOptionalLHS(callingObject); } else { memgroup.SetOptionalObject(callingObject); } return memgroup; }
private Symbol NewBasicSymbol( SYMKIND kind, Name name, ParentSymbol parent) { Symbol sym; switch (kind) { case SYMKIND.SK_NamespaceSymbol: sym = new NamespaceSymbol(); sym.name = name; break; case SYMKIND.SK_AggregateSymbol: sym = new AggregateSymbol(); sym.name = name; break; case SYMKIND.SK_AggregateDeclaration: sym = new AggregateDeclaration(); sym.name = name; break; case SYMKIND.SK_TypeParameterSymbol: sym = new TypeParameterSymbol(); sym.name = name; break; case SYMKIND.SK_FieldSymbol: sym = new FieldSymbol(); sym.name = name; break; case SYMKIND.SK_LocalVariableSymbol: sym = new LocalVariableSymbol(); sym.name = name; break; case SYMKIND.SK_MethodSymbol: sym = new MethodSymbol(); sym.name = name; break; case SYMKIND.SK_PropertySymbol: sym = new PropertySymbol(); sym.name = name; break; case SYMKIND.SK_EventSymbol: sym = new EventSymbol(); sym.name = name; break; case SYMKIND.SK_Scope: sym = new Scope(); sym.name = name; break; case SYMKIND.SK_IndexerSymbol: sym = new IndexerSymbol(); sym.name = name; break; default: throw Error.InternalCompilerError(); } sym.setKind(kind); if (parent != null) { // Set the parent element of the child symbol. parent.AddToChildList(sym); _symbolTable.InsertChild(parent, sym); } return(sym); }
public ExprMemberGroup CreateMemGroup(EXPRFLAG nFlags, Name pName, TypeArray pTypeArgs, SYMKIND symKind, CType pTypePar, MethodOrPropertySymbol pMPS, Expr pObject, CMemberLookupResults memberLookupResults) { Debug.Assert(0 == (nFlags & ~( EXPRFLAG.EXF_CTOR | EXPRFLAG.EXF_INDEXER | EXPRFLAG.EXF_OPERATOR | EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_BASECALL | EXPRFLAG.EXF_DELEGATE | EXPRFLAG.EXF_USERCALLABLE | EXPRFLAG.EXF_MASK_ANY ) )); ExprMemberGroup rval = new ExprMemberGroup(GetTypes().GetMethGrpType()); rval.Flags = nFlags; rval.Name = pName; rval.TypeArgs = pTypeArgs ?? BSYMMGR.EmptyTypeArray(); rval.SymKind = symKind; rval.ParentType = pTypePar; rval.OptionalObject = pObject; rval.MemberLookupResults = memberLookupResults; return(rval); }