public override void Populate(TextWriter trapFile) { PopulateMethod(trapFile); PopulateModifiers(trapFile); ContainingType.PopulateGenerics(); var returnType = Type.Create(Context, symbol.ReturnType); trapFile.methods(this, Name, ContainingType, returnType.TypeRef, OriginalDefinition); if (IsSourceDeclaration) { foreach (var declaration in symbol.DeclaringSyntaxReferences.Select(s => s.GetSyntax()).OfType <MethodDeclarationSyntax>()) { Context.BindComments(this, declaration.Identifier.GetLocation()); TypeMention.Create(Context, declaration.ReturnType, this, returnType); } } foreach (var l in Locations) { trapFile.method_location(this, l); } PopulateGenerics(trapFile); Overrides(trapFile); ExtractRefReturn(trapFile, symbol, this); ExtractCompilerGenerated(trapFile); }
public override void Populate(TextWriter trapFile) { PopulateMethod(trapFile); PopulateModifiers(trapFile); var returnType = Type.Create(Context, Symbol.ReturnType); trapFile.operators(this, Symbol.Name, OperatorSymbol(Context, Symbol), ContainingType, returnType.TypeRef, (UserOperator)OriginalDefinition); foreach (var l in Locations) { trapFile.operator_location(this, l); } if (IsSourceDeclaration) { var declSyntaxReferences = Symbol.DeclaringSyntaxReferences.Select(s => s.GetSyntax()).ToArray(); foreach (var declaration in declSyntaxReferences.OfType <OperatorDeclarationSyntax>()) { TypeMention.Create(Context, declaration.ReturnType, this, returnType); } foreach (var declaration in declSyntaxReferences.OfType <ConversionOperatorDeclarationSyntax>()) { TypeMention.Create(Context, declaration.Type, this, returnType); } } ContainingType.PopulateGenerics(); }
public override void Populate(TextWriter trapFile) { PopulateMethod(trapFile); PopulateModifiers(trapFile); ContainingType.PopulateGenerics(); trapFile.destructors(this, string.Format("~{0}", symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, symbol)); trapFile.destructor_location(this, Location); }
public override void Populate(TextWriter trapFile) { PopulateMethod(trapFile); PopulateModifiers(trapFile); ContainingType.PopulateGenerics(); var prop = PropertySymbol; if (prop == null) { Context.ModelError(symbol, "Unhandled accessor associated symbol"); return; } var parent = Property.Create(Context, prop); int kind; Accessor unboundAccessor; if (SymbolEqualityComparer.Default.Equals(symbol, prop.GetMethod)) { kind = 1; unboundAccessor = Create(Context, prop.OriginalDefinition.GetMethod); } else if (SymbolEqualityComparer.Default.Equals(symbol, prop.SetMethod)) { kind = 2; unboundAccessor = Create(Context, prop.OriginalDefinition.SetMethod); } else { Context.ModelError(symbol, "Unhandled accessor kind"); return; } trapFile.accessors(this, kind, symbol.Name, parent, unboundAccessor); foreach (var l in Locations) { trapFile.accessor_location(this, l); } Overrides(trapFile); if (symbol.FromSource() && Block == null) { trapFile.compiler_generated(this); } if (symbol.IsInitOnly) { trapFile.init_only_accessors(this); } }
public override void Populate(TextWriter trapFile) { PopulateMethod(trapFile); PopulateModifiers(trapFile); ContainingType.PopulateGenerics(); trapFile.constructors(this, symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition); trapFile.constructor_location(this, Location); if (symbol.IsImplicitlyDeclared) { var lineCounts = new LineCounts() { Total = 2, Code = 1, Comment = 0 }; trapFile.numlines(this, lineCounts); } ExtractCompilerGenerated(trapFile); }
public override void Populate(TextWriter trapFile) { PopulateMethod(trapFile); ContainingType.PopulateGenerics(); var @event = EventSymbol; if (@event == null) { Context.ModelError(symbol, "Unhandled event accessor associated symbol"); return; } var parent = Event.Create(Context, @event); int kind; EventAccessor unboundAccessor; if (SymbolEqualityComparer.Default.Equals(symbol, @event.AddMethod)) { kind = 1; unboundAccessor = Create(Context, @event.OriginalDefinition.AddMethod); } else if (SymbolEqualityComparer.Default.Equals(symbol, @event.RemoveMethod)) { kind = 2; unboundAccessor = Create(Context, @event.OriginalDefinition.RemoveMethod); } else { Context.ModelError(symbol, "Undhandled event accessor kind"); return; } trapFile.event_accessors(this, kind, symbol.Name, parent, unboundAccessor); foreach (var l in Locations) { trapFile.event_accessor_location(this, l); } Overrides(trapFile); }
public override void Populate(TextWriter trapFile) { PopulateMetadataHandle(trapFile); PopulateAttributes(); ContainingType.PopulateGenerics(); PopulateNullability(trapFile, symbol.NullableAnnotation); Field unboundFieldKey = Field.Create(Context, symbol.OriginalDefinition); trapFile.fields(this, (symbol.IsConst ? 2 : 1), symbol.Name, ContainingType, Type.Type.TypeRef, unboundFieldKey); PopulateModifiers(trapFile); if (symbol.IsVolatile) { Modifier.HasModifier(Context, trapFile, this, "volatile"); } if (symbol.IsConst) { Modifier.HasModifier(Context, trapFile, this, "const"); if (symbol.HasConstantValue) { trapFile.constant_value(this, Expression.ValueAsString(symbol.ConstantValue)); } } foreach (var l in Locations) { trapFile.field_location(this, l); } if (!IsSourceDeclaration || !symbol.FromSource()) { return; } Context.BindComments(this, Location.symbol); int child = 0; foreach (var initializer in symbol.DeclaringSyntaxReferences. Select(n => n.GetSyntax()). OfType <VariableDeclaratorSyntax>(). Where(n => n.Initializer != null)) { Context.PopulateLater(() => { var loc = Context.Create(initializer.GetLocation()); var simpleAssignExpr = new Expression(new ExpressionInfo(Context, Type, loc, ExprKind.SIMPLE_ASSIGN, this, child++, false, null)); Expression.CreateFromNode(new ExpressionNodeInfo(Context, initializer.Initializer.Value, simpleAssignExpr, 0)); var access = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.FIELD_ACCESS, simpleAssignExpr, 1, false, null)); trapFile.expr_access(access, this); if (!symbol.IsStatic) { This.CreateImplicit(Context, Entities.Type.Create(Context, symbol.ContainingType), Location, access, -1); } }); } foreach (var initializer in symbol.DeclaringSyntaxReferences. Select(n => n.GetSyntax()). OfType <EnumMemberDeclarationSyntax>(). Where(n => n.EqualsValue != null)) { // Mark fields that have explicit initializers. var expr = new Expression(new ExpressionInfo(Context, Type, Context.Create(initializer.EqualsValue.Value.FixedLocation()), Kinds.ExprKind.FIELD_ACCESS, this, child++, false, null)); trapFile.expr_access(expr, this); } if (IsSourceDeclaration) { foreach (var syntax in symbol.DeclaringSyntaxReferences. Select(d => d.GetSyntax()).OfType <VariableDeclaratorSyntax>(). Select(d => d.Parent).OfType <VariableDeclarationSyntax>()) { TypeMention.Create(Context, syntax.Type, this, Type); } } }
public override void Populate(TextWriter trapFile) { PopulateMetadataHandle(trapFile); PopulateAttributes(); ContainingType.PopulateGenerics(); PopulateNullability(trapFile, symbol.GetAnnotatedType()); var unboundFieldKey = Field.Create(Context, symbol.OriginalDefinition); trapFile.fields(this, (symbol.IsConst ? 2 : 1), symbol.Name, ContainingType, Type.TypeRef, unboundFieldKey); PopulateModifiers(trapFile); if (symbol.IsVolatile) { Modifier.HasModifier(Context, trapFile, this, "volatile"); } if (symbol.IsConst) { Modifier.HasModifier(Context, trapFile, this, "const"); if (symbol.HasConstantValue) { trapFile.constant_value(this, Expression.ValueAsString(symbol.ConstantValue)); } } foreach (var l in Locations) { trapFile.field_location(this, l); } if (!IsSourceDeclaration || !symbol.FromSource()) { return; } Context.BindComments(this, Location.symbol); var child = 0; foreach (var initializer in symbol.DeclaringSyntaxReferences .Select(n => n.GetSyntax()) .OfType <VariableDeclaratorSyntax>() .Where(n => n.Initializer != null)) { Context.PopulateLater(() => { var loc = Context.CreateLocation(initializer.GetLocation()); var fieldAccess = AddInitializerAssignment(trapFile, initializer.Initializer.Value, loc, null, ref child); if (!symbol.IsStatic) { This.CreateImplicit(Context, symbol.ContainingType, Location, fieldAccess, -1); } }); } foreach (var initializer in symbol.DeclaringSyntaxReferences .Select(n => n.GetSyntax()) .OfType <EnumMemberDeclarationSyntax>() .Where(n => n.EqualsValue != null)) { // Mark fields that have explicit initializers. var constValue = symbol.HasConstantValue ? Expression.ValueAsString(symbol.ConstantValue) : null; var loc = Context.CreateLocation(initializer.GetLocation()); AddInitializerAssignment(trapFile, initializer.EqualsValue.Value, loc, constValue, ref child); } if (IsSourceDeclaration) { foreach (var syntax in symbol.DeclaringSyntaxReferences .Select(d => d.GetSyntax()) .OfType <VariableDeclaratorSyntax>() .Select(d => d.Parent) .OfType <VariableDeclarationSyntax>()) { TypeMention.Create(Context, syntax.Type, this, Type); } } }