Ejemplo n.º 1
0
        internal static Expression /*!*/ MakeRead(int kind, Parser /*!*/ parser, string name, SourceSpan location)
        {
            switch (kind)
            {
            case Identifier:
                return((Expression)parser.CurrentScope.ResolveVariable(name) ?? new MethodCall(null, name, null, null, location));

            case Instance:
                return(new InstanceVariable(name, location));

            case Global:
                return(new GlobalVariable(name, location));

            case Constant:
                return(new ConstantVariable(name, location));

            case Class:
                return(new ClassVariable(name, location));

            case Nil:
                return(Literal.Nil(location));

            case Self:
                return(new SelfReference(location));

            case True:
                return(Literal.True(location));

            case False:
                return(Literal.False(location));

            case File:
                return(new FileLiteral(location));

            case Line:
                return(Literal.Integer(parser.Tokenizer.TokenSpan.Start.Line, location));

            case Encoding:
                return(new EncodingExpression(location));
            }

            throw Assert.Unreachable;
        }