本文整理汇总了C#中Boo.Lang.Compiler.Ast.Constructor类的典型用法代码示例。如果您正苦于以下问题:C# Constructor类的具体用法?C# Constructor怎么用?C# Constructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constructor类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了Constructor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
if (!node.IsVisibilitySet)
{
node.Modifiers |= TypeMemberModifiers.Public;
}
}
示例2: AddConstructor
// create a constructor that delegate to the base class
private void AddConstructor(ClassDefinition macro)
{
var ctor = new Constructor(macro.LexicalInfo);
ctor.Parameters.Add(
new ParameterDeclaration("viewEngine",
new SimpleTypeReference("MvcContrib.BrailViewEngine.BooViewEngine"))); // TODO: Update Reference
// ctor.Parameters.Add(
// new ParameterDeclaration("output",
// new SimpleTypeReference("System.IO.TextWriter")));
// ctor.Parameters.Add(
// new ParameterDeclaration("context",
// new SimpleTypeReference("Castle.MonoRail.Framework.IEngineContext")));
//
// ctor.Parameters.Add(
// new ParameterDeclaration("__controller",
// new SimpleTypeReference("Castle.MonoRail.Framework.IController")));
//
// ctor.Parameters.Add(
// new ParameterDeclaration("__controllerContext",
// new SimpleTypeReference("Castle.MonoRail.Framework.IControllerContext")));
var mie = new MethodInvocationExpression(new SuperLiteralExpression());
mie.Arguments.Add(AstUtil.CreateReferenceExpression("viewEngine"));
// mie.Arguments.Add(AstUtil.CreateReferenceExpression("output"));
// mie.Arguments.Add(AstUtil.CreateReferenceExpression("context"));
// mie.Arguments.Add(AstUtil.CreateReferenceExpression("__controller"));
// mie.Arguments.Add(AstUtil.CreateReferenceExpression("__controllerContext"));
ctor.Body.Add(mie);
macro.Members.Add(ctor);
}
示例3: CreateConstructor
public static Constructor CreateConstructor(Node lexicalInfoProvider, TypeMemberModifiers modifiers)
{
Constructor constructor = new Constructor(lexicalInfoProvider.LexicalInfo);
constructor.Modifiers = modifiers;
constructor.IsSynthetic = true;
return constructor;
}
示例4: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
MakeStaticIfNeeded(node);
CantBeMarkedTransient(node);
CantBeMarkedPartial(node);
CantBeMarkedFinal(node);
CannotReturnValue(node);
ConstructorCannotBePolymorphic(node);
}
示例5: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
if (node.IsVisibilitySet) return;
if (!node.IsStatic)
node.Modifiers |= Context.Parameters.DefaultMethodVisibility;
else
node.Modifiers |= TypeMemberModifiers.Private;
}
示例6: GenerateConstructors
private void GenerateConstructors(TypeDefinition definition)
{
ConstructorInfo[] ctors =
baseClass.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
foreach (ConstructorInfo ctor in ctors)
{
if (ctor.IsPrivate)
continue;
Constructor constructor = new Constructor(definition.LexicalInfo);
definition.Members.Add(constructor);
MethodInvocationExpression super = new MethodInvocationExpression(new SuperLiteralExpression());
constructor.Body.Add(super);
foreach (ParameterInfo info in ctor.GetParameters())
{
SimpleTypeReference typeReference =
new SimpleTypeReference(TypeUtilities.GetFullName(info.ParameterType));
constructor.Parameters.Add(new ParameterDeclaration(info.Name,
typeReference)
);
super.Arguments.Add(new ReferenceExpression(info.Name));
}
}
}
示例7: EnterConstructor
public override bool EnterConstructor(Constructor node)
{
base.EnterConstructor(node);
return EnterMethod(node);
}
示例8: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
base.LeaveConstructor(node);
LeaveMethod(node);
}
示例9: OnConstructor
public override void OnConstructor(Constructor node)
{
Visit(node.Parameters);
_emitter.EmitConstructorAttributes(node);
}
示例10: OnConstructor
public override void OnConstructor(Constructor node)
{
_parameters.Add(node);
base.OnConstructor(node);
}
示例11: VisitConstructorDeclaration
public object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
{
B.Constructor m = new B.Constructor(GetLexicalInfo(constructorDeclaration));
m.Modifiers = ConvertModifier(constructorDeclaration, B.TypeMemberModifiers.Private);
ConvertAttributes(constructorDeclaration.Attributes, m.Attributes);
if (currentType != null) currentType.Members.Add(m);
ConvertParameters(constructorDeclaration.Parameters, m.Parameters);
m.EndSourceLocation = GetEndLocation((INode)constructorDeclaration.Body ?? constructorDeclaration);
m.Body = ConvertMethodBlock(constructorDeclaration.Body);
ConstructorInitializer ci = constructorDeclaration.ConstructorInitializer;
if (ci != null && !ci.IsNull) {
B.Expression initializerBase;
if (ci.ConstructorInitializerType == ConstructorInitializerType.Base)
initializerBase = new B.SuperLiteralExpression();
else
initializerBase = new B.SelfLiteralExpression();
B.MethodInvocationExpression initializer = new B.MethodInvocationExpression(initializerBase);
ConvertExpressions(ci.Arguments, initializer.Arguments);
m.Body.Insert(0, new B.ExpressionStatement(initializer));
}
return m;
}
示例12: EntityFor
private IMethod EntityFor(Constructor node)
{
return (IMethod)EntityFor((TypeMember)node);
}
示例13: AddConstructor
public BooMethodBuilder AddConstructor()
{
Constructor constructor = new Constructor();
constructor.IsSynthetic = true;
constructor.Modifiers = TypeMemberModifiers.Public;
constructor.Entity = new InternalConstructor(_codeBuilder.TypeSystemServices, constructor);
_cd.Members.Add(constructor);
return new BooMethodBuilder(_codeBuilder, constructor);
}
示例14: OnConstructor
public override void OnConstructor(Constructor node)
{
if (null == node.Entity)
{
node.Entity = new InternalConstructor(TypeSystemServices, node);
}
_parameters.Add(node);
}
示例15: OnConstructor
public override void OnConstructor(Constructor node)
{
OnMethod(node);
}