Exemple #1
0
        public void RejectConstVariable(ast.ExprNode node)
        {
            // Is the lhs a global?
            if (node.GetType() != typeof(ast.ExprNodeIdentifier))
            {
                return;
            }

            // Check it's not a member accessor
            var identifier = (ast.ExprNodeIdentifier)node;

            if (identifier.Lhs != null)
            {
                return;
            }

            // Find the symbol and mark it as not a const
            var s = currentScope.FindSymbol(identifier.Name);

            if (s != null)
            {
                s.ConstValue   = null;
                s.ConstAllowed = false;
            }
        }
Exemple #2
0
		string GetIdentifier()
		{
			if (Index.GetType() != typeof(ast.ExprNodeLiteral))
				return null;

			object literal = ((ast.ExprNodeLiteral)Index).Value;
			if (literal.GetType() != typeof(string))
				return null;

			string identifier=(string)literal;
			if (!Tokenizer.IsIdentifier(identifier) && !Tokenizer.IsKeyword(identifier))
				return null;

			return identifier;
		}