private Tuple <Type, Dictionary <string, int> > AnalyzeImpl(ExpressionAst exprAst) { this._variables = FindAllVariablesVisitor.Visit(exprAst); this._disableOptimizations = true; this.Init(); this._localsAllocated = SpecialVariables.AutomaticVariables.Length; this._currentBlock = this._entryBlock; exprAst.Accept(this); this._currentBlock.FlowsTo(this._exitBlock); return(this.FinishAnalysis(false)); }
private Tuple <Type, Dictionary <string, int> > AnalyzeImpl(IParameterMetadataProvider ast, bool disableOptimizations, bool scriptCmdlet) { this._variables = FindAllVariablesVisitor.Visit(ast, disableOptimizations, scriptCmdlet, out this._localsAllocated, out this._disableOptimizations); this.Init(); if (ast.Parameters != null) { foreach (ParameterAst ast2 in ast.Parameters) { VariablePath variablePath = ast2.Name.VariablePath; if (variablePath.IsAnyLocal()) { bool flag = false; int num = -1; Type c = null; foreach (AttributeBaseAst ast3 in ast2.Attributes) { if (ast3 is TypeConstraintAst) { num++; if (c == null) { c = ast3.TypeName.GetReflectionType(); } } else { Type reflectionAttributeType = ast3.TypeName.GetReflectionAttributeType(); if (typeof(ValidateArgumentsAttribute).IsAssignableFrom(reflectionAttributeType) || typeof(ArgumentTransformationAttribute).IsAssignableFrom(reflectionAttributeType)) { flag = true; } } } string unaliasedVariableName = GetUnaliasedVariableName(variablePath); VariableAnalysisDetails details = this._variables[unaliasedVariableName]; c = c ?? (details.Type ?? typeof(object)); if (((flag || (num > 0)) || (typeof(PSReference).IsAssignableFrom(c) || MustBeBoxed(c))) && (!details.Automatic && !details.PreferenceVariable)) { details.LocalTupleIndex = -2; } this._entryBlock.AddAst(new AssignmentTarget(unaliasedVariableName, c)); } } } ast.Body.Accept(this); return(this.FinishAnalysis(scriptCmdlet)); }