public BooMethodBuilder AddMethod(string name, IType returnType, TypeMemberModifiers modifiers)
        {
            BooMethodBuilder builder = new BooMethodBuilder(_codeBuilder, name, returnType, modifiers);

            _cd.Members.Add(builder.Method);
            return(builder);
        }
		public GeneratorMethodProcessor(CompilerContext context, InternalMethod method)
		{
			_labels = new List<LabelStatement>();
			_mapping = new Hashtable();
			_generator = method;

			var skeleton = My<GeneratorSkeletonBuilder>.Instance.SkeletonFor(method);
			_generatorItemType = skeleton.GeneratorItemType;
			_enumerable = skeleton.GeneratorClassBuilder;
			_getEnumeratorBuilder = skeleton.GetEnumeratorBuilder;

			Initialize(context);
		}
        public GeneratorMethodProcessor(CompilerContext context, InternalMethod method)
        {
            _labels = new List();
            _mapping = new Hashtable();
            _generator = method;

            GeneratorSkeleton skeleton = context.Provide<GeneratorSkeletonBuilder>().SkeletonFor(method);
            _generatorItemType = skeleton.GeneratorItemType;
            _enumerable = skeleton.GeneratorClassBuilder;
            _getEnumeratorBuilder = skeleton.GetEnumeratorBuilder;

            Initialize(context);
        }
		void InitializeFieldFromConstructorParameter(BooMethodBuilder constructor,
		                                             Field field,
		                                             string parameterName,
		                                             IType parameterType)
		{
			ParameterDeclaration parameter = constructor.AddParameter(parameterName, parameterType);
			constructor.Body.Add(
				CodeBuilder.CreateAssignment(
					CodeBuilder.CreateReference(field),
					CodeBuilder.CreateReference(parameter)));
		}
		Field DeclareFieldInitializedFromConstructorParameter(BooClassBuilder type,
		                                                      BooMethodBuilder constructor,
		                                                      string parameterName,
		                                                      IType parameterType)
		{
			Field field = type.AddInternalField(UniqueName(parameterName), parameterType);
			InitializeFieldFromConstructorParameter(constructor, field, parameterName, parameterType);
			return field;
		}
		void CreateEnumeratorConstructor()
		{
			_enumeratorConstructor = CreateConstructor(_enumerator);
		}
		void CreateEnumerableConstructor()
		{
			_enumerableConstructor = CreateConstructor(_enumerable);
		}
Exemple #8
0
		public GeneratorSkeleton(BooClassBuilder generatorBuilder, BooMethodBuilder getEnumeratorBuilder, IType generatorItemType)
		{
			GeneratorClassBuilder = generatorBuilder;
			GeneratorItemType = generatorItemType;
			GetEnumeratorBuilder = getEnumeratorBuilder;
		}
Exemple #9
0
 public BooMethodBuilder AddMethod(string name, IType returnType, TypeMemberModifiers modifiers)
 {
     BooMethodBuilder builder = new BooMethodBuilder(_codeBuilder, name, returnType, modifiers);
     _cd.Members.Add(builder.Method);
     return builder;
 }