public override void CreateSymbols(AstSymbolTable functionSymbols, AstSymbolTable?parentSymbols = null)
        {
            Ast.Guard(!HasSymbol, "Symbol already set. Call CreateSymbols only once.");

            FunctionType.CreateSymbols(functionSymbols, parentSymbols);

            var contextSymbols = parentSymbols ?? functionSymbols;

            contextSymbols.Add(this);
        }
Esempio n. 2
0
        public override void CreateSymbols(AstSymbolTable functionSymbols, AstSymbolTable?parentSymbols = null)
        {
            base.CreateSymbols(functionSymbols, parentSymbols);

            foreach (var parameter in FunctionType.Parameters)
            {
                functionSymbols.TryAdd(parameter);
            }

            foreach (var templParam in TemplateParameters)
            {
                SymbolTable.TryAdd(templParam);
            }
        }
Esempio n. 3
0
 public static void AddAll(AstSymbolTable symbols)
 {
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.U8, typeof(Byte)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.U16, typeof(UInt16)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.U64, typeof(UInt64)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.U32, typeof(UInt32)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.I8, typeof(SByte)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.I16, typeof(Int16)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.I64, typeof(Int64)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.I32, typeof(Int32)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.C16, typeof(Char)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.F16, typeof(Half)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.F32, typeof(Single)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.F64, typeof(Double)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.F96, typeof(Decimal)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.Str, typeof(String)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.Bool, typeof(Boolean)));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.Void, null));
     AddIntrinsicSymbol(symbols, new(AstIdentifierIntrinsic.Array, typeof(Array), new(AstIdentifierIntrinsic.T)));
 }
 private static void AddIntrinsicSymbol(AstSymbolTable symbols, AstFunctionDefinitionIntrinsic function)
 => function.CreateSymbols(symbols);
 public static void AddAll(AstSymbolTable symbols)
 {
     // no intrinsic compiler generated functions at this time.
 }
 internal AstTypeDefinitionEnum(ParserRuleContext context, AstSymbolTable parentTable)
     : base(AstNodeKind.Enum)
 {
     Context     = context;
     SymbolTable = new AstSymbolTable("", parentTable);
 }
Esempio n. 7
0
 internal AstFile(string scopeName, AstSymbolTable parentTable, ParserRuleContext context)
     : base(AstNodeKind.File)
 {
     Context = context;
     this.SetCodeBlock(new AstCodeBlock(scopeName, parentTable));
 }
Esempio n. 8
0
 public AstCodeBlock(string scopeName, AstSymbolTable parentTable, CodeblockContext?context = null)
     : base(AstNodeKind.CodeBlock)
 {
     SymbolTable = new AstSymbolTable(scopeName, parentTable);
     Context     = context;
 }
Esempio n. 9
0
 internal AstTypeDefinitionStruct(ParserRuleContext context, AstSymbolTable parentTable)
     : base(AstNodeKind.Struct)
 {
     SymbolTable = new AstSymbolTable("", parentTable);
     Context     = context;
 }
Esempio n. 10
0
 protected static void AddIntrinsicSymbol(AstSymbolTable symbols, AstTypeDefinitionIntrinsic type)
 => symbols.AddSymbol(type.Identifier.SymbolName.CanonicalName.FullName, AstSymbolKind.Type, type);
Esempio n. 11
0
 public abstract void CreateSymbols(AstSymbolTable functionSymbols, AstSymbolTable?parentSymbols = null);