Ejemplo n.º 1
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			Evaluation cond_eval = condExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);

			if (cond_eval.HasValue)
			{
                if (Convert.ObjectToBoolean(cond_eval.Value))
                {
                    if (trueExpr != null)
                        return trueExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);
                    else
                        return cond_eval;   // condExpr ?: falseExpr    // ternary shortcut
                }
                else
                    return falseExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);
			}
			else
			{
                if (trueExpr != null)
                {
                    analyzer.EnterConditionalCode();
                    trueExpr = trueExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
                    analyzer.LeaveConditionalCode();
                }

				analyzer.EnterConditionalCode();
				falseExpr = falseExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
				analyzer.LeaveConditionalCode();

				return new Evaluation(this);
			}
		}
Ejemplo n.º 2
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            Debug.Assert(this.IsMemberOf == null);

            access = info.Access;

            this.typeArgsResolved = classNameRef.Analyze(analyzer);

            DType            type = classNameRef.ResolvedType;
            RoutineSignature signature;

            if (typeArgsResolved)
            {
                analyzer.AnalyzeConstructedType(type);
            }

            if (type != null)
            {
                bool error_reported = false;

                // make checks if we are sure about character of the type:
                if (type.IsIdentityDefinite)
                {
                    if (type.IsAbstract || type.IsInterface)
                    {
                        analyzer.ErrorSink.Add(Errors.AbstractClassOrInterfaceInstantiated, analyzer.SourceUnit,
                                               position, type.FullName);
                        error_reported = true;
                    }
                }

                // disallow instantiation of Closure
                if (type.RealType == typeof(PHP.Library.SPL.Closure))
                {
                    analyzer.ErrorSink.Add(Errors.ClosureInstantiated, analyzer.SourceUnit, position, type.FullName);
                    error_reported = true;
                }

                // type name resolved, look the constructor up:
                constructor = analyzer.ResolveConstructor(type, position, analyzer.CurrentType, analyzer.CurrentRoutine,
                                                          out runtimeVisibilityCheck);

                if (constructor.ResolveOverload(analyzer, callSignature, position, out signature) == DRoutine.InvalidOverloadIndex)
                {
                    if (!error_reported)
                    {
                        analyzer.ErrorSink.Add(Errors.ClassHasNoVisibleCtor, analyzer.SourceUnit,
                                               position, type.FullName);
                    }
                }
            }
            else
            {
                signature = UnknownSignature.Default;
            }

            callSignature.Analyze(analyzer, signature, info, false);

            return(new Evaluation(this));
        }
Ejemplo n.º 3
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;
            ExInfoFromParent operand_info = ExInfoFromParent.DefaultExInfo;

            Evaluation left_eval = leftExpr.Analyze(analyzer, operand_info);
            Evaluation right_eval;

            // Boolean expression evaluation semantics:
            if (operation == Operations.Or)
            {
                analyzer.EnterConditionalCode();
                right_eval = rightExpr.Analyze(analyzer, operand_info);
                analyzer.LeaveConditionalCode();
            }
            else
            {
                right_eval = rightExpr.Analyze(analyzer, operand_info);
            }

            Evaluation result = Evaluation.Evaluate(this, left_eval, out leftExpr, right_eval, out rightExpr);

            // division by zero check:
            if ((operation == Operations.Div || operation == Operations.Mod) && result.HasValue && result.Value is bool && (bool)result.Value == false)
            {
                analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position);
            }
            else if ((operation == Operations.Div || operation == Operations.Mod) && right_eval.HasValue && right_eval.Value is int && (int)right_eval.Value == 0)
            {
                result = new Evaluation(this, false);
                analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position);
            }

            return(result);
        }
Ejemplo n.º 4
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			bool already_resolved = constant != null;

			if (!already_resolved)
			{
				access = info.Access;
				ResolveName(analyzer);
			}

			if (constant.IsUnknown)
				return new Evaluation(this);

			KnownConstant known_const = (KnownConstant)constant;

			if (known_const.HasValue)
			{
				// constant value is known:
				return new Evaluation(this, known_const.Value);
			}
			else if (already_resolved)
			{
				// circular definition:
				constant.ReportCircularDefinition(analyzer.ErrorSink);
				return new Evaluation(this);
			}
			else
			{
				// value is not known yet, try to resolve it:
                if (known_const.Node != null)
				    known_const.Node.Analyze(analyzer);

				return (known_const.HasValue) ? new Evaluation(this, known_const.Value) : new Evaluation(this);
			}
		}
Ejemplo n.º 5
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;
			ExInfoFromParent operand_info = ExInfoFromParent.DefaultExInfo;

			Evaluation left_eval = leftExpr.Analyze(analyzer, operand_info);
			Evaluation right_eval;

			// Boolean expression evaluation semantics:
			if (operation == Operations.Or)
			{
				analyzer.EnterConditionalCode();
				right_eval = rightExpr.Analyze(analyzer, operand_info);
				analyzer.LeaveConditionalCode();
			}
			else
			{
				right_eval = rightExpr.Analyze(analyzer, operand_info);
			}

			Evaluation result = Evaluation.Evaluate(this, left_eval, out leftExpr, right_eval, out rightExpr);

			// division by zero check:
			if ((operation == Operations.Div || operation == Operations.Mod) && result.HasValue && result.Value is bool && (bool)result.Value == false)
			{
				analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position);
			}
			else if ((operation == Operations.Div || operation == Operations.Mod) && right_eval.HasValue && right_eval.Value is int && (int)right_eval.Value == 0)
			{
				result = new Evaluation(this, false);
				analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position);
			}

			return result;
		}
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;
			fileNameEx = fileNameEx.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
			analyzer.AddCurrentRoutineProperty(RoutineProperties.ContainsInclude);
			analyzer.CurrentScope = this.scope;
			return new Evaluation(this);
		}
Ejemplo n.º 8
0
        internal override void Analyze(Analyzer analyzer)
        {
            ExInfoFromParent info = new ExInfoFromParent(this);

            info.Access = AccessType.ReadRef;
            refToGet.Analyze(analyzer, info);
            base.Analyze(analyzer);
        }
Ejemplo n.º 9
0
 /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
 internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
 {
     access     = info.Access;
     fileNameEx = fileNameEx.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
     analyzer.AddCurrentRoutineProperty(RoutineProperties.ContainsInclude);
     analyzer.CurrentScope = this.scope;
     return(new Evaluation(this));
 }
Ejemplo n.º 10
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            base.Analyze(analyzer, info);

            fieldNameExpr = fieldNameExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();

            return(new Evaluation(this));
        }
Ejemplo n.º 11
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            variable.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);

            return(new Evaluation(this));
        }
Ejemplo n.º 12
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            base.Analyze(analyzer, info);

            property = analyzer.ResolveProperty(type, propertyName, position, true, analyzer.CurrentType, analyzer.CurrentRoutine, out runtimeVisibilityCheck);

            return(new Evaluation(this));
        }
Ejemplo n.º 13
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			foreach (Item i in items)
				if (i != null) i.Analyze(analyzer);

			return new Evaluation(this);
		}
Ejemplo n.º 14
0
        internal void Analyze(Analyzer /*!*/ analyzer, bool isBaseCtorCallConstrained)
        {
            // TODO: isBaseCtorCallConstrained

            ExInfoFromParent info = new ExInfoFromParent(this);

            analyzer.EnterActParam();

            if (analyzer.ActParamDeclIsUnknown())
            {
                // we don't know whether the parameter will be passed by reference at run-time:
                if (expression.AllowsPassByReference)
                {
                    info.Access = AccessType.ReadUnknown;

                    // Although we prepare to pass reference, value can be really passed.
                    // That's why we report warning when user use '&' in calling,
                    // because it has no influence.
                    if (ampersand)
                    {
                        analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
                    }
                }
                else
                {
                    info.Access = AccessType.Read;
                }
            }
            else
            {
                if (analyzer.ActParamPassedByRef())
                {
                    if (expression.AllowsPassByReference)
                    {
                        info.Access = AccessType.ReadRef;
                    }
                    else
                    {
                        analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, expression.Position);
                        analyzer.LeaveActParam();
                        return;
                    }
                }
                else
                {
                    info.Access = AccessType.Read;
                    if (ampersand)
                    {
                        analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
                    }
                }
            }

            expression = expression.Analyze(analyzer, info).Literalize();

            analyzer.LeaveActParam();
        }
Ejemplo n.º 15
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            if (isMemberOf != null)
            {
                isMemberOf.Analyze(analyzer, new ExInfoFromParent(this, DetermineAccessType(info.Access)));
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 16
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            Debug.Assert(expressions.Count > 0);
            access = info.Access;

            var concatChunks = AnalyzeChunks(analyzer, expressions);

            this.expressions = new List <Expression>(ChunkExpressions(concatChunks));   // replace expressions with optimized one

            if (concatChunks.Count == 1 && concatChunks[0].HasValue)
            {
                return(new Evaluation(this, concatChunks[0].Value)); // can be resolved during compilation time
            }
            else
            {
                return(new Evaluation(this));
            }

            // obsolete: The ConcatEx represents encaps_list (see parse.y), which contains alternating StringLiterals and VarLikeConstructUses.
            //for (int i = 0; i < expressions.Count; i++)
            //{
            //    // evaluate the expression
            //    expressions[i] = expressions[i].Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Expression;
            //    Debug.Assert(expressions[i] is StringLiteral || expressions[i] is VarLikeConstructUse);
            //}

            //return new Evaluation(this);

            // obsolete:
            //if (concat != null)
            //{
            //  ce.Append(re);
            //  this.expressions = ce.expressions;
            //  return this;
            //}
            //else
            //{
            //  ce = re as ConcatEx;
            //  if (ce != null)
            //  {
            //    ce.Prepend(le);
            //    this.expressions = ce.expressions;
            //    return this;
            //  }
            //  else
            //  {
            //    object l_value;
            //    if (!le.TryEvaluate(out l_value)) return this;

            //    object r_value;
            //    if (!re.TryEvaluate(out r_value)) return this;

            //    return new StringLiteral(position, Evaluate(l_value, r_value), access);
            //  }
            //}
        }
Ejemplo n.º 17
0
            public void Analyze(ActualParam/*!*/node, Analyzer/*!*/ analyzer, bool isBaseCtorCallConstrained)
            {
                // TODO: isBaseCtorCallConstrained

                ExInfoFromParent info = new ExInfoFromParent(node);

                analyzer.EnterActParam();

                if (node.IsVariadic) throw new NotImplementedException();

                if (analyzer.ActParamDeclIsUnknown())
                {
                    // we don't know whether the parameter will be passed by reference at run-time:
                    if (node.Expression.AllowsPassByReference)
                    {
                        info.Access = AccessType.ReadUnknown;

                        // Although we prepare to pass reference, value can be really passed.
                        // That's why we report warning when user use '&' in calling, 
                        // because it has no influence.
                        if (node.Ampersand)
                            analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, node.Span);
                    }
                    else
                    {
                        info.Access = AccessType.Read;
                    }
                }
                else
                {
                    if (analyzer.ActParamPassedByRef())
                    {
                        if (node.Expression.AllowsPassByReference)
                        {
                            info.Access = AccessType.ReadRef;
                        }
                        else
                        {
                            analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, node.Expression.Span);
                            analyzer.LeaveActParam();
                            return;
                        }
                    }
                    else
                    {
                        info.Access = AccessType.Read;
                        if (node.Ampersand) analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, node.Span);
                    }
                }

                node._expression = node.Expression.Analyze(analyzer, info).Literalize();

                // TODO: if signature is known, act. param has type hint and expression has known type; check if type hint matches expression

                analyzer.LeaveActParam();
            }
Ejemplo n.º 18
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			type = analyzer.ResolveTypeName(typeName, analyzer.CurrentType, analyzer.CurrentRoutine, position, false);

			analyzer.AnalyzeConstructedType(type);

			return new Evaluation(this);
		}
Ejemplo n.º 19
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;
			ExInfoFromParent var_info = new ExInfoFromParent(this);
			var_info.Access = AccessType.ReadAndWrite;

			variable.Analyze(analyzer, var_info);

			return new Evaluation(this);
		}
Ejemplo n.º 20
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

            this.typeRef.Analyze(analyzer);
            this.type = this.typeRef.ResolvedTypeOrUnknown;

			analyzer.AnalyzeConstructedType(type);

			return new Evaluation(this);
		}
Ejemplo n.º 21
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;
            ExInfoFromParent var_info = new ExInfoFromParent(this);

            var_info.Access = AccessType.ReadAndWrite;

            variable.Analyze(analyzer, var_info);

            return(new Evaluation(this));
        }
Ejemplo n.º 22
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            for (int i = 0; i < varList.Count; i++)
            {
                varList[i].Analyze(analyzer, ExInfoFromParent.DefaultExInfo);
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 23
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            this.typeRef.Analyze(analyzer);
            this.type = this.typeRef.ResolvedTypeOrUnknown;

            analyzer.AnalyzeConstructedType(type);

            return(new Evaluation(this));
        }
Ejemplo n.º 24
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            if (resultExpr != null)
            {
                resultExpr = resultExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
            }

            analyzer.EnterUnreachableCode();
            return(new Evaluation(this));
        }
Ejemplo n.º 25
0
		internal void Analyze(Analyzer/*!*/ analyzer, bool isBaseCtorCallConstrained)
		{
			// TODO: isBaseCtorCallConstrained

			ExInfoFromParent info = new ExInfoFromParent(this);

			analyzer.EnterActParam();

			if (analyzer.ActParamDeclIsUnknown())
			{
				// we don't know whether the parameter will be passed by reference at run-time:
				if (expression.AllowsPassByReference)
				{
					info.Access = AccessType.ReadUnknown;

					// Although we prepare to pass reference, value can be really passed.
					// That's why we report warning when user use '&' in calling, 
					// because it has no influence.
					if (ampersand)
						analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
				}
				else
				{
					info.Access = AccessType.Read;
				}
			}
			else
			{
				if (analyzer.ActParamPassedByRef())
				{
					if (expression.AllowsPassByReference)
					{
						info.Access = AccessType.ReadRef;
					}
					else
					{
						analyzer.ErrorSink.Add(Errors.NonVariablePassedByRef, analyzer.SourceUnit, expression.Position);
						analyzer.LeaveActParam();
						return;
					}
				}
				else
				{
					info.Access = AccessType.Read;
					if (ampersand) analyzer.ErrorSink.Add(Warnings.ActualParamWithAmpersand, analyzer.SourceUnit, position);
				}
			}

			expression = expression.Analyze(analyzer, info).Literalize();

			analyzer.LeaveActParam();
		}
Ejemplo n.º 26
0
        internal void Analyze(Analyzer analyzer)
        {
            ExInfoFromParent sinfo = new ExInfoFromParent(this);

            sinfo.Access = AccessType.WriteRef;

            variable.Analyze(analyzer, sinfo);

            if (initializer != null)
            {
                initializer = initializer.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
            }
        }
Ejemplo n.º 27
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            typeArgsResolved = classNameRef.Analyze(analyzer);

            if (typeArgsResolved)
            {
                analyzer.AnalyzeConstructedType(classNameRef.ResolvedType);
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 28
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.access;

            if (IsEvaluable(type))
            {
                return(new Evaluation(this, Evaluate(analyzer)));
            }
            else
            {
                return(new Evaluation(this));
            }
        }
Ejemplo n.º 29
0
        internal void Analyze(Analyzer /*!*/ analyzer)
        {
            ExInfoFromParent info = new ExInfoFromParent(this);

            info.Access = AccessType.Write;

            resolvedType = analyzer.ResolveTypeName(className, analyzer.CurrentType, analyzer.CurrentRoutine, position, false);

            variable.Analyze(analyzer, info);

            analyzer.EnterConditionalCode();
            this.Statements.Analyze(analyzer);
            analyzer.LeaveConditionalCode();
        }
Ejemplo n.º 30
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            bool var_shall_be_ref;

            access = info.Access;

            base.Analyze(analyzer, info);

            var_shall_be_ref = !(access == AccessType.Read || access == AccessType.Write || access == AccessType.ReadAndWrite ||
                                 access == AccessType.None);

            //If this VarUse is in GlobalCode, value of var_shall_be_ref does not matter.
            //All global vars are refs.

            //$this has special meaning, but $a->this has NOT
            if (varName.IsThisVariableName && isMemberOf == null)
            {
                // report misuse of $this if we are sure about it, that is in a static routine:
                if (analyzer.CurrentRoutine != null && analyzer.CurrentRoutine.IsStatic)
                {
                    analyzer.ErrorSink.Add(Warnings.ThisOutOfMethod, analyzer.SourceUnit, position);
                }

                if (!(info.Parent is VarLikeConstructUse) &&              // $this->a = 1; is ok, but $this has write AT
                    !(access == AccessType.None ||
                      access == AccessType.Read ||
                      access == AccessType.ReadRef ||
                      access == AccessType.ReadUnknown))
                {
                    analyzer.ErrorSink.Add(Warnings.ThisInWriteContext, analyzer.SourceUnit, position);
                }
            }

            if (isMemberOf == null)
            {
                if (analyzer.CurrentVarTable == null)
                {
                    Debug.Assert(analyzer.SourceUnit.CompilationUnit.IsPure);

                    // variables used in global context when we do not have global variable table:
                    analyzer.ErrorSink.Add(Errors.GlobalCodeInPureUnit, analyzer.SourceUnit, position);
                }
                else
                {
                    analyzer.CurrentVarTable.Set(varName, var_shall_be_ref);
                }
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 31
0
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            foreach (Item i in items)
            {
                if (i != null)
                {
                    i.Analyze(analyzer);
                }
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 32
0
        internal override Evaluation Analyze(Analyzer analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            this.StringExpr = this.StringExpr.Analyze(analyzer, info).Literalize();
            this.KeyExpr    = this.KeyExpr.Analyze(analyzer, info).Literalize();

            IntLiteral @int = this.KeyExpr as IntLiteral;

            if (@int != null)
            {
                int key = (int)@int.Value;
                if (key >= 0)
                {
                    StringLiteral       str;
                    BinaryStringLiteral bstr;

                    if ((str = this.StringExpr as StringLiteral) != null)
                    {
                        string strValue = (string)str.Value;
                        if (key < strValue.Length)
                        {
                            return(new Evaluation(this, strValue[key].ToString()));
                        }
                        else
                        {
                        }  // report invalid index
                    }
                    else if ((bstr = this.StringExpr as BinaryStringLiteral) != null)
                    {
                        var bytesValue = (PhpBytes)bstr.Value;
                        if (key < bytesValue.Length)
                        {
                            return(new Evaluation(this, new PhpBytes(new byte[] { bytesValue[key] })));
                        }
                        else
                        {
                        }  // report invalid index
                    }
                }
                else
                {
                    // report invalid index
                }
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 33
0
        internal void Analyze(Analyzer analyzer)
        {
            ExInfoFromParent info = new ExInfoFromParent(this);

            if (alias)
            {
                info.Access = AccessType.WriteRef;
            }
            else
            {
                info.Access = AccessType.Write;
            }

            //retval not needed
            variable.Analyze(analyzer, info);
        }
Ejemplo n.º 34
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			// if the expression should be emitted:
			if (characteristic == Characteristic.Dynamic || characteristic == Characteristic.StaticArgEvaluated)
			{
				fileNameEx = fileNameEx.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
			}

			analyzer.AddCurrentRoutineProperty(RoutineProperties.ContainsInclude);

			analyzer.CurrentScope = this.scope;

			return new Evaluation(this);
		}
Ejemplo n.º 35
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            // if the expression should be emitted:
            if (characteristic == Characteristic.Dynamic || characteristic == Characteristic.StaticArgEvaluated)
            {
                fileNameEx = fileNameEx.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
            }

            analyzer.AddCurrentRoutineProperty(RoutineProperties.ContainsInclude);

            analyzer.CurrentScope = this.scope;

            return(new Evaluation(this));
        }
Ejemplo n.º 36
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			bool var_shall_be_ref;
			access = info.Access;

			base.Analyze(analyzer, info);

			var_shall_be_ref = !(access == AccessType.Read || access == AccessType.Write || access == AccessType.ReadAndWrite ||
				access == AccessType.None);

			//If this VarUse is in GlobalCode, value of var_shall_be_ref does not matter.
			//All global vars are refs.

			//$this has special meaning, but $a->this has NOT
			if (varName.IsThisVariableName && isMemberOf == null)
			{
				// report misuse of $this if we are sure about it, that is in a static routine:
				if (analyzer.CurrentRoutine != null && analyzer.CurrentRoutine.IsStatic)
				{
					analyzer.ErrorSink.Add(Warnings.ThisOutOfMethod, analyzer.SourceUnit, position);
				}

				if (!(info.Parent is VarLikeConstructUse) // $this->a = 1; is ok, but $this has write AT
					&& !(access == AccessType.None
								|| access == AccessType.Read
								|| access == AccessType.ReadRef
								|| access == AccessType.ReadUnknown))
				{
					analyzer.ErrorSink.Add(Warnings.ThisInWriteContext, analyzer.SourceUnit, position);
				}
			}

			if (isMemberOf == null)
			{
				if (analyzer.CurrentVarTable == null)
				{
					Debug.Assert(analyzer.SourceUnit.CompilationUnit.IsPure);
				
					// variables used in global context when we do not have global variable table:
					analyzer.ErrorSink.Add(Errors.GlobalCodeInPureUnit, analyzer.SourceUnit, position);
				}
				else
					analyzer.CurrentVarTable.Set(varName, var_shall_be_ref);
			}
			
			return new Evaluation(this);
		}
Ejemplo n.º 37
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/>
        internal override Statement Analyze(Analyzer /*!*/ analyzer)
        {
            if (analyzer.IsThisCodeUnreachable())
            {
                analyzer.ReportUnreachableCode(position);
                return(EmptyStmt.Unreachable);
            }

            ExInfoFromParent info = new ExInfoFromParent(this);

            info.Access = AccessType.WriteRef;
            foreach (SimpleVarUse svu in varList)
            {
                svu.Analyze(analyzer, info);
            }
            return(this);
        }
Ejemplo n.º 38
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			switch (operation)
			{
				case Operations.Print:
				case Operations.Clone:
				case Operations.ObjectCast:
				case Operations.ArrayCast:
					expr = expr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
					return new Evaluation(this);

				default:
					return expr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Evaluate(this, out expr);
			}
		}
Ejemplo n.º 39
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            // checks for write context of key-less array operator ($a =& $x[] is ok):
            if (index == null &&
                (access == AccessType.Read ||
                 access == AccessType.ReadAndWrite ||
                 access == AccessType.ReadAndWriteAndReadRef ||
                 access == AccessType.ReadAndWriteAndReadUnknown))
            {
                analyzer.ErrorSink.Add(Errors.EmptyIndexInReadContext, analyzer.SourceUnit, position);
                return(new Evaluation(this));
            }

            base.Analyze(analyzer, info);

            ExInfoFromParent sinfo = new ExInfoFromParent(this);

            switch (info.Access)
            {
            case AccessType.Write:
            case AccessType.WriteRef:
            case AccessType.ReadRef: sinfo.Access = AccessType.Write; break;

            case AccessType.ReadAndWriteAndReadRef:
            case AccessType.WriteAndReadRef:
            case AccessType.ReadAndWrite: sinfo.Access = AccessType.ReadAndWrite; break;

            case AccessType.WriteAndReadUnknown:
            case AccessType.ReadAndWriteAndReadUnknown: sinfo.Access = info.Access; break;

            case AccessType.ReadUnknown: sinfo.Access = AccessType.ReadUnknown; break;

            default: sinfo.Access = AccessType.Read; break;
            }

            array.Analyze(analyzer, sinfo);

            if (index != null)
            {
                index = index.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
            }

            return(new Evaluation(this));
        }
Ejemplo n.º 40
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
        internal override Evaluation Analyze(Analyzer /*!*/ analyzer, ExInfoFromParent info)
        {
            access = info.Access;

            switch (operation)
            {
            case Operations.Print:
            case Operations.Clone:
            case Operations.ObjectCast:
            case Operations.ArrayCast:
                expr = expr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();
                return(new Evaluation(this));

            default:
                return(expr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Evaluate(this, out expr));
            }
        }
Ejemplo n.º 41
0
        internal override Evaluation Analyze(Analyzer analyzer, ExInfoFromParent info)
        {
            access = info.access;

            var value = this.Value;

            if (value != null)
            {
                return(new Evaluation(this, value));
            }

            //
            this.ResolveName(analyzer);

            //
            return(new Evaluation(this));
        }
Ejemplo n.º 42
0
        /// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/>
        internal override Statement Analyze(Analyzer /*!*/ analyzer)
        {
            if (analyzer.IsThisCodeUnreachable())
            {
                analyzer.ReportUnreachableCode(position);
                return(EmptyStmt.Unreachable);
            }

            ExInfoFromParent info = ExInfoFromParent.DefaultExInfo;

            for (int i = 0; i < parameters.Count; i++)
            {
                parameters[i] = parameters[i].Analyze(analyzer, info).Literalize();
            }

            return(this);
        }
Ejemplo n.º 43
0
        internal void Analyze(Analyzer /*!*/ analyzer)
        {
            analyzer.LeaveUnreachableCode();

            ExInfoFromParent info = new ExInfoFromParent(this);

            // analyze auto-prepended inclusion (no code reachability checks):
            if (prependedInclusion != null)
            {
                info.Access = AccessType.None;
                prependedInclusion.Analyze(analyzer, info);
            }

            for (int i = 0; i < statements.Count; i++)
            {
                if (analyzer.IsThisCodeUnreachable() && statements[i].IsDeclaration)
                {
                    //unreachable declarations in global code are valid
                    analyzer.LeaveUnreachableCode();
                    statements[i] = statements[i].Analyze(analyzer);
                    analyzer.EnterUnreachableCode();
                }
                else
                {
                    statements[i] = statements[i].Analyze(analyzer);
                }
            }

            if (!sourceUnit.CompilationUnit.IsPure)
            {
                Analyzer.ValidateLabels(analyzer.ErrorSink, sourceUnit, labels);
            }

            // analyze auto-prepended inclusion (no code reachability checks):
            if (appendedInclusion != null)
            {
                info.Access = AccessType.Read;
                appendedInclusion.Analyze(analyzer, info);
            }

            analyzer.LeaveUnreachableCode();
        }
Ejemplo n.º 44
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			// checks for write context of key-less array operator ($a =& $x[] is ok):
			if (index == null
				&& (access == AccessType.Read
					|| access == AccessType.ReadAndWrite
					|| access == AccessType.ReadAndWriteAndReadRef
					|| access == AccessType.ReadAndWriteAndReadUnknown))
			{
				analyzer.ErrorSink.Add(Errors.EmptyIndexInReadContext, analyzer.SourceUnit, position);
				return new Evaluation(this);
			}

			base.Analyze(analyzer, info);

			ExInfoFromParent sinfo = new ExInfoFromParent(this);
			switch (info.Access)
			{
				case AccessType.Write:
				case AccessType.WriteRef:
				case AccessType.ReadRef: sinfo.Access = AccessType.Write; break;

				case AccessType.ReadAndWriteAndReadRef:
				case AccessType.WriteAndReadRef:
				case AccessType.ReadAndWrite: sinfo.Access = AccessType.ReadAndWrite; break;

				case AccessType.WriteAndReadUnknown:
				case AccessType.ReadAndWriteAndReadUnknown: sinfo.Access = info.Access; break;

				case AccessType.ReadUnknown: sinfo.Access = AccessType.ReadUnknown; break;
				default: sinfo.Access = AccessType.Read; break;
			}

			array.Analyze(analyzer, sinfo);

			if (index != null)
				index = index.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();

			return new Evaluation(this);
		}
Ejemplo n.º 45
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;
			ExInfoFromParent sinfo = new ExInfoFromParent(this);

            // r-value
            if (RValue != null)
			    RValue = RValue.Analyze(analyzer, sinfo).Literalize();

            // l-values
			sinfo.Access = AccessType.Write;

			for (int i = 0; i < LValues.Count; i++)
			{
				if (LValues[i] != null)
					LValues[i] = LValues[i].Analyze(analyzer, sinfo).Expression;
			}

			return new Evaluation(this);
		}
Ejemplo n.º 46
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.Access;

			base.Analyze(analyzer, info);

			if (isMemberOf == null)
			{
				if (!(access == AccessType.Read
					|| access == AccessType.Write
					|| access == AccessType.ReadAndWrite
					|| access == AccessType.None))
				{
					analyzer.CurrentVarTable.SetAllRef();
				}
				analyzer.AddCurrentRoutineProperty(RoutineProperties.IndirectLocalAccess);
			}

			varNameEx = varNameEx.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();

			return new Evaluation(this);
		}
Ejemplo n.º 47
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			base.Analyze(analyzer, info);

			nameExpr = nameExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize();

			callSignature.Analyze(analyzer, UnknownSignature.Default, info, false);

			// function call:
			if (isMemberOf == null)
				analyzer.AddCurrentRoutineProperty(RoutineProperties.ContainsIndirectFcnCall);

			return new Evaluation(this);
		}
Ejemplo n.º 48
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			base.Analyze(analyzer, info);
			access = info.Access;
			return new Evaluation(this);
		}
Ejemplo n.º 49
0
        /// <summary>
        /// Analyze the method call (isMemberOf != null).
        /// </summary>
        /// <param name="analyzer"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        private Evaluation AnalyzeMethodCall(Analyzer/*!*/ analyzer, ref ExInfoFromParent info)
        {
            Debug.Assert(isMemberOf != null);

            // $this->
            DirectVarUse memberDirectVarUse = isMemberOf as DirectVarUse;
            if (memberDirectVarUse != null && memberDirectVarUse.IsMemberOf == null &&  // isMemberOf is single variable
                memberDirectVarUse.VarName.IsThisVariableName &&                        // isMemberOf if $this
                analyzer.CurrentType != null)                                           // called in class context of known type
            {
                // $this->{qualifiedName}(callSignature)

                bool runtimeVisibilityCheck, isCallMethod;

                routine = analyzer.ResolveMethod(
                    analyzer.CurrentType,//typeof(this)
                    qualifiedName.Name,//.Namespace?
                    Position,
                    analyzer.CurrentType, analyzer.CurrentRoutine, false,
                    out runtimeVisibilityCheck, out isCallMethod);

                Debug.Assert(runtimeVisibilityCheck == false);  // can only be set to true if CurrentType or CurrentRoutine are null

                if (!routine.IsUnknown)
                {
                    // check __call
                    if (isCallMethod)
                    {
                        // TODO: generic args
                        
                        var arg1 = new StringLiteral(this.Position, qualifiedName.Name.Value);
                        var arg2 = this.callSignature.BuildPhpArray();

                        this.callSignature = new CallSignature(
                            new List<ActualParam>(2) {
                                new ActualParam(arg1.Position, arg1, false),
                                new ActualParam(arg2.Position, arg2, false)
                            },
                            new List<TypeRef>());
                    }
                    
                    // resolve overload if applicable:
                    RoutineSignature signature;
                    overloadIndex = routine.ResolveOverload(analyzer, callSignature, position, out signature);

                    Debug.Assert(overloadIndex != DRoutine.InvalidOverloadIndex, "A function should have at least one overload");

                    // analyze parameters:
                    callSignature.Analyze(analyzer, signature, info, false);

                    // get properties:
                    analyzer.AddCurrentRoutineProperty(routine.GetCallerRequirements());

                    return new Evaluation(this);
                }
            }

            // by default, fall back to dynamic method invocation
            routine = null;
            callSignature.Analyze(analyzer, UnknownSignature.Default, info, false);

            return new Evaluation(this);
        }
Ejemplo n.º 50
0
        /// <summary>
        /// Analyze the function call (isMemberOf == null).
        /// </summary>
        /// <param name="analyzer"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>This code fragment is separated to save the stack when too long Expression chain is being compiled.</remarks>
        private Evaluation AnalyzeFunctionCall(Analyzer/*!*/ analyzer, ref ExInfoFromParent info)
        {
            Debug.Assert(isMemberOf == null);

            // resolve name:
            
            routine = analyzer.ResolveFunctionName(qualifiedName, position);

            if (routine.IsUnknown)
            {
                // note: we've to try following at run time, there can be dynamically added namespaced function matching qualifiedName
                // try fallback
                if (this.fallbackQualifiedName.HasValue)
                {
                    var fallbackroutine = analyzer.ResolveFunctionName(this.fallbackQualifiedName.Value, position);
                    if (fallbackroutine != null && !fallbackroutine.IsUnknown)
                    {
                        if (fallbackroutine is PhpLibraryFunction)  // we are calling library function directly
                            routine = fallbackroutine;
                    }
                }

                if (routine.IsUnknown)   // still unknown ?
                    Statistics.AST.AddUnknownFunctionCall(qualifiedName);
            }
            // resolve overload if applicable:
            RoutineSignature signature;
            overloadIndex = routine.ResolveOverload(analyzer, callSignature, position, out signature);

            Debug.Assert(overloadIndex != DRoutine.InvalidOverloadIndex, "A function should have at least one overload");

            if (routine is PhpLibraryFunction)
            {
                var opts = ((PhpLibraryFunction)routine).Options;
                // warning if not supported function call is detected
                if ((opts & FunctionImplOptions.NotSupported) != 0)
                    analyzer.ErrorSink.Add(Warnings.NotSupportedFunctionCalled, analyzer.SourceUnit, Position, QualifiedName.ToString());

                // warning if function requiring locals is detected (performance critical)
                if ((opts & FunctionImplOptions.NeedsVariables) != 0 && !analyzer.CurrentScope.IsGlobal)
                    analyzer.ErrorSink.Add(Warnings.UnoptimizedLocalsInFunction, analyzer.SourceUnit, Position, QualifiedName.ToString());
                
            }

            // analyze parameters:
            callSignature.Analyze(analyzer, signature, info, false);

            // get properties:
            analyzer.AddCurrentRoutineProperty(routine.GetCallerRequirements());

            // replaces the node if its value can be determined at compile-time:
            object value;
            return TryEvaluate(analyzer, out value) ?
                new Evaluation(this, value) :
                new Evaluation(this);
        }
Ejemplo n.º 51
0
 public static void Analyze(this CallSignature/*!*/node, Analyzer/*!*/ analyzer, RoutineSignature/*!*/ signature, ExInfoFromParent info, bool isBaseCtorCallConstrained)
 {
     node.NodeCompiler<ICallSignatureCompiler>().Analyze(node, analyzer, signature, info, isBaseCtorCallConstrained);
 }
Ejemplo n.º 52
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			if (isMemberOf != null)
                isMemberOf.Analyze(analyzer, new ExInfoFromParent(this, DetermineAccessType(info.Access)));
			
			return new Evaluation(this);
		}
Ejemplo n.º 53
0
		internal void Analyze(Analyzer/*!*/ analyzer, RoutineSignature/*!*/ signature, ExInfoFromParent info,
			bool isBaseCtorCallConstrained)
		{
			// generic:

			for (int i = 0; i < genericParams.Count; i++)
				genericParams[i].Analyze(analyzer);

			// regular:

			analyzer.EnterActualParams(signature, parameters.Count);

			for (int i = 0; i < parameters.Count; i++)
				parameters[i].Analyze(analyzer, isBaseCtorCallConstrained);

			analyzer.LeaveActualParams();
		}
Ejemplo n.º 54
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
            base.Analyze(analyzer, info);

            if (isMemberOf == null)
            {
                // function call //

                return AnalyzeFunctionCall(analyzer, ref info);
            }
            else
            {
				// method call //

                Debug.Assert(!this.fallbackQualifiedName.HasValue);   // only valid for global function call
                return AnalyzeMethodCall(analyzer, ref info);
			}
		}
Ejemplo n.º 55
0
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			base.Analyze(analyzer, info);
            this.typeRef.Analyze(analyzer);
            this.type = this.typeRef.ResolvedTypeOrUnknown;

			// analyze constructed type (new constructed type cane be used here):
			analyzer.AnalyzeConstructedType(type);

			if (type.TypeDesc.Equals(DTypeDesc.InterlockedTypeDesc))
				analyzer.ErrorSink.Add(Warnings.ClassBehaviorMayBeUnexpected, analyzer.SourceUnit, position, type.FullName);

			return new Evaluation(this);
		}
Ejemplo n.º 56
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			access = info.access;

            if (IsEvaluable(type))
				return new Evaluation(this, Evaluate(analyzer));
			else
				return new Evaluation(this);
		}
Ejemplo n.º 57
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal abstract Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info);
Ejemplo n.º 58
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			base.Analyze(analyzer, info);

            // look for the method:
            bool isCallMethod;
            method = analyzer.ResolveMethod(
                type, methodName, position, analyzer.CurrentType, analyzer.CurrentRoutine,
                true, out runtimeVisibilityCheck, out isCallMethod);

			if (!method.IsUnknown)
			{
				// we are sure about the method //

				if (method.IsAbstract)
				{
					analyzer.ErrorSink.Add(Errors.AbstractMethodCalled, analyzer.SourceUnit, position,
						method.DeclaringType.FullName, method.FullName);
				}
			}

            // check __callStatic
            if (isCallMethod)
            {
                // TODO: generic args

                // create new CallSignature({function name},{args})
                var arg1 = new StringLiteral(this.Position, methodName.Value);
                var arg2 = this.callSignature.BuildPhpArray();

                this.callSignature = new CallSignature(
                    new List<ActualParam>(2) {
                                new ActualParam(arg1.Position, arg1, false),
                                new ActualParam(arg2.Position, arg2, false)
                            },
                    new List<TypeRef>());
            }

            // analyze the method
			RoutineSignature signature;
			overloadIndex = method.ResolveOverload(analyzer, callSignature, position, out signature);

			Debug.Assert(overloadIndex != DRoutine.InvalidOverloadIndex, "Each method should have at least one overload");

            // analyze arguments
			callSignature.Analyze(analyzer, signature, info, false);

			return new Evaluation(this);
		}
Ejemplo n.º 59
0
            public void Analyze(CallSignature/*!*/node, Analyzer/*!*/ analyzer, RoutineSignature/*!*/ signature, ExInfoFromParent info, bool isBaseCtorCallConstrained)
            {
                // generic:

                foreach (var p in node.GenericParams)
                    TypeRefHelper.Analyze(p, analyzer);

                // regular:

                analyzer.EnterActualParams(signature, node.Parameters.Count);

                foreach (var p in node.Parameters)
                    p.NodeCompiler<ActualParamCompiler>().Analyze(p, analyzer, isBaseCtorCallConstrained);

                analyzer.LeaveActualParams();
            }
Ejemplo n.º 60
0
		/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/>
		internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info)
		{
			base.Analyze(analyzer, info);

			methodNameVar.Analyze(analyzer, ExInfoFromParent.DefaultExInfo);

			callSignature.Analyze(analyzer, UnknownSignature.Default, info, false);

			return new Evaluation(this);
		}