Ejemplo n.º 1
0
 public bool EnterFunctionDeclaration(PhpLambdaFunction/*!*/ function)
 {
     return EnterFunctionDeclarationInternal(function, new QualifiedName(function.Name));
 }
Ejemplo n.º 2
0
        public LambdaFunctionExpr(SourceUnit/*!*/ sourceUnit,
            Position position, Position entireDeclarationPosition, ShortPosition headingEndPosition, ShortPosition declarationBodyPosition,
            Scope scope, NamespaceDecl ns,
            bool aliasReturn, List<FormalParam>/*!*/ formalParams, List<FormalParam> useParams,
            List<Statement>/*!*/ body)
            : base(position)
        {
            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;

            //QualifiedName qn = (ns != null) ? new QualifiedName(this.name, ns.QualifiedName) : new QualifiedName(this.name);
            //function = new PhpFunction(qn, memberAttributes, signature, typeSignature, isConditional, scope, sourceUnit, position);
            function = new PhpLambdaFunction(this.signature, sourceUnit, position);
            function.WriteUp(new TypeSignature(FormalTypeParam.EmptyList).ToPhpRoutineSignature(function));
        }