Files
PowerShell/src/System.Management.Automation/engine/ComInterop/ComClassMetaObject.cs
T
PowerShell Team 403ae3f53f Initial run of code formatter
I (Jason Shirk) ran https://github.com/dotnet/codeformatter with the default rules, basically:

    codeformatter /nocopyright "/c:DEBUG,UNIX,CORECLR" @files.rsp

This caused a few problems building, which were fixed up manually.

Notable changes:

`this.` is removed unless needed to disambiguate.
private instance fields are renamed to have a `_` prefix.
private static fields are renamed to have a `s_` prefix.

I left some projects alone (like PackageManagement) and also left some generated code alone.
2016-08-01 15:57:03 -07:00

44 lines
1.3 KiB
C#

/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
#if !SILVERLIGHT // ComObject
#if !CLR2
using System.Linq.Expressions;
#else
using Microsoft.Scripting.Ast;
#endif
using System.Dynamic;
//using AstUtils = Microsoft.Scripting.Ast.Utils;
using System.Management.Automation.Interpreter;
using AstUtils = System.Management.Automation.Interpreter.Utils;
namespace System.Management.Automation.ComInterop
{
internal class ComClassMetaObject : DynamicMetaObject
{
internal ComClassMetaObject(Expression expression, ComTypeClassDesc cls)
: base(expression, BindingRestrictions.Empty, cls)
{
}
public override DynamicMetaObject BindCreateInstance(CreateInstanceBinder binder, DynamicMetaObject[] args)
{
return new DynamicMetaObject(
Expression.Call(
AstUtils.Convert(Expression, typeof(ComTypeClassDesc)),
typeof(ComTypeClassDesc).GetMethod("CreateInstance")
),
BindingRestrictions.Combine(args).Merge(
BindingRestrictions.GetTypeRestriction(Expression, typeof(ComTypeClassDesc))
)
);
}
}
}
#endif