本文整理汇总了C#中Boo.Lang.Compiler.Ast.Constructor类的典型用法代码示例。如果您正苦于以下问题:C# Constructor类的具体用法?C# Constructor怎么用?C# Constructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constructor类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了Constructor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
if (!node.IsVisibilitySet)
{
node.Modifiers |= TypeMemberModifiers.Public;
}
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:NormalizeTypeAndMemberDefinitions.cs
示例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);
}
开发者ID:JonKruger,项目名称:MvcContrib,代码行数:35,代码来源:TransformToBrailStep.cs
示例3: CreateConstructor
public static Constructor CreateConstructor(Node lexicalInfoProvider, TypeMemberModifiers modifiers)
{
Constructor constructor = new Constructor(lexicalInfoProvider.LexicalInfo);
constructor.Modifiers = modifiers;
constructor.IsSynthetic = true;
return constructor;
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:AstUtil.cs
示例4: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
MakeStaticIfNeeded(node);
CantBeMarkedTransient(node);
CantBeMarkedPartial(node);
CantBeMarkedFinal(node);
CannotReturnValue(node);
ConstructorCannotBePolymorphic(node);
}
开发者ID:scottstephens,项目名称:boo,代码行数:9,代码来源:PreErrorChecking.cs
示例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;
}
开发者ID:elfrostie,项目名称:boo,代码行数:9,代码来源:NormalizeTypeAndMemberDefinitions.cs
示例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));
}
}
}
开发者ID:yonglehou,项目名称:NGinnBPM,代码行数:23,代码来源:BaseClassCompilerStep.cs
示例7: EnterConstructor
public override bool EnterConstructor(Constructor node)
{
base.EnterConstructor(node);
return EnterMethod(node);
}
开发者ID:gogobyte,项目名称:boolangstudio,代码行数:6,代码来源:BooDocumentVisitor.cs
示例8: LeaveConstructor
public override void LeaveConstructor(Constructor node)
{
base.LeaveConstructor(node);
LeaveMethod(node);
}
开发者ID:gogobyte,项目名称:boolangstudio,代码行数:6,代码来源:BooDocumentVisitor.cs
示例9: OnConstructor
public override void OnConstructor(Constructor node)
{
Visit(node.Parameters);
_emitter.EmitConstructorAttributes(node);
}
开发者ID:Bombadil77,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs
示例10: OnConstructor
public override void OnConstructor(Constructor node)
{
_parameters.Add(node);
base.OnConstructor(node);
}
开发者ID:turugina,项目名称:boo,代码行数:5,代码来源:BindTypeMembers.cs
示例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;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:22,代码来源:ConvertVisitorTypeMembers.cs
示例12: EntityFor
private IMethod EntityFor(Constructor node)
{
return (IMethod)EntityFor((TypeMember)node);
}
开发者ID:scottstephens,项目名称:boo,代码行数:4,代码来源:PreErrorChecking.cs
示例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);
}
开发者ID:boo,项目名称:boo-lang,代码行数:10,代码来源:BooClassBuilder.cs
示例14: OnConstructor
public override void OnConstructor(Constructor node)
{
if (null == node.Entity)
{
node.Entity = new InternalConstructor(TypeSystemServices, node);
}
_parameters.Add(node);
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:8,代码来源:BindTypeMembers.cs
示例15: OnConstructor
public override void OnConstructor(Constructor node)
{
OnMethod(node);
}
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:BranchChecking.cs
示例16: InstanceMethodInvocationBeforeInitialization
public static CompilerError InstanceMethodInvocationBeforeInitialization(Constructor ctor, MemberReferenceExpression mre)
{
return Instantiate("BCE0158", mre, mre.Name, SelfKeyword);
}
开发者ID:neonux,项目名称:boo,代码行数:4,代码来源:CompilerErrorFactory.cs
示例17: EmitConstructorAttributes
void EmitConstructorAttributes(Constructor node, TypeCreator knownTypes)
{
ConstructorBuilder builder = (ConstructorBuilder)GetBuilder(node);
EmitAttributes(node, builder.SetCustomAttribute, knownTypes);
}
开发者ID:hlizard,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs
示例18: method
//.........这里部分代码省略.........
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
if (0==inputState.guessing)
{
IToken token = id ?? spliceBegin;
if (emi != null) {
m = new Method(emi.LexicalInfo);
} else {
m = new Method(ToLexicalInfo(token));
}
m.Name = token.getText();
m.ExplicitInfo = emi;
if (nameSplice != null) {
typeMember = new SpliceTypeMember(m, nameSplice);
} else {
typeMember = m;
}
}
}
break;
}
case CONSTRUCTOR:
{
c = LT(1);
match(CONSTRUCTOR);
if (0==inputState.guessing)
{
typeMember = m = new Constructor(ToLexicalInfo(c));
}
break;
}
case DESTRUCTOR:
{
d = LT(1);
match(DESTRUCTOR);
if (0==inputState.guessing)
{
typeMember = m = new Destructor(ToLexicalInfo(d));
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
break;
}
case CONSTRUCTOR:
{
cc = LT(1);
match(CONSTRUCTOR);
if (0==inputState.guessing)
{
typeMember = m = new Constructor(ToLexicalInfo(cc));
}
break;
}
case DESTRUCTOR:
开发者ID:hlizard,项目名称:boo,代码行数:67,代码来源:BooParserBase.cs
示例19: CheckInstanceMethodInvocationsWithinConstructor
//ECMA-335 Partition III Section 1.8.1.4
//cannot call an instance method before super/self.
void CheckInstanceMethodInvocationsWithinConstructor(Constructor ctor)
{
if (ctor.Body.IsEmpty)
return;
foreach (Statement st in ctor.Body.Statements)
{
ExpressionStatement est = st as ExpressionStatement;
if (null == est) continue;
MethodInvocationExpression mie = est.Expression as MethodInvocationExpression;
if (null == mie) continue;
if (mie.Target is SelfLiteralExpression
|| mie.Target is SuperLiteralExpression)
break;//okay we're done checking
if (mie.Target is MemberReferenceExpression)
{
MemberReferenceExpression mre = (MemberReferenceExpression) mie.Target;
if (mre.Target is SelfLiteralExpression
|| mre.Target is SuperLiteralExpression)
{
Error(CompilerErrorFactory.InstanceMethodInvocationBeforeInitialization(ctor, mre));
}
}
}
}
开发者ID:stuman08,项目名称:boo,代码行数:30,代码来源:ProcessMethodBodies.cs
示例20: ConstructorCannotBePolymorphic
void ConstructorCannotBePolymorphic(Constructor node)
{
if (node.IsAbstract || node.IsOverride || node.IsVirtual)
{
Error(CompilerErrorFactory.ConstructorCantBePolymorphic(node, EntityFor(node)));
}
}
开发者ID:scottstephens,项目名称:boo,代码行数:7,代码来源:PreErrorChecking.cs
注:本文中的Boo.Lang.Compiler.Ast.Constructor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论