Beispiel #1
0
 public void AddIdentifier(AstIdentifier identifier)
 {
     if (!TryAddIdentifier(identifier))
     {
         throw new InvalidOperationException(
                   "Identifier is already set, null or no Site could be found.");
     }
 }
Beispiel #2
0
        public ArgumentT?LookupArgument(AstIdentifier parameterName)
        {
            var parameter = FindByName(_parameters, parameterName.CanonicalFullName);

            if (parameter is not null)
            {
                return(LookupArgument(parameter));
            }
            return(null);
        }
Beispiel #3
0
        public override bool TrySetIdentifier(AstIdentifier identifier)
        {
            if (identifier.IsIntrinsic)
            {
                // self (parameter) is the only intrinsic that can be referenced in variable.
                return(TrySetIdentifier(identifier, AstIdentifierKind.Parameter));
            }

            return(base.TrySetIdentifier(identifier));
        }
        public override bool TrySetIdentifier(AstIdentifier identifier)
        {
            var success = base.TrySetIdentifier(identifier);

            if (success)
            {
                SymbolTable.SetName(identifier.SymbolName.CanonicalName.FullName);
            }

            return(success);
        }
Beispiel #5
0
        public AstTypeDefinitionIntrinsic(AstIdentifier identifier, Type?systemType,
                                          AstTemplateParameterDefinition?templateParameter = null)
        {
            this.SetIdentifier(identifier);
            SystemType = systemType;

            if (templateParameter is not null)
            {
                this.AddTemplateParameter(templateParameter);
            }
        }
Beispiel #6
0
 protected bool TrySetIdentifier(AstIdentifier identifier, AstIdentifierKind matchKind)
 {
     Ast.Guard(identifier.IdentifierKind == matchKind, $"Identifier must be of kind {matchKind}");
     return(Ast.SafeSet(ref _identifier, identifier));
 }
Beispiel #7
0
 public virtual bool TrySetIdentifier(AstIdentifier identifier)
 => TrySetIdentifier(identifier, AstIdentifierKind.Variable);
Beispiel #8
0
 public AstFunctionParameterDefinition(AstIdentifier identifier)
     : base(null)
 {
     this.SetIdentifier(identifier);
     IsSelf = identifier.IsEqual(AstIdentifierIntrinsic.Self);
 }
 public bool TrySetIdentifier(AstIdentifier identifier)
 {
     Ast.Guard(identifier.IdentifierKind == AstIdentifierKind.TemplateParameter, "Identifier must be of kind TemplateParameter");
     return(Ast.SafeSet(ref _identifier, identifier));
 }
Beispiel #10
0
 protected AstIdentifier(AstIdentifier identifierToCopy)
 {
     Context        = identifierToCopy.Context;
     IdentifierKind = identifierToCopy.IdentifierKind;
     SymbolName     = new AstSymbolName(identifierToCopy.SymbolName);
 }
Beispiel #11
0
 public AstTypeReferenceType(AstIdentifier identifier)
 {
     this.SetIdentifier(identifier);
 }
Beispiel #12
0
 public virtual bool TrySetIdentifier(AstIdentifier identifier)
 {
     Ast.Guard(identifier.IdentifierKind == AstIdentifierKind.Type, "Identifier must be of kind Type");
     return(Ast.SafeSet(ref _identifier, identifier));
 }
Beispiel #13
0
 public virtual bool TrySetIdentifier(AstIdentifier identifier)
 => TrySetIdentifier(identifier, AstIdentifierKind.Field);
Beispiel #14
0
 public bool TrySetIdentifier(AstIdentifier identifier)
 {
     Ast.Guard(identifier.IdentifierKind == AstIdentifierKind.Function, "Identifier must be of kind Function");
     return(Ast.SafeSet(ref _identifier, identifier));
 }
 public override bool TrySetIdentifier(AstIdentifier identifier)
 => TrySetIdentifier(identifier, AstIdentifierKind.EnumOption);
 public AstTemplateParameterDefinition(AstIdentifier identifier)
 {
     this.SetIdentifier(identifier);
 }
 public AstGenericParameterDefinition(AstIdentifier identifier)
 {
     this.SetIdentifier(identifier);
 }