Beispiel #1
0
        private FieldSymbol BuildPropertyAsField(PropertyDeclarationNode propertyNode, TypeSymbol typeSymbol) {
            AttributeNode intrinsicPropertyAttribute = AttributeNode.FindAttribute(propertyNode.Attributes, "IntrinsicProperty");
            if (intrinsicPropertyAttribute == null) {
                return null;
            }

            TypeSymbol fieldType = typeSymbol.SymbolSet.ResolveType(propertyNode.Type, _symbolTable, typeSymbol);
            Debug.Assert(fieldType != null);

            if (fieldType != null) {
                FieldSymbol symbol = new FieldSymbol(propertyNode.Name, typeSymbol, fieldType);
                BuildMemberDetails(symbol, typeSymbol, propertyNode, propertyNode.Attributes);

                string scriptAlias = GetAttributeValue(propertyNode.Attributes, "ScriptAlias");
                if (scriptAlias != null) {
                    symbol.SetAlias(scriptAlias);
                }

                return symbol;
            }

            return null;
        }
Beispiel #2
0
        private PropertySymbol BuildProperty(PropertyDeclarationNode propertyNode, TypeSymbol typeSymbol) {
            TypeSymbol propertyType = typeSymbol.SymbolSet.ResolveType(propertyNode.Type, _symbolTable, typeSymbol);
            Debug.Assert(propertyType != null);

            if (propertyType != null) {
                PropertySymbol property = new PropertySymbol(propertyNode.Name, typeSymbol, propertyType);
                BuildMemberDetails(property, typeSymbol, propertyNode, propertyNode.Attributes);

                SymbolImplementationFlags implFlags = SymbolImplementationFlags.Regular;
                if (propertyNode.SetAccessor == null) {
                    implFlags |= SymbolImplementationFlags.ReadOnly;
                }
                if ((propertyNode.Modifiers & Modifiers.Abstract) != 0) {
                    implFlags |= SymbolImplementationFlags.Abstract;
                }
                else if ((propertyNode.Modifiers & Modifiers.Override) != 0) {
                    implFlags |= SymbolImplementationFlags.Override;
                }
                property.SetImplementationState(implFlags);

                property.AddParameter(new ParameterSymbol("value", property, propertyType, ParameterMode.In));

                return property;
            }

            return null;
        }