internal MshExpression CreateFromExpressionToken(ExpressionToken et, DatabaseLoadingInfo loadingInfo) { if (!et.isScriptBlock) { return(new MshExpression(et.expressionValue)); } if (this._expressionCache != null) { MshExpression expression; if (this._expressionCache.TryGetValue(et, out expression)) { return(expression); } } else { this._expressionCache = new Dictionary <ExpressionToken, MshExpression>(); } ScriptBlock scriptBlock = ScriptBlock.Create(et.expressionValue); scriptBlock.DebuggerStepThrough = true; if ((loadingInfo != null) && loadingInfo.isFullyTrusted) { scriptBlock.LanguageMode = 0; } MshExpression expression2 = new MshExpression(scriptBlock); this._expressionCache.Add(et, expression2); return(expression2); }
internal MshExpression CreateFromExpressionToken(ExpressionToken et, DatabaseLoadingInfo loadingInfo) { if (!et.isScriptBlock) { return new MshExpression(et.expressionValue); } if (this._expressionCache != null) { MshExpression expression; if (this._expressionCache.TryGetValue(et, out expression)) { return expression; } } else { this._expressionCache = new Dictionary<ExpressionToken, MshExpression>(); } ScriptBlock scriptBlock = ScriptBlock.Create(et.expressionValue); scriptBlock.DebuggerStepThrough = true; if ((loadingInfo != null) && loadingInfo.isFullyTrusted) { scriptBlock.LanguageMode = 0; } MshExpression expression2 = new MshExpression(scriptBlock); this._expressionCache.Add(et, expression2); return expression2; }
internal ComplexControlGenerator(TypeInfoDataBase dataBase, DatabaseLoadingInfo loadingInfo, MshExpressionFactory expressionFactory, List<ControlDefinition> controlDefinitionList, FormatErrorManager resultErrorManager, int enumerationLimit, TerminatingErrorContext errorContext) { this.db = dataBase; this.loadingInfo = loadingInfo; this.expressionFactory = expressionFactory; this.controlDefinitionList = controlDefinitionList; this.errorManager = resultErrorManager; this.enumerationLimit = enumerationLimit; this.errorContext = errorContext; }
internal ComplexControlGenerator(TypeInfoDataBase dataBase, DatabaseLoadingInfo loadingInfo, MshExpressionFactory expressionFactory, List <ControlDefinition> controlDefinitionList, FormatErrorManager resultErrorManager, int enumerationLimit, TerminatingErrorContext errorContext) { this.db = dataBase; this.loadingInfo = loadingInfo; this.expressionFactory = expressionFactory; this.controlDefinitionList = controlDefinitionList; this.errorManager = resultErrorManager; this.enumerationLimit = enumerationLimit; this.errorContext = errorContext; }
internal ComplexControlGenerator(TypeInfoDataBase dataBase, DatabaseLoadingInfo loadingInfo, PSPropertyExpressionFactory expressionFactory, List <ControlDefinition> controlDefinitionList, FormatErrorManager resultErrorManager, int enumerationLimit, TerminatingErrorContext errorContext) { _db = dataBase; _loadingInfo = loadingInfo; _expressionFactory = expressionFactory; _controlDefinitionList = controlDefinitionList; _errorManager = resultErrorManager; _enumerationLimit = enumerationLimit; _errorContext = errorContext; }
/// <summary> /// create an expression from an expression token /// </summary> /// <param name="et">expression token to use</param> /// <param name="loadingInfo">The context from which the file was loaded</param> /// <returns>constructed expression</returns> /// <exception cref="ParseException"></exception> internal PSPropertyExpression CreateFromExpressionToken(ExpressionToken et, DatabaseLoadingInfo loadingInfo) { if (et.isScriptBlock) { // we cache script blocks from expression tokens if (_expressionCache != null) { PSPropertyExpression value; if (_expressionCache.TryGetValue(et, out value)) { // got a hit on the cache, just return return(value); } } else { _expressionCache = new Dictionary <ExpressionToken, PSPropertyExpression>(); } bool isFullyTrusted = false; bool isProductCode = false; if (loadingInfo != null) { isFullyTrusted = loadingInfo.isFullyTrusted; isProductCode = loadingInfo.isProductCode; } // no hit, we build one and we cache ScriptBlock sb = ScriptBlock.CreateDelayParsedScriptBlock(et.expressionValue, isProductCode: isProductCode); sb.DebuggerStepThrough = true; if (isFullyTrusted) { sb.LanguageMode = PSLanguageMode.FullLanguage; } PSPropertyExpression ex = new PSPropertyExpression(sb); _expressionCache.Add(et, ex); return(ex); } // we do not cache if it is just a property name return(new PSPropertyExpression(et.expressionValue)); }
/// <summary> /// create an expression from an expression token /// </summary> /// <param name="et">expression token to use</param> /// <param name="loadingInfo">The context from which the file was loaded</param> /// <returns>constructed expression</returns> /// <exception cref="ParseException"></exception> internal MshExpression CreateFromExpressionToken(ExpressionToken et, DatabaseLoadingInfo loadingInfo) { if (et.isScriptBlock) { // we cache script blocks from expression tokens if (_expressionCache != null) { MshExpression value; if (_expressionCache.TryGetValue(et, out value)) { // got a hit on the cache, just return return value; } } else { _expressionCache = new Dictionary<ExpressionToken, MshExpression>(); } bool isFullyTrusted = false; bool isProductCode = false; if (loadingInfo != null) { isFullyTrusted = loadingInfo.isFullyTrusted; isProductCode = loadingInfo.isProductCode; } // no hit, we build one and we cache ScriptBlock sb = ScriptBlock.CreateDelayParsedScriptBlock(et.expressionValue, isProductCode: isProductCode); sb.DebuggerStepThrough = true; if (isFullyTrusted) { sb.LanguageMode = PSLanguageMode.FullLanguage; } MshExpression ex = new MshExpression(sb); _expressionCache.Add(et, ex); return ex; } // we do not cache if it is just a property name return new MshExpression(et.expressionValue); }