Exemplo n.º 1
0
        private GenericConstraint BuildConstraintFromChain(string name, ConstraintChain chain, TokenPosition position)
        {
            // Extracted chain data.
            bool valueType = false;
            bool defCtor = false;
            Expression bases = null;

            // Iterator though the chains.
            while(chain != null)
            {
                // Get the chain base.
                if(chain.baseExpr != null)
                {
                    Expression newBase = chain.baseExpr;
                    newBase.SetNext(bases);
                    bases = newBase;
                }

                // Check the value type and default constructor.
                valueType = valueType || chain.valueType;
                defCtor = defCtor || chain.defCtor;

                // Check the next chain.
                chain = chain.next;
            }

            // Create the generic constraint.
            return new GenericConstraint(name, valueType, defCtor, bases, position);
        }
Exemplo n.º 2
0
 public CompilerException(string what, TokenPosition position)
     : base(position.ToString() + ": " + what)
 {
     this.position = position;
 }
Exemplo n.º 3
0
        private void PrepareFile(AstNode content, string fileName)
        {
            // Use an special position.
            TokenPosition pos = new TokenPosition(fileName, -1, -1);

            // Create the file node.
            FileNode file = new FileNode(content, pos);

            // Add the file into the module node.
            moduleNode.AddFirst(file);
        }
Exemplo n.º 4
0
 public ArgTypeAndFlags(Expression type, TokenPosition position)
     : this(type, position, false)
 {
 }
Exemplo n.º 5
0
 public ArgTypeAndFlags(Expression type, TokenPosition position, bool isParams)
     : base(position)
 {
     this.type = type;
     this.isParams = isParams;
 }
Exemplo n.º 6
0
 public MemberFlagsAndMask(MemberFlags flags, TokenPosition position)
     : base(position)
 {
     this.flags = flags;
     this.mask = (MemberFlags)(~0);
 }
Exemplo n.º 7
0
 public MemberFlagsAndMask(MemberFlags flags, MemberFlags mask, TokenPosition position)
     : base(position)
 {
     this.flags = flags;
     this.mask = mask;
 }
Exemplo n.º 8
0
	void Error(TokenPosition position, string message)
	{
		throw new CompilerException(message, position);
	}
Exemplo n.º 9
0
 public TokenPosition(TokenPosition position)
 {
     this.fileName = position.fileName;
     this.line = position.line;
     this.column = position.column;
 }