public FunctionCall(Text.Span span, Text.Span nameSpan, List<ActualParam>/*!*/ parameters, List<TypeRef>/*!*/ genericParams)
			: base(span)
		{
			Debug.Assert(parameters != null);

			this.callSignature = new CallSignature(parameters, genericParams);
            this.NameSpan = nameSpan;
		}
		public IndirectVarUse(Text.Span span, int levelOfIndirection, Expression varNameEx)
            : base(span)
		{
			Debug.Assert(levelOfIndirection > 0 && varNameEx != null);

			if (levelOfIndirection == 1)
			{
				this.varNameEx = varNameEx;
			}
			else
			{
                Text.Span varspan = new Text.Span(span.Start + 1, span.Length - 1);
                this.varNameEx = new IndirectVarUse(varspan, --levelOfIndirection, varNameEx);
			}
		}
Exemple #3
0
 private void Append(Text.Span span)
 {
     if (this.span.IsValid)
     {
         if (span.IsValid)
             this.span = Text.Span.Combine(this.span, span);
     }
     else
     {
         this.span = span;
     }
 }
Exemple #4
0
		/// <summary>
		/// Used by compiler.
		/// </summary>
		public PhpField(VariableName name, DTypeDesc/*!*/ declaringType, PhpMemberAttributes memberAttributes,
            bool hasInitialValue, SourceUnit/*!*/ sourceUnit, Text.Span position)
			: base(new DPhpFieldDesc(declaringType, memberAttributes), name)
		{
			this.hasInitialValue = hasInitialValue;
			this.span = position;
			this.sourceUnit = sourceUnit;
			this.builder = new PhpFieldBuilder(this);
		}
        public LambdaFunctionExpr(SourceUnit/*!*/ sourceUnit,
            Text.Span span, Text.Span entireDeclarationPosition, int headingEndPosition, int declarationBodyPosition,
            Scope scope, NamespaceDecl ns,
            bool aliasReturn, List<FormalParam>/*!*/ formalParams, List<FormalParam> useParams,
            IList<Statement>/*!*/ body)
            : base(span)
        {
            Debug.Assert(formalParams != null && body != null);
            Debug.Assert(sourceUnit != null);

            this.sourceUnit = sourceUnit;
            
            this.ns = ns;
            this.signature = new Signature(aliasReturn, formalParams);
            this.useParams = useParams;
            //this.typeSignature = new TypeSignature(genericParams);
            //this.attributes = new CustomAttributes(attributes);
            this.body = body.AsArray();
            this.entireDeclarationPosition = entireDeclarationPosition;
            this.headingEndPosition = headingEndPosition;
            this.declarationBodyPosition = declarationBodyPosition;
        }
Exemple #6
0
        public NamedTypeDecl(
            Text.Span span, Text.Span headingSpan, bool isConditional, PhpMemberAttributes memberAttributes, bool isPartial,
            NameRef className, List <FormalTypeParam> /*!*/ genericParams, INamedTypeRef baseClass,
            List <INamedTypeRef> /*!*/ implementsList, List <TypeMemberDecl> /*!*/ elements, Text.Span bodySpan,

            List <CustomAttribute> attributes)
            : base(span, headingSpan, isConditional,
                   memberAttributes, isPartial, genericParams, baseClass, implementsList, elements, bodySpan, attributes)
        {
            Debug.Assert(genericParams != null && implementsList != null && elements != null);
            Debug.Assert((memberAttributes & PhpMemberAttributes.Trait) == 0 || (memberAttributes & PhpMemberAttributes.Interface) == 0, "Interface cannot be a trait");

            this.name = className;
        }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the StringLiteral class.
 /// </summary>
 public BinaryStringLiteral(Text.Span span, byte[] /*!*/ value)
     : base(span)
 {
     this.value = value;
 }
Exemple #8
0
 protected Literal(Text.Span span)
     : base(span)
 {
 }
Exemple #9
0
 public TraitAdaptationBlock(Text.Span span, IList <TraitsUse.TraitAdaptation> /*!*/ body)
     : base(span)
 {
     Debug.Assert(body != null);
     _adaptations = body.AsArray();
 }
        public LambdaFunctionExpr(SourceUnit/*!*/ sourceUnit,
            Text.Span span, Text.Span entireDeclarationPosition, int headingEndPosition, int declarationBodyPosition,
            Scope scope, NamespaceDecl ns,
            bool aliasReturn, List<FormalParam>/*!*/ formalParams, List<FormalParam> useParams,
            List<Statement>/*!*/ body)
            : base(span)
        {
            Debug.Assert(formalParams != null && body != null);

            // inject use parameters at the begining of formal parameters
            if (useParams != null && useParams.Count > 0)
            {
                if (formalParams.Count == 0)
                    formalParams = useParams;   // also we don't want to modify Parser.emptyFormalParamListIndex singleton.
                else
                    formalParams.InsertRange(0, useParams);
            }
            
            //this.ns = ns;
            this.signature = new Signature(aliasReturn, formalParams);
            this.useParams = useParams;
            //this.typeSignature = new TypeSignature(genericParams);
            //this.attributes = new CustomAttributes(attributes);
            this.body = body;
            this.entireDeclarationPosition = entireDeclarationPosition;
            this.headingEndPosition = headingEndPosition;
            this.declarationBodyPosition = declarationBodyPosition;
        }
Exemple #11
0
 public ConstDeclList(Text.Span span, PhpMemberAttributes modifiers, List <ClassConstantDecl> /*!*/ constants, List <CustomAttribute> attributes)
     : base(span, modifiers, attributes)
 {
     Debug.Assert(constants != null);
     this.constants = constants;
 }
Exemple #12
0
 public ClassConstantDecl(Text.Span span, string /*!*/ name, Text.Span namePos, Expression /*!*/ initializer)
     : base(span, name, namePos, initializer)
 {
 }
Exemple #13
0
 public FieldDecl(Text.Span span, string /*!*/ name, Expression initVal)
     : base(span)
 {
     this.name        = new VariableName(name);
     this.initializer = initVal;
 }
Exemple #14
0
        public MethodDecl(Text.Span span,
                          NameRef name, bool aliasReturn, IList <FormalParam> /*!*/ formalParams, Text.Span paramsSpan,
                          IList <FormalTypeParam> /*!*/ genericParams, BlockStmt body,
                          PhpMemberAttributes modifiers, IList <ActualParam> baseCtorParams,
                          List <CustomAttribute> attributes, TypeRef returnType)
            : base(span, modifiers, attributes)
        {
            Debug.Assert(genericParams != null && formalParams != null);

            this.name           = name;
            this.signature      = new Signature(aliasReturn, formalParams);
            this.typeSignature  = new TypeSignature(genericParams);
            this.body           = body;
            this.baseCtorParams = (baseCtorParams != null) ? baseCtorParams.AsArray() : null;
            this.parametersSpan = paramsSpan;
            this.returnType     = returnType;
        }
Exemple #15
0
 public AnonymousTypeDecl(
     Text.Span span, Text.Span headingSpan,
     bool isConditional, PhpMemberAttributes memberAttributes, bool isPartial,
     List <FormalTypeParam> /*!*/ genericParams, INamedTypeRef baseClass,
     List <INamedTypeRef> /*!*/ implementsList, List <TypeMemberDecl> /*!*/ elements, Text.Span bodySpan,
     List <CustomAttribute> attributes)
     : base(span, headingSpan, isConditional,
            memberAttributes, isPartial, genericParams, baseClass, implementsList, elements, bodySpan, attributes)
 {
 }
Exemple #16
0
        public MethodDecl(Text.Span span, Text.Span entireDeclarationPosition, int headingEndPosition, int declarationBodyPosition, 
			string name, bool aliasReturn, IList<FormalParam>/*!*/ formalParams, IList<FormalTypeParam>/*!*/ genericParams, 
			IList<Statement> body, PhpMemberAttributes modifiers, IList<ActualParam> baseCtorParams, 
			List<CustomAttribute> attributes)
            : base(span, attributes)
        {
            Debug.Assert(genericParams != null && formalParams != null);

            this.modifiers = modifiers;
            this.name = new Name(name);
            this.signature = new Signature(aliasReturn, formalParams);
            this.typeSignature = new TypeSignature(genericParams);
            this.body = (body != null) ? body.AsArray() : null;
            this.baseCtorParams = (baseCtorParams != null) ? baseCtorParams.AsArray() : null;
            this.entireDeclarationSpan = entireDeclarationPosition;
            this.headingEndPosition = headingEndPosition;
            this.declarationBodyPosition = declarationBodyPosition;
        }
Exemple #17
0
 public TraitAdaptation(Text.Span span, Tuple <QualifiedNameRef, NameRef> traitMemberName)
     : base(span)
 {
     this.TraitMemberName = traitMemberName;
 }
Exemple #18
0
		/// <summary>
        /// Initialize the LangElement.
        /// </summary>
        /// <param name="span">The position of the LangElement in the source code.</param>
		protected LangElement(Text.Span span)
		{
			this.Span = span;
		}
Exemple #19
0
 public TraitAdaptationPrecedence(Text.Span span, Tuple <QualifiedNameRef, NameRef> traitMemberName, List <QualifiedNameRef> /*!*/ ignoredTypes)
     : base(span, traitMemberName)
 {
     this.IgnoredTypes = ignoredTypes;
 }
Exemple #20
0
 protected AssignEx(Text.Span p) : base(p)
 {
 }
Exemple #21
0
 public FinallyItem(Text.Span span, IList <Statement> /*!*/ statements)
     : base(span)
 {
     this.statements = statements.AsArray();
 }
Exemple #22
0
 public BoolLiteral(Text.Span span, bool value)
     : base(span)
 {
     this.value = value;
 }
Exemple #23
0
		/// <summary>
		/// Used by compiler.
		/// </summary>
		public ClassConstant(VariableName name, DTypeDesc/*!*/ declaringType, PhpMemberAttributes memberAttributes,
            SourceUnit/*!*/ sourceUnit, Text.Span position)
			: base(new DConstantDesc(declaringType, memberAttributes, null))
		{
			Debug.Assert(declaringType != null);

			this.name = name;
			this.span = position;
			this.sourceUnit = sourceUnit;
		}
Exemple #24
0
		public GotoStmt(Text.Span span, string/*!*/labelName, Text.Span nameSpan)
			: base(span)
		{
            Debug.Assert(!string.IsNullOrEmpty(labelName));
			_labelName = new VariableName(labelName);
            _nameSpan = nameSpan;
		}
Exemple #25
0
        /// <summary>
        /// Used by the compiler.
        /// </summary>
        internal PhpLambdaFunction(Signature astSignature, CompilationSourceUnit/*!*/ sourceUnit, Text.Span position)
            : base(
            new PhpRoutineDesc(
                DTypeDesc.Create(typeof(PHP.Library.SPL.Closure)),
                PhpMemberAttributes.Private | PhpMemberAttributes.Static | PhpMemberAttributes.Final),
            astSignature,
            new TypeSignature(FormalTypeParam.EmptyList))
        {
            Debug.Assert(sourceUnit != null && position.IsValid);

            this.span = position;
            this.sourceUnit = sourceUnit;
        }
Exemple #26
0
 public ThrowStmt(Text.Span span, Expression /*!*/ expression)
     : base(span)
 {
     Debug.Assert(expression != null);
     this.expression = expression;
 }
Exemple #27
0
        public TypeDecl(
            Text.Span span, Text.Span headingSpan,
            bool isConditional, PhpMemberAttributes memberAttributes, bool isPartial,
            List <FormalTypeParam> /*!*/ genericParams, INamedTypeRef baseClass,
            List <INamedTypeRef> /*!*/ implementsList, List <TypeMemberDecl> /*!*/ elements, Text.Span bodySpan,
            List <CustomAttribute> attributes)
            : base(span)
        {
            Debug.Assert(genericParams != null && implementsList != null && elements != null);
            Debug.Assert((memberAttributes & PhpMemberAttributes.Trait) == 0 || (memberAttributes & PhpMemberAttributes.Interface) == 0, "Interface cannot be a trait");

            this.typeSignature    = new TypeSignature(genericParams);
            this.baseClass        = baseClass;
            this.MemberAttributes = memberAttributes;
            this.IsConditional    = isConditional;
            this.ImplementsList   = implementsList.AsArray();
            this.members          = elements;
            this.members.TrimExcess();

            if (attributes != null && attributes.Count != 0)
            {
                this.Attributes = new CustomAttributes(attributes);
            }
            this.headingSpan    = headingSpan;
            this.bodySpan       = bodySpan;
            this.partialKeyword = isPartial;
        }
Exemple #28
0
		/// <summary>
		/// Used by the compiler.
		/// </summary>
		internal PhpMethod(PhpType/*!*/ declaringType, Name name, PhpMemberAttributes memberAttributes, bool hasBody,
      Signature astSignature, TypeSignature astTypeSignature, CompilationSourceUnit/*!*/ sourceUnit, Text.Span position)
			: base(new PhpRoutineDesc(declaringType.TypeDesc, memberAttributes), astSignature, astTypeSignature)
		{
			Debug.Assert(declaringType != null && sourceUnit != null && position.IsValid);

			this.name = name;
			this.span = position;
			this.hasBody = hasBody;
			this.sourceUnit = sourceUnit;
		}
Exemple #29
0
 public StringLiteralDereferenceEx(Text.Span span, Expression expr, Expression key)
     : base(span)
 {
     this.StringExpr = expr;
     this.KeyExpr    = key;
 }
Exemple #30
0
        /// <summary>
        /// Initialize the PhpStringBuilder.
        /// </summary>
        /// <param name="encoding"></param>
        /// <param name="binary"></param>
        /// <param name="initialLength"></param>
        public PhpStringBuilder(Encoding/*!*/encoding, bool binary, int initialLength)
        {
            Debug.Assert(encoding != null);

            this.encoding = encoding;
            this.span = Text.Span.Invalid;

            //if (binary)
            //    _binaryBuilder = new List<byte>(initialLength);
            //else
                _unicodeBuilder = new StringBuilder(initialLength);
        }
Exemple #31
0
 public NamedActualParam(Text.Span span, string name, Expression /*!*/ expression)
     : base(span)
 {
     this.name       = new VariableName(name);
     this.expression = expression;
 }
Exemple #32
0
        public ClassConstUse(Text.Span span, TypeRef/*!*/typeRef, string/*!*/ name, Text.Span namePosition)
            : base(span)
        {
            Debug.Assert(typeRef != null);
            Debug.Assert(!string.IsNullOrEmpty(name));

            this.typeRef = typeRef;
			this.name = new VariableName(name);
            this.NamePosition = namePosition;
        }
Exemple #33
0
 public ActualParam(Text.Span p, Expression param)
     : this(p, param, Flags.Default)
 {
 }
Exemple #34
0
		public TypeDecl(SourceUnit/*!*/ sourceUnit,
            Text.Span span, Text.Span entireDeclarationPosition, int headingEndPosition, int declarationBodyPosition,
            bool isConditional, Scope scope, PhpMemberAttributes memberAttributes, bool isPartial, Name className, Text.Span classNamePosition,
            NamespaceDecl ns, List<FormalTypeParam>/*!*/ genericParams, Tuple<GenericQualifiedName, Text.Span> baseClassName,
            List<Tuple<GenericQualifiedName, Text.Span>>/*!*/ implementsList, List<TypeMemberDecl>/*!*/ elements,
			List<CustomAttribute> attributes)
            : base(span)
		{
			Debug.Assert(genericParams != null && implementsList != null && elements != null);
            Debug.Assert((memberAttributes & PhpMemberAttributes.Trait) == 0 || (memberAttributes & PhpMemberAttributes.Interface) == 0, "Interface cannot be a trait");

			this.name = className;
            this.NamePosition = classNamePosition;
			this.ns = ns;
			this.typeSignature = new TypeSignature(genericParams);
            if (baseClassName != null)
            {
                this.baseClassName = baseClassName.Item1;
                this.BaseClassNamePosition = baseClassName.Item2;
            }
            this.MemberAttributes = memberAttributes;
            this.Scope = scope;
            this.SourceUnit = sourceUnit;
            this.IsConditional = isConditional;
            if (implementsList == null || implementsList.Count == 0)
            {
                this.ImplementsList = EmptyArray<GenericQualifiedName>.Instance;
                this.ImplementsListPosition = EmptyArray<Text.Span>.Instance;
            }
            else
            {
                this.ImplementsList = implementsList.Select(x => x.Item1).ToArray();
                this.ImplementsListPosition = implementsList.Select(x => x.Item2).ToArray();
            }
            this.members = elements;
            this.members.TrimExcess();

			if (attributes != null && attributes.Count != 0)
                this.Attributes = new CustomAttributes(attributes);
			this.entireDeclarationSpan = entireDeclarationPosition;
            this.headingEndPosition = headingEndPosition;
			this.declarationBodyPosition = declarationBodyPosition;
            this.partialKeyword = isPartial;
		}
Exemple #35
0
 /// <summary>
 /// Initializes new echo statement as a representation of HTML code.
 /// </summary>
 public EchoStmt(Text.Span span, string htmlCode)
     : base(span)
 {
     this.parameters = new Expression[] { new StringLiteral(span, htmlCode) };
     this.isHtmlCode = true;
 }
Exemple #36
0
		public FunctionDecl(SourceUnit/*!*/ sourceUnit,
            Text.Span span, Text.Span entireDeclarationPosition, int headingEndPosition, int declarationBodyPosition,
			bool isConditional, Scope scope, PhpMemberAttributes memberAttributes, string/*!*/ name, NamespaceDecl ns,
			bool aliasReturn, List<FormalParam>/*!*/ formalParams, List<FormalTypeParam>/*!*/ genericParams,
			IList<Statement>/*!*/ body, List<CustomAttribute> attributes)
			: base(span)
		{
			Debug.Assert(genericParams != null && name != null && formalParams != null && body != null);

			this.name = new Name(name);
			this.ns = ns;
			this.signature = new Signature(aliasReturn, formalParams);
			this.typeSignature = new TypeSignature(genericParams);
			if (attributes != null && attributes.Count != 0)
                this.Attributes = new CustomAttributes(attributes);
			this.body = body.AsArray();
			this.entireDeclarationPosition = entireDeclarationPosition;
            this.headingEndPosition = headingEndPosition;
            this.declarationBodyPosition = declarationBodyPosition;
            this.IsConditional = isConditional;
            this.MemberAttributes = memberAttributes;
            this.Scope = scope;
            this.SourceUnit = sourceUnit;
		}
Exemple #37
0
 /// <summary>
 /// Initializes a new instance of the IntLiteral class.
 /// </summary>
 public LongIntLiteral(Text.Span span, long value)
     : base(span)
 {
     this.value = value;
 }
Exemple #38
0
        public ConditionalStmt(Text.Span span, Expression condition, Statement/*!*/ statement)
		{
            this.Span = span;
			this.condition = condition;
			this.statement = statement;
		}
Exemple #39
0
 /// <summary>
 /// Initializes a new instance of the DoubleLiteral class.
 /// </summary>
 /// <param name="value">A double value to be stored in node.</param>
 /// <param name="p">A position.</param>
 public DoubleLiteral(Text.Span p, double value)
     : base(p)
 {
     this.value = value;
 }
Exemple #40
0
 /// <summary>
 /// Initializes a new instance of the StringLiteral class.
 /// </summary>
 public StringLiteral(Text.Span span, string value)
     : base(span)
 {
     this.value = value;
 }
Exemple #41
0
 /// <summary>
 /// Initialize the ConcatEx AST node and optimize the subtree if possible. Look for child expressions and chain possible concatenations. This prevents StackOverflowException in case of huge concatenation expressions.
 /// </summary>
 /// <param name="span"></param>
 /// <param name="expressions">List of expressions to concatenate.</param>
 /// <remarks>This method tries to propagate child concatenations and chain them.</remarks>
 public ConcatEx(Text.Span span, IList <Expression> /*!*/ expressions)
     : base(span)
 {
     Debug.Assert(expressions != null);
     this.expressions = expressions.AsArray();
 }