Exemplo n.º 1
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.entireDeclarationSpan   = entireDeclarationPosition;
            this.headingEndPosition      = headingEndPosition;
            this.declarationBodyPosition = declarationBodyPosition;
            this.IsConditional           = isConditional;
            this.MemberAttributes        = memberAttributes;
            this.Scope      = scope;
            this.SourceUnit = sourceUnit;
        }
Exemplo n.º 2
0
 public GlobalConstantDecl(SourceUnit /*!*/ sourceUnit, Text.Span span, bool isConditional, Scope scope,
                           string /*!*/ name, NamespaceDecl ns, Expression /*!*/ initializer)
     : base(span, name, initializer)
 {
     this.ns            = ns;
     this.IsConditional = IsConditional;
     this.Scope         = scope;
     this.SourceUnit    = sourceUnit;
 }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        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.entireDeclarationSpan   = entireDeclarationPosition;
            this.headingEndPosition      = headingEndPosition;
            this.declarationBodyPosition = declarationBodyPosition;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Visit namespace statements.
 /// </summary>
 /// <param name="x"></param>
 virtual public void VisitNamespaceDecl(NamespaceDecl x)
 {
     VisitStatements(x.Statements);
 }