示例#1
0
    public static void RemoveTypeHint(
        this Tokenizer <NeuToken> tokenizer,
        NeuTypeIdentifier typeIdentifier)
    {
        var t = tokenizer as NeuTokenizer;

        if (t == null)
        {
            throw new Exception($"Unsupported tokenizer");
        }

        ///

        var first = t.TypeHints.FirstOrDefault();

        ///

        if (first == null)
        {
            throw new Exception();
        }

        ///

        if (!Equals(first, typeIdentifier))
        {
            throw new Exception();
        }

        ///

        t.TypeHints.Pop();
    }
示例#2
0
    ///

    public NeuReturnClause(
        NeuTypeIdentifier typeId)
        : base(
            new Node[] {
        new NeuPunc("->", new UnknownLocation(), new UnknownLocation(), NeuPuncType.Arrow),
        typeId
    },
            new UnknownLocation(),
            new UnknownLocation())
    {
    }
示例#3
0
    public static void AddTypeHint(
        this Tokenizer <NeuToken> tokenizer,
        NeuTypeIdentifier typeIdentifier)
    {
        var t = tokenizer as NeuTokenizer;

        if (t == null)
        {
            throw new Exception($"Unsupported tokenizer");
        }

        ///

        t.TypeHints.Push(typeIdentifier);
    }