public override void Populate() { PopulateMethod(); ExtractModifiers(); ContainingType.ExtractGenerics(); var returnType = Type.Create(Context, symbol.ReturnType); Context.Emit(Tuples.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) { Context.Emit(Tuples.method_location(this, l)); } ExtractGenerics(); Overrides(); ExtractRefReturn(); ExtractCompilerGenerated(); }
public override void Populate() { PopulateMethod(); ExtractModifiers(); var returnType = Type.Create(Context, symbol.ReturnType); Context.Emit(Tuples.operators(this, symbol.Name, OperatorSymbol(Context, symbol.Name), ContainingType, returnType.TypeRef, (UserOperator)OriginalDefinition)); foreach (var l in Locations) { Context.Emit(Tuples.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.ExtractGenerics(); }
public override void Populate() { PopulateMethod(); ExtractModifiers(); ContainingType.ExtractGenerics(); Context.Emit(Tuples.destructors(this, string.Format("~{0}", symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, symbol))); Context.Emit(Tuples.destructor_location(this, Location)); }
public override void Populate() { PopulateMethod(); ExtractModifiers(); ContainingType.ExtractGenerics(); 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 (symbol.Equals(prop.GetMethod)) { kind = 1; unboundAccessor = Create(Context, prop.OriginalDefinition.GetMethod); } else if (symbol.Equals(prop.SetMethod)) { kind = 2; unboundAccessor = Create(Context, prop.OriginalDefinition.SetMethod); } else { Context.ModelError(symbol, "Undhandled accessor kind"); return; } Context.Emit(Tuples.accessors(this, kind, symbol.Name, parent, unboundAccessor)); foreach (var l in Locations) { Context.Emit(Tuples.accessor_location(this, l)); } Overrides(); if (symbol.FromSource() && Block == null) { Context.Emit(Tuples.compiler_generated(this)); } }
public override void Populate() { PopulateMethod(); ExtractModifiers(); ContainingType.ExtractGenerics(); Context.Emit(Tuples.constructors(this, symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition)); Context.Emit(Tuples.constructor_location(this, Location)); if (symbol.IsImplicitlyDeclared) { var lineCounts = new LineCounts() { Total = 2, Code = 1, Comment = 0 }; Context.Emit(Tuples.numlines(this, lineCounts)); } ExtractCompilerGenerated(); }
public override void Populate() { PopulateMethod(); ContainingType.ExtractGenerics(); 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 (symbol.Equals(@event.AddMethod)) { kind = 1; unboundAccessor = Create(Context, @event.OriginalDefinition.AddMethod); } else if (symbol.Equals(@event.RemoveMethod)) { kind = 2; unboundAccessor = Create(Context, @event.OriginalDefinition.RemoveMethod); } else { Context.ModelError(symbol, "Undhandled event accessor kind"); return; } Context.Emit(Tuples.event_accessors(this, kind, symbol.Name, parent, unboundAccessor)); foreach (var l in Locations) { Context.Emit(Tuples.event_accessor_location(this, l)); } Overrides(); }
public override void Populate() { ExtractMetadataHandle(); ExtractAttributes(); ContainingType.ExtractGenerics(); Field unboundFieldKey = Field.Create(Context, symbol.OriginalDefinition); Context.Emit(Tuples.fields(this, (symbol.IsConst ? 2 : 1), symbol.Name, ContainingType, Type.TypeRef, unboundFieldKey)); ExtractModifiers(); if (symbol.IsVolatile) { Modifier.HasModifier(Context, this, "volatile"); } if (symbol.IsConst) { Modifier.HasModifier(Context, this, "const"); if (symbol.HasConstantValue) { Context.Emit(Tuples.constant_value(this, Expression.ValueAsString(symbol.ConstantValue))); } } foreach (var l in Locations) { Context.Emit(Tuples.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(() => { Expression.CreateFromNode(new ExpressionNodeInfo(Context, initializer.Initializer.Value, this, child++)); }); } 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)); Context.Emit(Tuples.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); } } }