상속: CodeObject
 public SimpleCSharpRazorCodeGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host)
     : base(className, rootNamespaceName, sourceFileName, host)
 {
     var baseType = new CodeTypeReference(SimpleRazorConfiguration.BaseClass);
     Context.GeneratedClass.BaseTypes.Clear();
     Context.GeneratedClass.BaseTypes.Add(baseType);
 }
        public void SetTestFixtureSetup(CodeMemberMethod fixtureSetupMethod)
        {
            // xUnit uses IUseFixture<T> on the class

            fixtureSetupMethod.Attributes |= MemberAttributes.Static;

            _currentFixtureTypeDeclaration = new CodeTypeDeclaration("FixtureData");
            _currentTestTypeDeclaration.Members.Add(_currentFixtureTypeDeclaration);

            var fixtureDataType = 
                CodeDomHelper.CreateNestedTypeReference(_currentTestTypeDeclaration, _currentFixtureTypeDeclaration.Name);
            
            var useFixtureType = new CodeTypeReference(IUSEFIXTURE_INTERFACE, fixtureDataType);
            CodeDomHelper.SetTypeReferenceAsInterface(useFixtureType);

            _currentTestTypeDeclaration.BaseTypes.Add(useFixtureType);

            // public void SetFixture(T) { } // explicit interface implementation for generic interfaces does not work with codedom

            CodeMemberMethod setFixtureMethod = new CodeMemberMethod();
            setFixtureMethod.Attributes = MemberAttributes.Public;
            setFixtureMethod.Name = "SetFixture";
            setFixtureMethod.Parameters.Add(new CodeParameterDeclarationExpression(fixtureDataType, "fixtureData"));
            setFixtureMethod.ImplementationTypes.Add(useFixtureType);
            _currentTestTypeDeclaration.Members.Add(setFixtureMethod);

            // public <_currentFixtureTypeDeclaration>() { <fixtureSetupMethod>(); }
            CodeConstructor ctorMethod = new CodeConstructor();
            ctorMethod.Attributes = MemberAttributes.Public;
            _currentFixtureTypeDeclaration.Members.Add(ctorMethod);
            ctorMethod.Statements.Add(
                new CodeMethodInvokeExpression(
                    new CodeTypeReferenceExpression(new CodeTypeReference(_currentTestTypeDeclaration.Name)),
                    fixtureSetupMethod.Name));
        }
        internal CodeTypeMemberCollection GenerateParameterProperty(IParameter parameter,
            IMethod method,
            CodeTypeDeclaration resourceClass,
            IEnumerable<string> usedNames)
        {
            // Get the name and return type of this parameter.
            string name = parameter.Name;
            CodeTypeReference returnType = ResourceBaseGenerator.GetParameterTypeReference(
                resourceClass, parameter);

            // Generate the property and field.
            CodeTypeMemberCollection newMembers = DecoratorUtil.CreateAutoProperty(
                name, parameter.Description, returnType, usedNames, parameter.IsRequired);

            // Add the KeyAttribute to the property.
            foreach (CodeTypeMember member in newMembers)
            {
                CodeMemberProperty property = member as CodeMemberProperty;
                if (property == null)
                {
                    continue;
                }

                // Declare the RequestParameter attribute.
                CodeTypeReference attributeType = new CodeTypeReference(typeof(RequestParameterAttribute));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(attributeType);
                attribute.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(parameter.Name)));
                property.CustomAttributes.Add(attribute);
            }

            return newMembers;
        }
예제 #4
0
        public void Visit(BufferTable table)
        {
            var descriptor = new TableDescriptor(typeof(BufferTable<>));
            var bufferTable = new CodeTypeDeclaration(table.Variable) { TypeAttributes = TypeAttributes.NestedPrivate };
            bufferTable.BaseTypes.Add(new CodeTypeReference("IRow"));

            var bufferCodeDomType = new CodeTypeReference("CodeTable", new CodeTypeReference(table.Variable));
            Scope.Current.Type.Type.Members.Add(
                new CodeMemberField(bufferCodeDomType, table.Variable) { Attributes = MemberAttributes.Public | MemberAttributes.Final });

            Scope.Current.Type.Constructor.Statements.Add(new CodeAssignStatement(
                new CodeSnippetExpression(table.Variable),
                new CodeObjectCreateExpression(
                    new CodeTypeReference("BufferTable", new CodeTypeReference(table.Variable)))));

            foreach (var arg in table.Args)
            {
                var domArg = VisitChild(arg);
                bufferTable.Members.AddRange(domArg.ParentMemberDefinitions);
                descriptor.Variables.Add(new VariableTypePair { Variable = arg.Variable, Primitive = TablePrimitive.FromString(arg.Type) });
            }

            _mainType.Type.Members.Add(bufferTable);

            if (Scope.Current.IsCurrentScopeRegistered(table.Variable))
                Errors.Add(new VariableAlreadyExists(new Semantic.LineInfo(table.Line.Line, table.Line.CharacterPosition), table.Variable));

            Scope.Current.RegisterTable(table.Variable, descriptor, bufferCodeDomType);
        }
예제 #5
0
        internal static CodeTypeReference GetParameterTypeReference(CodeTypeDeclaration classDeclaration,
            IParameter param)
        {
            Type underlyingType = GetParameterType(param);
            CodeTypeReference paramTypeRef = new CodeTypeReference(underlyingType);
            bool isValueType = underlyingType.IsValueType;

            // Check if we need to declare a custom type for this parameter.
            // If the parameter is an enum, try finding the matching enumeration in the current class
            if (!param.EnumValues.IsNullOrEmpty())
            {
                // Naming scheme: MethodnameParametername
                CodeTypeReference enumReference = DecoratorUtil.FindFittingEnumeration(
                    classDeclaration, param.EnumValues, param.EnumValueDescriptions);

                if (enumReference != null)
                {
                    paramTypeRef = enumReference;
                    isValueType = true;
                }
            }

            // Check if this is an optional value parameter.
            if (isValueType && !param.IsRequired)
            {
                paramTypeRef = new CodeTypeReference(typeof(Nullable<>))
                {
                    TypeArguments = { paramTypeRef.BaseType }
                };
                // An optional value parameter has to be nullable.
            }

            return paramTypeRef;
        }
        public string GetTypeOutput(CodeTypeReference type)
        {
            if (!_baseTypeRegex.IsMatch(type.BaseType))
                throw new ArgumentException("Type mismatch");

            var baseTypeName = _baseTypeRegex
                .Match(type.BaseType)
                .Groups["TypeName"]
                .Captures[0]
                .Value;

            string typeOutputString;

            if (baseTypeName.Contains("Nullable"))
            {
                typeOutputString = GetTypeArgument(type);
            }
            else
            {
                typeOutputString = TranslateType(baseTypeName);

                if (type.TypeArguments.Count > 0)
                    typeOutputString = AddTypeArguments(type, typeOutputString);
            }

            if (_arrayRegex.IsMatch(type.BaseType))
                typeOutputString = GetArrayType(type.BaseType, typeOutputString);
            else if (type.ArrayRank > 0)
                typeOutputString = GetArrayString(typeOutputString, type.ArrayRank);

            return typeOutputString;
        }
        protected override void ProcessProperty(CodeTypeDeclaration type, CodeMemberField field, CodeMemberProperty property)
        {
            if (property.Type.ArrayElementType == null) return; // Is array?

            if (property.Name == "Items" || property.Name == "ItemsElementName") return;

            CodeTypeReference genericType = new CodeTypeReference("System.Collections.Generic.List", new CodeTypeReference(property.Type.BaseType));

            property.Type = genericType;
            if (field != null) {
                field.Type = genericType;

                property.GetStatements.Insert(0,
                    // if
                    new CodeConditionStatement(
                        // field == null
                        new CodeBinaryOperatorExpression(
                            new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), field.Name),
                            CodeBinaryOperatorType.IdentityEquality,
                            new CodePrimitiveExpression(null)),
                        // field = new List<T>();
                        new CodeAssignStatement(
                            new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), field.Name),
                            new CodeObjectCreateExpression(genericType))));
            }
        }
 /// <summary>
 /// Initializes a new instance of the CodeCreateAndInitializeObjectExpression class.
 /// </summary>
 /// <param name="objectType">The object type.</param>
 /// <param name="constructorParameters">The constructor parameters.</param>
 public CodeCreateAndInitializeObjectExpression(CodeTypeReference objectType,  params CodeExpression[] constructorParameters)
 {
     this.ObjectType = objectType;
     this.ConstructorParameters = new CodeExpressionCollection();
     this.ConstructorParameters.AddRange(constructorParameters);
     this.PropertyInitializers = new List<KeyValuePair<string, CodeExpression>>();
 }
        private void EmitField(CodeTypeDeclaration typeDecl, CodeTypeReference fieldType, bool hasDefault)
        {
            CodeMemberField memberField = new CodeMemberField(fieldType, Utils.FieldNameFromPropName(Item.Name));
            memberField.Attributes = MemberAttributes.Private;

            AttributeEmitter.AddGeneratedCodeAttribute(memberField);

            if (hasDefault)
            {
                if (this.Generator.UseDataServiceCollection)
                {
                    // new DataServiceCollection<T>(null, System.Data.Services.Client.TrackingMode.None, null, null, null);
                    // declare type is DataServiceCollection<T>
                    Debug.Assert(fieldType.TypeArguments.Count == 1, "Declare type is non generic.");

                    // new DataServiceCollection<[type]>(null, TrackingMode.None)
                    memberField.InitExpression = new CodeObjectCreateExpression(
                        fieldType,
                        new CodePrimitiveExpression(null),
                        new CodeFieldReferenceExpression(
                            new CodeTypeReferenceExpression(typeof(System.Data.Services.Client.TrackingMode)),
                            "None"));
                }
                else
                {
                    memberField.InitExpression = new CodeObjectCreateExpression(fieldType);
                }
            }

            typeDecl.Members.Add(memberField);
        }
 protected internal override object DeserializeFromString(WorkflowMarkupSerializationManager serializationManager, Type propertyType, string value)
 {
     CodeTypeReference reference;
     if (!propertyType.IsAssignableFrom(typeof(CodeTypeReference)))
     {
         return null;
     }
     if (string.IsNullOrEmpty(value) || base.IsValidCompactAttributeFormat(value))
     {
         return null;
     }
     try
     {
         Type type = serializationManager.GetType(value);
         if (type != null)
         {
             reference = new CodeTypeReference(type);
             reference.UserData["QualifiedName"] = type.AssemblyQualifiedName;
             return reference;
         }
     }
     catch (Exception)
     {
     }
     reference = new CodeTypeReference(value);
     reference.UserData["QualifiedName"] = value;
     return reference;
 }
예제 #11
0
 private CodeTypeReference ComputeForType(Type type)
 {
     // we know that we can safely global:: qualify this because it was already 
     // compiled before we are emitting or else we wouldn't have a Type object
     CodeTypeReference value = new CodeTypeReference(type, CodeTypeReferenceOptions.GlobalReference);
     return value;
 }
예제 #12
0
		public override void Visit(ViewTreeNode node)
		{
			if (typeStack.Count == 0) return;

			var constructionArguments = new CodeExpression[]
			{
				new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), naming.ToMemberVariableName(serviceIdentifier)),
				new CodeTypeOfExpression(node.Controller.FullName),
				new CodePrimitiveExpression(node.Controller.Area),
				new CodePrimitiveExpression(naming.ToControllerName(node.Controller.Name)),
				new CodePrimitiveExpression(node.Name)
			};

			CodeExpression returnExpression =
				new CodeMethodInvokeExpression(
					new CodeMethodReferenceExpression(
						new CodePropertyReferenceExpression(
							new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), naming.ToMemberVariableName(serviceIdentifier)),
							"ControllerReferenceFactory"),
						"CreateViewReference"),
					constructionArguments);

			var propertyType = new CodeTypeReference(typeof (IControllerViewReference));
			typeStack.Peek().Members.Add(source.CreateReadOnlyProperty(node.Name, propertyType, returnExpression));

			base.Visit(node);
		}
 private static string ConvertTypeReferenceToString(CodeTypeReference reference)
 {
     StringBuilder builder;
     if (reference.ArrayElementType != null)
     {
         builder = new StringBuilder(ConvertTypeReferenceToString(reference.ArrayElementType));
         if (reference.ArrayRank > 0)
         {
             builder.Append("[");
             builder.Append(',', reference.ArrayRank - 1);
             builder.Append("]");
         }
     }
     else
     {
         builder = new StringBuilder(reference.BaseType);
         if ((reference.TypeArguments != null) && (reference.TypeArguments.Count > 0))
         {
             string str = "[";
             foreach (CodeTypeReference reference2 in reference.TypeArguments)
             {
                 builder.Append(str);
                 builder.Append(ConvertTypeReferenceToString(reference2));
                 str = ", ";
             }
             builder.Append("]");
         }
     }
     return builder.ToString();
 }
예제 #14
0
파일: Type.cs 프로젝트: BillTheBest/IronAHK
        public string GetTypeOutput(CodeTypeReference type)
        {
            var name = new StringBuilder(type.BaseType.Length + type.ArrayRank * 2);

            string basename = type.BaseType;
            int z = basename.IndexOf('`');
            if (z != -1)
                basename = basename.Substring(0, z);
            name.Append(basename);

            if (type.TypeArguments.Count > 0)
            {
                name.Append('<');

                for (int i = 0; i < type.TypeArguments.Count; i++)
                {
                    name.Append(GetTypeOutput(type.TypeArguments[i]));
                    if (i > 0)
                        name.Append(", ");
                }

                name.Append('>');
            }

            for (int i = 0; i < type.ArrayRank; i++)
                name.Append("[]");

            return name.ToString();
        }
 private void SetBaseType(string modelTypeName)
 {
     var baseClass = StringExtensions.SplitOnFirst((string) Host.DefaultBaseClass, (char) '<')[0];
     var baseType = new CodeTypeReference(baseClass + "<" + modelTypeName + ">");
     GeneratedClass.BaseTypes.Clear();
     GeneratedClass.BaseTypes.Add(baseType);
 }
	public void AddRange(CodeTypeReference[] value)
			{
				foreach(CodeTypeReference e in value)
				{
					List.Add(e);
				}
			}
예제 #17
0
		protected override CodeTypeDeclaration BeginClass ()
		{
			CodeTypeDeclaration codeClass = base.BeginClass ();
			CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.HttpPostClientProtocol");
			codeClass.BaseTypes.Add (ctr);
			return codeClass;
		}
예제 #18
0
        // Generates a codedom instantiation expression: new foo() or new foo[x].
        public static CodeExpression Emit(Instantiation instantiation)
        {
            // Array instantiation needs a different treatment.
            if (instantiation.IsArray)
            {
                var c = new CodeArrayCreateExpression();

                c.CreateType = new CodeTypeReference(instantiation.Name);
                c.SizeExpression = CodeDomEmitter.EmitCodeExpression(instantiation.Parameters.ChildExpressions[0]);
                return c;
            }
            else // Non-array instantiation
            {
                var c = new CodeObjectCreateExpression();

                // The type that is being created
                var createType = new CodeTypeReference(instantiation.Name);

                // Apply the generic type names, if any.
                foreach (var g in instantiation.GenericTypes)
                {
                    createType.TypeArguments.Add(new CodeTypeReference(g));
                }
                c.CreateType = createType;

                // Translate the instantiation parameters.
                foreach (var a in instantiation.Parameters.ChildExpressions)
                    c.Parameters.Add(CodeDomEmitter.EmitCodeExpression(a));

                return c;
            }
        }
 CodeTypeDeclaration EmitClass()
 {
     CodeTypeDeclaration customSBConfigSectionClass = new CodeTypeDeclaration(generatedElementClassName);
     CodeTypeReference baseClass = new CodeTypeReference(TypeNameConstants.StdBindingElement);
     customSBConfigSectionClass.BaseTypes.Add(baseClass);
     return customSBConfigSectionClass;
 }
        public void Visit(DownloadImageExpression expression)
        {
            var type = new CodeTypeReference("RuntimeTable", new CodeTypeReference("DownloadImage"));
            DownloadImpl(expression.Statement, "DownloadImage", type, expression.Line.Line);

            _codeStack.Peek().Scope = new ScopeData<TableDescriptor> { Type = DownloadImage.Columns, CodeDomReference = type };
        }
		public void Constructor1_Deny_Unrestricted ()
		{
			CodeTypeReference type = new CodeTypeReference ("System.Int32");
			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression (type);
			Assert.AreSame (type, ctre.Type, "Type");
			ctre.Type = new CodeTypeReference ("System.Void");
		}
예제 #22
0
		public void Constructor1_Deny_Unrestricted ()
		{
			CodeTypeReference ctr = new CodeTypeReference ();
			CodeDefaultValueExpression cdve = new CodeDefaultValueExpression (ctr);
			Assert.AreSame (ctr, cdve.Type, "Type");
			cdve.Type = new CodeTypeReference ();
		}
		public void Constructor0 ()
		{
			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression ();
			Assert.IsNotNull (cpde.CustomAttributes, "#1");
			Assert.AreEqual (0, cpde.CustomAttributes.Count, "#2");
			Assert.AreEqual (FieldDirection.In, cpde.Direction, "#3");
			Assert.IsNotNull (cpde.Name, "#4");
			Assert.AreEqual (string.Empty, cpde.Name, "#5");
			Assert.IsNotNull (cpde.Type, "#6");
			Assert.AreEqual (typeof (void).FullName, cpde.Type.BaseType, "#7");

			cpde.Direction = FieldDirection.Out;
			Assert.AreEqual (FieldDirection.Out, cpde.Direction, "#8");

			string name = "mono";
			cpde.Name = name;
			Assert.AreSame (name, cpde.Name, "#9");

			cpde.Name = null;
			Assert.IsNotNull (cpde.Name, "#10");
			Assert.AreEqual (string.Empty, cpde.Name, "#11");

			CodeTypeReference type = new CodeTypeReference ("mono");
			cpde.Type = type;
			Assert.AreSame (type, cpde.Type, "#12");

			cpde.Type = null;
			Assert.IsNotNull (cpde.Type, "#13");
			Assert.AreEqual (typeof (void).FullName, cpde.Type.BaseType, "#14");
		}
	public CodeVariableDeclarationStatement(Type type, String name,
											CodeExpression initExpression)
			{
				this.type = new CodeTypeReference(type);
				this.name = name;
				this.initExpression = initExpression;
			}
        internal BindingElementExtensionSectionGenerator(Type bindingElementType, Assembly userAssembly, CodeDomProvider provider)
        {
            this.bindingElementType = bindingElementType;
            this.userAssembly = userAssembly;
            this.provider = provider;

            string typePrefix = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement));
            this.generatedClassName = typePrefix + Constants.ElementSuffix;
            this.constantsClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.ConfigurationStrings;
            this.defaultValuesClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.Defaults;

            this.customBEVarInstance = Helpers.TurnFirstCharLower(bindingElementType.Name);
            customBEArgRef = new CodeArgumentReferenceExpression(customBEVarInstance);

            this.customBETypeRef = new CodeTypeReference(bindingElementType.Name);
            this.customBETypeOfRef = new CodeTypeOfExpression(customBETypeRef);
            this.customBENewVarAssignRef = new CodeVariableDeclarationStatement(
                                                customBETypeRef,
                                                customBEVarInstance,
                                                new CodeObjectCreateExpression(customBETypeRef));
            this.bindingElementMethodParamRef = new CodeParameterDeclarationExpression(
                                                    CodeDomHelperObjects.bindingElementTypeRef,
                                                    Constants.bindingElementParamName);

        }
		public CodeAttributeDeclaration (CodeTypeReference attributeType)
		{
			attribute = attributeType;
			if (attributeType != null) {
				name = attributeType.BaseType;
			}
		}
예제 #27
0
		public void Constructor1 ()
		{
			CodeTypeReference type1 = new CodeTypeReference ("mono1");
			CodeExpression expression1 = new CodeExpression ();

			CodeCastExpression cce = new CodeCastExpression (type1, expression1);
			Assert.IsNotNull (cce.Expression, "#1");
			Assert.AreSame (expression1, cce.Expression, "#2");
			Assert.IsNotNull (cce.TargetType, "#3");
			Assert.AreSame (type1, cce.TargetType, "#4");

			cce.Expression = null;
			Assert.IsNull (cce.Expression, "#5");

			CodeExpression expression2 = new CodeExpression ();
			cce.Expression = expression2;
			Assert.IsNotNull (cce.Expression, "#6");
			Assert.AreSame (expression2, cce.Expression, "#7");

			cce.TargetType = null;
			Assert.IsNotNull (cce.TargetType, "#8");
			Assert.AreEqual (typeof (void).FullName, cce.TargetType.BaseType, "#9");

			CodeTypeReference type2 = new CodeTypeReference ("mono2");
			cce.TargetType = type2;
			Assert.IsNotNull (cce.TargetType, "#10");
			Assert.AreSame (type2, cce.TargetType, "#11");

			cce = new CodeCastExpression ((CodeTypeReference) null, (CodeExpression) null);
			Assert.IsNull (cce.Expression, "#12");
			Assert.IsNotNull (cce.TargetType, "#13");
			Assert.AreEqual (typeof (void).FullName, cce.TargetType.BaseType, "#14");
		}
예제 #28
0
        protected void ResourceCallAddBodyDeclaration(IMethod method,
                                                      CodeMemberMethod member,
                                                      CodeTypeReference bodyType,
                                                      bool addBodyIfUnused)
        {
            switch (method.HttpMethod)
            {
                case Request.GET:
                case Request.DELETE:
                    if (!addBodyIfUnused)
                    {
                        break;
                    }

                    // string body = null;
                    var bodyVarDeclaration = new CodeVariableDeclarationStatement(bodyType, "body");
                    bodyVarDeclaration.InitExpression = new CodePrimitiveExpression(null);
                    member.Statements.Add(bodyVarDeclaration);
                    break;

                case Request.PUT:
                case Request.POST:
                case Request.PATCH:
                    // add body Parameter.
                    member.Parameters.Add(new CodeParameterDeclarationExpression(bodyType, "body"));
                    break;
                default:
                    throw new NotSupportedException("Unsupported HttpMethod [" + method.HttpMethod + "]");
            }
        }
예제 #29
0
        /// <include file='doc\CodeTypeReference.uex' path='docs/doc[@for="CodeTypeReference.CodeTypeReference1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public CodeTypeReference(string typeName) {
            if (typeName == null || typeName.Length == 0) {
                typeName = typeof(void).FullName;
            }

            // See if this ends with standard array tail. If is is not an exact match, we pass it through verbatim.
            int lastArrayOpen = typeName.LastIndexOf('[');
            int lastArrayClose = typeName.LastIndexOf(']');
            bool isArray = lastArrayOpen >= 0 && lastArrayClose == (typeName.Length - 1) && lastArrayOpen < lastArrayClose;
            if (isArray) {
                for (int index = lastArrayOpen + 1; index < lastArrayClose; index++) {
                    if (typeName[index] != ',') {
                        isArray = false;
                    }
                }
            }

            if (isArray) {
                this.baseType = null;
                this.arrayRank = lastArrayClose - lastArrayOpen;
                this.arrayElementType = new CodeTypeReference(typeName.Substring(0, lastArrayOpen));
            }
            else {
                this.baseType = typeName;
                this.arrayRank = 0;
                this.arrayElementType = null;
            }
        }
		public void Constructor1 ()
		{
			CodeExpression expression = new CodeExpression ();
			CodeTypeReference type = new CodeTypeReference ("mono");
			string methodName = "mono";

			CodeDelegateCreateExpression cdce = new CodeDelegateCreateExpression (
				type, expression, methodName);

			Assert.IsNotNull (cdce.DelegateType, "#1");
			Assert.AreSame (type, cdce.DelegateType, "#2");
			Assert.IsNotNull (cdce.MethodName, "#3");
			Assert.AreSame (methodName, cdce.MethodName, "#4");
			Assert.IsNotNull (cdce.TargetObject, "#5");
			Assert.AreSame (expression, cdce.TargetObject, "#6");

			cdce = new CodeDelegateCreateExpression ((CodeTypeReference) null,
				(CodeExpression) null, (string) null);

			Assert.IsNotNull (cdce.DelegateType, "#7");
			Assert.AreEqual (typeof (void).FullName, cdce.DelegateType.BaseType, "#8");
			Assert.IsNotNull (cdce.MethodName, "#9");
			Assert.AreEqual (string.Empty, cdce.MethodName, "#10");
			Assert.IsNull (cdce.TargetObject, "#11");
		}
예제 #31
0
 protected override void OutputType(System.CodeDom.CodeTypeReference typeRef)
 {
     if (!own_output && typeRef.BaseType != "System.Windows.Forms.ContextMenuStrip")
     {
         Output.Write(typeRef.BaseType.Replace("System.Windows.Forms.Label", "&Label").Replace("System.Windows.Forms.", ""));
     }
     else
     {
         Output.Write(typeRef.BaseType);
     }
 }
 public CodeAttributeDeclaration(CodeTypeReference attributeType)
 {
 }
예제 #33
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeCatchClause(string localName, CodeTypeReference catchExceptionType)
 {
     this.localName          = localName;
     this.catchExceptionType = catchExceptionType;
 }
예제 #34
0
 protected override void OutputType(System.CodeDom.CodeTypeReference typeRef)
 {
     Output.Write(typeRef.BaseType);
 }
예제 #35
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeArrayCreateExpression(Type createType, int size)
 {
     this.createType = new CodeTypeReference(createType);
     this.size       = size;
 }
예제 #36
0
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of <see cref='System.CodeDom.CodeArrayCreateExpression'/>. with the specified array
 ///       type and size.
 ///    </para>
 /// </devdoc>
 public CodeArrayCreateExpression(CodeTypeReference createType, int size)
 {
     this.createType = createType;
     this.size       = size;
 }
예제 #37
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeArrayCreateExpression(Type createType, params CodeExpression[] initializers)
 {
     this.createType = new CodeTypeReference(createType);
     this.initializers.AddRange(initializers);
 }
예제 #38
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeArrayCreateExpression(string createType, CodeExpression size)
 {
     this.createType     = new CodeTypeReference(createType);
     this.sizeExpression = size;
 }
예제 #39
0
 protected override string GetTypeOutput(System.CodeDom.CodeTypeReference value)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 public CodeParameterDeclarationExpression(Type type, string name)
 {
     this.type = new CodeTypeReference(type);
     this.name = name;
 }
예제 #41
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeVariableDeclarationStatement(Type type, string name)
 {
     Type = new CodeTypeReference(type);
     Name = name;
 }
 public CodeAttributeDeclaration(CodeTypeReference attributeType, CodeAttributeArgument[] arguments)
 {
 }
 /// <include file='doc\CodeObjectCreateExpression.uex' path='docs/doc[@for="CodeObjectCreateExpression.CodeObjectCreateExpression3"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeObjectCreateExpression(Type createType, params CodeExpression[] parameters)
 {
     CreateType = new CodeTypeReference(createType);
     Parameters.AddRange(parameters);
 }
예제 #44
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeVariableDeclarationStatement(Type type, string name, CodeExpression initExpression)
 {
     Type           = new CodeTypeReference(type);
     Name           = name;
     InitExpression = initExpression;
 }
예제 #45
0
 /// <include file='doc\CodeTypeOfExpression.uex' path='docs/doc[@for="CodeTypeOfExpression.CodeTypeOfExpression1"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of <see cref='System.CodeDom.CodeTypeOfExpression'/>.
 ///    </para>
 /// </devdoc>
 public CodeTypeOfExpression(CodeTypeReference type)
 {
     Type = type;
 }
예제 #46
0
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of <see cref='System.CodeDom.CodeVariableDeclarationStatement'/> using the specified type and name.
 ///    </para>
 /// </devdoc>
 public CodeVariableDeclarationStatement(CodeTypeReference type, string name)
 {
     Type = type;
     Name = name;
 }
예제 #47
0
 public CodeTypeReferenceExpression(CodeTypeReference type)
 {
     this.type = type;
 }
예제 #48
0
 /// <include file='doc\CodeTypeOfExpression.uex' path='docs/doc[@for="CodeTypeOfExpression.CodeTypeOfExpression3"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public CodeTypeOfExpression(Type type)
 {
     Type = new CodeTypeReference(type);
 }
예제 #49
0
 public CodeCatchClause(string localName, CodeTypeReference catchExceptionType, params CodeStatement[] statements)
 {
     throw new NotImplementedException();
 }
예제 #50
0
 public CodeTypeReferenceExpression(Type type)
 {
     this.type = new CodeTypeReference(type);
 }
 public CodeObjectCreateExpression(ILInstruction inline, Type createType, params CodeExpression[] parameters) : base(inline)
 {
     CreateType = new CodeTypeReference(createType);
     Parameters.AddRange(parameters);
 }
예제 #52
0
 public CodeTypeOfExpression(string type)
 {
     this.type = new CodeTypeReference(type);
 }
 /// <devdoc>
 ///    <para> Removes a specific <see cref='System.CodeDom.CodeTypeReference'/> from the
 ///    <see cref='System.CodeDom.CodeTypeReferenceCollection'/> .</para>
 /// </devdoc>
 public void Remove(CodeTypeReference value)
 {
     List.Remove(value);
 }
예제 #54
0
 public CodeCatchClause(string localName, CodeTypeReference catchExceptionType)
 {
     throw new NotImplementedException();
 }
 /// <devdoc>
 ///    <para>Returns the index of a <see cref='System.CodeDom.CodeTypeReference'/> in
 ///       the <see cref='System.CodeDom.CodeTypeReferenceCollection'/> .</para>
 /// </devdoc>
 public int IndexOf(CodeTypeReference value)
 {
     return(List.IndexOf(value));
 }
 /// <devdoc>
 ///    <para>Adds a <see cref='System.CodeDom.CodeTypeReference'/> with the specified value to the
 ///    <see cref='System.CodeDom.CodeTypeReferenceCollection'/> .</para>
 /// </devdoc>
 public int Add(CodeTypeReference value)
 {
     return(List.Add(value));
 }
예제 #57
0
 public CodeMemberField(Type type, String name)
 {
     this.type = new CodeTypeReference(type);
     this.Name = name;
 }
 /// <devdoc>
 /// <para>Inserts a <see cref='System.CodeDom.CodeTypeReference'/> into the <see cref='System.CodeDom.CodeTypeReferenceCollection'/> at the specified index.</para>
 /// </devdoc>
 public void Insert(int index, CodeTypeReference value)
 {
     List.Insert(index, value);
 }
예제 #59
0
 public CodeMemberField(CodeTypeReference type, String name)
 {
     this.type = type;
     this.Name = name;
 }
 /// <devdoc>
 /// <para>Gets a value indicating whether the
 ///    <see cref='System.CodeDom.CodeTypeReferenceCollection'/> contains the specified <see cref='System.CodeDom.CodeTypeReference'/>.</para>
 /// </devdoc>
 public bool Contains(CodeTypeReference value)
 {
     return(List.Contains(value));
 }