Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ResGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ internal class {0} {{
internal static global::System.Resources.ResourceManager ResourceManager {{
get {{
if (object.ReferenceEquals(resourceMan, null)) {{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(""{1}.resources.{3}"", typeof({0}).GetTypeInfo().Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(""{1}.resources.{3}"", typeof({0}).Assembly);
resourceMan = temp;
}}
return resourceMan;
Expand Down
49 changes: 0 additions & 49 deletions src/System.Management.Automation/engine/SessionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,55 +376,6 @@ internal void InitializeFixedVariables()
this.GlobalScope.SetVariable(v.Name, v, false, true, this, CommandOrigin.Internal, fastPath: true);
}

/// <summary>
/// Add all of the default built-in functions to this session state instance...
/// </summary>
internal void AddBuiltInEntries(bool addSetStrictMode)
{
// Other built-in variables
AddBuiltInVariables();
AddBuiltInFunctions();
AddBuiltInAliases();
if (addSetStrictMode)
{
SessionStateFunctionEntry f = new SessionStateFunctionEntry("Set-StrictMode", "");
this.AddSessionStateEntry(f);
}
}

/// <summary>
/// Add the built-in variables to this instance of session state...
/// </summary>
internal void AddBuiltInVariables()
{
foreach (SessionStateVariableEntry e in InitialSessionState.BuiltInVariables)
{
this.AddSessionStateEntry(e);
}
}

/// <summary>
/// Add the built-in functions to this instance of session state...
/// </summary>
internal void AddBuiltInFunctions()
{
foreach (SessionStateFunctionEntry f in InitialSessionState.BuiltInFunctions)
{
this.AddSessionStateEntry(f);
}
}

/// <summary>
/// Add the built-in aliases to this instance of session state...
/// </summary>
internal void AddBuiltInAliases()
{
foreach (SessionStateAliasEntry ae in InitialSessionState.BuiltInAliases)
{
this.AddSessionStateEntry(ae, StringLiterals.Global);
}
}

/// <summary>
/// Check to see if an application is allowed to be run.
/// </summary>
Expand Down
16 changes: 8 additions & 8 deletions src/System.Management.Automation/engine/parser/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ internal static Expression Convert(this Expression expr, Type type)
return Expression.Convert(expr, type);
}

if (type.GetTypeInfo().ContainsGenericParameters)
if (type.ContainsGenericParameters)
{
return Expression.Call(
CachedReflectionInfo.LanguagePrimitives_ThrowInvalidCastException,
Expand All @@ -614,7 +614,7 @@ internal static Expression Cast(this Expression expr, Type type)
return expr;
}

if ((expr.Type.IsFloating() || expr.Type == typeof(Decimal)) && type.GetTypeInfo().IsPrimitive)
if ((expr.Type.IsFloating() || expr.Type == typeof(Decimal)) && type.IsPrimitive)
{
// Convert correctly handles most "primitive" conversions for PowerShell,
// but it does not correctly handle floating point.
Expand Down Expand Up @@ -1513,7 +1513,7 @@ internal static bool TryGetDefaultParameterValue(Type type, out object value)
return true;
}

if (type.GetTypeInfo().IsClass)
if (type.IsClass)
{
value = null;
return true;
Expand All @@ -1531,7 +1531,7 @@ internal static bool TryGetDefaultParameterValue(Type type, out object value)
return true;
}

if (LanguagePrimitives.IsNumeric(LanguagePrimitives.GetTypeCode(type)) && !type.GetTypeInfo().IsEnum)
if (LanguagePrimitives.IsNumeric(LanguagePrimitives.GetTypeCode(type)) && !type.IsEnum)
{
value = 0;
return true;
Expand Down Expand Up @@ -4856,7 +4856,7 @@ public object VisitBinaryExpression(BinaryExpressionAst binaryExpressionAst)
var isType = (Type)((ConstantExpression)rhs).Value;
if (!(isType == typeof(PSCustomObject)) && !(isType == typeof(PSObject)))
{
lhs = lhs.Type.GetTypeInfo().IsValueType ? lhs : Expression.Call(CachedReflectionInfo.PSObject_Base, lhs);
lhs = lhs.Type.IsValueType ? lhs : Expression.Call(CachedReflectionInfo.PSObject_Base, lhs);
if (binaryExpressionAst.Operator == TokenKind.Is)
return Expression.TypeIs(lhs, isType);
return Expression.Not(Expression.TypeIs(lhs, isType));
Expand Down Expand Up @@ -5162,7 +5162,7 @@ private Expression CompileIncrementOrDecrement(ExpressionAst exprAst, int valueT
var newValue = DynamicExpression.Dynamic(PSUnaryOperationBinder.Get(valueToAdd == 1 ? ExpressionType.Increment : ExpressionType.Decrement),
typeof(object), tmp);
exprs.Add(av.SetValue(this, newValue));
if (tmp.Type.GetTypeInfo().IsValueType)
if (tmp.Type.IsValueType)
{
// This is the result of the expression - it might be unused, but we don't bother knowing if it is used or not.
exprs.Add(tmp);
Expand Down Expand Up @@ -5363,7 +5363,7 @@ public object VisitMemberExpression(MemberExpressionAst memberExpressionAst)
if (memberExpressionAst.Static && (memberExpressionAst.Expression is TypeExpressionAst))
{
var type = ((TypeExpressionAst)memberExpressionAst.Expression).TypeName.GetReflectionType();
if (type != null && !type.GetTypeInfo().IsGenericTypeDefinition)
if (type != null && !type.IsGenericTypeDefinition)
{
var member = memberExpressionAst.Member as StringConstantExpressionAst;
if (member != null)
Expand Down Expand Up @@ -5419,7 +5419,7 @@ internal static PSMethodInvocationConstraints GetInvokeMemberConstraints(BaseCto
TypeDefinitionAst typeDefinitionAst = Ast.GetAncestorTypeDefinitionAst(invokeMemberExpressionAst);
if (typeDefinitionAst != null)
{
targetTypeConstraint = (typeDefinitionAst as TypeDefinitionAst).Type.GetTypeInfo().BaseType;
targetTypeConstraint = (typeDefinitionAst as TypeDefinitionAst).Type.BaseType;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public override AstVisitAction VisitTrap(TrapStatementAst trapStatementAst)
return AstVisitAction.SkipChildren;
}

// Return true if the variable is newly allocated and should be allocated in the locals tuple.
// Add a variable to the variable dictionary
private void NoteVariable(string variableName, int index, Type type, bool automatic = false, bool preferenceVariable = false)
{
if (!_variables.ContainsKey(variableName))
Expand Down Expand Up @@ -504,7 +504,7 @@ private Tuple<Type, Dictionary<string, int>> AnalyzeImpl(ExpressionAst exprAst)
{
_variables = FindAllVariablesVisitor.Visit(exprAst);

// We disable optimizations for trap because it simplifies what we need to do when invoking
// We disable optimizations for expression because it simplifies what we need to do when invoking
// the default argument, and it's assumed that the code inside a default argument rarely, if ever, actually creates
// any local variables.
_disableOptimizations = true;
Expand Down Expand Up @@ -731,7 +731,7 @@ private static bool MustBeBoxed(Type type)
// $value.Property = 42
// We make sure we never allocate an instance of such mutable types in the MutableType.

return (type.GetTypeInfo().IsValueType && PSVariableAssignmentBinder.IsValueTypeMutable(type)) && typeof(SwitchParameter) != type;
return (type.IsValueType && PSVariableAssignmentBinder.IsValueTypeMutable(type)) && typeof(SwitchParameter) != type;
}

private static void FixTupleIndex(Ast ast, int newIndex)
Expand Down
Loading