コード例 #1
0
        internal override Evaluation Analyze(Analyzer analyzer, ExInfoFromParent info)
        {
            signature.AnalyzeMembers(analyzer, function);

            //attributes.Analyze(analyzer, this);

            // ensure 'use' parameters in parent scope:
            if (this.useParams != null)
            {
                foreach (var p in this.useParams)
                {
                    analyzer.CurrentVarTable.Set(p.Name, p.PassedByRef);
                }
            }

            // function is analyzed even if it is unreachable in order to discover more errors at compile-time:
            analyzer.EnterFunctionDeclaration(function);

            //typeSignature.Analyze(analyzer);
            signature.Analyze(analyzer);

            this.Body.Analyze(analyzer);

            // validate function and its body:
            function.ValidateBody(analyzer.ErrorSink);

            analyzer.LeaveFunctionDeclaration();

            return(new Evaluation(this));
        }
コード例 #2
0
            public override Evaluation Analyze(LambdaFunctionExpr node, Analyzer analyzer, ExInfoFromParent info)
            {
                // construct fake signature containing both - use params and regular params
                var allparams = new List <FormalParam>(node.Signature.FormalParams);

                if (node.UseParams != null)
                {
                    allparams.InsertRange(0, node.UseParams);
                }
                var signature = new Signature(false, allparams);

                //
                function = new PhpLambdaFunction(signature, analyzer.SourceUnit, node.Span);
                function.WriteUp(new TypeSignature(FormalTypeParam.EmptyList).ToPhpRoutineSignature(function));

                SignatureCompiler.AnalyzeMembers(signature, analyzer, function);

                //attributes.Analyze(analyzer, this);

                // ensure 'use' parameters in parent scope:
                if (node.UseParams != null)
                {
                    foreach (var p in node.UseParams)
                    {
                        analyzer.CurrentVarTable.Set(p.Name, p.PassedByRef);
                    }
                }

                // function is analyzed even if it is unreachable in order to discover more errors at compile-time:
                analyzer.EnterFunctionDeclaration(function);

                //typeSignature.Analyze(analyzer);
                SignatureCompiler.Analyze(signature, analyzer);

                node.Body.Analyze(analyzer);

                // validate function and its body:
                function.ValidateBody(analyzer.ErrorSink);

                analyzer.LeaveFunctionDeclaration();

                return(new Evaluation(node));
            }