code
stringlengths 2
1.05M
| repo_name
stringlengths 5
101
| path
stringlengths 4
991
| language
stringclasses 3
values | license
stringclasses 5
values | size
int64 2
1.05M
|
|---|---|---|---|---|---|
Imports System.Drawing
Public Class MyMath
''' <summary>
''' 向量的模
''' </summary>
''' <param name="p">向量的坐标</param>
''' <returns>模</returns>
''' <remarks></remarks>
Public Shared Function Distance(p As Point) As Double
Return Math.Sqrt(p.X * p.X + p.Y * p.Y)
End Function
''' <summary>
''' 两点间距离
''' </summary>
''' <param name="a">一个点</param>
''' <param name="b">另外一个点</param>
''' <returns>距离</returns>
''' <remarks></remarks>
Public Shared Function Distance(a As Point, b As Point) As Double
Dim delta = a - b
Return Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y)
End Function
''' <summary>
''' 向量的模的平方
''' </summary>
''' <param name="p">向量的坐标</param>
''' <returns>模的平方</returns>
''' <remarks></remarks>
Public Shared Function Distance2(p As Point) As Integer
Return p.X * p.X + p.Y * p.Y
End Function
''' <summary>
''' 两点间距离的平方
''' </summary>
''' <param name="a">一个点</param>
''' <param name="b">另外一个点</param>
''' <returns>距离的平方</returns>
''' <remarks></remarks>
Public Shared Function Distance2(a As Point, b As Point) As Integer
Dim delta = a - b
Return delta.X * delta.X + delta.Y * delta.Y
End Function
''' <summary>
''' 点到线段的距离的平方
''' </summary>
''' <param name="a">线段一个端点</param>
''' <param name="b">线段一个端点</param>
''' <param name="p">待测点</param>
''' <returns>距离的平方</returns>
''' <remarks></remarks>
Public Shared Function PointToLine2(a As Point, b As Point, p As Point) As Double
Dim AP = p - a
Dim d2AP = Distance2(AP)
If d2AP = 0 Then
Return 0.0
End If
Dim BP = p - b
Dim d2BP = Distance2(BP)
If d2BP = 0 Then
Return 0.0
End If
Dim AB = b - a
Dim d2AB = Distance2(AB)
If d2AB = 0 Then '3
Return d2AP
End If
If d2BP > d2AB + d2AP Then '1
Return d2AP
End If
If d2AP > d2AB + d2BP Then '2
Return d2BP
End If
Dim APdotAB As Double = AP.X * AB.X + AP.Y * AB.Y
'Dim cos2A = (APdotAB * APdotAB) / (d2AP * d2AB)
'Dim sin2A = 1 - cos2A
'Return d2AP * sin2A
Return d2AP - (APdotAB * APdotAB) / d2AB
End Function
''' <summary>
''' 点到线段的距离
''' </summary>
''' <param name="a">线段一个端点</param>
''' <param name="b">线段一个端点</param>
''' <param name="p">待测点</param>
''' <returns>距离</returns>
''' <remarks></remarks>
Public Shared Function PointToLine(a As Point, b As Point, p As Point) As Double
Return Math.Sqrt(PointToLine2(a, b, p))
End Function
Public Shared Function PointToLine_way2(a As Point, b As Point, p As Point) As Double
Dim AP = p - a
Dim d2AP = Distance2(AP)
If d2AP = 0 Then
Return 0.0
End If
Dim BP = p - b
Dim d2BP = Distance2(BP)
If d2BP = 0 Then
Return 0.0
End If
Dim AB = b - a
Dim d2AB = Distance2(AB)
If d2AB = 0 Then '3
Return Math.Sqrt(d2AP)
End If
If d2BP > d2AB + d2AP Then '1
Return Math.Sqrt(d2AP)
End If
If d2AP > d2AB + d2BP Then '2
Return Math.Sqrt(d2BP)
End If
Dim x = Math.Sqrt(d2AP), y = Math.Sqrt(d2BP), z = Math.Sqrt(d2AB)
Dim l = (x + y + z) / 2
Dim s = Math.Sqrt(l * (l - x) * (l - y) * (l - z))
Return 2 * s / z
End Function
''' <summary>
''' 判断矩形是否相交
''' </summary>
''' <param name="R1">矩形一</param>
''' <param name="R2">矩形二</param>
''' <returns>是否相交</returns>
''' <remarks></remarks>
Public Shared Function IsCoincide(ByVal R1 As Rectangle, ByVal R2 As Rectangle) As Boolean
Return R1.Left < R2.Right AndAlso R1.Right > R2.Left AndAlso
R1.Top < R2.Bottom AndAlso R1.Bottom > R2.Top
End Function
End Class
|
twd2/Circuit
|
WDMath/MyMath.vb
|
Visual Basic
|
mit
| 4,310
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.Shared.Extensions.ContextQuery
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
''' <summary>
''' Helper structure to store some context about a position for keyword completion
''' </summary>
Friend NotInheritable Class VisualBasicSyntaxContext
Inherits SyntaxContext
''' <summary>
''' True if position is after a colon, or an
''' EOL that was not preceded by an explicit line continuation
''' </summary>
Public ReadOnly FollowsEndOfStatement As Boolean
''' <summary>
''' True if position is definitely the beginning of a new statement (after a colon
''' or two line breaks).
'''
''' Dim q = From a In args
''' $1
''' $2
'''
''' $1 may continue the previous statement, but $2 definitely starts a
''' new statement since there are two line breaks before it.
''' </summary>
Public ReadOnly MustBeginNewStatement As Boolean
Public ReadOnly IsSingleLineStatementContext As Boolean
Public ReadOnly IsMultiLineStatementContext As Boolean
Public ReadOnly IsGlobalStatementContext As Boolean
Public ReadOnly IsTypeDeclarationKeywordContext As Boolean
Public ReadOnly IsTypeMemberDeclarationKeywordContext As Boolean
Public ReadOnly IsInterfaceMemberDeclarationKeywordContext As Boolean
Public ReadOnly ModifierCollectionFacts As ModifierCollectionFacts
Public ReadOnly IsPreprocessorStartContext As Boolean
Public ReadOnly IsInLambda As Boolean
Public ReadOnly IsQueryOperatorContext As Boolean
Public ReadOnly EnclosingNamedType As CancellableLazy(Of INamedTypeSymbol)
Public ReadOnly IsCustomEventContext As Boolean
Public ReadOnly IsPreprocessorEndDirectiveKeywordContext As Boolean
Public ReadOnly IsWithinPreprocessorContext As Boolean
Private Sub New(
workspace As Workspace,
semanticModel As SemanticModel,
position As Integer,
leftToken As SyntaxToken,
targetToken As SyntaxToken,
isTypeContext As Boolean,
isNamespaceContext As Boolean,
isNamespaceDeclarationNameContext As Boolean,
isPreProcessorDirectiveContext As Boolean,
isPreProcessorExpressionContext As Boolean,
isRightOfNameSeparator As Boolean,
isSingleLineStatementContext As Boolean,
isExpressionContext As Boolean,
isAttributeNameContext As Boolean,
isEnumTypeMemberAccessContext As Boolean,
isNameOfContext As Boolean,
isInLambda As Boolean,
isInQuery As Boolean,
isInImportsDirective As Boolean,
isCustomEventContext As Boolean,
isPossibleTupleContext As Boolean,
isInArgumentList As Boolean,
cancellationToken As CancellationToken
)
MyBase.New(
workspace,
semanticModel,
position,
leftToken,
targetToken,
isTypeContext,
isNamespaceContext,
isNamespaceDeclarationNameContext,
isPreProcessorDirectiveContext,
isPreProcessorExpressionContext,
isRightOfNameSeparator,
isStatementContext:=isSingleLineStatementContext,
isAnyExpressionContext:=isExpressionContext,
isAttributeNameContext:=isAttributeNameContext,
isEnumTypeMemberAccessContext:=isEnumTypeMemberAccessContext,
isNameOfContext:=isNameOfContext,
isInQuery:=isInQuery,
isInImportsDirective:=isInImportsDirective,
isWithinAsyncMethod:=IsWithinAsyncMethod(targetToken),
isPossibleTupleContext:=isPossibleTupleContext,
isAtStartOfPattern:=False,
isAtEndOfPattern:=False,
isRightSideOfNumericType:=False,
isOnArgumentListBracketOrComma:=isInArgumentList,
cancellationToken:=cancellationToken)
Dim syntaxTree = semanticModel.SyntaxTree
Me.FollowsEndOfStatement = targetToken.FollowsEndOfStatement(position)
Me.MustBeginNewStatement = targetToken.MustBeginNewStatement(position)
Me.IsSingleLineStatementContext = isSingleLineStatementContext
Me.IsMultiLineStatementContext = syntaxTree.IsMultiLineStatementStartContext(position, targetToken, cancellationToken)
Me.IsGlobalStatementContext = syntaxTree.IsGlobalStatementContext(position, cancellationToken)
Me.IsTypeDeclarationKeywordContext = syntaxTree.IsTypeDeclarationKeywordContext(position, targetToken, cancellationToken)
Me.IsTypeMemberDeclarationKeywordContext = syntaxTree.IsTypeMemberDeclarationKeywordContext(position, targetToken, cancellationToken)
Me.IsInterfaceMemberDeclarationKeywordContext = syntaxTree.IsInterfaceMemberDeclarationKeywordContext(position, targetToken, cancellationToken)
Me.ModifierCollectionFacts = New ModifierCollectionFacts(syntaxTree, position, targetToken, cancellationToken)
Me.IsInLambda = isInLambda
Me.IsPreprocessorStartContext = ComputeIsPreprocessorStartContext(position, targetToken)
Me.IsWithinPreprocessorContext = ComputeIsWithinPreprocessorContext(position, targetToken)
Me.IsQueryOperatorContext = syntaxTree.IsFollowingCompleteExpression(Of QueryExpressionSyntax)(position, targetToken, Function(query) query, cancellationToken)
Me.EnclosingNamedType = CancellableLazy.Create(AddressOf ComputeEnclosingNamedType)
Me.IsCustomEventContext = isCustomEventContext
Me.IsPreprocessorEndDirectiveKeywordContext = targetToken.FollowsBadEndDirective()
End Sub
Private Shared Shadows Function IsWithinAsyncMethod(targetToken As SyntaxToken) As Boolean
Dim enclosingMethod = targetToken.GetAncestor(Of MethodBlockBaseSyntax)()
Return enclosingMethod IsNot Nothing AndAlso enclosingMethod.BlockStatement.Modifiers.Any(SyntaxKind.AsyncKeyword)
End Function
Public Shared Function CreateContext(workspace As Workspace, semanticModel As SemanticModel, position As Integer, cancellationToken As CancellationToken) As VisualBasicSyntaxContext
Dim syntaxTree = semanticModel.SyntaxTree
Dim leftToken = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken, includeDirectives:=True, includeDocumentationComments:=True)
Dim targetToken = syntaxTree.GetTargetToken(position, cancellationToken)
Return New VisualBasicSyntaxContext(
workspace,
semanticModel,
position,
leftToken,
targetToken,
isTypeContext:=syntaxTree.IsTypeContext(position, targetToken, cancellationToken, semanticModel),
isNamespaceContext:=syntaxTree.IsNamespaceContext(position, targetToken, cancellationToken, semanticModel),
isNamespaceDeclarationNameContext:=syntaxTree.IsNamespaceDeclarationNameContext(position, cancellationToken),
isPreProcessorDirectiveContext:=syntaxTree.IsInPreprocessorDirectiveContext(position, cancellationToken),
isPreProcessorExpressionContext:=syntaxTree.IsInPreprocessorExpressionContext(position, cancellationToken),
isRightOfNameSeparator:=syntaxTree.IsRightOfDot(position, cancellationToken),
isSingleLineStatementContext:=syntaxTree.IsSingleLineStatementContext(position, targetToken, cancellationToken),
isExpressionContext:=syntaxTree.IsExpressionContext(position, targetToken, cancellationToken, semanticModel),
isAttributeNameContext:=syntaxTree.IsAttributeNameContext(position, targetToken, cancellationToken),
isEnumTypeMemberAccessContext:=syntaxTree.IsEnumTypeMemberAccessContext(position, targetToken, semanticModel, cancellationToken),
isNameOfContext:=syntaxTree.IsNameOfContext(position, cancellationToken),
isInLambda:=leftToken.GetAncestor(Of LambdaExpressionSyntax)() IsNot Nothing,
isInQuery:=leftToken.GetAncestor(Of QueryExpressionSyntax)() IsNot Nothing,
isInImportsDirective:=leftToken.GetAncestor(Of ImportsStatementSyntax)() IsNot Nothing,
isCustomEventContext:=targetToken.GetAncestor(Of EventBlockSyntax)() IsNot Nothing,
isPossibleTupleContext:=syntaxTree.IsPossibleTupleContext(targetToken, position),
isInArgumentList:=targetToken.Parent.IsKind(SyntaxKind.ArgumentList),
cancellationToken:=cancellationToken)
End Function
Friend Overrides Function IsAwaitKeywordContext() As Boolean
If IsAnyExpressionContext OrElse IsSingleLineStatementContext Then
For Each node In TargetToken.GetAncestors(Of SyntaxNode)()
If node.IsKind(SyntaxKind.SingleLineSubLambdaExpression, SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression, SyntaxKind.MultiLineFunctionLambdaExpression) Then
Return True
End If
If node.IsKind(SyntaxKind.FinallyBlock, SyntaxKind.SyncLockBlock, SyntaxKind.CatchBlock) Then
Return False
End If
Next
Return True
End If
Return False
End Function
Private Function ComputeEnclosingNamedType(cancellationToken As CancellationToken) As INamedTypeSymbol
Dim enclosingSymbol = Me.SemanticModel.GetEnclosingSymbol(Me.TargetToken.SpanStart, cancellationToken)
Dim container = TryCast(enclosingSymbol, INamedTypeSymbol)
If container Is Nothing Then
container = enclosingSymbol.ContainingType
End If
Return container
End Function
Private Shared Function ComputeIsWithinPreprocessorContext(position As Integer, targetToken As SyntaxToken) As Boolean
' If we're touching it, then we can just look past it
If targetToken.IsKind(SyntaxKind.HashToken) AndAlso targetToken.Span.End = position Then
targetToken = targetToken.GetPreviousToken()
End If
Return targetToken.Kind = SyntaxKind.None OrElse
targetToken.Kind = SyntaxKind.EndOfFileToken OrElse
(targetToken.HasNonContinuableEndOfLineBeforePosition(position) AndAlso Not targetToken.FollowsBadEndDirective())
End Function
Private Shared Function ComputeIsPreprocessorStartContext(position As Integer, targetToken As SyntaxToken) As Boolean
' The triggering hash token must be part of a directive (not trivia within it)
If targetToken.Kind = SyntaxKind.HashToken Then
Return TypeOf targetToken.Parent Is DirectiveTriviaSyntax
End If
Return targetToken.Kind = SyntaxKind.None OrElse
targetToken.Kind = SyntaxKind.EndOfFileToken OrElse
(targetToken.HasNonContinuableEndOfLineBeforePosition(position) AndAlso Not targetToken.FollowsBadEndDirective())
End Function
Public Function IsFollowingParameterListOrAsClauseOfMethodDeclaration() As Boolean
If TargetToken.FollowsEndOfStatement(Position) Then
Return False
End If
Dim methodDeclaration = TargetToken.GetAncestor(Of MethodStatementSyntax)()
If methodDeclaration Is Nothing Then
Return False
End If
' We will trigger if either (a) we are after the ) of the parameter list, or (b) we are
' after the method name itself if the user is omitting the parenthesis, or (c) we are
' after the return type of the AsClause.
Return (TargetToken.IsKind(SyntaxKind.CloseParenToken) AndAlso
methodDeclaration.ParameterList IsNot Nothing AndAlso
TargetToken = methodDeclaration.ParameterList.CloseParenToken) _
OrElse
(methodDeclaration.AsClause IsNot Nothing AndAlso
TargetToken = methodDeclaration.AsClause.GetLastToken(includeZeroWidth:=True)) _
OrElse
(TargetToken.IsKind(SyntaxKind.IdentifierToken) AndAlso
methodDeclaration.ParameterList Is Nothing AndAlso
TargetToken = methodDeclaration.Identifier)
End Function
Public Function IsFollowingCompleteEventDeclaration() As Boolean
Dim eventDeclaration = TargetToken.GetAncestor(Of EventStatementSyntax)()
If eventDeclaration Is Nothing Then
Return False
End If
If eventDeclaration.AsClause IsNot Nothing Then
Return TargetToken = eventDeclaration.AsClause.GetLastToken(includeZeroWidth:=True)
End If
If eventDeclaration.ParameterList IsNot Nothing AndAlso
Not eventDeclaration.ParameterList.CloseParenToken.IsMissing AndAlso
TargetToken = eventDeclaration.ParameterList.CloseParenToken Then
Return True
End If
Return TargetToken = eventDeclaration.Identifier
End Function
Public Function IsFollowingCompletePropertyDeclaration(cancellationToken As CancellationToken) As Boolean
Dim propertyDeclaration = TargetToken.GetAncestor(Of PropertyStatementSyntax)()
If propertyDeclaration Is Nothing Then
Return False
End If
If propertyDeclaration.Initializer IsNot Nothing Then
Return SyntaxTree.IsFollowingCompleteExpression(
Position, TargetToken, Function(p As PropertyStatementSyntax) p.Initializer.Value, cancellationToken, allowImplicitLineContinuation:=False)
End If
If propertyDeclaration.AsClause IsNot Nothing Then
Return TargetToken = propertyDeclaration.AsClause.GetLastToken(includeZeroWidth:=True)
End If
If propertyDeclaration.ParameterList IsNot Nothing AndAlso
Not propertyDeclaration.ParameterList.CloseParenToken.IsMissing AndAlso
TargetToken = propertyDeclaration.ParameterList.CloseParenToken Then
Return True
End If
Return TargetToken = propertyDeclaration.Identifier
End Function
Public Function IsAdditionalJoinOperatorContext(cancellationToken As CancellationToken) As Boolean
'This specifies if we're in a position where an additional "Join" operator may be present after a first Join
'operator.
Return SyntaxTree.IsFollowingCompleteExpression(Of JoinClauseSyntax)(
Position, TargetToken, Function(joinOperator) joinOperator.JoinedVariables.LastCollectionExpression(), cancellationToken)
End Function
Friend Overrides Function GetTypeInferenceServiceWithoutWorkspace() As ITypeInferenceService
Return New VisualBasicTypeInferenceService()
End Function
Friend Structure TestAccessor
Public Shared Function CreateContext(semanticModel As SemanticModel, position As Integer, cancellationToken As CancellationToken) As VisualBasicSyntaxContext
Return VisualBasicSyntaxContext.CreateContext(Nothing, semanticModel, position, cancellationToken)
End Function
End Structure
End Class
End Namespace
|
eriawan/roslyn
|
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Extensions/ContextQuery/VisualBasicSyntaxContext.vb
|
Visual Basic
|
apache-2.0
| 16,383
|
'Copyright 2019 Esri
'Licensed under the Apache License, Version 2.0 (the "License");
'you may not use this file except in compliance with the License.
'You may obtain a copy of the License at
' http://www.apache.org/licenses/LICENSE-2.0
'Unless required by applicable law or agreed to in writing, software
'distributed under the License is distributed on an "AS IS" BASIS,
'WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'See the License for the specific language governing permissions and
'limitations under the License.
Imports Microsoft.VisualBasic
Imports System
Public Partial Class DynamicBikingSpeedCtrl
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.IContainer = Nothing
''' <summary>
''' Clean up any resources being used.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (Not components Is Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
#Region "Component Designer generated code"
''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.trackBar1 = New System.Windows.Forms.TrackBar()
Me.lblMin = New System.Windows.Forms.Label()
Me.lblMaximum = New System.Windows.Forms.Label()
Me.lblSpeed = New System.Windows.Forms.Label()
Me.toolTip1 = New System.Windows.Forms.ToolTip(Me.components)
CType(Me.trackBar1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
' trackBar1
'
Me.trackBar1.Location = New System.Drawing.Point(110, 4)
Me.trackBar1.Maximum = 20
Me.trackBar1.Minimum = 1
Me.trackBar1.Name = "trackBar1"
Me.trackBar1.Size = New System.Drawing.Size(145, 45)
Me.trackBar1.TabIndex = 0
Me.trackBar1.TickFrequency = 2
Me.toolTip1.SetToolTip(Me.trackBar1, "Playback speed")
Me.trackBar1.Value = 10
' Me.trackBar1.ValueChanged += New System.EventHandler(Me.trackBar1_ValueChanged);
'
' lblMin
'
Me.lblMin.AutoSize = True
Me.lblMin.Location = New System.Drawing.Point(95, 14)
Me.lblMin.Name = "lblMin"
Me.lblMin.Size = New System.Drawing.Size(20, 13)
Me.lblMin.TabIndex = 1
Me.lblMin.Text = "X1"
'
' lblMaximum
'
Me.lblMaximum.AutoSize = True
Me.lblMaximum.Location = New System.Drawing.Point(250, 14)
Me.lblMaximum.Name = "lblMaximum"
Me.lblMaximum.Size = New System.Drawing.Size(26, 13)
Me.lblMaximum.TabIndex = 2
Me.lblMaximum.Text = "X20"
'
' lblSpeed
'
Me.lblSpeed.AutoSize = True
Me.lblSpeed.Location = New System.Drawing.Point(2, 13)
Me.lblSpeed.Name = "lblSpeed"
Me.lblSpeed.Size = New System.Drawing.Size(85, 13)
Me.lblSpeed.TabIndex = 3
Me.lblSpeed.Text = "playback speed:"
'
' toolTip1
'
Me.toolTip1.AutoPopDelay = 500
Me.toolTip1.InitialDelay = 500
Me.toolTip1.ReshowDelay = 100
Me.toolTip1.ToolTipTitle = "Playback speed"
'
' DynamicBikingSpeedCtrl
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.lblSpeed)
Me.Controls.Add(Me.lblMaximum)
Me.Controls.Add(Me.lblMin)
Me.Controls.Add(Me.trackBar1)
Me.Name = "DynamicBikingSpeedCtrl"
Me.Size = New System.Drawing.Size(280, 41)
CType(Me.trackBar1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private WithEvents trackBar1 As System.Windows.Forms.TrackBar
Private lblMin As System.Windows.Forms.Label
Private lblMaximum As System.Windows.Forms.Label
Private lblSpeed As System.Windows.Forms.Label
Private toolTip1 As System.Windows.Forms.ToolTip
End Class
|
Esri/arcobjects-sdk-community-samples
|
Net/GraphicsPipeline/DynamicBiking/VBNet/DynamicBikingSpeedCtrl.Designer.vb
|
Visual Basic
|
apache-2.0
| 4,042
|
Imports BVSoftware.Bvc5.Core
Imports System.Collections.ObjectModel
Partial Class BVAdmin_Configuration_Countries
Inherits BaseAdminPage
Protected Sub Page_PreInit1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Me.PageTitle = "Countries"
Me.CurrentTab = AdminTabType.Configuration
ValidateCurrentUserHasPermission(Membership.SystemPermissions.SettingsView)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
LoadCountries()
LoadFields()
End If
End Sub
Private Sub LoadFields()
PostalCodeValidationCheckBox.Checked = WebAppSettings.EnablePostalCodeValidation
End Sub
Private Sub LoadCountries()
Dim countries As Collection(Of Content.Country)
countries = Content.Country.FindAll
Dim activeCountries As New Collection(Of Content.Country)
Dim nonActiveCountries As New Collection(Of Content.Country)
For i As Integer = 0 To countries.Count - 1
If countries(i).Active = True Then
activeCountries.Add(countries(i))
Else
nonActiveCountries.Add(countries(i))
End If
Next
countries = Nothing
Me.GridView1.DataSource = activeCountries
Me.GridView1.DataBind()
Me.GridView2.DataSource = nonActiveCountries
Me.GridView2.DataBind()
End Sub
Protected Sub btnNew_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnNew.Click
NewCountry()
End Sub
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
NewCountry()
End Sub
Private Sub NewCountry()
Response.Redirect("Countries_Edit.aspx")
End Sub
Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
Dim bvin As String = CType(GridView1.DataKeys(e.RowIndex).Value, String)
Dim c As Content.Country = Content.Country.FindByBvin(bvin)
If c.Bvin <> String.Empty Then
c.Active = False
Content.Country.Update(c)
End If
LoadCountries()
End Sub
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
Dim bvin As String = CType(GridView1.DataKeys(e.RowIndex).Value, String)
Content.Country.Delete(bvin)
LoadCountries()
End Sub
Protected Sub GridView2_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView2.RowCancelingEdit
Dim bvin As String = CType(GridView2.DataKeys(e.RowIndex).Value, String)
Dim c As Content.Country = Content.Country.FindByBvin(bvin)
If c.Bvin <> String.Empty Then
c.Active = True
Content.Country.Update(c)
End If
LoadCountries()
End Sub
Protected Sub GridView2_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView2.RowDeleting
Dim bvin As String = CType(GridView2.DataKeys(e.RowIndex).Value, String)
Content.Country.Delete(bvin)
LoadCountries()
End Sub
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
Dim bvin As String = CType(GridView1.DataKeys(e.NewEditIndex).Value, String)
Response.Redirect("countries_edit.aspx?id=" & bvin)
End Sub
Protected Sub GridView2_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView2.RowEditing
Dim bvin As String = CType(GridView2.DataKeys(e.NewEditIndex).Value, String)
Response.Redirect("countries_edit.aspx?id=" & bvin)
End Sub
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click
WebAppSettings.EnablePostalCodeValidation = PostalCodeValidationCheckBox.Checked
End Sub
Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnCancel.Click
LoadFields()
End Sub
End Class
|
ajaydex/Scopelist_2015
|
BVAdmin/Configuration/Countries.aspx.vb
|
Visual Basic
|
apache-2.0
| 4,513
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form3
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.GsfBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.Database1DataSet = New WindowsApplication1.Database1DataSet
Me.GsfTableAdapter = New WindowsApplication1.Database1DataSetTableAdapters.gsfTableAdapter
Me.TableAdapterManager = New WindowsApplication1.Database1DataSetTableAdapters.TableAdapterManager
Me.DataView1 = New System.Data.DataView
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Gsf2BindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.Gsf2TableAdapter = New WindowsApplication1.Database1DataSetTableAdapters.gsf2TableAdapter
CType(Me.GsfBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Database1DataSet, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Gsf2BindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GsfBindingSource
'
Me.GsfBindingSource.DataMember = "gsf"
Me.GsfBindingSource.DataSource = Me.Database1DataSet
'
'Database1DataSet
'
Me.Database1DataSet.DataSetName = "Database1DataSet"
Me.Database1DataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'GsfTableAdapter
'
Me.GsfTableAdapter.ClearBeforeFill = True
'
'TableAdapterManager
'
Me.TableAdapterManager.BackupDataSetBeforeUpdate = False
Me.TableAdapterManager.gsf2TableAdapter = Me.Gsf2TableAdapter
Me.TableAdapterManager.gsfTableAdapter = Me.GsfTableAdapter
Me.TableAdapterManager.UpdateOrder = WindowsApplication1.Database1DataSetTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete
'
'DataView1
'
Me.DataView1.Table = Me.Database1DataSet.gsf2
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(45, 12)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(100, 198)
Me.TextBox1.TabIndex = 0
'
'Gsf2BindingSource
'
Me.Gsf2BindingSource.DataMember = "gsf2"
Me.Gsf2BindingSource.DataSource = Me.Database1DataSet
'
'Gsf2TableAdapter
'
Me.Gsf2TableAdapter.ClearBeforeFill = True
'
'Form3
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer))
Me.ClientSize = New System.Drawing.Size(277, 328)
Me.Controls.Add(Me.TextBox1)
Me.Font = New System.Drawing.Font("Constantia", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.Name = "Form3"
Me.Text = "Member profile"
CType(Me.GsfBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Database1DataSet, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Gsf2BindingSource, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Database1DataSet As WindowsApplication1.Database1DataSet
Friend WithEvents GsfBindingSource As System.Windows.Forms.BindingSource
Friend WithEvents GsfTableAdapter As WindowsApplication1.Database1DataSetTableAdapters.gsfTableAdapter
Friend WithEvents TableAdapterManager As WindowsApplication1.Database1DataSetTableAdapters.TableAdapterManager
Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
Friend WithEvents DataView1 As System.Data.DataView
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Gsf2TableAdapter As WindowsApplication1.Database1DataSetTableAdapters.gsf2TableAdapter
Friend WithEvents Gsf2BindingSource As System.Windows.Forms.BindingSource
End Class
|
superibk/ChurchManager
|
real/Form3.Designer.vb
|
Visual Basic
|
apache-2.0
| 5,508
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18047
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("GridCoinDotNet.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
bitspill/Gridcoin-master
|
contrib/RD/GridCoinDotNet/GridCoin/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,720
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.EventHandling
Public Class RaiseEventKeywordRecommenderTests
Inherits RecommenderTests
<Fact>
<WorkItem(808406, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/808406")>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub RaiseEventInCustomEventTest()
Dim code = <File>
Public Class Z
Public Custom Event E As Action
|
End Event
End Class</File>
VerifyRecommendationsContain(code, "RaiseEvent")
End Sub
<Fact>
<WorkItem(899057, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/899057")>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub RaiseEventInSingleLineLambdaTest()
Dim code = <File>
Public Class Z
Public Sub Main()
Dim c = Sub() |
End Sub
End Class</File>
VerifyRecommendationsContain(code, "RaiseEvent")
End Sub
<Fact>
<WorkItem(808406, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/808406")>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub NotRaiseEventInCustomEventWithRaiseEventTest()
Dim code = <File>
Public Class Z
Public Custom Event E As Action
RaiseEvent()
End RaiseEvent
|
End Event
End Class</File>
VerifyRecommendationsMissing(code, "RaiseEvent")
End Sub
End Class
End Namespace
|
CyrusNajmabadi/roslyn
|
src/EditorFeatures/VisualBasicTest/Recommendations/EventHandling/RaiseEventKeywordRecommenderTests.vb
|
Visual Basic
|
mit
| 1,746
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Partial Class BoundAnonymousTypePropertyAccess
Private ReadOnly _lazyPropertySymbol As New Lazy(Of PropertySymbol)(AddressOf LazyGetProperty)
Public Overrides ReadOnly Property ExpressionSymbol As Symbol
Get
Return Me._lazyPropertySymbol.Value
End Get
End Property
Private Function LazyGetProperty() As PropertySymbol
Return Me.Binder.GetAnonymousTypePropertySymbol(Me.PropertyIndex)
End Function
End Class
End Namespace
|
jmarolf/roslyn
|
src/Compilers/VisualBasic/Portable/BoundTree/BoundAnonymousTypePropertyAccess.vb
|
Visual Basic
|
mit
| 922
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEndConstruct
Imports Microsoft.CodeAnalysis.Diagnostics
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.GenerateEndConstruct
Public Class GenerateEndConstructTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
Return (Nothing, New GenerateEndConstructCodeFixProvider())
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestIf() As Task
Dim text = <MethodBody>
If True Then[||]
</MethodBody>
Dim expected = <MethodBody>
If True Then
End If</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestUsing() As Task
Dim text = <MethodBody>
Using (foo)[||]
</MethodBody>
Dim expected = <MethodBody>
Using (foo)
End Using</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestStructure() As Task
Dim text = <File>
Structure Foo[||]</File>
Dim expected = StringFromLines("Structure Foo", "End Structure", "")
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestModule() As Task
Dim text = <File>
Module Foo[||]
</File>
Dim expected = StringFromLines("Module Foo", "End Module", "")
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestNamespace() As Task
Dim text = <File>
Namespace Foo[||]
</File>
Dim expected = StringFromLines("Namespace Foo", "End Namespace", "")
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestClass() As Task
Dim text = <File>
Class Foo[||]
</File>
Dim expected = StringFromLines("Class Foo", "End Class", "")
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestInterface() As Task
Dim text = <File>
Interface Foo[||]
</File>
Dim expected = StringFromLines("Interface Foo", "End Interface", "")
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestEnum() As Task
Dim text = <File>
Enum Foo[||]
</File>
Dim expected = StringFromLines("Enum Foo", "End Enum", "")
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestWhile() As Task
Dim text = <MethodBody>
While True[||]</MethodBody>
Dim expected = <MethodBody>
While True
End While</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestWith() As Task
Dim text = <MethodBody>
With True[||]</MethodBody>
Dim expected = <MethodBody>
With True
End With</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestSyncLock() As Task
Dim text = <MethodBody>
SyncLock Me[||]</MethodBody>
Dim expected = <MethodBody>
SyncLock Me
End SyncLock</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestDoLoop() As Task
Dim text = <MethodBody>
Do While True[||]</MethodBody>
Dim expected = <MethodBody>
Do While True
Loop</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestForNext() As Task
Dim text = <MethodBody>
For x = 1 to 3[||]</MethodBody>
Dim expected = <MethodBody>
For x = 1 to 3
Next</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestForEachNext() As Task
Dim text = <MethodBody>
For Each x in {}[||]</MethodBody>
Dim expected = <MethodBody>
For Each x in {}
Next</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestEndTry() As Task
Dim text = <MethodBody>
Try[||]</MethodBody>
Dim expected = <MethodBody>
Try
End Try</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestEndTryCatch() As Task
Dim text = <MethodBody>
Try[||]
Catch</MethodBody>
Dim expected = <MethodBody>
Try
Catch
End Try</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestEndTryCatchFinally() As Task
Dim text = <MethodBody>
Try[||]
Catch
Finally</MethodBody>
Dim expected = <MethodBody>
Try
Catch
Finally
End Try</MethodBody>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestProperty() As Task
Dim text = <File>
Class C
Property P As Integer[||]
Get
End Class</File>
Dim expected = <File>
Class C
Property P As Integer
Get
End Get
Set(value As Integer)
End Set
End Property
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestReadOnlyProperty() As Task
Dim text = <File>
Class C
ReadOnly Property P As Integer[||]
Get
End Class</File>
Dim expected = <File>
Class C
ReadOnly Property P As Integer
Get
End Get
End Property
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestWriteOnlyProperty() As Task
Dim text = <File>
Class C
WriteOnly Property P As Integer[||]
Set
End Class</File>
Dim expected = <File>
Class C
WriteOnly Property P As Integer
Set
End Set
End Property
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestWriteOnlyPropertyFromSet() As Task
Dim text = <File>
Class C
WriteOnly Property P As Integer
Set[||]
End Class</File>
Dim expected = <File>
Class C
WriteOnly Property P As Integer
Set
End Set
End Property
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestInvInsideEndsEnum() As Task
Dim text = <File>
Public Enum e[||]
e1
Class Foo
End Class</File>
Dim expected = <File>
Public Enum e
e1
End Enum
Class Foo
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestMissingEndSub() As Task
Dim text = <File>
Class C
Sub Bar()[||]
End Class</File>
Dim expected = <File>
Class C
Sub Bar()
End Sub
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestMissingEndFunction() As Task
Dim text = <File>
Class C
Function Bar() as Integer[||]
End Class</File>
Dim expected = <File>
Class C
Function Bar() as Integer
End Function
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<WorkItem(576176, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576176")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestFormatWrappedBlock() As Task
Dim text = <File>
Class C
Sub Main(args As String())
While True[||]
Dim x = 1
Dim y = 2
Dim z = 3
End Sub
End Class</File>
Dim expected = <File>
Class C
Sub Main(args As String())
While True
End While
Dim x = 1
Dim y = 2
Dim z = 3
End Sub
End Class</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<WorkItem(578253, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578253")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestDoNotWrapCLass() As Task
Dim text = <File>
Class C[||]
Function f1() As Integer
Return 1
End Function
Module Program
Sub Main(args As String())
End Sub
End Module</File>
Dim expected = <File>
Class C
End Class
Function f1() As Integer
Return 1
End Function
Module Program
Sub Main(args As String())
End Sub
End Module</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
<WorkItem(578260, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578260")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestNotOnLambda() As Task
Await TestMissingInRegularAndScriptAsync(
"Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main(args As String())
End Sub
Function foo()
Dim op = Sub[||](c)
Dim kl = Sub(g)
End Sub
End Function
End Module")
End Function
<WorkItem(578271, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578271")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEndConstruct)>
Public Async Function TestNamespaceThatEndsAtFile() As Task
Dim text = <File>
Namespace N[||]
Interface I
Module Program
Sub Main(args As String())
End Sub
End Module
End Interface</File>
Dim expected = <File>
Namespace N
End Namespace
Interface I
Module Program
Sub Main(args As String())
End Sub
End Module
End Interface</File>
Await TestInRegularAndScriptAsync(text.ConvertTestSourceTag(), expected.ConvertTestSourceTag(), ignoreTrivia:=False)
End Function
End Class
End Namespace
|
mattwar/roslyn
|
src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateEndConstruct/GenerateEndConstructTests.vb
|
Visual Basic
|
apache-2.0
| 14,489
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.FindUsages
Imports Microsoft.CodeAnalysis.Navigation
Imports Microsoft.CodeAnalysis.Options
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities.GoToHelpers
Friend Class MockSymbolNavigationService
Implements ISymbolNavigationService
Public _triedNavigationToSymbol As Boolean = False
Public _triedSymbolNavigationNotify As Boolean = False
Public _wouldNavigateToSymbol As Boolean = False
Public Function TryNavigateToSymbol(symbol As ISymbol, project As Project, Optional options As OptionSet = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Boolean Implements ISymbolNavigationService.TryNavigateToSymbol
_triedNavigationToSymbol = True
Return True
End Function
Public Function TrySymbolNavigationNotify(symbol As ISymbol, project As Project, cancellationToken As CancellationToken) As Boolean Implements ISymbolNavigationService.TrySymbolNavigationNotify
_triedSymbolNavigationNotify = True
Return True
End Function
Public Function WouldNavigateToSymbol(definitionItem As DefinitionItem, solution As Solution, cancellationToken As CancellationToken, ByRef filePath As String, ByRef lineNumber As Integer, ByRef charOffset As Integer) As Boolean Implements ISymbolNavigationService.WouldNavigateToSymbol
_wouldNavigateToSymbol = True
Return True
End Function
End Class
End Namespace
|
OmarTawfik/roslyn
|
src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/MockSymbolNavigationService.vb
|
Visual Basic
|
apache-2.0
| 1,701
|
Public Class EnvelopeView
Public Property ViewModel As EnvelopeViewModel
Get
Return GetValue(ViewModelProperty)
End Get
Set(ByVal value As EnvelopeViewModel)
SetValue(ViewModelProperty, value)
End Set
End Property
Public Shared ReadOnly ViewModelProperty As DependencyProperty = _
DependencyProperty.Register("ViewModel", _
GetType(EnvelopeViewModel), GetType(EnvelopeView), _
New FrameworkPropertyMetadata(Nothing))
Private Sub Slider_PreviewMouseWheel(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseWheelEventArgs)
Dim slider As Slider = CType(sender, Slider)
Dim tick As Double = slider.TickFrequency
If e.Delta > 0 Then
slider.Value += tick
Else
slider.Value -= tick
End If
slider.Value = Math.Round(slider.Value, 5)
End Sub
End Class
|
perttu606/haerveli
|
Application/Haerveli/ui/EnvelopeView.xaml.vb
|
Visual Basic
|
mit
| 1,028
|
Imports Microsoft.Win32
Public Class OfficeTheme
Public Shared ReadOnly Property Current As Theme
Get
Try
Dim key = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Office\16.0\Common")
If key IsNot Nothing Then
Dim uiTheme = CType(key.GetValue("UI Theme"), Integer)
Return CType(uiTheme, Theme)
End If
Catch
End Try
Return Theme.Colorful
End Get
End Property
End Class
Public Class OfficeThemeModel
Public Shared Property Current As OfficeThemeModel = New OfficeThemeModel With {.Theme = OfficeTheme.Current}
Public Property Theme As Theme
End Class
Public Enum Theme
Colorful = 0
DarkGray = 3
Black = 4
White = 5
End Enum
Public Class ControlTeheme
Public Shared Property Control As ControlColors = New ControlColors()
Public Shared Property Grid As GridColors = New GridColors()
Public Shared Property Header As HeaderColors = New HeaderColors()
Public Shared Sub Apply(officeTheme As Theme)
Select Case officeTheme
Case Theme.DarkGray
With ControlTeheme.Control
.Background = New SolidColorBrush(Color.FromArgb(&HFF, &H66, &H66, &H66)) '#666666
.Foreground = New SolidColorBrush(Colors.White) 'white
End With
With ControlTeheme.Grid
.HorizontalGridLines = New SolidColorBrush(Color.FromArgb(&HFF, &HB9, &HB9, &HB9)) '#b9b9b9
.VerticalGridLines = New SolidColorBrush(Colors.Silver) 'Silver
.Background = Color.FromArgb(&HFF, &HD4, &HD4, &HD4) '#d4d4d4
.Foreground = New SolidColorBrush(Color.FromArgb(&HFF, &H4D, &H4D, &H4D)) '#4b4b4b
.HilightBackground = Color.FromArgb(&HFF, &HDD, &HF3, &HFE) '#DDF3FE
.HilightForeground = Colors.Black 'black
.CurrentBorder = New SolidColorBrush(Color.FromArgb(&HFF, &HD, &H58, &H98)) '#0d5898
End With
With ControlTeheme.Header
.Background = New SolidColorBrush(Color.FromArgb(&HFF, &H66, &H66, &H66)) '#666666
.Border = New SolidColorBrush(Colors.Black) 'black
.Foreground = New SolidColorBrush(Colors.White) 'white
End With
Case Theme.Black
With ControlTeheme.Control
.Background = New SolidColorBrush(Color.FromArgb(&HFF, &H26, &H26, &H26)) '#262626
.Foreground = New SolidColorBrush(Colors.White) 'white
End With
'TODO: Case Theme.White
Case Else 'Theme.Colorful
With ControlTeheme.Control
.Background = New SolidColorBrush(Color.FromArgb(&HFF, &HE3, &HE3, &HE3)) '#FFE3E3E3
.Foreground = New SolidColorBrush(Color.FromArgb(&HFF, &H44, &H44, &H44)) '#FF444444
End With
With ControlTeheme.Grid
.HorizontalGridLines = New SolidColorBrush(Colors.Silver) 'Silver
.VerticalGridLines = New SolidColorBrush(Color.FromArgb(&HFF, &HF0, &HF0, &HF0)) '#FFF0F0F0
.Background = Colors.White 'white
.Foreground = New SolidColorBrush(Color.FromArgb(&HFF, &H44, &H44, &H44)) '#FF444444
.HilightBackground = Color.FromArgb(&HFF, &HDD, &HF3, &HFE) '#DDF3FE
.HilightForeground = Colors.Black 'black
.CurrentBorder = New SolidColorBrush(Color.FromArgb(&HFF, &HD, &H58, &H98)) '#0d5898
End With
With ControlTeheme.Header
.Background = New SolidColorBrush(Color.FromArgb(&HFF, &HFB, &HFB, &HFB)) '#FFFBFBFB
.Border = New SolidColorBrush(Colors.Silver) 'Silver
.Foreground = New SolidColorBrush(Colors.Black) 'Black
End With
End Select
End Sub
End Class
Public Class ControlColors
Public Property Background As Brush
Public Property Foreground As Brush
End Class
Public Class GridColors
Public Property Foreground As Brush
Public Property Background As Color
Public Property HorizontalGridLines As Brush
Public Property VerticalGridLines As Brush
Public Property HilightBackground As Color
Public Property HilightForeground As Color
Public Property CurrentBorder As Brush
End Class
Public Class HeaderColors
Public Property Background As Brush
Public Property Border As Brush
Public Property Foreground As Brush
End Class
|
surviveplus/EditorPlus
|
office2013/EditorPlus.UI/EditorPlus.UI/OfficeTheme.vb
|
Visual Basic
|
mit
| 4,740
|
Namespace Directories
Partial Public Class Parameter
#Region " Public Methods "
''' <summary>
''' Overrides the Default ToString Representation of the Object to output the Parameter
''' in a string format ready for querying the Directory Service.
''' </summary>
''' <returns>A String Representation of the Parameter.</returns>
''' <remarks></remarks>
Public Overrides Function ToString() As String
Dim s_builder As New System.Text.StringBuilder
With s_builder
If Not Relation Is Nothing Then
.Append(BRACKET_START)
Select Case [Operator]
Case ParameterOperator.AndOperator
s_builder.Append(AMPERSAND)
Case ParameterOperator.NotEquality
s_builder.Append(EXCLAMATION_MARK)
Case ParameterOperator.OrEquality
s_builder.Append(PIPE)
End Select
End If
.Append(BRACKET_START)
.Append(Name.ToString)
Select Case Comparative
Case ParameterComparator.ApproximatelyEqualTo
.Append(TILDA).Append(EQUALS_SIGN)
Case ParameterComparator.EqualTo
.Append(EQUALS_SIGN)
Case ParameterComparator.GreaterThanOrEqualTo
.Append(ANGLE_BRACKET_END).Append(EQUALS_SIGN)
Case ParameterComparator.LessThanOrEqualTo
.Append(ANGLE_BRACKET_START).Append(EQUALS_SIGN)
End Select
.Append(StringCommands.ObjectToSingleString([Object], SEMI_COLON))
.Append(BRACKET_END)
If Not Relation Is Nothing Then .Append(Relation.ToString).Append(BRACKET_END)
End With
Return s_builder.ToString
End Function
#End Region
End Class
End Namespace
|
thiscouldbejd/Caerus
|
_Directories/Partials/Parameter.vb
|
Visual Basic
|
mit
| 2,504
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "fFicha_DatosProveedores"
'-------------------------------------------------------------------------------------------'
Partial Class fFicha_DatosProveedores
Inherits vis2Formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine(" SELECT")
loComandoSeleccionar.AppendLine(" Proveedores.cod_pro,")
loComandoSeleccionar.AppendLine(" Proveedores.nom_pro,")
loComandoSeleccionar.AppendLine(" CASE")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.Status = 'A' THEN 'Activo'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.Status = 'I' THEN 'Inactivo'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.Status = 'S' THEN 'Suspendido'")
loComandoSeleccionar.AppendLine(" END AS Status,")
loComandoSeleccionar.AppendLine(" Proveedores.tip_pro,")
loComandoSeleccionar.AppendLine(" CASE")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.crm_sec = 'P' THEN 'Producción'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.crm_sec = 'C' THEN 'Comercio'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.crm_sec = 'S' THEN 'Servicio'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.crm_sec = 'G' THEN 'Gobierno'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.crm_sec = 'O' THEN 'Otro'")
loComandoSeleccionar.AppendLine(" END AS crm_sec,")
loComandoSeleccionar.AppendLine(" Proveedores.abc,")
loComandoSeleccionar.AppendLine(" CASE")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.Sexo = 'X' THEN 'No Aplica'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.Sexo = 'M' THEN 'Masculino'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.Sexo = 'F' THEN 'Femenino'")
loComandoSeleccionar.AppendLine(" END AS Sexo,")
loComandoSeleccionar.AppendLine(" Proveedores.tip_pag,")
loComandoSeleccionar.AppendLine(" Proveedores.nit,")
loComandoSeleccionar.AppendLine(" Proveedores.rif,")
loComandoSeleccionar.AppendLine(" Proveedores.movil,")
loComandoSeleccionar.AppendLine(" Proveedores.web,")
loComandoSeleccionar.AppendLine(" Proveedores.telefonos,")
loComandoSeleccionar.AppendLine(" Proveedores.fec_ini,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_pos,")
loComandoSeleccionar.AppendLine(" Proveedores.fax,")
loComandoSeleccionar.AppendLine(" Proveedores.fec_fin,")
loComandoSeleccionar.AppendLine(" Proveedores.correo,")
loComandoSeleccionar.AppendLine(" Proveedores.contacto,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_tip,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_zon,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_pai,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_est,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_ciu,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_cla,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_con,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_per,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_for,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_ven,")
loComandoSeleccionar.AppendLine(" Proveedores.cod_tra,")
loComandoSeleccionar.AppendLine(" Proveedores.matriz,")
loComandoSeleccionar.AppendLine(" Proveedores.dir_fis,")
loComandoSeleccionar.AppendLine(" Proveedores.dir_exa,")
loComandoSeleccionar.AppendLine(" Proveedores.dir_otr,")
loComandoSeleccionar.AppendLine(" Proveedores.dir_ent,")
loComandoSeleccionar.AppendLine(" Proveedores.actividad,")
loComandoSeleccionar.AppendLine(" Proveedores.are_neg,")
loComandoSeleccionar.AppendLine(" Proveedores.fec_nac,")
loComandoSeleccionar.AppendLine(" Proveedores.comentario,")
loComandoSeleccionar.AppendLine(" Proveedores.hor_caj,")
loComandoSeleccionar.AppendLine(" Proveedores.fiscal,")
loComandoSeleccionar.AppendLine(" Proveedores.nacional,")
loComandoSeleccionar.AppendLine(" Proveedores.mar_rec,")
loComandoSeleccionar.AppendLine(" Proveedores.crm_pos,")
loComandoSeleccionar.AppendLine(" Proveedores.pol_com,")
loComandoSeleccionar.AppendLine(" Proveedores.mon_sal,")
loComandoSeleccionar.AppendLine(" Proveedores.mon_cre,")
loComandoSeleccionar.AppendLine(" Proveedores.dia_cre,")
loComandoSeleccionar.AppendLine(" Proveedores.pro_pag,")
loComandoSeleccionar.AppendLine(" Proveedores.por_des,")
loComandoSeleccionar.AppendLine(" Proveedores.por_ali,")
loComandoSeleccionar.AppendLine(" Proveedores.por_int,")
loComandoSeleccionar.AppendLine(" Proveedores.por_pat,")
loComandoSeleccionar.AppendLine(" Proveedores.por_isl,")
loComandoSeleccionar.AppendLine(" Proveedores.por_ret,")
loComandoSeleccionar.AppendLine(" Proveedores.por_pat,")
loComandoSeleccionar.AppendLine(" Proveedores.por_otr,")
loComandoSeleccionar.AppendLine(" Proveedores.kilometros,")
loComandoSeleccionar.AppendLine(" Proveedores.generico,")
loComandoSeleccionar.AppendLine(" CASE")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Formal' THEN 'Formal'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Ordinario' THEN 'Ordinario'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Especial' THEN 'Especial'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Ocasional' THEN 'Ocasional'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Otro_1' THEN 'Otro 1'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Otro_2' THEN 'Otro 2'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Otro_3' THEN 'Otro 3'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Otro_4' THEN 'Otro 4'")
loComandoSeleccionar.AppendLine(" WHEN Proveedores.tip_con = 'Otro_5' THEN 'Otro 5'")
loComandoSeleccionar.AppendLine(" END AS tip_con,")
loComandoSeleccionar.AppendLine(" Proveedores.tipo,")
loComandoSeleccionar.AppendLine(" Proveedores.clase,")
loComandoSeleccionar.AppendLine(" Tipos_Proveedores.Nom_Tip,")
loComandoSeleccionar.AppendLine(" Zonas.Nom_Zon,")
loComandoSeleccionar.AppendLine(" Paises.Nom_Pai,")
loComandoSeleccionar.AppendLine(" Estados.Nom_Est,")
loComandoSeleccionar.AppendLine(" Ciudades.Nom_Ciu,")
loComandoSeleccionar.AppendLine(" Clases_Proveedores.Nom_Cla,")
loComandoSeleccionar.AppendLine(" Personas.Nom_Per,")
loComandoSeleccionar.AppendLine(" Formas_Pagos.Nom_For,")
loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven,")
loComandoSeleccionar.AppendLine(" Transportes.Nom_Tra,")
loComandoSeleccionar.AppendLine(" Conceptos.Nom_Con")
loComandoSeleccionar.AppendLine(" FROM Proveedores")
loComandoSeleccionar.AppendLine(" JOIN Tipos_Proveedores ON Tipos_Proveedores.Cod_Tip = Proveedores.Cod_Tip")
loComandoSeleccionar.AppendLine(" JOIN Zonas ON Zonas.Cod_Zon = Proveedores.Cod_Zon")
loComandoSeleccionar.AppendLine(" JOIN Paises ON Paises.Cod_Pai = Proveedores.Cod_Pai")
loComandoSeleccionar.AppendLine(" LEFT JOIN Estados ON Estados.Cod_Est = Proveedores.Cod_Est")
loComandoSeleccionar.AppendLine(" LEFT JOIN Ciudades ON Ciudades.Cod_Ciu = Proveedores.Cod_Ciu")
loComandoSeleccionar.AppendLine(" JOIN Clases_Proveedores ON Clases_Proveedores.Cod_Cla = Proveedores.Cod_Cla")
loComandoSeleccionar.AppendLine(" JOIN Personas ON Personas.Cod_Per = Proveedores.Cod_Per")
loComandoSeleccionar.AppendLine(" JOIN Formas_Pagos ON Formas_Pagos.Cod_For = Proveedores.Cod_For")
loComandoSeleccionar.AppendLine(" JOIN Vendedores ON Vendedores.Cod_Ven = Proveedores.Cod_Ven")
loComandoSeleccionar.AppendLine(" JOIN Transportes ON Transportes.Cod_Tra = Proveedores.Cod_Tra")
loComandoSeleccionar.AppendLine(" JOIN Conceptos ON Conceptos.Cod_Con = Proveedores.Cod_Con")
loComandoSeleccionar.AppendLine(" WHERE")
loComandoSeleccionar.AppendLine(" " & cusAplicacion.goFormatos.pcCondicionPrincipal)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes")
'--------------------------------------------------'
' Carga la imagen del logo en cusReportes '
'--------------------------------------------------'
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
'-------------------------------------------------------------------------------------------------------
' Verificando si el select (tabla nº0) trae registros
'-------------------------------------------------------------------------------------------------------
If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
"No se Encontraron Registros para los Parámetros Especificados. ", _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
"350px", _
"200px")
End If
loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fFicha_DatosProveedores", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfFicha_DatosProveedores.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' CMS: 19/09/09 : Codigo inicial
'-------------------------------------------------------------------------------------------'
' CMS: 17/03/10: Se aplicaron los metodos carga de imagen y validacion de registro cero
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
fFicha_DatosProveedores.aspx.vb
|
Visual Basic
|
mit
| 11,850
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class EditMessageFrm
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel
Me.OK_Button = New System.Windows.Forms.Button
Me.txtEditMessage = New DevComponents.DotNetBar.Controls.TextBoxX
Me.Label1 = New System.Windows.Forms.Label
Me.TableLayoutPanel1.SuspendLayout()
Me.SuspendLayout()
'
'TableLayoutPanel1
'
Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.TableLayoutPanel1.ColumnCount = 2
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 93.98496!))
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.015038!))
Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0)
Me.TableLayoutPanel1.Location = New System.Drawing.Point(321, 191)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 1
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(133, 29)
Me.TableLayoutPanel1.TabIndex = 0
'
'OK_Button
'
Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None
Me.OK_Button.Location = New System.Drawing.Point(29, 3)
Me.OK_Button.Name = "OK_Button"
Me.OK_Button.Size = New System.Drawing.Size(67, 23)
Me.OK_Button.TabIndex = 1
Me.OK_Button.Text = "OK"
'
'txtEditMessage
'
'
'
'
Me.txtEditMessage.Border.Class = "TextBoxBorder"
Me.txtEditMessage.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.txtEditMessage.Location = New System.Drawing.Point(12, 44)
Me.txtEditMessage.Multiline = True
Me.txtEditMessage.Name = "txtEditMessage"
Me.txtEditMessage.Size = New System.Drawing.Size(442, 131)
Me.txtEditMessage.TabIndex = 0
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 17)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(183, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Insert the reasons of the modification:"
'
'EditMessageFrm
'
Me.AcceptButton = Me.OK_Button
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(469, 232)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtEditMessage)
Me.Controls.Add(Me.TableLayoutPanel1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "EditMessageFrm"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "Message Of Edition"
Me.TableLayoutPanel1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents OK_Button As System.Windows.Forms.Button
Friend WithEvents txtEditMessage As DevComponents.DotNetBar.Controls.TextBoxX
Friend WithEvents Label1 As System.Windows.Forms.Label
End Class
|
QMDevTeam/QMDesigner
|
DataManager/Dialogs/EditMessageFrm.Designer.vb
|
Visual Basic
|
apache-2.0
| 4,512
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Composition
Imports System.Runtime.InteropServices
Imports System.Threading
Imports Microsoft.CodeAnalysis.Differencing
Imports Microsoft.CodeAnalysis.EditAndContinue
Imports Microsoft.CodeAnalysis.Host
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
<ExportLanguageService(GetType(IEditAndContinueAnalyzer), LanguageNames.VisualBasic), [Shared]>
Friend NotInheritable Class VisualBasicEditAndContinueAnalyzer
Inherits AbstractEditAndContinueAnalyzer
#Region "Syntax Analysis"
''' <returns>
''' <see cref="MethodBlockBaseSyntax"/> for methods, constructors, operators and accessors.
''' <see cref="PropertyStatementSyntax"/> for auto-properties.
''' <see cref="VariableDeclaratorSyntax"/> for fields with simple initialization "Dim a = 1", or "Dim a As New C"
''' <see cref="ModifiedIdentifierSyntax"/> for fields with shared AsNew initialization "Dim a, b As New C" or array initializer "Dim a(n), b(n)".
''' A null reference otherwise.
''' </returns>
Friend Overrides Function FindMemberDeclaration(rootOpt As SyntaxNode, node As SyntaxNode) As SyntaxNode
While node IsNot rootOpt
Select Case node.Kind
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.ConstructorBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
Return node
Case SyntaxKind.PropertyStatement
' Property [|a As Integer = 1|]
' Property [|a As New C()|]
If Not node.Parent.IsKind(SyntaxKind.PropertyBlock) Then
Return node
End If
Case SyntaxKind.VariableDeclarator
If node.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
' Dim [|a = 0|]
' Dim [|a = 0|], [|b = 0|]
' Dim [|b as Integer = 0|]
' Dim [|v1 As New C|]
' Dim v1, v2 As New C(Sub [|Foo()|])
Return node
End If
Case SyntaxKind.ModifiedIdentifier
' Dim [|a(n)|], [|b(n)|] As Integer
' Dim [|v1|], [|v2|] As New C
If Not node.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
Exit Select
End If
If DirectCast(node, ModifiedIdentifierSyntax).ArrayBounds IsNot Nothing OrElse
DirectCast(node.Parent, VariableDeclaratorSyntax).Names.Count > 1 Then
Return node
End If
End Select
node = node.Parent
End While
Return Nothing
End Function
''' <returns>
''' Given a node representing a declaration (<paramref name="isMember"/> = true) or a top-level edit node (<paramref name="isMember"/> = false) returns:
''' - <see cref="MethodBlockBaseSyntax"/> for methods, constructors, operators and accessors.
''' - <see cref="ExpressionSyntax"/> for auto-properties and fields with initializer or AsNew clause.
''' - <see cref="ArgumentListSyntax"/> for fields with array initializer, e.g. "Dim a(1) As Integer".
''' A null reference otherwise.
''' </returns>
Friend Overrides Function TryGetDeclarationBody(node As SyntaxNode, isMember As Boolean) As SyntaxNode
Select Case node.Kind
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.ConstructorBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
' the body is the Statements list of the block
Return node
Case SyntaxKind.PropertyStatement
' the body is the initializer expression/new expression (if any)
Dim propertyStatement = DirectCast(node, PropertyStatementSyntax)
If propertyStatement.Initializer IsNot Nothing Then
Return propertyStatement.Initializer.Value
End If
If HasAsNewClause(propertyStatement) Then
Return DirectCast(propertyStatement.AsClause, AsNewClauseSyntax).NewExpression
End If
Return Nothing
Case SyntaxKind.VariableDeclarator
If Not node.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
Return Nothing
End If
' Dim a = initializer
Dim variableDeclarator = DirectCast(node, VariableDeclaratorSyntax)
If variableDeclarator.Initializer IsNot Nothing Then
Return variableDeclarator.Initializer.Value
End If
If HasAsNewClause(variableDeclarator) Then
' Dim a As New C()
' Dim a, b As New C(), but only if the specified node isn't already a member declaration representative.
' -- This is to handle an edit in AsNew clause because such an edit doesn't affect the modified identifier that would otherwise represent the member.
If variableDeclarator.Names.Count = 1 OrElse Not isMember Then
Return DirectCast(variableDeclarator.AsClause, AsNewClauseSyntax).NewExpression
End If
End If
Return Nothing
Case SyntaxKind.ModifiedIdentifier
If Not node.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
Return Nothing
End If
' Dim a, b As New C()
Dim variableDeclarator = DirectCast(node.Parent, VariableDeclaratorSyntax)
If HasMultiAsNewInitializer(variableDeclarator) Then
Return DirectCast(variableDeclarator.AsClause, AsNewClauseSyntax).NewExpression
End If
' Dim a(n)
' Dim a(n), b(n) As Integer
' Dim a(n1, n2, n3) As Integer
Dim modifiedIdentifier = DirectCast(node, ModifiedIdentifierSyntax)
If modifiedIdentifier.ArrayBounds IsNot Nothing Then
Return modifiedIdentifier.ArrayBounds
End If
Return Nothing
Case Else
' Note: A method without body is represented by a SubStatement.
Return Nothing
End Select
End Function
Protected Overrides Function GetCapturedVariables(model As SemanticModel, memberBody As SyntaxNode) As ImmutableArray(Of ISymbol)
Dim methodBlock = TryCast(memberBody, MethodBlockBaseSyntax)
If methodBlock IsNot Nothing Then
If methodBlock.Statements.IsEmpty Then
Return ImmutableArray(Of ISymbol).Empty
End If
Return model.AnalyzeDataFlow(methodBlock.Statements.First, methodBlock.Statements.Last).Captured
End If
Dim expression = TryCast(memberBody, ExpressionSyntax)
If expression IsNot Nothing Then
Return model.AnalyzeDataFlow(expression).Captured
End If
' Edge case, no need to be efficient, currently there can either be no captured variables or just "Me".
' Dim a((Function(n) n + 1).Invoke(1), (Function(n) n + 2).Invoke(2)) As Integer
Dim arrayBounds = TryCast(memberBody, ArgumentListSyntax)
If arrayBounds IsNot Nothing Then
Return ImmutableArray.CreateRange(
arrayBounds.Arguments.
SelectMany(AddressOf GetArgumentExpressions).
SelectMany(Function(expr) model.AnalyzeDataFlow(expr).Captured).
Distinct())
End If
Throw ExceptionUtilities.UnexpectedValue(memberBody)
End Function
Private Shared Iterator Function GetArgumentExpressions(argument As ArgumentSyntax) As IEnumerable(Of ExpressionSyntax)
Select Case argument.Kind
Case SyntaxKind.SimpleArgument
Yield DirectCast(argument, SimpleArgumentSyntax).Expression
Case SyntaxKind.RangeArgument
Dim range = DirectCast(argument, RangeArgumentSyntax)
Yield range.LowerBound
Yield range.UpperBound
Case SyntaxKind.OmittedArgument
Case Else
Throw ExceptionUtilities.UnexpectedValue(argument.Kind)
End Select
End Function
Friend Overrides Function HasParameterClosureScope(member As ISymbol) As Boolean
Return False
End Function
Protected Overrides Function GetVariableUseSites(roots As IEnumerable(Of SyntaxNode), localOrParameter As ISymbol, model As SemanticModel, cancellationToken As CancellationToken) As IEnumerable(Of SyntaxNode)
Debug.Assert(TypeOf localOrParameter Is IParameterSymbol OrElse TypeOf localOrParameter Is ILocalSymbol OrElse TypeOf localOrParameter Is IRangeVariableSymbol)
' Not supported (it's non trivial to find all places where "this" is used):
Debug.Assert(Not localOrParameter.IsThisParameter())
Return From root In roots
From node In root.DescendantNodesAndSelf()
Where node.IsKind(SyntaxKind.IdentifierName)
Let identifier = DirectCast(node, IdentifierNameSyntax)
Where String.Equals(DirectCast(identifier.Identifier.Value, String), localOrParameter.Name, StringComparison.OrdinalIgnoreCase) AndAlso
If(model.GetSymbolInfo(identifier, cancellationToken).Symbol?.Equals(localOrParameter), False)
Select node
End Function
Private Shared Function HasSimpleAsNewInitializer(variableDeclarator As VariableDeclaratorSyntax) As Boolean
Return variableDeclarator.Names.Count = 1 AndAlso HasAsNewClause(variableDeclarator)
End Function
Private Shared Function HasMultiAsNewInitializer(variableDeclarator As VariableDeclaratorSyntax) As Boolean
Return variableDeclarator.Names.Count > 1 AndAlso HasAsNewClause(variableDeclarator)
End Function
Private Shared Function HasAsNewClause(variableDeclarator As VariableDeclaratorSyntax) As Boolean
Return variableDeclarator.AsClause IsNot Nothing AndAlso variableDeclarator.AsClause.IsKind(SyntaxKind.AsNewClause)
End Function
Private Shared Function HasAsNewClause(propertyStatement As PropertyStatementSyntax) As Boolean
Return propertyStatement.AsClause IsNot Nothing AndAlso propertyStatement.AsClause.IsKind(SyntaxKind.AsNewClause)
End Function
''' <returns>
''' Methods, operators, constructors, property and event accessors:
''' - We need to return the entire block declaration since the Begin and End statements are covered by breakpoint spans.
''' Field declarations in form of "Dim a, b, c As New C()"
''' - Breakpoint spans cover "a", "b" and "c" and also "New C()" since the expression may contain lambdas.
''' For simplicity we don't allow moving the new expression independently of the field name.
''' Field declarations with array initializers "Dim a(n), b(n) As Integer"
''' - Breakpoint spans cover "a(n)" and "b(n)".
''' </returns>
Friend Overrides Function TryGetActiveTokens(node As SyntaxNode) As IEnumerable(Of SyntaxToken)
Select Case node.Kind
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.ConstructorBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
' the body is the Statements list of the block
Return node.DescendantTokens()
Case SyntaxKind.PropertyStatement
' Property: Attributes Modifiers [|Identifier AsClause Initializer|] ImplementsClause
Dim propertyStatement = DirectCast(node, PropertyStatementSyntax)
If propertyStatement.Initializer IsNot Nothing Then
Return {propertyStatement.Identifier}.Concat(propertyStatement.AsClause.DescendantTokens()).Concat(propertyStatement.Initializer.DescendantTokens())
End If
If HasAsNewClause(propertyStatement) Then
Return {propertyStatement.Identifier}.Concat(propertyStatement.AsClause.DescendantTokens())
End If
Return Nothing
Case SyntaxKind.VariableDeclarator
If Not node.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
Return Nothing
End If
' Field: Attributes Modifiers Declarators
Dim fieldDeclaration = DirectCast(node.Parent, FieldDeclarationSyntax)
If fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) Then
Return Nothing
End If
' Dim a = initializer
Dim variableDeclarator = DirectCast(node, VariableDeclaratorSyntax)
If variableDeclarator.Initializer IsNot Nothing Then
Return variableDeclarator.DescendantTokens()
End If
' Dim a As New C()
If HasSimpleAsNewInitializer(variableDeclarator) Then
Return variableDeclarator.DescendantTokens()
End If
Return Nothing
Case SyntaxKind.ModifiedIdentifier
If Not node.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
Return Nothing
End If
' Dim a, b As New C()
Dim variableDeclarator = DirectCast(node.Parent, VariableDeclaratorSyntax)
If HasMultiAsNewInitializer(variableDeclarator) Then
Return node.DescendantTokens().Concat(DirectCast(variableDeclarator.AsClause, AsNewClauseSyntax).NewExpression.DescendantTokens())
End If
' Dim a(n)
' Dim a(n), b(n) As Integer
Dim modifiedIdentifier = DirectCast(node, ModifiedIdentifierSyntax)
If modifiedIdentifier.ArrayBounds IsNot Nothing Then
Return node.DescendantTokens()
End If
Return Nothing
Case Else
Return Nothing
End Select
End Function
Protected Overrides Function GetEncompassingAncestorImpl(bodyOrMatchRoot As SyntaxNode) As SyntaxNode
' AsNewClause is a match root for field/property As New initializer
' EqualsClause is a match root for field/property initializer
If bodyOrMatchRoot.IsKind(SyntaxKind.AsNewClause) OrElse bodyOrMatchRoot.IsKind(SyntaxKind.EqualsValue) Then
Debug.Assert(bodyOrMatchRoot.Parent.IsKind(SyntaxKind.VariableDeclarator) OrElse
bodyOrMatchRoot.Parent.IsKind(SyntaxKind.PropertyStatement))
Return bodyOrMatchRoot.Parent
End If
' ArgumentList is a match root for an array initialized field
If bodyOrMatchRoot.IsKind(SyntaxKind.ArgumentList) Then
Debug.Assert(bodyOrMatchRoot.Parent.IsKind(SyntaxKind.ModifiedIdentifier))
Return bodyOrMatchRoot.Parent
End If
' The following active nodes are outside of the initializer body,
' we need to return a node that encompasses them.
' Dim [|a = <<Body>>|]
' Dim [|a As Integer = <<Body>>|]
' Dim [|a As <<Body>>|]
' Dim [|a|], [|b|], [|c|] As <<Body>>
' Property [|P As Integer = <<Body>>|]
' Property [|P As <<Body>>|]
If bodyOrMatchRoot.Parent.IsKind(SyntaxKind.AsNewClause) OrElse
bodyOrMatchRoot.Parent.IsKind(SyntaxKind.EqualsValue) Then
Return bodyOrMatchRoot.Parent.Parent
End If
Return bodyOrMatchRoot
End Function
Protected Overrides Function FindStatementAndPartner(declarationBody As SyntaxNode,
position As Integer,
partnerDeclarationBodyOpt As SyntaxNode,
<Out> ByRef partnerOpt As SyntaxNode,
<Out> ByRef statementPart As Integer) As SyntaxNode
SyntaxUtilities.AssertIsBody(declarationBody, allowLambda:=False)
Debug.Assert(partnerDeclarationBodyOpt Is Nothing OrElse partnerDeclarationBodyOpt.RawKind = declarationBody.RawKind)
' Only field and property initializers may have an [|active statement|] starting outside of the <<body>>.
' Simple field initializers: Dim [|a = <<expr>>|]
' Dim [|a As Integer = <<expr>>|]
' Dim [|a = <<expr>>|], [|b = <<expr>>|], [|c As Integer = <<expr>>|]
' Dim [|a As <<New C>>|]
' Array initialized fields: Dim [|a<<(array bounds)>>|] As Integer
' Shared initializers: Dim [|a|], [|b|] As <<New C(Function() [|...|])>>
' Property initializers: Property [|p As Integer = <<body>>|]
' Property [|p As <<New C()>>|]
If position < declarationBody.SpanStart Then
If declarationBody.Parent.Parent.IsKind(SyntaxKind.PropertyStatement) Then
' Property [|p As Integer = <<body>>|]
' Property [|p As <<New C()>>|]
If partnerDeclarationBodyOpt IsNot Nothing Then
partnerOpt = partnerDeclarationBodyOpt.Parent.Parent
End If
Debug.Assert(declarationBody.Parent.Parent.IsKind(SyntaxKind.PropertyStatement))
Return declarationBody.Parent.Parent
End If
If declarationBody.IsKind(SyntaxKind.ArgumentList) Then
' Dim a<<ArgumentList>> As Integer
If partnerDeclarationBodyOpt IsNot Nothing Then
partnerOpt = partnerDeclarationBodyOpt.Parent
End If
Debug.Assert(declarationBody.Parent.IsKind(SyntaxKind.ModifiedIdentifier))
Return declarationBody.Parent
End If
If declarationBody.Parent.IsKind(SyntaxKind.AsNewClause) Then
Dim variableDeclarator = DirectCast(declarationBody.Parent.Parent, VariableDeclaratorSyntax)
If variableDeclarator.Names.Count > 1 Then
' Dim a, b, c As <<NewExpression>>
Dim nameIndex = GetItemIndexByPosition(variableDeclarator.Names, position)
If partnerDeclarationBodyOpt IsNot Nothing Then
partnerOpt = DirectCast(partnerDeclarationBodyOpt.Parent.Parent, VariableDeclaratorSyntax).Names(nameIndex)
End If
Return variableDeclarator.Names(nameIndex)
Else
If partnerDeclarationBodyOpt IsNot Nothing Then
partnerOpt = partnerDeclarationBodyOpt.Parent.Parent
End If
' Dim a As <<NewExpression>>
Return variableDeclarator
End If
End If
Debug.Assert(declarationBody.Parent.IsKind(SyntaxKind.EqualsValue))
Debug.Assert(declarationBody.Parent.Parent.IsKind(SyntaxKind.VariableDeclarator) AndAlso
declarationBody.Parent.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration))
If partnerDeclarationBodyOpt IsNot Nothing Then
partnerOpt = partnerDeclarationBodyOpt.Parent.Parent
End If
Return declarationBody.Parent.Parent
End If
Debug.Assert(declarationBody.FullSpan.Contains(position))
Dim node As SyntaxNode = Nothing
If partnerDeclarationBodyOpt IsNot Nothing Then
SyntaxUtilities.FindLeafNodeAndPartner(declarationBody, position, partnerDeclarationBodyOpt, node, partnerOpt)
Else
node = declarationBody.FindToken(position).Parent
partnerOpt = Nothing
End If
Debug.Assert(node IsNot Nothing)
While node IsNot declarationBody AndAlso
Not StatementSyntaxComparer.HasLabel(node) AndAlso
Not LambdaUtilities.IsLambdaBodyStatementOrExpression(node)
node = node.Parent
If partnerOpt IsNot Nothing Then
partnerOpt = partnerOpt.Parent
End If
End While
' In case of local variable declaration an active statement may start with a modified identifier.
' If it is a declaration with a simple initializer we want the resulting statement to be the declaration,
' not the identifier.
If node.IsKind(SyntaxKind.ModifiedIdentifier) AndAlso
node.Parent.IsKind(SyntaxKind.VariableDeclarator) AndAlso
DirectCast(node.Parent, VariableDeclaratorSyntax).Names.Count = 1 Then
node = node.Parent
End If
Return node
End Function
Friend Overrides Function FindPartnerInMemberInitializer(leftModel As SemanticModel, leftType As INamedTypeSymbol, leftNode As SyntaxNode, rightType As INamedTypeSymbol, cancellationToken As CancellationToken) As SyntaxNode
Dim leftInitializer = leftNode.FirstAncestorOrSelf(Of SyntaxNode)(
Function(node)
Return node.IsKind(SyntaxKind.EqualsValue) AndAlso (node.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) OrElse node.Parent.IsKind(SyntaxKind.PropertyStatement)) OrElse
node.IsKind(SyntaxKind.AsNewClause) AndAlso node.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) OrElse
IsArrayBoundsArgument(node)
End Function)
If leftInitializer Is Nothing Then
Return Nothing
End If
Dim rightInitializer As SyntaxNode
If leftInitializer.Parent.IsKind(SyntaxKind.PropertyStatement) Then
' property initializer
Dim leftDeclaration = DirectCast(leftInitializer.Parent, PropertyStatementSyntax)
Dim leftSymbol = leftModel.GetDeclaredSymbol(leftDeclaration, cancellationToken)
Debug.Assert(leftSymbol IsNot Nothing)
Dim rightProperty = rightType.GetMembers(leftSymbol.Name).Single()
Dim rightDeclaration = DirectCast(GetSymbolSyntax(rightProperty, cancellationToken), PropertyStatementSyntax)
rightInitializer = rightDeclaration.Initializer
ElseIf leftInitializer.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration)
' field initializer or AsNewClause
Dim leftDeclarator = DirectCast(leftInitializer.Parent, VariableDeclaratorSyntax)
Dim leftSymbol = leftModel.GetDeclaredSymbol(leftDeclarator.Names.First(), cancellationToken)
Debug.Assert(leftSymbol IsNot Nothing)
Dim rightSymbol = rightType.GetMembers(leftSymbol.Name).Single()
Dim rightDeclarator = DirectCast(GetSymbolSyntax(rightSymbol, cancellationToken).Parent, VariableDeclaratorSyntax)
rightInitializer = If(leftInitializer.IsKind(SyntaxKind.EqualsValue), rightDeclarator.Initializer, DirectCast(rightDeclarator.AsClause, SyntaxNode))
Else
' ArrayBounds argument
Dim leftArguments = DirectCast(leftInitializer.Parent, ArgumentListSyntax)
Dim argumentIndex = GetItemIndexByPosition(leftArguments.Arguments, leftInitializer.Span.Start)
Dim leftIdentifier = leftArguments.Parent
Debug.Assert(leftIdentifier.IsKind(SyntaxKind.ModifiedIdentifier))
Dim leftSymbol = leftModel.GetDeclaredSymbol(leftIdentifier, cancellationToken)
Debug.Assert(leftSymbol IsNot Nothing)
Dim rightSymbol = rightType.GetMembers(leftSymbol.Name).Single()
Dim rightIdentifier = DirectCast(GetSymbolSyntax(rightSymbol, cancellationToken), ModifiedIdentifierSyntax)
rightInitializer = rightIdentifier.ArrayBounds.Arguments(argumentIndex)
End If
If rightInitializer Is Nothing Then
Return Nothing
End If
Return FindPartner(leftInitializer, rightInitializer, leftNode)
End Function
Friend Overrides Function FindPartner(leftRoot As SyntaxNode, rightRoot As SyntaxNode, leftNode As SyntaxNode) As SyntaxNode
Return SyntaxUtilities.FindPartner(leftRoot, rightRoot, leftNode)
End Function
Private Shared Function IsArrayBoundsArgument(node As SyntaxNode) As Boolean
Dim argumentSyntax = TryCast(node, ArgumentSyntax)
If argumentSyntax IsNot Nothing Then
Debug.Assert(argumentSyntax.Parent.IsKind(SyntaxKind.ArgumentList))
Dim identifier = argumentSyntax.Parent.Parent
Return identifier.IsKind(SyntaxKind.ModifiedIdentifier) AndAlso identifier.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration)
End If
Return False
End Function
Friend Overrides Function IsClosureScope(node As SyntaxNode) As Boolean
Return LambdaUtilities.IsClosureScope(node)
End Function
Protected Overrides Function FindEnclosingLambdaBody(containerOpt As SyntaxNode, node As SyntaxNode) As SyntaxNode
Dim root As SyntaxNode = GetEncompassingAncestor(containerOpt)
While node IsNot root
Dim body As SyntaxNode = Nothing
If LambdaUtilities.IsLambdaBodyStatementOrExpression(node, body) Then
Return body
End If
node = node.Parent
End While
Return Nothing
End Function
Protected Overrides Function TryGetPartnerLambdaBody(oldBody As SyntaxNode, newLambda As SyntaxNode) As SyntaxNode
Return LambdaUtilities.GetCorrespondingLambdaBody(oldBody, newLambda)
End Function
Protected Overrides Function ComputeTopLevelMatch(oldCompilationUnit As SyntaxNode, newCompilationUnit As SyntaxNode) As Match(Of SyntaxNode)
Return TopSyntaxComparer.Instance.ComputeMatch(oldCompilationUnit, newCompilationUnit)
End Function
Protected Overrides Function ComputeBodyMatch(oldBody As SyntaxNode, newBody As SyntaxNode, knownMatches As IEnumerable(Of KeyValuePair(Of SyntaxNode, SyntaxNode))) As Match(Of SyntaxNode)
SyntaxUtilities.AssertIsBody(oldBody, allowLambda:=True)
SyntaxUtilities.AssertIsBody(newBody, allowLambda:=True)
Debug.Assert((TypeOf oldBody.Parent Is LambdaExpressionSyntax) = (TypeOf oldBody.Parent Is LambdaExpressionSyntax))
Debug.Assert((TypeOf oldBody Is ExpressionSyntax) = (TypeOf newBody Is ExpressionSyntax))
Debug.Assert((TypeOf oldBody Is ArgumentListSyntax) = (TypeOf newBody Is ArgumentListSyntax))
If TypeOf oldBody.Parent Is LambdaExpressionSyntax Then
' The root is a single/multi line sub/function lambda.
Return New StatementSyntaxComparer(oldBody.Parent, oldBody.Parent.ChildNodes(), newBody.Parent, newBody.Parent.ChildNodes(), matchingLambdas:=True).
ComputeMatch(oldBody.Parent, newBody.Parent, knownMatches)
End If
If TypeOf oldBody Is ExpressionSyntax Then
' Dim a = <Expression>
' Dim a As <NewExpression>
' Dim a, b, c As <NewExpression>
' Queries: The root is a query clause, the body is the expression.
Return New StatementSyntaxComparer(oldBody.Parent, {oldBody}, newBody.Parent, {newBody}, matchingLambdas:=False).
ComputeMatch(oldBody.Parent, newBody.Parent, knownMatches)
End If
' Method, accessor, operator, etc. bodies are represented by the declaring block, which is also the root.
' The body of an array initialized fields is an ArgumentListSyntax, which is the match root.
Return StatementSyntaxComparer.Default.ComputeMatch(oldBody, newBody, knownMatches)
End Function
Protected Overrides Function TryMatchActiveStatement(oldStatement As SyntaxNode,
statementPart As Integer,
oldBody As SyntaxNode,
newBody As SyntaxNode,
<Out> ByRef newStatement As SyntaxNode) As Boolean
SyntaxUtilities.AssertIsBody(oldBody, allowLambda:=True)
SyntaxUtilities.AssertIsBody(newBody, allowLambda:=True)
' only statements in bodies of the same kind can be matched
Debug.Assert((TypeOf oldBody Is MethodBlockBaseSyntax) = (TypeOf newBody Is MethodBlockBaseSyntax))
Debug.Assert((TypeOf oldBody Is ExpressionSyntax) = (TypeOf newBody Is ExpressionSyntax))
Debug.Assert((TypeOf oldBody Is ArgumentListSyntax) = (TypeOf newBody Is ArgumentListSyntax))
Debug.Assert((TypeOf oldBody Is LambdaHeaderSyntax) = (TypeOf newBody Is LambdaHeaderSyntax))
Debug.Assert(oldBody.Parent.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) = newBody.Parent.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration))
Debug.Assert(oldBody.Parent.Parent.IsKind(SyntaxKind.PropertyStatement) = newBody.Parent.Parent.IsKind(SyntaxKind.PropertyStatement))
' methods
If TypeOf oldBody Is MethodBlockBaseSyntax Then
newStatement = Nothing
Return False
End If
' lambdas
If oldBody.IsKind(SyntaxKind.FunctionLambdaHeader) OrElse oldBody.IsKind(SyntaxKind.SubLambdaHeader) Then
Dim oldSingleLineLambda = TryCast(oldBody.Parent, SingleLineLambdaExpressionSyntax)
Dim newSingleLineLambda = TryCast(newBody.Parent, SingleLineLambdaExpressionSyntax)
If oldSingleLineLambda IsNot Nothing AndAlso
newSingleLineLambda IsNot Nothing AndAlso
oldStatement Is oldSingleLineLambda.Body Then
newStatement = newSingleLineLambda.Body
Return True
End If
newStatement = Nothing
Return False
End If
' array initialized fields
If newBody.IsKind(SyntaxKind.ArgumentList) Then
' the parent ModifiedIdentifier is the active statement
If oldStatement Is oldBody.Parent Then
newStatement = newBody.Parent
Return True
End If
newStatement = Nothing
Return False
End If
' field and property initializers
If TypeOf newBody Is ExpressionSyntax Then
If newBody.Parent.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
' field
Dim newDeclarator = DirectCast(newBody.Parent.Parent, VariableDeclaratorSyntax)
Dim oldName As SyntaxToken
If oldStatement.IsKind(SyntaxKind.VariableDeclarator) Then
oldName = DirectCast(oldStatement, VariableDeclaratorSyntax).Names.Single.Identifier
Else
oldName = DirectCast(oldStatement, ModifiedIdentifierSyntax).Identifier
End If
For Each newName In newDeclarator.Names
If SyntaxFactory.AreEquivalent(newName.Identifier, oldName) Then
newStatement = newName
Return True
End If
Next
newStatement = Nothing
Return False
ElseIf newBody.Parent.Parent.IsKind(SyntaxKind.PropertyStatement) Then
' property
If oldStatement Is oldBody.Parent.Parent Then
newStatement = newBody.Parent.Parent
Return True
End If
newStatement = newBody
Return True
End If
End If
' queries
If oldStatement Is oldBody Then
newStatement = newBody
Return True
End If
newStatement = Nothing
Return False
End Function
#End Region
#Region "Syntax And Semantic Utils"
Protected Overrides Function GetSyntaxSequenceEdits(oldNodes As ImmutableArray(Of SyntaxNode), newNodes As ImmutableArray(Of SyntaxNode)) As IEnumerable(Of SequenceEdit)
Return SyntaxComparer.GetSequenceEdits(oldNodes, newNodes)
End Function
Friend Overrides ReadOnly Property EmptyCompilationUnit As SyntaxNode
Get
Return SyntaxFactory.CompilationUnit()
End Get
End Property
Friend Overrides Function ExperimentalFeaturesEnabled(tree As SyntaxTree) As Boolean
' There are no experimental features at this time.
Return False
End Function
Protected Overrides Function StatementLabelEquals(node1 As SyntaxNode, node2 As SyntaxNode) As Boolean
Return StatementSyntaxComparer.GetLabelImpl(node1) = StatementSyntaxComparer.GetLabelImpl(node2)
End Function
Private Shared Function GetItemIndexByPosition(Of TNode As SyntaxNode)(list As SeparatedSyntaxList(Of TNode), position As Integer) As Integer
For i = list.SeparatorCount - 1 To 0 Step -1
If position > list.GetSeparator(i).SpanStart Then
Return i + 1
End If
Next
Return 0
End Function
Private Shared Function ChildrenCompiledInBody(node As SyntaxNode) As Boolean
Return Not node.IsKind(SyntaxKind.MultiLineFunctionLambdaExpression) AndAlso
Not node.IsKind(SyntaxKind.SingleLineFunctionLambdaExpression) AndAlso
Not node.IsKind(SyntaxKind.MultiLineSubLambdaExpression) AndAlso
Not node.IsKind(SyntaxKind.SingleLineSubLambdaExpression)
End Function
Protected Overrides Function TryGetEnclosingBreakpointSpan(root As SyntaxNode, position As Integer, <Out> ByRef span As TextSpan) As Boolean
Return BreakpointSpans.TryGetEnclosingBreakpointSpan(root, position, span)
End Function
Protected Overrides Function TryGetActiveSpan(node As SyntaxNode, statementPart As Integer, <Out> ByRef span As TextSpan) As Boolean
Return BreakpointSpans.TryGetEnclosingBreakpointSpan(node, node.SpanStart, span)
End Function
Protected Overrides Iterator Function EnumerateNearStatements(statement As SyntaxNode) As IEnumerable(Of KeyValuePair(Of SyntaxNode, Integer))
Dim direction As Integer = +1
Dim nodeOrToken As SyntaxNodeOrToken = statement
Dim propertyOrFieldModifiers As SyntaxTokenList? = GetFieldOrPropertyModifiers(statement)
While True
' If the current statement is the last statement of if-block or try-block statements
' pretend there are no siblings following it.
Dim lastBlockStatement As SyntaxNode = Nothing
If nodeOrToken.Parent IsNot Nothing Then
If nodeOrToken.Parent.IsKind(SyntaxKind.MultiLineIfBlock) Then
lastBlockStatement = DirectCast(nodeOrToken.Parent, MultiLineIfBlockSyntax).Statements.LastOrDefault()
ElseIf nodeOrToken.Parent.IsKind(SyntaxKind.SingleLineIfStatement) Then
lastBlockStatement = DirectCast(nodeOrToken.Parent, SingleLineIfStatementSyntax).Statements.LastOrDefault()
ElseIf nodeOrToken.Parent.IsKind(SyntaxKind.TryBlock) Then
lastBlockStatement = DirectCast(nodeOrToken.Parent, TryBlockSyntax).Statements.LastOrDefault()
End If
End If
If direction > 0 Then
If lastBlockStatement IsNot Nothing AndAlso nodeOrToken.AsNode() Is lastBlockStatement Then
nodeOrToken = Nothing
Else
nodeOrToken = nodeOrToken.GetNextSibling()
End If
Else
nodeOrToken = nodeOrToken.GetPreviousSibling()
If lastBlockStatement IsNot Nothing AndAlso nodeOrToken.AsNode() Is lastBlockStatement Then
nodeOrToken = Nothing
End If
End If
If nodeOrToken.RawKind = 0 Then
Dim parent = statement.Parent
If parent Is Nothing Then
Return
End If
If direction > 0 Then
nodeOrToken = statement
direction = -1
Continue While
End If
If propertyOrFieldModifiers.HasValue Then
Yield KeyValuePair.Create(statement, -1)
End If
nodeOrToken = parent
statement = parent
propertyOrFieldModifiers = GetFieldOrPropertyModifiers(statement)
direction = +1
End If
Dim node = nodeOrToken.AsNode()
If node Is Nothing Then
Continue While
End If
If propertyOrFieldModifiers.HasValue Then
Dim nodeModifiers = GetFieldOrPropertyModifiers(node)
If Not nodeModifiers.HasValue OrElse
propertyOrFieldModifiers.Value.Any(SyntaxKind.SharedKeyword) <> nodeModifiers.Value.Any(SyntaxKind.SharedKeyword) Then
Continue While
End If
End If
Yield KeyValuePair.Create(node, 0)
End While
End Function
Private Shared Function GetFieldOrPropertyModifiers(node As SyntaxNode) As SyntaxTokenList?
If node.IsKind(SyntaxKind.FieldDeclaration) Then
Return DirectCast(node, FieldDeclarationSyntax).Modifiers
ElseIf node.IsKind(SyntaxKind.PropertyStatement) Then
Return DirectCast(node, PropertyStatementSyntax).Modifiers
Else
Return Nothing
End If
End Function
Protected Overrides Function AreEquivalent(left As SyntaxNode, right As SyntaxNode) As Boolean
Return SyntaxFactory.AreEquivalent(left, right)
End Function
Private Shared Function AreEquivalentIgnoringLambdaBodies(left As SyntaxNode, right As SyntaxNode) As Boolean
' usual case
If SyntaxFactory.AreEquivalent(left, right) Then
Return True
End If
Return LambdaUtilities.AreEquivalentIgnoringLambdaBodies(left, right)
End Function
Protected Overrides Function AreEquivalentActiveStatements(oldStatement As SyntaxNode, newStatement As SyntaxNode, statementPart As Integer) As Boolean
If oldStatement.RawKind <> newStatement.RawKind Then
Return False
End If
' Dim a,b,c As <NewExpression>
' We need to check the actual initializer expression in addition to the identifier.
If HasMultiInitializer(oldStatement) Then
Return AreEquivalentIgnoringLambdaBodies(oldStatement, newStatement) AndAlso
AreEquivalentIgnoringLambdaBodies(DirectCast(oldStatement.Parent, VariableDeclaratorSyntax).AsClause,
DirectCast(newStatement.Parent, VariableDeclaratorSyntax).AsClause)
End If
Select Case oldStatement.Kind
Case SyntaxKind.SubNewStatement,
SyntaxKind.SubStatement,
SyntaxKind.SubNewStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.OperatorStatement,
SyntaxKind.GetAccessorStatement,
SyntaxKind.SetAccessorStatement,
SyntaxKind.AddHandlerAccessorStatement,
SyntaxKind.RemoveHandlerAccessorStatement,
SyntaxKind.RaiseEventAccessorStatement
' Header statements are nops. Changes in the header statements are changes in top-level surface
' which should not be reported as active statement rude edits.
Return True
Case Else
Return AreEquivalentIgnoringLambdaBodies(oldStatement, newStatement)
End Select
End Function
Private Shared Function HasMultiInitializer(modifiedIdentifier As SyntaxNode) As Boolean
Return modifiedIdentifier.Parent.IsKind(SyntaxKind.VariableDeclarator) AndAlso
DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax).Names.Count > 1
End Function
Friend Overrides Function IsMethod(declaration As SyntaxNode) As Boolean
Return SyntaxUtilities.IsMethod(declaration)
End Function
Friend Overrides Function TryGetContainingTypeDeclaration(memberDeclaration As SyntaxNode) As SyntaxNode
Return memberDeclaration.Parent.FirstAncestorOrSelf(Of TypeBlockSyntax)()
End Function
Friend Overrides Function HasBackingField(propertyDeclaration As SyntaxNode) As Boolean
Return SyntaxUtilities.HasBackingField(propertyDeclaration)
End Function
Friend Overrides Function IsDeclarationWithInitializer(declaration As SyntaxNode) As Boolean
Select Case declaration.Kind
Case SyntaxKind.VariableDeclarator
Dim declarator = DirectCast(declaration, VariableDeclaratorSyntax)
Return GetInitializerExpression(declarator.Initializer, declarator.AsClause) IsNot Nothing
Case SyntaxKind.ModifiedIdentifier
Debug.Assert(declaration.Parent.IsKind(SyntaxKind.VariableDeclarator) OrElse
declaration.Parent.IsKind(SyntaxKind.Parameter))
If Not declaration.Parent.IsKind(SyntaxKind.VariableDeclarator) Then
Return False
End If
Dim declarator = DirectCast(declaration.Parent, VariableDeclaratorSyntax)
Dim identifier = DirectCast(declaration, ModifiedIdentifierSyntax)
Return identifier.ArrayBounds IsNot Nothing OrElse
GetInitializerExpression(declarator.Initializer, declarator.AsClause) IsNot Nothing
Case SyntaxKind.PropertyStatement
Dim propertyStatement = DirectCast(declaration, PropertyStatementSyntax)
Return GetInitializerExpression(propertyStatement.Initializer, propertyStatement.AsClause) IsNot Nothing
Case Else
Return False
End Select
End Function
Private Shared Function GetInitializerExpression(equalsValue As EqualsValueSyntax, asClause As AsClauseSyntax) As ExpressionSyntax
If equalsValue IsNot Nothing Then
Return equalsValue.Value
End If
If asClause IsNot Nothing AndAlso asClause.IsKind(SyntaxKind.AsNewClause) Then
Return DirectCast(asClause, AsNewClauseSyntax).NewExpression
End If
Return Nothing
End Function
Friend Overrides Function IsConstructorWithMemberInitializers(declaration As SyntaxNode) As Boolean
Dim ctor = TryCast(declaration, ConstructorBlockSyntax)
If ctor Is Nothing Then
Return False
End If
' Constructor includes field initializers if the first statement
' isn't a call to another constructor of the declaring class or module.
If ctor.Statements.Count = 0 Then
Return True
End If
Dim firstStatement = ctor.Statements.First
If Not firstStatement.IsKind(SyntaxKind.ExpressionStatement) Then
Return True
End If
Dim expressionStatement = DirectCast(firstStatement, ExpressionStatementSyntax)
If Not expressionStatement.Expression.IsKind(SyntaxKind.InvocationExpression) Then
Return True
End If
Dim invocation = DirectCast(expressionStatement.Expression, InvocationExpressionSyntax)
If Not invocation.Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression) Then
Return True
End If
Dim memberAccess = DirectCast(invocation.Expression, MemberAccessExpressionSyntax)
If Not memberAccess.Name.IsKind(SyntaxKind.IdentifierName) OrElse
Not memberAccess.Name.Identifier.IsKind(SyntaxKind.IdentifierToken) Then
Return True
End If
' Note that ValueText returns "New" for both New and [New]
If Not String.Equals(memberAccess.Name.Identifier.ToString(), "New", StringComparison.OrdinalIgnoreCase) Then
Return True
End If
Return memberAccess.Expression.IsKind(SyntaxKind.MyBaseKeyword)
End Function
Friend Overrides Function IsPartial(type As INamedTypeSymbol) As Boolean
Dim syntaxRefs = type.DeclaringSyntaxReferences
Return syntaxRefs.Length > 1 OrElse
DirectCast(syntaxRefs.Single().GetSyntax(), TypeStatementSyntax).Modifiers.Any(SyntaxKind.PartialKeyword)
End Function
Protected Overrides Function GetSymbolForEdit(model As SemanticModel, node As SyntaxNode, editKind As EditKind, editMap As Dictionary(Of SyntaxNode, EditKind), cancellationToken As CancellationToken) As ISymbol
' Avoid duplicate semantic edits - don't return symbols for statements within blocks.
Select Case node.Kind()
Case SyntaxKind.OperatorStatement,
SyntaxKind.SubNewStatement,
SyntaxKind.SetAccessorStatement,
SyntaxKind.GetAccessorStatement,
SyntaxKind.AddHandlerAccessorStatement,
SyntaxKind.RemoveHandlerAccessorStatement,
SyntaxKind.RaiseEventAccessorStatement,
SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement,
SyntaxKind.ClassStatement,
SyntaxKind.StructureStatement,
SyntaxKind.InterfaceStatement,
SyntaxKind.ModuleStatement,
SyntaxKind.EnumStatement,
SyntaxKind.NamespaceStatement
Return Nothing
Case SyntaxKind.EventStatement
If node.Parent.IsKind(SyntaxKind.EventBlock) Then
Return Nothing
End If
Case SyntaxKind.PropertyStatement ' autoprop or interface property
If node.Parent.IsKind(SyntaxKind.PropertyBlock) Then
Return Nothing
End If
Case SyntaxKind.SubStatement ' interface method
If node.Parent.IsKind(SyntaxKind.SubBlock) Then
Return Nothing
End If
Case SyntaxKind.FunctionStatement ' interface method
If node.Parent.IsKind(SyntaxKind.FunctionBlock) Then
Return Nothing
End If
Case SyntaxKind.Parameter
Return Nothing
Case SyntaxKind.ModifiedIdentifier
If node.Parent.IsKind(SyntaxKind.Parameter) Then
Return Nothing
End If
Case SyntaxKind.VariableDeclarator
' An update to a field variable declarator might either be
' 1) variable declarator update (an initializer is changes)
' 2) modified identifier update (an array bound changes)
' Handle the first one here.
If editKind = EditKind.Update AndAlso node.Parent.IsKind(SyntaxKind.FieldDeclaration) Then
' If multiple fields are defined by this declaration pick the first one.
' We want to analyze the associated initializer just once. Any of the fields is good.
node = DirectCast(node, VariableDeclaratorSyntax).Names.First()
End If
End Select
Return model.GetDeclaredSymbol(node, cancellationToken)
End Function
Friend Overrides Function ContainsLambda(declaration As SyntaxNode) As Boolean
Return declaration.DescendantNodes().Any(AddressOf LambdaUtilities.IsLambda)
End Function
Friend Overrides Function IsLambda(node As SyntaxNode) As Boolean
Return LambdaUtilities.IsLambda(node)
End Function
Friend Overrides Function IsLambdaExpression(node As SyntaxNode) As Boolean
Return TypeOf node Is LambdaExpressionSyntax
End Function
Friend Overrides Function TryGetLambdaBodies(node As SyntaxNode, ByRef body1 As SyntaxNode, ByRef body2 As SyntaxNode) As Boolean
Return LambdaUtilities.TryGetLambdaBodies(node, body1, body2)
End Function
Friend Overrides Function GetLambda(lambdaBody As SyntaxNode) As SyntaxNode
Return LambdaUtilities.GetLambda(lambdaBody)
End Function
Protected Overrides Function GetLambdaBodyExpressionsAndStatements(lambdaBody As SyntaxNode) As IEnumerable(Of SyntaxNode)
Return LambdaUtilities.GetLambdaBodyExpressionsAndStatements(lambdaBody)
End Function
Friend Overrides Function GetLambdaExpressionSymbol(model As SemanticModel, lambdaExpression As SyntaxNode, cancellationToken As CancellationToken) As IMethodSymbol
Dim lambdaExpressionSyntax = DirectCast(lambdaExpression, LambdaExpressionSyntax)
' The semantic model only returns the lambda symbol for positions that are within the body of the lambda (not the header)
Return DirectCast(model.GetEnclosingSymbol(lambdaExpressionSyntax.SubOrFunctionHeader.Span.End, cancellationToken), IMethodSymbol)
End Function
Friend Overrides Function GetContainingQueryExpression(node As SyntaxNode) As SyntaxNode
Return node.FirstAncestorOrSelf(Of QueryExpressionSyntax)
End Function
Friend Overrides Function QueryClauseLambdasTypeEquivalent(oldModel As SemanticModel, oldNode As SyntaxNode, newModel As SemanticModel, newNode As SyntaxNode, cancellationToken As CancellationToken) As Boolean
Select Case oldNode.Kind
Case SyntaxKind.AggregateClause
Dim oldInfo = oldModel.GetAggregateClauseSymbolInfo(DirectCast(oldNode, AggregateClauseSyntax), cancellationToken)
Dim newInfo = newModel.GetAggregateClauseSymbolInfo(DirectCast(newNode, AggregateClauseSyntax), cancellationToken)
Return MemberSignaturesEquivalent(oldInfo.Select1.Symbol, newInfo.Select1.Symbol) AndAlso
MemberSignaturesEquivalent(oldInfo.Select2.Symbol, newInfo.Select2.Symbol)
Case SyntaxKind.CollectionRangeVariable
Dim oldInfo = oldModel.GetCollectionRangeVariableSymbolInfo(DirectCast(oldNode, CollectionRangeVariableSyntax), cancellationToken)
Dim newInfo = newModel.GetCollectionRangeVariableSymbolInfo(DirectCast(newNode, CollectionRangeVariableSyntax), cancellationToken)
Return MemberSignaturesEquivalent(oldInfo.AsClauseConversion.Symbol, newInfo.AsClauseConversion.Symbol) AndAlso
MemberSignaturesEquivalent(oldInfo.SelectMany.Symbol, newInfo.SelectMany.Symbol) AndAlso
MemberSignaturesEquivalent(oldInfo.ToQueryableCollectionConversion.Symbol, newInfo.ToQueryableCollectionConversion.Symbol)
Case SyntaxKind.FunctionAggregation
Dim oldInfo = oldModel.GetSymbolInfo(DirectCast(oldNode, FunctionAggregationSyntax), cancellationToken)
Dim newInfo = newModel.GetSymbolInfo(DirectCast(newNode, FunctionAggregationSyntax), cancellationToken)
Return MemberSignaturesEquivalent(oldInfo.Symbol, newInfo.Symbol)
Case SyntaxKind.ExpressionRangeVariable
Dim oldInfo = oldModel.GetSymbolInfo(DirectCast(oldNode, ExpressionRangeVariableSyntax), cancellationToken)
Dim newInfo = newModel.GetSymbolInfo(DirectCast(newNode, ExpressionRangeVariableSyntax), cancellationToken)
Return MemberSignaturesEquivalent(oldInfo.Symbol, newInfo.Symbol)
Case SyntaxKind.AscendingOrdering,
SyntaxKind.DescendingOrdering
Dim oldInfo = oldModel.GetSymbolInfo(DirectCast(oldNode, OrderingSyntax), cancellationToken)
Dim newInfo = newModel.GetSymbolInfo(DirectCast(newNode, OrderingSyntax), cancellationToken)
Return MemberSignaturesEquivalent(oldInfo.Symbol, newInfo.Symbol)
Case SyntaxKind.FromClause,
SyntaxKind.WhereClause,
SyntaxKind.SkipClause,
SyntaxKind.TakeClause,
SyntaxKind.SkipWhileClause,
SyntaxKind.TakeWhileClause,
SyntaxKind.GroupByClause,
SyntaxKind.SimpleJoinClause,
SyntaxKind.GroupJoinClause,
SyntaxKind.SelectClause
Dim oldInfo = oldModel.GetSymbolInfo(DirectCast(oldNode, QueryClauseSyntax), cancellationToken)
Dim newInfo = newModel.GetSymbolInfo(DirectCast(newNode, QueryClauseSyntax), cancellationToken)
Return MemberSignaturesEquivalent(oldInfo.Symbol, newInfo.Symbol)
Case Else
Return True
End Select
End Function
#End Region
#Region "Diagnostic Info"
Protected Overrides ReadOnly Property ErrorDisplayFormat As SymbolDisplayFormat
Get
Return SymbolDisplayFormat.VisualBasicShortErrorMessageFormat
End Get
End Property
Protected Overrides Function GetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan
Return GetDiagnosticSpanImpl(node, editKind)
End Function
Private Shared Function GetDiagnosticSpanImpl(node As SyntaxNode, editKind As EditKind) As TextSpan
Return GetDiagnosticSpanImpl(node.Kind, node, editKind)
End Function
' internal for testing; kind is passed explicitly for testing as well
Friend Shared Function GetDiagnosticSpanImpl(kind As SyntaxKind, node As SyntaxNode, editKind As EditKind) As TextSpan
Select Case kind
Case SyntaxKind.CompilationUnit
Return Nothing
Case SyntaxKind.OptionStatement,
SyntaxKind.ImportsStatement
Return node.Span
Case SyntaxKind.NamespaceBlock
Return GetDiagnosticSpan(DirectCast(node, NamespaceBlockSyntax).NamespaceStatement)
Case SyntaxKind.NamespaceStatement
Return GetDiagnosticSpan(DirectCast(node, NamespaceStatementSyntax))
Case SyntaxKind.ClassBlock,
SyntaxKind.StructureBlock,
SyntaxKind.InterfaceBlock,
SyntaxKind.ModuleBlock
Return GetDiagnosticSpan(DirectCast(node, TypeBlockSyntax).BlockStatement)
Case SyntaxKind.ClassStatement,
SyntaxKind.StructureStatement,
SyntaxKind.InterfaceStatement,
SyntaxKind.ModuleStatement
Return GetDiagnosticSpan(DirectCast(node, TypeStatementSyntax))
Case SyntaxKind.EnumBlock
Return GetDiagnosticSpanImpl(DirectCast(node, EnumBlockSyntax).EnumStatement, editKind)
Case SyntaxKind.EnumStatement
Dim enumStatement = DirectCast(node, EnumStatementSyntax)
Return GetDiagnosticSpan(enumStatement.Modifiers, enumStatement.EnumKeyword, enumStatement.Identifier)
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.ConstructorBlock,
SyntaxKind.EventBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.GetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
Return GetDiagnosticSpan(DirectCast(node, MethodBlockBaseSyntax).BlockStatement)
Case SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.OperatorStatement,
SyntaxKind.SubNewStatement,
SyntaxKind.EventStatement,
SyntaxKind.SetAccessorStatement,
SyntaxKind.GetAccessorStatement,
SyntaxKind.AddHandlerAccessorStatement,
SyntaxKind.RemoveHandlerAccessorStatement,
SyntaxKind.RaiseEventAccessorStatement,
SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement,
SyntaxKind.DelegateSubStatement,
SyntaxKind.DelegateFunctionStatement
Return GetDiagnosticSpan(DirectCast(node, MethodBaseSyntax))
Case SyntaxKind.PropertyBlock
Return GetDiagnosticSpan(DirectCast(node, PropertyBlockSyntax).PropertyStatement)
Case SyntaxKind.PropertyStatement
Return GetDiagnosticSpan(DirectCast(node, PropertyStatementSyntax))
Case SyntaxKind.FieldDeclaration
Dim fieldDeclaration = DirectCast(node, FieldDeclarationSyntax)
Return GetDiagnosticSpan(fieldDeclaration.Modifiers, fieldDeclaration.Declarators.First, fieldDeclaration.Declarators.Last)
Case SyntaxKind.VariableDeclarator,
SyntaxKind.ModifiedIdentifier,
SyntaxKind.EnumMemberDeclaration,
SyntaxKind.TypeParameterSingleConstraintClause,
SyntaxKind.TypeParameterMultipleConstraintClause,
SyntaxKind.ClassConstraint,
SyntaxKind.StructureConstraint,
SyntaxKind.NewConstraint,
SyntaxKind.TypeConstraint
Return node.Span
Case SyntaxKind.TypeParameter
Return DirectCast(node, TypeParameterSyntax).Identifier.Span
Case SyntaxKind.TypeParameterList,
SyntaxKind.ParameterList,
SyntaxKind.AttributeList,
SyntaxKind.SimpleAsClause
If editKind = EditKind.Delete Then
Return GetDiagnosticSpanImpl(node.Parent, editKind)
Else
Return node.Span
End If
Case SyntaxKind.AttributesStatement,
SyntaxKind.Attribute
Return node.Span
Case SyntaxKind.Parameter
Dim parameter = DirectCast(node, ParameterSyntax)
Return GetDiagnosticSpan(parameter.Modifiers, parameter.Identifier, parameter)
Case SyntaxKind.MultiLineFunctionLambdaExpression,
SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression,
SyntaxKind.SingleLineSubLambdaExpression
Return GetDiagnosticSpan(DirectCast(node, LambdaExpressionSyntax).SubOrFunctionHeader)
Case SyntaxKind.MultiLineIfBlock
Dim ifStatement = DirectCast(node, MultiLineIfBlockSyntax).IfStatement
Return GetDiagnosticSpan(ifStatement.IfKeyword, ifStatement.Condition, ifStatement.ThenKeyword)
Case SyntaxKind.ElseIfBlock
Dim elseIfStatement = DirectCast(node, ElseIfBlockSyntax).ElseIfStatement
Return GetDiagnosticSpan(elseIfStatement.ElseIfKeyword, elseIfStatement.Condition, elseIfStatement.ThenKeyword)
Case SyntaxKind.SingleLineIfStatement
Dim ifStatement = DirectCast(node, SingleLineIfStatementSyntax)
Return GetDiagnosticSpan(ifStatement.IfKeyword, ifStatement.Condition, ifStatement.ThenKeyword)
Case SyntaxKind.SingleLineElseClause
Return DirectCast(node, SingleLineElseClauseSyntax).ElseKeyword.Span
Case SyntaxKind.TryBlock
Return DirectCast(node, TryBlockSyntax).TryStatement.TryKeyword.Span
Case SyntaxKind.CatchBlock
Return DirectCast(node, CatchBlockSyntax).CatchStatement.CatchKeyword.Span
Case SyntaxKind.FinallyBlock
Return DirectCast(node, FinallyBlockSyntax).FinallyStatement.FinallyKeyword.Span
Case SyntaxKind.SyncLockBlock
Return DirectCast(node, SyncLockBlockSyntax).SyncLockStatement.Span
Case SyntaxKind.WithBlock
Return DirectCast(node, WithBlockSyntax).WithStatement.Span
Case SyntaxKind.UsingBlock
Return DirectCast(node, UsingBlockSyntax).UsingStatement.Span
Case SyntaxKind.SimpleDoLoopBlock,
SyntaxKind.DoWhileLoopBlock,
SyntaxKind.DoUntilLoopBlock,
SyntaxKind.DoLoopWhileBlock,
SyntaxKind.DoLoopUntilBlock
Return DirectCast(node, DoLoopBlockSyntax).DoStatement.Span
Case SyntaxKind.WhileBlock
Return DirectCast(node, WhileBlockSyntax).WhileStatement.Span
Case SyntaxKind.ForEachBlock,
SyntaxKind.ForBlock
Return DirectCast(node, ForOrForEachBlockSyntax).ForOrForEachStatement.Span
Case SyntaxKind.AwaitExpression
Return DirectCast(node, AwaitExpressionSyntax).AwaitKeyword.Span
Case SyntaxKind.AnonymousObjectCreationExpression
Dim newWith = DirectCast(node, AnonymousObjectCreationExpressionSyntax)
Return TextSpan.FromBounds(newWith.NewKeyword.Span.Start,
newWith.Initializer.WithKeyword.Span.End)
Case SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.SingleLineSubLambdaExpression,
SyntaxKind.MultiLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression
Return DirectCast(node, LambdaExpressionSyntax).SubOrFunctionHeader.Span
Case SyntaxKind.QueryExpression
Return GetDiagnosticSpanImpl(DirectCast(node, QueryExpressionSyntax).Clauses.First(), editKind)
Case SyntaxKind.WhereClause
Return DirectCast(node, WhereClauseSyntax).WhereKeyword.Span
Case SyntaxKind.SelectClause
Return DirectCast(node, SelectClauseSyntax).SelectKeyword.Span
Case SyntaxKind.FromClause
Return DirectCast(node, FromClauseSyntax).FromKeyword.Span
Case SyntaxKind.AggregateClause
Return DirectCast(node, AggregateClauseSyntax).AggregateKeyword.Span
Case SyntaxKind.LetClause
Return DirectCast(node, LetClauseSyntax).LetKeyword.Span
Case SyntaxKind.SimpleJoinClause
Return DirectCast(node, SimpleJoinClauseSyntax).JoinKeyword.Span
Case SyntaxKind.GroupJoinClause
Dim groupJoin = DirectCast(node, GroupJoinClauseSyntax)
Return TextSpan.FromBounds(groupJoin.GroupKeyword.SpanStart, groupJoin.JoinKeyword.Span.End)
Case SyntaxKind.GroupByClause
Return DirectCast(node, GroupByClauseSyntax).GroupKeyword.Span
Case SyntaxKind.FunctionAggregation
Return node.Span
Case SyntaxKind.CollectionRangeVariable,
SyntaxKind.ExpressionRangeVariable
Return GetDiagnosticSpanImpl(node.Parent, editKind)
Case SyntaxKind.TakeWhileClause,
SyntaxKind.SkipWhileClause
Dim partition = DirectCast(node, PartitionWhileClauseSyntax)
Return TextSpan.FromBounds(partition.SkipOrTakeKeyword.SpanStart, partition.WhileKeyword.Span.End)
Case SyntaxKind.AscendingOrdering,
SyntaxKind.DescendingOrdering
Return node.Span
Case SyntaxKind.JoinCondition
Return DirectCast(node, JoinConditionSyntax).EqualsKeyword.Span
Case Else
Return node.Span
End Select
End Function
Private Overloads Shared Function GetDiagnosticSpan(ifKeyword As SyntaxToken, condition As SyntaxNode, thenKeywordOpt As SyntaxToken) As TextSpan
Return TextSpan.FromBounds(ifKeyword.Span.Start,
If(thenKeywordOpt.RawKind <> 0, thenKeywordOpt.Span.End, condition.Span.End))
End Function
Private Overloads Shared Function GetDiagnosticSpan(node As NamespaceStatementSyntax) As TextSpan
Return TextSpan.FromBounds(node.NamespaceKeyword.SpanStart, node.Name.Span.End)
End Function
Private Overloads Shared Function GetDiagnosticSpan(node As TypeStatementSyntax) As TextSpan
Return GetDiagnosticSpan(node.Modifiers,
node.DeclarationKeyword,
If(node.TypeParameterList, CType(node.Identifier, SyntaxNodeOrToken)))
End Function
Private Overloads Shared Function GetDiagnosticSpan(modifiers As SyntaxTokenList, start As SyntaxNodeOrToken, endNode As SyntaxNodeOrToken) As TextSpan
Return TextSpan.FromBounds(If(modifiers.Count <> 0, modifiers.First.SpanStart, start.SpanStart),
endNode.Span.End)
End Function
Private Overloads Shared Function GetDiagnosticSpan(header As MethodBaseSyntax) As TextSpan
Dim startToken As SyntaxToken
Dim endToken As SyntaxToken
If header.Modifiers.Count > 0 Then
startToken = header.Modifiers.First
Else
Select Case header.Kind
Case SyntaxKind.DelegateFunctionStatement,
SyntaxKind.DelegateSubStatement
startToken = DirectCast(header, DelegateStatementSyntax).DelegateKeyword
Case SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement
startToken = DirectCast(header, DeclareStatementSyntax).DeclareKeyword
Case Else
startToken = header.DeclarationKeyword
End Select
End If
If header.ParameterList IsNot Nothing Then
endToken = header.ParameterList.CloseParenToken
Else
Select Case header.Kind
Case SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement
endToken = DirectCast(header, MethodStatementSyntax).Identifier
Case SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement
endToken = DirectCast(header, DeclareStatementSyntax).LibraryName.Token
Case SyntaxKind.OperatorStatement
endToken = DirectCast(header, OperatorStatementSyntax).OperatorToken
Case SyntaxKind.SubNewStatement
endToken = DirectCast(header, SubNewStatementSyntax).NewKeyword
Case SyntaxKind.PropertyStatement
endToken = DirectCast(header, PropertyStatementSyntax).Identifier
Case SyntaxKind.EventStatement
endToken = DirectCast(header, EventStatementSyntax).Identifier
Case SyntaxKind.DelegateFunctionStatement,
SyntaxKind.DelegateSubStatement
endToken = DirectCast(header, DelegateStatementSyntax).Identifier
Case SyntaxKind.SetAccessorStatement,
SyntaxKind.GetAccessorStatement,
SyntaxKind.AddHandlerAccessorStatement,
SyntaxKind.RemoveHandlerAccessorStatement,
SyntaxKind.RaiseEventAccessorStatement
endToken = header.DeclarationKeyword
Case Else
Throw ExceptionUtilities.Unreachable
End Select
End If
Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)
End Function
Private Overloads Shared Function GetDiagnosticSpan(lambda As LambdaHeaderSyntax) As TextSpan
Dim startToken = If(lambda.Modifiers.Count <> 0, lambda.Modifiers.First, lambda.DeclarationKeyword)
Dim endToken As SyntaxToken
If lambda.ParameterList IsNot Nothing Then
endToken = lambda.ParameterList.CloseParenToken
Else
endToken = lambda.DeclarationKeyword
End If
Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)
End Function
Friend Overrides Function GetLambdaParameterDiagnosticSpan(lambda As SyntaxNode, ordinal As Integer) As TextSpan
Select Case lambda.Kind
Case SyntaxKind.MultiLineFunctionLambdaExpression,
SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression,
SyntaxKind.SingleLineSubLambdaExpression
Return DirectCast(lambda, LambdaExpressionSyntax).SubOrFunctionHeader.ParameterList.Parameters(ordinal).Identifier.Span
Case Else
Return lambda.Span
End Select
End Function
Protected Overrides Function GetTopLevelDisplayName(node As SyntaxNode, editKind As EditKind) As String
Return GetTopLevelDisplayNameImpl(node)
End Function
Protected Overrides Function GetStatementDisplayName(node As SyntaxNode, editKind As EditKind) As String
Return GetStatementDisplayNameImpl(node, editKind)
End Function
Protected Overrides Function GetLambdaDisplayName(lambda As SyntaxNode) As String
Return GetStatementDisplayNameImpl(lambda, EditKind.Update)
End Function
' internal for testing
Friend Shared Function GetTopLevelDisplayNameImpl(node As SyntaxNode) As String
Select Case node.Kind
Case SyntaxKind.OptionStatement
Return VBFeaturesResources.OptionStatement
Case SyntaxKind.ImportsStatement
Return VBFeaturesResources.ImportStatement
Case SyntaxKind.NamespaceBlock,
SyntaxKind.NamespaceStatement
Return FeaturesResources.Namespace
Case SyntaxKind.ClassBlock,
SyntaxKind.ClassStatement
Return FeaturesResources.Class
Case SyntaxKind.StructureBlock,
SyntaxKind.StructureStatement
Return VBFeaturesResources.StructureStatement
Case SyntaxKind.InterfaceBlock,
SyntaxKind.InterfaceStatement
Return FeaturesResources.Interface
Case SyntaxKind.ModuleBlock,
SyntaxKind.ModuleStatement
Return VBFeaturesResources.ModuleStatement
Case SyntaxKind.EnumBlock,
SyntaxKind.EnumStatement
Return FeaturesResources.Enum
Case SyntaxKind.DelegateSubStatement,
SyntaxKind.DelegateFunctionStatement
Return FeaturesResources.Delegate
Case SyntaxKind.FieldDeclaration
Dim declaration = DirectCast(node, FieldDeclarationSyntax)
Return If(declaration.Modifiers.Any(SyntaxKind.WithEventsKeyword), VBFeaturesResources.WithEventsFieldStatement,
If(declaration.Modifiers.Any(SyntaxKind.ConstKeyword), FeaturesResources.ConstField, FeaturesResources.Field))
Case SyntaxKind.VariableDeclarator,
SyntaxKind.ModifiedIdentifier
Return GetTopLevelDisplayNameImpl(node.Parent)
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement
Return FeaturesResources.Method
Case SyntaxKind.OperatorBlock,
SyntaxKind.OperatorStatement
Return FeaturesResources.Operator
Case SyntaxKind.ConstructorBlock,
SyntaxKind.SubNewStatement
Return FeaturesResources.Constructor
Case SyntaxKind.PropertyBlock
Return FeaturesResources.Property
Case SyntaxKind.PropertyStatement
Return FeaturesResources.AutoProperty
Case SyntaxKind.EventBlock,
SyntaxKind.EventStatement
Return FeaturesResources.Event
Case SyntaxKind.EnumMemberDeclaration
Return FeaturesResources.EnumValue
Case SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.GetAccessorStatement,
SyntaxKind.SetAccessorStatement
Return VBFeaturesResources.PropertyAccessor
Case SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock,
SyntaxKind.AddHandlerAccessorStatement,
SyntaxKind.RemoveHandlerAccessorStatement,
SyntaxKind.RaiseEventAccessorStatement
Return FeaturesResources.EventAccessor
Case SyntaxKind.TypeParameterSingleConstraintClause,
SyntaxKind.TypeParameterMultipleConstraintClause,
SyntaxKind.ClassConstraint,
SyntaxKind.StructureConstraint,
SyntaxKind.NewConstraint,
SyntaxKind.TypeConstraint
Return FeaturesResources.TypeConstraint
Case SyntaxKind.SimpleAsClause
Return VBFeaturesResources.AsClause
Case SyntaxKind.TypeParameterList
Return VBFeaturesResources.TypeParameterList
Case SyntaxKind.TypeParameter
Return FeaturesResources.TypeParameter
Case SyntaxKind.ParameterList
Return VBFeaturesResources.ParameterList
Case SyntaxKind.Parameter
Return FeaturesResources.Parameter
Case SyntaxKind.AttributeList,
SyntaxKind.AttributesStatement
Return VBFeaturesResources.AttributeList
Case SyntaxKind.Attribute
Return FeaturesResources.Attribute
Case Else
Throw ExceptionUtilities.UnexpectedValue(node.Kind())
End Select
End Function
' internal for testing
Friend Shared Function GetStatementDisplayNameImpl(node As SyntaxNode, kind As EditKind) As String
Select Case node.Kind
Case SyntaxKind.TryBlock
Return VBFeaturesResources.TryBlock
Case SyntaxKind.CatchBlock
Return VBFeaturesResources.CatchClause
Case SyntaxKind.FinallyBlock
Return VBFeaturesResources.FinallyClause
Case SyntaxKind.UsingBlock
Return If(kind = EditKind.Update, VBFeaturesResources.UsingStatement, VBFeaturesResources.UsingBlock)
Case SyntaxKind.WithBlock
Return If(kind = EditKind.Update, VBFeaturesResources.WithStatement, VBFeaturesResources.WithBlock)
Case SyntaxKind.SyncLockBlock
Return If(kind = EditKind.Update, VBFeaturesResources.SyncLockStatement, VBFeaturesResources.SyncLockBlock)
Case SyntaxKind.ForEachBlock
Return If(kind = EditKind.Update, VBFeaturesResources.ForEachStatement, VBFeaturesResources.ForEachBlock)
Case SyntaxKind.OnErrorGoToMinusOneStatement,
SyntaxKind.OnErrorGoToZeroStatement,
SyntaxKind.OnErrorResumeNextStatement,
SyntaxKind.OnErrorGoToLabelStatement
Return VBFeaturesResources.OnErrorStatement
Case SyntaxKind.ResumeStatement,
SyntaxKind.ResumeNextStatement,
SyntaxKind.ResumeLabelStatement
Return VBFeaturesResources.ResumeStatement
Case SyntaxKind.YieldStatement
Return VBFeaturesResources.YieldStatement
Case SyntaxKind.AwaitExpression
Return VBFeaturesResources.AwaitExpression
Case SyntaxKind.MultiLineFunctionLambdaExpression,
SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression,
SyntaxKind.SingleLineSubLambdaExpression
Return VBFeaturesResources.LambdaExpression
Case SyntaxKind.WhereClause
Return VBFeaturesResources.WhereClause
Case SyntaxKind.SelectClause
Return VBFeaturesResources.SelectClause
Case SyntaxKind.FromClause
Return VBFeaturesResources.FromClause
Case SyntaxKind.AggregateClause
Return VBFeaturesResources.AggregateClause
Case SyntaxKind.LetClause
Return VBFeaturesResources.LetClause
Case SyntaxKind.SimpleJoinClause
Return VBFeaturesResources.SimpleJoinClause
Case SyntaxKind.GroupJoinClause
Return VBFeaturesResources.GroupJoinClause
Case SyntaxKind.GroupByClause
Return VBFeaturesResources.GroupByClause
Case SyntaxKind.FunctionAggregation
Return VBFeaturesResources.FunctionAggregation
Case SyntaxKind.CollectionRangeVariable,
SyntaxKind.ExpressionRangeVariable
Return GetStatementDisplayNameImpl(node.Parent, kind)
Case SyntaxKind.TakeWhileClause
Return VBFeaturesResources.TakeWhileClause
Case SyntaxKind.SkipWhileClause
Return VBFeaturesResources.SkipWhileClause
Case SyntaxKind.AscendingOrdering,
SyntaxKind.DescendingOrdering
Return VBFeaturesResources.OrderingClause
Case SyntaxKind.JoinCondition
Return VBFeaturesResources.JoinCondition
Case Else
Throw ExceptionUtilities.UnexpectedValue(node.Kind())
End Select
End Function
#End Region
#Region "Top-level Syntaxtic Rude Edits"
Private Structure EditClassifier
Private ReadOnly _analyzer As VisualBasicEditAndContinueAnalyzer
Private ReadOnly _diagnostics As List(Of RudeEditDiagnostic)
Private ReadOnly _match As Match(Of SyntaxNode)
Private ReadOnly _oldNode As SyntaxNode
Private ReadOnly _newNode As SyntaxNode
Private ReadOnly _kind As EditKind
Private ReadOnly _span As TextSpan?
Public Sub New(analyzer As VisualBasicEditAndContinueAnalyzer,
diagnostics As List(Of RudeEditDiagnostic),
oldNode As SyntaxNode,
newNode As SyntaxNode,
kind As EditKind,
Optional match As Match(Of SyntaxNode) = Nothing,
Optional span As TextSpan? = Nothing)
Me._analyzer = analyzer
Me._diagnostics = diagnostics
Me._oldNode = oldNode
Me._newNode = newNode
Me._kind = kind
Me._span = span
Me._match = match
End Sub
Private Sub ReportError(kind As RudeEditKind)
ReportError(kind, {GetDisplayName()})
End Sub
Private Sub ReportError(kind As RudeEditKind, args As String())
_diagnostics.Add(New RudeEditDiagnostic(kind, GetSpan(), If(_newNode, _oldNode), args))
End Sub
Private Sub ReportError(kind As RudeEditKind, spanNode As SyntaxNode, displayNode As SyntaxNode)
_diagnostics.Add(New RudeEditDiagnostic(kind, GetDiagnosticSpanImpl(spanNode, Me._kind), displayNode, {GetTopLevelDisplayNameImpl(displayNode)}))
End Sub
Private Function GetSpan() As TextSpan
If _span.HasValue Then
Return _span.Value
End If
If _newNode Is Nothing Then
Return _analyzer.GetDeletedNodeDiagnosticSpan(_match.Matches, _oldNode)
Else
Return GetDiagnosticSpanImpl(_newNode, _kind)
End If
End Function
Private Function GetDisplayName() As String
Return GetTopLevelDisplayNameImpl(If(_newNode, _oldNode))
End Function
Public Sub ClassifyEdit()
Select Case _kind
Case EditKind.Delete
ClassifyDelete(_oldNode)
Return
Case EditKind.Update
ClassifyUpdate(_oldNode, _newNode)
Return
Case EditKind.Move
ClassifyMove(_oldNode, _newNode)
Return
Case EditKind.Insert
ClassifyInsert(_newNode)
Return
Case EditKind.Reorder
ClassifyReorder(_oldNode, _newNode)
Return
Case Else
Throw ExceptionUtilities.Unreachable
End Select
End Sub
#Region "Move and Reorder"
Private Sub ClassifyMove(oldNode As SyntaxNode, newNode As SyntaxNode)
ReportError(RudeEditKind.Move)
End Sub
Private Sub ClassifyReorder(oldNode As SyntaxNode, newNode As SyntaxNode)
Select Case newNode.Kind
Case SyntaxKind.OptionStatement,
SyntaxKind.ImportsStatement,
SyntaxKind.AttributesStatement,
SyntaxKind.NamespaceBlock,
SyntaxKind.ClassBlock,
SyntaxKind.StructureBlock,
SyntaxKind.InterfaceBlock,
SyntaxKind.ModuleBlock,
SyntaxKind.EnumBlock,
SyntaxKind.DelegateFunctionStatement,
SyntaxKind.DelegateSubStatement,
SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement,
SyntaxKind.ConstructorBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.PropertyBlock,
SyntaxKind.EventBlock,
SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock,
SyntaxKind.ClassConstraint,
SyntaxKind.StructureConstraint,
SyntaxKind.NewConstraint,
SyntaxKind.TypeConstraint,
SyntaxKind.AttributeList,
SyntaxKind.Attribute
' We'll ignore these edits. A general policy is to ignore edits that are only discoverable via reflection.
Return
Case SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement
' Interface methods. We could allow reordering of non-COM interface methods.
Debug.Assert(oldNode.Parent.IsKind(SyntaxKind.InterfaceBlock) AndAlso newNode.Parent.IsKind(SyntaxKind.InterfaceBlock))
ReportError(RudeEditKind.Move)
Return
Case SyntaxKind.PropertyStatement,
SyntaxKind.FieldDeclaration,
SyntaxKind.EventStatement,
SyntaxKind.VariableDeclarator
' Maybe we could allow changing order of field declarations unless the containing type layout is sequential,
' and it's not a COM interface.
ReportError(RudeEditKind.Move)
Return
Case SyntaxKind.EnumMemberDeclaration
' To allow this change we would need to check that values of all fields of the enum
' are preserved, or make sure we can update all method bodies that accessed those that changed.
ReportError(RudeEditKind.Move)
Return
Case SyntaxKind.TypeParameter,
SyntaxKind.Parameter
ReportError(RudeEditKind.Move)
Return
Case SyntaxKind.ModifiedIdentifier
' Identifier can only moved from one VariableDeclarator to another if both are part of
' the same declaration. We could allow these moves if the order and types of variables
' didn't change.
ReportError(RudeEditKind.Move)
Return
Case Else
Throw ExceptionUtilities.Unreachable
End Select
End Sub
#End Region
#Region "Insert"
Private Sub ClassifyInsert(node As SyntaxNode)
Select Case node.Kind
Case SyntaxKind.OptionStatement,
SyntaxKind.ImportsStatement,
SyntaxKind.NamespaceBlock
ReportError(RudeEditKind.Insert)
Return
Case SyntaxKind.ClassBlock,
SyntaxKind.StructureBlock
ClassifyTypeWithPossibleExternMembersInsert(DirectCast(node, TypeBlockSyntax))
Return
Case SyntaxKind.InterfaceBlock
ClassifyTypeInsert(DirectCast(node, TypeBlockSyntax).BlockStatement.Modifiers)
Return
Case SyntaxKind.EnumBlock
ClassifyTypeInsert(DirectCast(node, EnumBlockSyntax).EnumStatement.Modifiers)
Return
Case SyntaxKind.ModuleBlock
' Modules can't be nested or private
ReportError(RudeEditKind.Insert)
Return
Case SyntaxKind.DelegateSubStatement,
SyntaxKind.DelegateFunctionStatement
ClassifyTypeInsert(DirectCast(node, DelegateStatementSyntax).Modifiers)
Return
Case SyntaxKind.SubStatement, ' interface method
SyntaxKind.FunctionStatement ' interface method
ReportError(RudeEditKind.Insert)
Return
Case SyntaxKind.PropertyBlock
ClassifyModifiedMemberInsert(DirectCast(node, PropertyBlockSyntax).PropertyStatement.Modifiers)
Return
Case SyntaxKind.PropertyStatement ' autoprop or interface property
' We don't need to check whether the container is an interface, since we disallow
' adding public methods And all methods in interface declarations are public.
ClassifyModifiedMemberInsert(DirectCast(node, PropertyStatementSyntax).Modifiers)
Return
Case SyntaxKind.EventBlock
ClassifyModifiedMemberInsert(DirectCast(node, EventBlockSyntax).EventStatement.Modifiers)
Return
Case SyntaxKind.EventStatement
ClassifyModifiedMemberInsert(DirectCast(node, EventStatementSyntax).Modifiers)
Return
Case SyntaxKind.OperatorBlock
ReportError(RudeEditKind.InsertOperator)
Return
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock
ClassifyMethodInsert(DirectCast(node, MethodBlockSyntax).SubOrFunctionStatement)
Return
Case SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement
' CLR doesn't support adding P/Invokes
ReportError(RudeEditKind.Insert)
Return
Case SyntaxKind.ConstructorBlock
If SyntaxUtilities.IsParameterlessConstructor(node) Then
Return
End If
ClassifyModifiedMemberInsert(DirectCast(node, MethodBlockBaseSyntax).BlockStatement.Modifiers)
Return
Case SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
Return
Case SyntaxKind.FieldDeclaration
ClassifyFieldInsert(DirectCast(node, FieldDeclarationSyntax))
Return
Case SyntaxKind.VariableDeclarator
' Ignore, errors will be reported for children (ModifiedIdentifier, AsClause)
Return
Case SyntaxKind.ModifiedIdentifier
ClassifyFieldInsert(DirectCast(node, ModifiedIdentifierSyntax))
Return
Case SyntaxKind.EnumMemberDeclaration,
SyntaxKind.TypeParameter,
SyntaxKind.StructureConstraint,
SyntaxKind.TypeParameterSingleConstraintClause,
SyntaxKind.TypeParameterMultipleConstraintClause,
SyntaxKind.ClassConstraint,
SyntaxKind.StructureConstraint,
SyntaxKind.NewConstraint,
SyntaxKind.TypeConstraint,
SyntaxKind.TypeParameterList,
SyntaxKind.Parameter,
SyntaxKind.Attribute,
SyntaxKind.AttributeList,
SyntaxKind.AttributesStatement,
SyntaxKind.SimpleAsClause
ReportError(RudeEditKind.Insert)
Return
Case SyntaxKind.ParameterList
ClassifyParameterInsert(DirectCast(node, ParameterListSyntax))
Return
Case Else
Throw ExceptionUtilities.UnexpectedValue(node.Kind())
End Select
End Sub
Private Function ClassifyModifiedMemberInsert(modifiers As SyntaxTokenList) As Boolean
If modifiers.Any(SyntaxKind.OverridableKeyword) OrElse
modifiers.Any(SyntaxKind.MustOverrideKeyword) OrElse
modifiers.Any(SyntaxKind.OverridesKeyword) Then
ReportError(RudeEditKind.InsertVirtual)
Return False
End If
Return True
End Function
Private Function ClassifyTypeInsert(modifiers As SyntaxTokenList) As Boolean
Return ClassifyModifiedMemberInsert(modifiers)
End Function
Private Sub ClassifyTypeWithPossibleExternMembersInsert(type As TypeBlockSyntax)
If Not ClassifyTypeInsert(type.BlockStatement.Modifiers) Then
Return
End If
For Each member In type.Members
Dim modifiers As SyntaxTokenList = Nothing
Select Case member.Kind
Case SyntaxKind.DeclareFunctionStatement,
SyntaxKind.DeclareSubStatement
ReportError(RudeEditKind.Insert, member, member)
Case SyntaxKind.PropertyStatement
modifiers = DirectCast(member, PropertyStatementSyntax).Modifiers
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock
modifiers = DirectCast(member, MethodBlockBaseSyntax).BlockStatement.Modifiers
End Select
' TODO: DllImport/Declare?
'If (modifiers.Any(SyntaxKind.MustOverrideKeyword)) Then
' ReportError(RudeEditKind.InsertMustOverride, member, member)
'End If
Next
End Sub
Private Sub ClassifyMethodInsert(method As MethodStatementSyntax)
If method.TypeParameterList IsNot Nothing Then
ReportError(RudeEditKind.InsertGenericMethod)
End If
If method.HandlesClause IsNot Nothing Then
ReportError(RudeEditKind.InsertHandlesClause)
End If
ClassifyModifiedMemberInsert(method.Modifiers)
End Sub
Private Sub ClassifyFieldInsert(field As FieldDeclarationSyntax)
' Can't insert WithEvents field since it is effectively a virtual property.
If field.Modifiers.Any(SyntaxKind.WithEventsKeyword) Then
ReportError(RudeEditKind.Insert)
Return
End If
Dim containingType = field.Parent
If containingType.IsKind(SyntaxKind.ModuleBlock) Then
ReportError(RudeEditKind.Insert)
Return
End If
End Sub
Private Sub ClassifyFieldInsert(fieldVariableName As ModifiedIdentifierSyntax)
ClassifyFieldInsert(DirectCast(fieldVariableName.Parent.Parent, FieldDeclarationSyntax))
End Sub
Private Sub ClassifyParameterInsert(parameterList As ParameterListSyntax)
' Sub M -> Sub M() is ok
If parameterList.Parameters.Count = 0 Then
Return
End If
ReportError(RudeEditKind.Insert)
End Sub
#End Region
#Region "Delete"
Private Sub ClassifyDelete(oldNode As SyntaxNode)
Select Case oldNode.Kind
Case SyntaxKind.OptionStatement,
SyntaxKind.ImportsStatement,
SyntaxKind.AttributesStatement,
SyntaxKind.NamespaceBlock,
SyntaxKind.ClassBlock,
SyntaxKind.StructureBlock,
SyntaxKind.InterfaceBlock,
SyntaxKind.ModuleBlock,
SyntaxKind.DelegateFunctionStatement,
SyntaxKind.DelegateSubStatement,
SyntaxKind.EnumBlock,
SyntaxKind.FieldDeclaration,
SyntaxKind.ModifiedIdentifier,
SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.OperatorBlock,
SyntaxKind.PropertyBlock,
SyntaxKind.PropertyStatement,
SyntaxKind.EventBlock,
SyntaxKind.EventStatement,
SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement
' To allow removal of declarations we would need to update method bodies that
' were previously binding to them but now are binding to another symbol that was previously hidden.
ReportError(RudeEditKind.Delete)
Return
Case SyntaxKind.ConstructorBlock
' Allow deletion of a parameterless constructor.
' Semantic analysis reports an error if the parameterless ctor isn't replaced by a default ctor.
If Not SyntaxUtilities.IsParameterlessConstructor(oldNode) Then
ReportError(RudeEditKind.Delete)
End If
Return
Case SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
' An accessor can be removed. Accessors are not hiding other symbols.
' If the new compilation still uses the removed accessor a semantic error will be reported.
' For simplicity though we disallow deletion of accessors for now.
ReportError(RudeEditKind.Delete)
Return
Case SyntaxKind.AttributeList,
SyntaxKind.Attribute
' To allow removal of attributes we would need to check if the removed attribute
' is a pseudo-custom attribute that CLR allows us to change, or if it is a compiler well-know attribute
' that affects the generated IL.
ReportError(RudeEditKind.Delete)
Return
Case SyntaxKind.EnumMemberDeclaration
' We could allow removing enum member if it didn't affect the values of other enum members.
' If the updated compilation binds without errors it means that the enum value wasn't used.
ReportError(RudeEditKind.Delete)
Return
Case SyntaxKind.TypeParameter,
SyntaxKind.TypeParameterList,
SyntaxKind.Parameter,
SyntaxKind.TypeParameterSingleConstraintClause,
SyntaxKind.TypeParameterMultipleConstraintClause,
SyntaxKind.ClassConstraint,
SyntaxKind.StructureConstraint,
SyntaxKind.NewConstraint,
SyntaxKind.TypeConstraint,
SyntaxKind.SimpleAsClause
ReportError(RudeEditKind.Delete)
Return
Case SyntaxKind.ParameterList
ClassifyDelete(DirectCast(oldNode, ParameterListSyntax))
Case SyntaxKind.VariableDeclarator
' Ignore, errors will be reported for children (ModifiedIdentifier, AsClause)
Return
Case Else
Throw ExceptionUtilities.Unreachable
End Select
End Sub
Private Sub ClassifyDelete(oldNode As ParameterListSyntax)
' Sub Foo() -> Sub Foo is ok
If oldNode.Parameters.Count = 0 Then
Return
End If
ReportError(RudeEditKind.Delete)
End Sub
#End Region
#Region "Update"
Private Sub ClassifyUpdate(oldNode As SyntaxNode, newNode As SyntaxNode)
Select Case newNode.Kind
Case SyntaxKind.OptionStatement
ReportError(RudeEditKind.Update)
Return
Case SyntaxKind.ImportsStatement
ReportError(RudeEditKind.Update)
Return
Case SyntaxKind.NamespaceBlock
Return
Case SyntaxKind.NamespaceStatement
ClassifyUpdate(DirectCast(oldNode, NamespaceStatementSyntax), DirectCast(newNode, NamespaceStatementSyntax))
Return
Case SyntaxKind.ClassBlock,
SyntaxKind.StructureBlock,
SyntaxKind.InterfaceBlock,
SyntaxKind.ModuleBlock
ClassifyUpdate(DirectCast(oldNode, TypeBlockSyntax), DirectCast(newNode, TypeBlockSyntax))
Return
Case SyntaxKind.ClassStatement,
SyntaxKind.StructureStatement,
SyntaxKind.InterfaceStatement,
SyntaxKind.ModuleStatement
ClassifyUpdate(DirectCast(oldNode, TypeStatementSyntax), DirectCast(newNode, TypeStatementSyntax))
Return
Case SyntaxKind.EnumBlock
Return
Case SyntaxKind.EnumStatement
ClassifyUpdate(DirectCast(oldNode, EnumStatementSyntax), DirectCast(newNode, EnumStatementSyntax))
Return
Case SyntaxKind.DelegateSubStatement,
SyntaxKind.DelegateFunctionStatement
ClassifyUpdate(DirectCast(oldNode, DelegateStatementSyntax), DirectCast(newNode, DelegateStatementSyntax))
Return
Case SyntaxKind.FieldDeclaration
ClassifyUpdate(DirectCast(oldNode, FieldDeclarationSyntax), DirectCast(newNode, FieldDeclarationSyntax))
Return
Case SyntaxKind.VariableDeclarator
ClassifyUpdate(DirectCast(oldNode, VariableDeclaratorSyntax), DirectCast(newNode, VariableDeclaratorSyntax))
Return
Case SyntaxKind.ModifiedIdentifier
ClassifyUpdate(DirectCast(oldNode, ModifiedIdentifierSyntax), DirectCast(newNode, ModifiedIdentifierSyntax))
Return
Case SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock
ClassifyUpdate(DirectCast(oldNode, MethodBlockSyntax), DirectCast(newNode, MethodBlockSyntax))
Return
Case SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement
ClassifyUpdate(DirectCast(oldNode, DeclareStatementSyntax), DirectCast(newNode, DeclareStatementSyntax))
Return
Case SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement
ClassifyUpdate(DirectCast(oldNode, MethodStatementSyntax), DirectCast(newNode, MethodStatementSyntax))
Return
Case SyntaxKind.SimpleAsClause
ClassifyUpdate(DirectCast(oldNode, SimpleAsClauseSyntax), DirectCast(newNode, SimpleAsClauseSyntax))
Return
Case SyntaxKind.OperatorBlock
ClassifyUpdate(DirectCast(oldNode, OperatorBlockSyntax), DirectCast(newNode, OperatorBlockSyntax))
Return
Case SyntaxKind.OperatorStatement
ClassifyUpdate(DirectCast(oldNode, OperatorStatementSyntax), DirectCast(newNode, OperatorStatementSyntax))
Return
Case SyntaxKind.ConstructorBlock
ClassifyUpdate(DirectCast(oldNode, ConstructorBlockSyntax), DirectCast(newNode, ConstructorBlockSyntax))
Return
Case SyntaxKind.SubNewStatement
ClassifyUpdate(DirectCast(oldNode, SubNewStatementSyntax), DirectCast(newNode, SubNewStatementSyntax))
Return
Case SyntaxKind.PropertyBlock
Return
Case SyntaxKind.PropertyStatement
ClassifyUpdate(DirectCast(oldNode, PropertyStatementSyntax), DirectCast(newNode, PropertyStatementSyntax))
Return
Case SyntaxKind.EventBlock
Return
Case SyntaxKind.EventStatement
ClassifyUpdate(DirectCast(oldNode, EventStatementSyntax), DirectCast(newNode, EventStatementSyntax))
Return
Case SyntaxKind.GetAccessorStatement,
SyntaxKind.SetAccessorStatement,
SyntaxKind.AddHandlerAccessorStatement,
SyntaxKind.RemoveHandlerAccessorStatement,
SyntaxKind.RaiseEventAccessorStatement
Return
Case SyntaxKind.GetAccessorBlock,
SyntaxKind.SetAccessorBlock,
SyntaxKind.AddHandlerAccessorBlock,
SyntaxKind.RemoveHandlerAccessorBlock,
SyntaxKind.RaiseEventAccessorBlock
ClassifyUpdate(DirectCast(oldNode, AccessorBlockSyntax), DirectCast(newNode, AccessorBlockSyntax))
Return
Case SyntaxKind.EnumMemberDeclaration
ClassifyUpdate(DirectCast(oldNode, EnumMemberDeclarationSyntax), DirectCast(newNode, EnumMemberDeclarationSyntax))
Return
Case SyntaxKind.StructureConstraint,
SyntaxKind.ClassConstraint,
SyntaxKind.NewConstraint
ReportError(RudeEditKind.ConstraintKindUpdate,
{DirectCast(oldNode, SpecialConstraintSyntax).ConstraintKeyword.ValueText,
DirectCast(newNode, SpecialConstraintSyntax).ConstraintKeyword.ValueText})
Return
Case SyntaxKind.TypeConstraint
ReportError(RudeEditKind.TypeUpdate)
Return
Case SyntaxKind.TypeParameterMultipleConstraintClause,
SyntaxKind.TypeParameterSingleConstraintClause
Return
Case SyntaxKind.TypeParameter
ClassifyUpdate(DirectCast(oldNode, TypeParameterSyntax), DirectCast(newNode, TypeParameterSyntax))
Return
Case SyntaxKind.Parameter
ClassifyUpdate(DirectCast(oldNode, ParameterSyntax), DirectCast(newNode, ParameterSyntax))
Return
Case SyntaxKind.Attribute
ReportError(RudeEditKind.Update)
Return
Case SyntaxKind.TypeParameterList,
SyntaxKind.ParameterList,
SyntaxKind.AttributeList
Return
Case Else
Throw ExceptionUtilities.Unreachable
End Select
End Sub
Private Sub ClassifyUpdate(oldNode As NamespaceStatementSyntax, newNode As NamespaceStatementSyntax)
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.Name, newNode.Name))
ReportError(RudeEditKind.Renamed)
End Sub
Private Sub ClassifyUpdate(oldNode As TypeStatementSyntax, newNode As TypeStatementSyntax)
If oldNode.RawKind <> newNode.RawKind Then
ReportError(RudeEditKind.TypeKindUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier))
ReportError(RudeEditKind.Renamed)
End Sub
Private Sub ClassifyUpdate(oldNode As TypeBlockSyntax, newNode As TypeBlockSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Inherits, newNode.Inherits) OrElse
Not SyntaxFactory.AreEquivalent(oldNode.Implements, newNode.Implements) Then
ReportError(RudeEditKind.BaseTypeOrInterfaceUpdate)
End If
' type member list separators
End Sub
Private Sub ClassifyUpdate(oldNode As EnumStatementSyntax, newNode As EnumStatementSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.UnderlyingType, newNode.UnderlyingType))
ReportError(RudeEditKind.EnumUnderlyingTypeUpdate)
End Sub
Private Sub ClassifyUpdate(oldNode As DelegateStatementSyntax, newNode As DelegateStatementSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
' Function changed to Sub or vice versa. Note that Function doesn't need to have AsClause.
If oldNode.RawKind <> newNode.RawKind Then
ReportError(RudeEditKind.TypeUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.AsClause, newNode.AsClause) Then
ReportError(RudeEditKind.TypeUpdate)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier))
ReportError(RudeEditKind.Renamed)
End Sub
Private Sub ClassifyUpdate(oldNode As FieldDeclarationSyntax, newNode As FieldDeclarationSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
End If
' VariableDeclarator separators were modified
End Sub
Private Sub ClassifyUpdate(oldNode As ModifiedIdentifierSyntax, newNode As ModifiedIdentifierSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
' TODO (tomat): We could be smarter and consider the following syntax changes to be legal:
' Dim a? As Integer <-> Dim a As Integer?
' Dim a() As Integer <-> Dim a As Integer()
If Not SyntaxFactory.AreEquivalent(oldNode.ArrayRankSpecifiers, newNode.ArrayRankSpecifiers) OrElse
Not SyntaxFactory.AreEquivalent(oldNode.Nullable, newNode.Nullable) Then
ReportError(RudeEditKind.TypeUpdate)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.ArrayBounds, newNode.ArrayBounds))
If oldNode.ArrayBounds Is Nothing OrElse
newNode.ArrayBounds Is Nothing OrElse
oldNode.ArrayBounds.Arguments.Count <> newNode.ArrayBounds.Arguments.Count Then
ReportError(RudeEditKind.TypeUpdate)
Return
End If
' Otherwise only the size of the array changed, which is a legal initializer update
' unless it contains lambdas, queries etc.
ClassifyDeclarationBodyRudeUpdates(newNode)
End Sub
Private Sub ClassifyUpdate(oldNode As VariableDeclaratorSyntax, newNode As VariableDeclaratorSyntax)
Dim typeDeclaration = DirectCast(oldNode.Parent.Parent, TypeBlockSyntax)
If typeDeclaration.BlockStatement.Arity > 0 Then
ReportError(RudeEditKind.GenericTypeInitializerUpdate)
Return
End If
If ClassifyTypeAndInitializerUpdates(oldNode.Initializer,
oldNode.AsClause,
newNode.Initializer,
newNode.AsClause) Then
' Check if a constant field is updated:
Dim fieldDeclaration = DirectCast(oldNode.Parent, FieldDeclarationSyntax)
If fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) Then
ReportError(RudeEditKind.Update)
Return
End If
End If
End Sub
Private Sub ClassifyUpdate(oldNode As PropertyStatementSyntax, newNode As PropertyStatementSyntax)
If Not IncludesSignificantPropertyModifiers(oldNode.Modifiers, newNode.Modifiers) OrElse
Not IncludesSignificantPropertyModifiers(newNode.Modifiers, oldNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.ImplementsClause, newNode.ImplementsClause) Then
ReportError(RudeEditKind.ImplementsClauseUpdate)
Return
End If
If ClassifyTypeAndInitializerUpdates(oldNode.Initializer, oldNode.AsClause, newNode.Initializer, newNode.AsClause) Then
' change in an initializer of an auto-property
Dim typeDeclaration = DirectCast(oldNode.Parent, TypeBlockSyntax)
If typeDeclaration.BlockStatement.Arity > 0 Then
ReportError(RudeEditKind.GenericTypeInitializerUpdate)
Return
End If
End If
End Sub
Private Shared Function IncludesSignificantPropertyModifiers(subset As SyntaxTokenList, superset As SyntaxTokenList) As Boolean
For Each modifier In subset
' ReadOnly and WriteOnly keywords are redundant, it would be a semantic error if they Then didn't match the present accessors.
' We want to allow adding an accessor to a property, which requires change in the RO/WO modifiers.
If modifier.IsKind(SyntaxKind.ReadOnlyKeyword) OrElse
modifier.IsKind(SyntaxKind.WriteOnlyKeyword) Then
Continue For
End If
If Not superset.Any(modifier.Kind) Then
Return False
End If
Next
Return True
End Function
' Returns true if the initializer has changed.
Private Function ClassifyTypeAndInitializerUpdates(oldEqualsValue As EqualsValueSyntax,
oldClause As AsClauseSyntax,
newEqualsValue As EqualsValueSyntax,
newClause As AsClauseSyntax) As Boolean
Dim oldInitializer = GetInitializerExpression(oldEqualsValue, oldClause)
Dim newInitializer = GetInitializerExpression(newEqualsValue, newClause)
If newInitializer IsNot Nothing AndAlso Not SyntaxFactory.AreEquivalent(oldInitializer, newInitializer) Then
ClassifyDeclarationBodyRudeUpdates(newInitializer)
Return True
End If
Return False
End Function
Private Sub ClassifyUpdate(oldNode As EventStatementSyntax, newNode As EventStatementSyntax)
' A custom event can't be matched with a field event and vice versa:
Debug.Assert(SyntaxFactory.AreEquivalent(oldNode.CustomKeyword, newNode.CustomKeyword))
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.ImplementsClause, newNode.ImplementsClause) Then
ReportError(RudeEditKind.ImplementsClauseUpdate)
Return
End If
Dim oldHasGeneratedType = oldNode.ParameterList IsNot Nothing
Dim newHasGeneratedType = newNode.ParameterList IsNot Nothing
Debug.Assert(oldHasGeneratedType <> newHasGeneratedType)
ReportError(RudeEditKind.TypeUpdate)
End Sub
Private Sub ClassifyUpdate(oldNode As MethodBlockSyntax, newNode As MethodBlockSyntax)
ClassifyMethodBodyRudeUpdate(oldNode,
newNode,
containingMethod:=newNode,
containingType:=DirectCast(newNode.Parent, TypeBlockSyntax))
End Sub
Private Sub ClassifyUpdate(oldNode As MethodStatementSyntax, newNode As MethodStatementSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.DeclarationKeyword, newNode.DeclarationKeyword) Then
ReportError(RudeEditKind.MethodKindUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
If Not ClassifyMethodModifierUpdate(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
' TODO (tomat): We can support this
If Not SyntaxFactory.AreEquivalent(oldNode.HandlesClause, newNode.HandlesClause) Then
ReportError(RudeEditKind.HandlesClauseUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.ImplementsClause, newNode.ImplementsClause) Then
ReportError(RudeEditKind.ImplementsClauseUpdate)
Return
End If
End Sub
Private Function ClassifyMethodModifierUpdate(oldModifiers As SyntaxTokenList, newModifiers As SyntaxTokenList) As Boolean
Dim oldAsyncIndex = oldModifiers.IndexOf(SyntaxKind.AsyncKeyword)
Dim newAsyncIndex = newModifiers.IndexOf(SyntaxKind.AsyncKeyword)
If oldAsyncIndex >= 0 Then
oldModifiers = oldModifiers.RemoveAt(oldAsyncIndex)
End If
If newAsyncIndex >= 0 Then
newModifiers = newModifiers.RemoveAt(newAsyncIndex)
End If
Dim oldIteratorIndex = oldModifiers.IndexOf(SyntaxKind.IteratorKeyword)
Dim newIteratorIndex = newModifiers.IndexOf(SyntaxKind.IteratorKeyword)
If oldIteratorIndex >= 0 Then
oldModifiers = oldModifiers.RemoveAt(oldIteratorIndex)
End If
If newIteratorIndex >= 0 Then
newModifiers = newModifiers.RemoveAt(newIteratorIndex)
End If
Return SyntaxFactory.AreEquivalent(oldModifiers, newModifiers)
End Function
Private Sub ClassifyUpdate(oldNode As DeclareStatementSyntax, newNode As DeclareStatementSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.CharsetKeyword, newNode.CharsetKeyword) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.LibraryName, newNode.LibraryName) Then
ReportError(RudeEditKind.DeclareLibraryUpdate)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.AliasName, newNode.AliasName))
ReportError(RudeEditKind.DeclareAliasUpdate)
End Sub
Private Sub ClassifyUpdate(oldNode As OperatorBlockSyntax, newNode As OperatorBlockSyntax)
ClassifyMethodBodyRudeUpdate(oldNode,
newNode,
containingMethod:=Nothing,
containingType:=DirectCast(newNode.Parent, TypeBlockSyntax))
End Sub
Private Sub ClassifyUpdate(oldNode As OperatorStatementSyntax, newNode As OperatorStatementSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.OperatorToken, newNode.OperatorToken))
ReportError(RudeEditKind.Renamed)
End Sub
Private Sub ClassifyUpdate(oldNode As AccessorBlockSyntax, newNode As AccessorBlockSyntax)
Debug.Assert(newNode.Parent.IsKind(SyntaxKind.EventBlock) OrElse
newNode.Parent.IsKind(SyntaxKind.PropertyBlock))
ClassifyMethodBodyRudeUpdate(oldNode,
newNode,
containingMethod:=Nothing,
containingType:=DirectCast(newNode.Parent.Parent, TypeBlockSyntax))
End Sub
Private Sub ClassifyUpdate(oldNode As AccessorStatementSyntax, newNode As AccessorStatementSyntax)
If oldNode.RawKind <> newNode.RawKind Then
ReportError(RudeEditKind.AccessorKindUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
End Sub
Private Sub ClassifyUpdate(oldNode As EnumMemberDeclarationSyntax, newNode As EnumMemberDeclarationSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.Initializer, newNode.Initializer))
ReportError(RudeEditKind.InitializerUpdate)
End Sub
Private Sub ClassifyUpdate(oldNode As ConstructorBlockSyntax, newNode As ConstructorBlockSyntax)
ClassifyMethodBodyRudeUpdate(oldNode,
newNode,
containingMethod:=Nothing,
containingType:=DirectCast(newNode.Parent, TypeBlockSyntax))
End Sub
Private Sub ClassifyUpdate(oldNode As SubNewStatementSyntax, newNode As SubNewStatementSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
End Sub
Private Sub ClassifyUpdate(oldNode As SimpleAsClauseSyntax, newNode As SimpleAsClauseSyntax)
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.Type, newNode.Type))
ReportError(RudeEditKind.TypeUpdate, newNode.Parent, newNode.Parent)
End Sub
Private Sub ClassifyUpdate(oldNode As TypeParameterSyntax, newNode As TypeParameterSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
Debug.Assert(Not SyntaxFactory.AreEquivalent(oldNode.VarianceKeyword, newNode.VarianceKeyword))
ReportError(RudeEditKind.VarianceUpdate)
End Sub
Private Sub ClassifyUpdate(oldNode As ParameterSyntax, newNode As ParameterSyntax)
If Not SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier) Then
ReportError(RudeEditKind.Renamed)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Modifiers, newNode.Modifiers) Then
ReportError(RudeEditKind.ModifiersUpdate)
Return
End If
If Not SyntaxFactory.AreEquivalent(oldNode.Default, newNode.Default) Then
ReportError(RudeEditKind.InitializerUpdate)
Return
End If
If ClassifyTypeAndInitializerUpdates(oldNode.Default, oldNode.AsClause, newNode.Default, newNode.AsClause) Then
Return
End If
ClassifyUpdate(oldNode.Identifier, newNode.Identifier)
End Sub
Private Sub ClassifyMethodBodyRudeUpdate(oldBody As MethodBlockBaseSyntax,
newBody As MethodBlockBaseSyntax,
containingMethod As MethodBlockSyntax,
containingType As TypeBlockSyntax)
If (oldBody.EndBlockStatement Is Nothing) <> (newBody.EndBlockStatement Is Nothing) Then
If oldBody.EndBlockStatement Is Nothing Then
ReportError(RudeEditKind.MethodBodyAdd)
Return
Else
ReportError(RudeEditKind.MethodBodyDelete)
Return
End If
End If
' The method only gets called if there are no other changes to the method declaration.
' Since we got the update edit something has to be different in the body.
Debug.Assert(newBody.EndBlockStatement IsNot Nothing)
ClassifyMemberBodyRudeUpdate(containingMethod, containingType, isTriviaUpdate:=False)
ClassifyDeclarationBodyRudeUpdates(newBody)
End Sub
Public Sub ClassifyMemberBodyRudeUpdate(containingMethodOpt As MethodBlockSyntax, containingTypeOpt As TypeBlockSyntax, isTriviaUpdate As Boolean)
If containingMethodOpt?.SubOrFunctionStatement.TypeParameterList IsNot Nothing Then
ReportError(If(isTriviaUpdate, RudeEditKind.GenericMethodTriviaUpdate, RudeEditKind.GenericMethodUpdate))
Return
End If
If containingTypeOpt?.BlockStatement.Arity > 0 Then
ReportError(If(isTriviaUpdate, RudeEditKind.GenericTypeTriviaUpdate, RudeEditKind.GenericTypeUpdate))
Return
End If
End Sub
Public Sub ClassifyDeclarationBodyRudeUpdates(newDeclarationOrBody As SyntaxNode)
For Each node In newDeclarationOrBody.DescendantNodesAndSelf()
Select Case node.Kind
Case SyntaxKind.AggregateClause,
SyntaxKind.GroupByClause,
SyntaxKind.SimpleJoinClause,
SyntaxKind.GroupJoinClause
ReportError(RudeEditKind.RUDE_EDIT_COMPLEX_QUERY_EXPRESSION, node, Me._newNode)
Return
Case SyntaxKind.LocalDeclarationStatement
Dim declaration = DirectCast(node, LocalDeclarationStatementSyntax)
If declaration.Modifiers.Any(SyntaxKind.StaticKeyword) Then
ReportError(RudeEditKind.UpdateStaticLocal)
End If
End Select
Next
End Sub
#End Region
End Structure
Friend Overrides Sub ReportSyntacticRudeEdits(diagnostics As List(Of RudeEditDiagnostic),
match As Match(Of SyntaxNode),
edit As Edit(Of SyntaxNode),
editMap As Dictionary(Of SyntaxNode, EditKind))
' For most nodes we ignore Insert and Delete edits if their parent was also inserted or deleted, respectively.
' For ModifiedIdentifiers though we check the grandparent instead because variables can move across
' VariableDeclarators. Moving a variable from a VariableDeclarator that only has a single variable results in
' deletion of that declarator. We don't want to report that delete. Similarly for moving to a new VariableDeclarator.
If edit.Kind = EditKind.Delete AndAlso
edit.OldNode.IsKind(SyntaxKind.ModifiedIdentifier) AndAlso
edit.OldNode.Parent.IsKind(SyntaxKind.VariableDeclarator) Then
If HasEdit(editMap, edit.OldNode.Parent.Parent, EditKind.Delete) Then
Return
End If
ElseIf edit.Kind = EditKind.Insert AndAlso
edit.NewNode.IsKind(SyntaxKind.ModifiedIdentifier) AndAlso
edit.NewNode.Parent.IsKind(SyntaxKind.VariableDeclarator) Then
If HasEdit(editMap, edit.NewNode.Parent.Parent, EditKind.Insert) Then
Return
End If
ElseIf HasParentEdit(editMap, edit) Then
Return
End If
Dim classifier = New EditClassifier(Me, diagnostics, edit.OldNode, edit.NewNode, edit.Kind, match)
classifier.ClassifyEdit()
End Sub
Friend Overrides Sub ReportMemberUpdateRudeEdits(diagnostics As List(Of RudeEditDiagnostic), newMember As SyntaxNode, span As TextSpan?)
Dim classifier = New EditClassifier(Me, diagnostics, Nothing, newMember, EditKind.Update, span:=span)
classifier.ClassifyMemberBodyRudeUpdate(
TryCast(newMember, MethodBlockSyntax),
newMember.FirstAncestorOrSelf(Of TypeBlockSyntax)(),
isTriviaUpdate:=True)
classifier.ClassifyDeclarationBodyRudeUpdates(newMember)
End Sub
#End Region
#Region "Semantic Rude Edits"
Friend Overrides Sub ReportInsertedMemberSymbolRudeEdits(diagnostics As List(Of RudeEditDiagnostic), newSymbol As ISymbol)
' CLR doesn't support adding P/Invokes.
' VB needs to check if the type doesn't contain methods with DllImport attribute.
If newSymbol.IsKind(SymbolKind.NamedType) Then
For Each member In DirectCast(newSymbol, INamedTypeSymbol).GetMembers()
ReportDllImportInsertRudeEdit(diagnostics, member)
Next
Else
ReportDllImportInsertRudeEdit(diagnostics, newSymbol)
End If
End Sub
Private Shared Sub ReportDllImportInsertRudeEdit(diagnostics As List(Of RudeEditDiagnostic), member As ISymbol)
If member.IsKind(SymbolKind.Method) AndAlso
DirectCast(member, IMethodSymbol).GetDllImportData() IsNot Nothing Then
diagnostics.Add(New RudeEditDiagnostic(RudeEditKind.InsertDllImport,
member.Locations.First().SourceSpan))
End If
End Sub
#End Region
#Region "Exception Handling Rude Edits"
Protected Overrides Function GetExceptionHandlingAncestors(node As SyntaxNode, isLeaf As Boolean) As List(Of SyntaxNode)
Dim result = New List(Of SyntaxNode)()
Dim initialNode = node
While node IsNot Nothing
Dim kind = node.Kind
Select Case kind
Case SyntaxKind.TryBlock
If Not isLeaf Then
result.Add(node)
End If
Case SyntaxKind.CatchBlock,
SyntaxKind.FinallyBlock
result.Add(node)
Debug.Assert(node.Parent.Kind = SyntaxKind.TryBlock)
node = node.Parent
Case SyntaxKind.ClassBlock,
SyntaxKind.StructureBlock
' stop at type declaration
Exit While
End Select
' stop at lambda
If LambdaUtilities.IsLambda(node) Then
Exit While
End If
node = node.Parent
End While
Return result
End Function
Friend Overrides Sub ReportEnclosingExceptionHandlingRudeEdits(diagnostics As List(Of RudeEditDiagnostic),
exceptionHandlingEdits As IEnumerable(Of Edit(Of SyntaxNode)),
oldStatement As SyntaxNode,
newStatement As SyntaxNode)
For Each edit In exceptionHandlingEdits
Debug.Assert(edit.Kind <> EditKind.Update OrElse edit.OldNode.RawKind = edit.NewNode.RawKind)
If edit.Kind <> EditKind.Update OrElse Not AreExceptionHandlingPartsEquivalent(edit.OldNode, edit.NewNode) Then
AddRudeDiagnostic(diagnostics, edit.OldNode, edit.NewNode, newStatement)
End If
Next
End Sub
Private Shared Function AreExceptionHandlingPartsEquivalent(oldNode As SyntaxNode, newNode As SyntaxNode) As Boolean
Select Case oldNode.Kind
Case SyntaxKind.TryBlock
Dim oldTryBlock = DirectCast(oldNode, TryBlockSyntax)
Dim newTryBlock = DirectCast(newNode, TryBlockSyntax)
Return SyntaxFactory.AreEquivalent(oldTryBlock.FinallyBlock, newTryBlock.FinallyBlock) AndAlso
SyntaxFactory.AreEquivalent(oldTryBlock.CatchBlocks, newTryBlock.CatchBlocks)
Case SyntaxKind.CatchBlock,
SyntaxKind.FinallyBlock
Return SyntaxFactory.AreEquivalent(oldNode, newNode)
Case Else
Throw ExceptionUtilities.UnexpectedValue(oldNode.Kind)
End Select
End Function
''' <summary>
''' An active statement (leaf or not) inside a "Catch" makes the Catch part readonly.
''' An active statement (leaf or not) inside a "Finally" makes the whole Try/Catch/Finally part read-only.
''' An active statement (non leaf) inside a "Try" makes the Catch/Finally part read-only.
''' </summary>
Protected Overrides Function GetExceptionHandlingRegion(node As SyntaxNode, <Out> ByRef coversAllChildren As Boolean) As TextSpan
Select Case node.Kind
Case SyntaxKind.TryBlock
Dim tryBlock = DirectCast(node, TryBlockSyntax)
coversAllChildren = False
If tryBlock.CatchBlocks.Count = 0 Then
Debug.Assert(tryBlock.FinallyBlock IsNot Nothing)
Return TextSpan.FromBounds(tryBlock.FinallyBlock.SpanStart, tryBlock.EndTryStatement.Span.End)
End If
Return TextSpan.FromBounds(tryBlock.CatchBlocks.First().SpanStart, tryBlock.EndTryStatement.Span.End)
Case SyntaxKind.CatchBlock
coversAllChildren = True
Return node.Span
Case SyntaxKind.FinallyBlock
coversAllChildren = True
Return DirectCast(node.Parent, TryBlockSyntax).Span
Case Else
Throw ExceptionUtilities.UnexpectedValue(node.Kind)
End Select
End Function
#End Region
#Region "State Machines"
Friend Overrides Function IsStateMachineMethod(declaration As SyntaxNode) As Boolean
Return SyntaxUtilities.IsAsyncMethodOrLambda(declaration) OrElse
SyntaxUtilities.IsIteratorMethodOrLambda(declaration)
End Function
Protected Overrides Function GetStateMachineSuspensionPoints(body As SyntaxNode) As ImmutableArray(Of SyntaxNode)
' In VB declaration and body are represented by the same node for both lambdas and methods (unlike C#)
If SyntaxUtilities.IsAsyncMethodOrLambda(body) Then
Return SyntaxUtilities.GetAwaitExpressions(body)
Else
Return SyntaxUtilities.GetYieldStatements(body)
End If
End Function
Friend Overrides Sub ReportStateMachineSuspensionPointRudeEdits(diagnostics As List(Of RudeEditDiagnostic), oldNode As SyntaxNode, newNode As SyntaxNode)
' TODO: changes around suspension points (foreach, lock, using, etc.)
If newNode.IsKind(SyntaxKind.AwaitExpression) Then
Dim oldContainingStatementPart = FindContainingStatementPart(oldNode)
Dim newContainingStatementPart = FindContainingStatementPart(newNode)
' If the old statement has spilled state and the new doesn't, the edit is ok. We'll just not use the spilled state.
If Not SyntaxFactory.AreEquivalent(oldContainingStatementPart, newContainingStatementPart) AndAlso
Not HasNoSpilledState(newNode, newContainingStatementPart) Then
diagnostics.Add(New RudeEditDiagnostic(RudeEditKind.AwaitStatementUpdate, newContainingStatementPart.Span))
End If
End If
End Sub
Private Shared Function FindContainingStatementPart(node As SyntaxNode) As SyntaxNode
Dim statement = TryCast(node, StatementSyntax)
While statement Is Nothing
Select Case node.Parent.Kind()
Case SyntaxKind.ForStatement,
SyntaxKind.ForEachStatement,
SyntaxKind.IfStatement,
SyntaxKind.WhileStatement,
SyntaxKind.SimpleDoStatement,
SyntaxKind.SelectStatement,
SyntaxKind.UsingStatement
Return node
End Select
If LambdaUtilities.IsLambdaBodyStatementOrExpression(node) Then
Return node
End If
node = node.Parent
statement = TryCast(node, StatementSyntax)
End While
Return statement
End Function
Private Shared Function HasNoSpilledState(awaitExpression As SyntaxNode, containingStatementPart As SyntaxNode) As Boolean
Debug.Assert(awaitExpression.IsKind(SyntaxKind.AwaitExpression))
' There is nothing within the statement part surrouding the await expression.
If containingStatementPart Is awaitExpression Then
Return True
End If
Select Case containingStatementPart.Kind()
Case SyntaxKind.ExpressionStatement,
SyntaxKind.ReturnStatement
Dim expression = GetExpressionFromStatementPart(containingStatementPart)
' Await <expr>
' Return Await <expr>
If expression Is awaitExpression Then
Return True
End If
' <ident> = Await <expr>
' Return <ident> = Await <expr>
Return IsSimpleAwaitAssignment(expression, awaitExpression)
Case SyntaxKind.VariableDeclarator
' <ident> = Await <expr> in using, for, etc
' EqualsValue -> VariableDeclarator
Return awaitExpression.Parent.Parent Is containingStatementPart
Case SyntaxKind.LoopUntilStatement,
SyntaxKind.LoopWhileStatement,
SyntaxKind.DoUntilStatement,
SyntaxKind.DoWhileStatement
' Until Await <expr>
' UntilClause -> LoopUntilStatement
Return awaitExpression.Parent.Parent Is containingStatementPart
Case SyntaxKind.LocalDeclarationStatement
' Dim <ident> = Await <expr>
' EqualsValue -> VariableDeclarator -> LocalDeclarationStatement
Return awaitExpression.Parent.Parent.Parent Is containingStatementPart
End Select
Return IsSimpleAwaitAssignment(containingStatementPart, awaitExpression)
End Function
Private Shared Function GetExpressionFromStatementPart(statement As SyntaxNode) As ExpressionSyntax
Select Case statement.Kind()
Case SyntaxKind.ExpressionStatement
Return DirectCast(statement, ExpressionStatementSyntax).Expression
Case SyntaxKind.ReturnStatement
Return DirectCast(statement, ReturnStatementSyntax).Expression
Case Else
Throw ExceptionUtilities.Unreachable
End Select
End Function
Private Shared Function IsSimpleAwaitAssignment(node As SyntaxNode, awaitExpression As SyntaxNode) As Boolean
If node.IsKind(SyntaxKind.SimpleAssignmentStatement) Then
Dim assignment = DirectCast(node, AssignmentStatementSyntax)
Return assignment.Left.IsKind(SyntaxKind.IdentifierName) AndAlso assignment.Right Is awaitExpression
End If
Return False
End Function
#End Region
#Region "Rude Edits around Active Statement"
Friend Overrides Sub ReportOtherRudeEditsAroundActiveStatement(diagnostics As List(Of RudeEditDiagnostic),
match As Match(Of SyntaxNode),
oldActiveStatement As SyntaxNode,
newActiveStatement As SyntaxNode,
isLeaf As Boolean)
Dim onErrorOrResumeStatement = FindOnErrorOrResumeStatement(match.NewRoot)
If onErrorOrResumeStatement IsNot Nothing Then
AddRudeDiagnostic(diagnostics, oldActiveStatement, onErrorOrResumeStatement, newActiveStatement)
End If
ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics, match, oldActiveStatement, newActiveStatement, isLeaf)
End Sub
Private Shared Function FindOnErrorOrResumeStatement(newDeclarationOrBody As SyntaxNode) As SyntaxNode
For Each node In newDeclarationOrBody.DescendantNodes(AddressOf ChildrenCompiledInBody)
Select Case node.Kind
Case SyntaxKind.OnErrorGoToLabelStatement,
SyntaxKind.OnErrorGoToMinusOneStatement,
SyntaxKind.OnErrorGoToZeroStatement,
SyntaxKind.OnErrorResumeNextStatement,
SyntaxKind.ResumeStatement,
SyntaxKind.ResumeNextStatement,
SyntaxKind.ResumeLabelStatement
Return node
End Select
Next
Return Nothing
End Function
Private Sub ReportRudeEditsForAncestorsDeclaringInterStatementTemps(diagnostics As List(Of RudeEditDiagnostic),
match As Match(Of SyntaxNode),
oldActiveStatement As SyntaxNode,
newActiveStatement As SyntaxNode,
isLeaf As Boolean)
' Rude Edits for Using/SyncLock/With/ForEach statements that are added/updated around an active statement.
' Although such changes are technically possible, they might lead to confusion since
' the temporary variables these statements generate won't be properly initialized.
'
' We use a simple algorithm to match each New node with its old counterpart.
' If all nodes match this algorithm Is linear, otherwise it's quadratic.
'
' Unlike exception regions matching where we use LCS, we allow reordering of the statements.
ReportUnmatchedStatements(Of SyncLockBlockSyntax)(diagnostics, match, SyntaxKind.SyncLockBlock, oldActiveStatement, newActiveStatement,
areEquivalent:=Function(n1, n2) AreEquivalentIgnoringLambdaBodies(n1.SyncLockStatement.Expression, n2.SyncLockStatement.Expression),
areSimilar:=Nothing)
ReportUnmatchedStatements(Of WithBlockSyntax)(diagnostics, match, SyntaxKind.WithBlock, oldActiveStatement, newActiveStatement,
areEquivalent:=Function(n1, n2) AreEquivalentIgnoringLambdaBodies(n1.WithStatement.Expression, n2.WithStatement.Expression),
areSimilar:=Nothing)
ReportUnmatchedStatements(Of UsingBlockSyntax)(diagnostics, match, SyntaxKind.UsingBlock, oldActiveStatement, newActiveStatement,
areEquivalent:=Function(n1, n2) AreEquivalentIgnoringLambdaBodies(n1.UsingStatement.Expression, n2.UsingStatement.Expression),
areSimilar:=Nothing)
ReportUnmatchedStatements(Of ForOrForEachBlockSyntax)(diagnostics, match, SyntaxKind.ForEachBlock, oldActiveStatement, newActiveStatement,
areEquivalent:=Function(n1, n2) AreEquivalentIgnoringLambdaBodies(n1.ForOrForEachStatement, n2.ForOrForEachStatement),
areSimilar:=Function(n1, n2) AreEquivalentIgnoringLambdaBodies(DirectCast(n1.ForOrForEachStatement, ForEachStatementSyntax).ControlVariable,
DirectCast(n2.ForOrForEachStatement, ForEachStatementSyntax).ControlVariable))
End Sub
#End Region
End Class
End Namespace
|
stjeong/roslyn
|
src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb
|
Visual Basic
|
apache-2.0
| 155,094
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Utilities.IntrinsicOperators
Friend NotInheritable Class DirectCastExpressionDocumentation
Inherits AbstractCastExpressionDocumentation
Public Overrides ReadOnly Property DocumentationText As String
Get
Return VBWorkspaceResources.Introduces_a_type_conversion_operation_similar_to_CType_The_difference_is_that_CType_succeeds_as_long_as_there_is_a_valid_conversion_whereas_DirectCast_requires_that_one_type_inherit_from_or_implement_the_other_type
End Get
End Property
Public Overrides ReadOnly Property PrefixParts As IEnumerable(Of SymbolDisplayPart)
Get
Return {
New SymbolDisplayPart(SymbolDisplayPartKind.Keyword, Nothing, "DirectCast"),
New SymbolDisplayPart(SymbolDisplayPartKind.Punctuation, Nothing, "(")
}
End Get
End Property
End Class
End Namespace
|
leppie/roslyn
|
src/Workspaces/VisualBasic/Portable/Utilities/IntrinsicOperators/DirectCastExpressionDocumentation.vb
|
Visual Basic
|
apache-2.0
| 1,389
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Globalization
Imports System.Threading
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class SymbolDisplayTests
Inherits BasicTestBase
<Fact>
Public Sub TestClassNameOnlySimple()
Dim text =
<compilation>
<file name="a.vb">
class A
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("A", 0).Single()
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly)
TestSymbolDescription(
text,
findSymbol,
format,
"A",
{SymbolDisplayPartKind.ClassName})
End Sub
<Fact>
Public Sub TestClassNameOnlyComplex()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class C1
class C2
end class
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Return globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single()
End Function
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly)
TestSymbolDescription(
text,
findSymbol,
format,
"C2",
{SymbolDisplayPartKind.ClassName})
format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"C1.C2",
{SymbolDisplayPartKind.ClassName, SymbolDisplayPartKind.Operator, SymbolDisplayPartKind.ClassName})
format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces)
TestSymbolDescription(
text,
findSymbol,
format,
"N1.N2.N3.C1.C2",
{SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName})
End Sub
<Fact>
Public Sub TestFullyQualifiedFormat()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class C1
class C2
end class
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Return globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single()
End Function
TestSymbolDescription(
text,
findSymbol,
SymbolDisplayFormat.FullyQualifiedFormat,
"Global.N1.N2.N3.C1.C2",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName})
End Sub
<Fact>
Public Sub TestMethodNameOnlySimple()
Dim text =
<compilation>
<file name="a.vb">
class A
Sub M()
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("A", 0).Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat()
TestSymbolDescription(
text,
findSymbol,
format,
"M",
{SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestMethodNameOnlyComplex()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class C1
class C2
public shared function M(nullable x as integer, c as C1) as Integer()
end function
end class
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat()
TestSymbolDescription(
text,
findSymbol,
format,
"M",
{SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestClassNameOnlyWithKindSimple()
Dim text =
<compilation>
<file name="a.vb">
class A
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("A", 0).Single()
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly,
kindOptions:=SymbolDisplayKindOptions.IncludeTypeKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Class A",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName})
End Sub
<Fact()>
Public Sub TestClassWithKindComplex()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class A
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("A").Single()
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
kindOptions:=SymbolDisplayKindOptions.IncludeTypeKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Class N1.N2.N3.A",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName})
End Sub
<Fact()>
Public Sub TestNamespaceWithKindSimple()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class A
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"})
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly,
kindOptions:=SymbolDisplayKindOptions.IncludeNamespaceKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Namespace N3",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NamespaceName})
End Sub
<Fact()>
Public Sub TestNamespaceWithKindComplex()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class A
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"})
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
kindOptions:=SymbolDisplayKindOptions.IncludeNamespaceKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Namespace N1.N2.N3",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName})
End Sub
<Fact()>
Public Sub TestMethodAndParamsSimple()
Dim text =
<compilation>
<file name="a.vb">
class A
Private sub M()
End Sub
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("A", 0).Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Private Sub M()",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeType,
parameterOptions:=SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"M()",
{SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestMethodAndParamsComplex()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
namespace N2.N3
class C1
class C2
public shared function M(x? as integer, c as C1) as Integer()
end function
end class
end class
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Shared Function M(x As Integer?, c As C1) As Integer()",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact>
Public Sub TestExtensionMethodAsStatic()
Dim text =
<compilation>
<file name="a.vb">
class C1(Of T)
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource)(source As C1(Of TSource), index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C2", 0).Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.StaticMethod,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C2.M(Of TSource)(source As C1(Of TSource), index As Integer) As TSource",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName})
End Sub
<Fact>
Public Sub TestExtensionMethodAsInstance()
Dim text =
<compilation>
<file name="a.vb">
class C1(Of T)
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource)(source As C1(Of TSource), index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C2", 0).Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.InstanceMethod,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C1(Of TSource).M(index As Integer) As TSource",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName})
End Sub
<Fact>
Public Sub TestExtensionMethodAsDefault()
Dim text =
<compilation>
<file name="a.vb">
class C1(Of T)
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource)(source As C1(Of TSource), index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C2", 0).Single().
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.Default,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C2.M(Of TSource)(source As C1(Of TSource), index As Integer) As TSource",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName})
End Sub
<Fact>
Public Sub TestIrreducibleExtensionMethodAsInstance()
Dim text =
<compilation>
<file name="a.vb">
class C1(Of T)
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource As Structure)(source As C1(Of TSource), index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Dim c2Type = globalns.GetTypeMember("C2")
Dim method = c2Type.GetMember(Of MethodSymbol)("M")
Return method.Construct(c2Type)
End Function
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.InstanceMethod,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C2.M(Of C2)(source As C1(Of C2), index As Integer) As C2",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName})
End Sub
<Fact>
Public Sub TestReducedExtensionMethodAsStatic()
Dim text =
<compilation>
<file name="a.vb">
class C1
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource)(source As C1, index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Dim type = globalns.GetTypeMember("C1")
Dim method = DirectCast(globalns.GetTypeMember("C2").GetMember("M"), MethodSymbol)
Return method.ReduceExtensionMethod(type)
End Function
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.StaticMethod,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C2.M(Of TSource)(source As C1, index As Integer) As TSource",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ModuleName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName})
End Sub
<Fact>
Public Sub TestReducedExtensionMethodAsInstance()
Dim text =
<compilation>
<file name="a.vb">
class C1
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource)(source As C1, index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Dim type = globalns.GetTypeMember("C1")
Dim method = DirectCast(globalns.GetTypeMember("C2").GetMember("M"), MethodSymbol)
Return method.ReduceExtensionMethod(type)
End Function
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.InstanceMethod,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C1.M(Of TSource)(index As Integer) As TSource",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName})
End Sub
<Fact>
Public Sub TestReducedExtensionMethodAsDefault()
Dim text =
<compilation>
<file name="a.vb">
class C1
end class
module C2
<System.Runtime.CompilerServices.ExtensionAttribute()>
public function M(Of TSource)(source As C1, index As Integer) As TSource
end function
end module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Dim type = globalns.GetTypeMember("C1")
Dim method = DirectCast(globalns.GetTypeMember("C2").GetMember("M"), MethodSymbol)
Return method.ReduceExtensionMethod(type)
End Function
Dim format = New SymbolDisplayFormat(
extensionMethodStyle:=SymbolDisplayExtensionMethodStyle.Default,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeModifiers Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeContainingType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeExtensionThis Or SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Function C1.M(Of TSource)(index As Integer) As TSource",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName})
End Sub
<Fact()>
Public Sub TestNothingParameters()
Dim text =
<compilation>
<file name="a.vb">
class C1
dim public f as Integer()(,)(,,)
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C1").Single().
GetMembers("f").Single()
Dim format As SymbolDisplayFormat = Nothing
' default is show asterisks for VB. If this is changed, this test will fail
' in this case, please rewrite the test TestNoArrayAsterisks to TestArrayAsterisks
TestSymbolDescription(
text,
findSymbol,
format,
"Public f As Integer()(*,*)(*,*,*)",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation
})
End Sub
<Fact()>
Public Sub TestArrayRank()
Dim text =
<compilation>
<file name="a.vb">
class C1
dim public f as Integer()(,)(,,)
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C1").Single().
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"f As Integer()(,)(,,)",
{
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation
})
End Sub
<Fact()>
Public Sub TestEscapeKeywordIdentifiers()
Dim text =
<compilation>
<file name="a.vb">
namespace N1
class [Integer]
Class [class]
Shared Sub [shared]([boolean] As System.String)
If [boolean] Then
Console.WriteLine("true")
Else
Console.WriteLine("false")
End If
End Sub
End Class
End Class
end namespace
namespace [Global]
namespace [Integer]
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
GetTypeMembers("Integer").Single().
GetTypeMembers("class").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeType,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' no escaping because N1 does not need to be escaped
TestSymbolDescription(
text,
findSymbol,
format,
"N1.Integer.class",
{
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName
})
format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeType,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypes,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' outer class needs escaping
TestSymbolDescription(
text,
findSymbol,
format,
"[Integer].class",
{
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName
})
format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeType,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' outer class needs escaping
TestSymbolDescription(
text,
findSymbol,
format,
"[class]",
{
SymbolDisplayPartKind.ClassName
})
findSymbol = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
GetTypeMembers("Integer").Single().
GetTypeMembers("class").Single().GetMembers("shared").Single()
format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeParameters,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeType,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' actual test case from bug 4389
TestSymbolDescription(
text,
findSymbol,
format,
"Public Sub [shared]([boolean] As System.String)",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation
})
format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeParameters,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeType,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypes,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' making sure that types still get escaped if no special type formatting was chosen
TestSymbolDescription(
text,
findSymbol,
format,
"Public Sub [shared]([boolean] As [String])",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation
})
format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeAccessibility Or SymbolDisplayMemberOptions.IncludeParameters,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeName Or SymbolDisplayParameterOptions.IncludeType,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypes,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers Or SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
' making sure that types don't get escaped if special type formatting was chosen
TestSymbolDescription(
text,
findSymbol,
format,
"Public Sub [shared]([boolean] As String)",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation
})
findSymbol = Function(globalns) globalns.LookupNestedNamespace({"Global"})
format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' making sure that types don't get escaped if special type formatting was chosen
TestSymbolDescription(
text,
findSymbol,
format,
"[Global]",
{
SymbolDisplayPartKind.NamespaceName
})
format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' never escape "the" Global namespace, but escape other ns named "global" always
TestSymbolDescription(
text,
findSymbol,
format,
"Global.Global",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName
})
findSymbol = Function(globalns) globalns
' never escape "the" Global namespace, but escape other ns named "global" always
TestSymbolDescription(
text,
findSymbol,
format,
"Global",
{
SymbolDisplayPartKind.Keyword
})
findSymbol = Function(globalns) globalns.LookupNestedNamespace({"Global"}).LookupNestedNamespace({"Integer"})
' never escape "the" Global namespace, but escape other ns named "global" always
TestSymbolDescription(
text,
findSymbol,
format,
"Global.Global.Integer",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName
})
format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Omitted,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
TestSymbolDescription(
text,
findSymbol,
format,
"[Global].Integer",
{
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName
})
format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Omitted,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameOnly,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
TestSymbolDescription(
text,
findSymbol,
format,
"[Integer]",
{
SymbolDisplayPartKind.NamespaceName
})
End Sub
<Fact()>
Public Sub AlwaysEscapeMethodNamedNew()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub [New]()
End Sub
End Class
</file>
</compilation>
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeContainingType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
' The method should be escaped
TestSymbolDescription(
text,
Function(globalns As NamespaceSymbol) globalns.GetTypeMembers("C").Single().GetMembers("New").Single(),
format,
"C.[New]",
{
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName
})
' The constructor should not
TestSymbolDescription(
text,
Function(globalns As NamespaceSymbol) globalns.GetTypeMembers("C").Single().InstanceConstructors.Single(),
format,
"C.New",
{
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.Keyword
})
End Sub
<Fact()>
Public Sub TestExplicitMethodImplNameOnly()
Dim text =
<compilation>
<file name="a.vb">
Interface I
sub M()
End Sub
end Interface
Class C Implements I
sub I_M() implements I.M
End Sub
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("I_M").Single()
Dim format = New SymbolDisplayFormat(memberOptions:=SymbolDisplayMemberOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"I_M",
{SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestExplicitMethodImplNameAndInterface()
Dim text =
<compilation>
<file name="a.vb">
Interface I
sub M()
End Sub
end Interface
Class C Implements I
sub I_M() implements I.M
End Sub
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("I_M").Single()
Dim format = New SymbolDisplayFormat(memberOptions:=SymbolDisplayMemberOptions.IncludeExplicitInterface)
TestSymbolDescription(
text,
findSymbol,
format,
"I_M",
{SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestExplicitMethodImplNameAndInterfaceAndType()
Dim text =
<compilation>
<file name="a.vb">
Interface I
sub M()
End Sub
end Interface
Class C Implements I
sub I_M() implements I.M
End Sub
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("I_M").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeExplicitInterface Or SymbolDisplayMemberOptions.IncludeContainingType)
TestSymbolDescription(
text,
findSymbol,
format,
"C.I_M",
{SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestGlobalNamespaceCode()
Dim text =
<compilation>
<file name="a.vb">
Class C
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C")
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included)
TestSymbolDescription(
text,
findSymbol,
format,
"Global.C",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName})
End Sub
<Fact()>
Public Sub TestGlobalNamespaceHumanReadable()
Dim text =
<compilation>
<file name="a.vb">
Class C
End Class
namespace [Global]
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included)
TestSymbolDescription(
text,
findSymbol,
format,
"Global",
{SymbolDisplayPartKind.Keyword})
format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers)
TestSymbolDescription(
text,
findSymbol,
format,
"Global",
{SymbolDisplayPartKind.Keyword})
End Sub
<Fact()>
Public Sub TestSpecialTypes()
Dim text =
<compilation>
<file name="a.vb">
Class C
dim f as Integer
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"f As Integer",
{
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword
})
End Sub
<Fact()>
Public Sub TestNoArrayAsterisks()
Dim text =
<compilation>
<file name="a.vb">
class C1
dim public f as Integer()(,)(,,)
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C1").Single().
GetMembers("f").Single()
Dim format As SymbolDisplayFormat = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"f As Int32()(,)(,,)",
{
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation
})
End Sub
<Fact()>
Public Sub TestMetadataMethodNames()
Dim text =
<compilation>
<file name="a.vb">
Class C
New C()
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers(".ctor").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
compilerInternalOptions:=SymbolDisplayCompilerInternalOptions.UseMetadataMethodNames)
TestSymbolDescription(
text,
findSymbol,
format,
"Sub .ctor",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestArityForGenericTypes()
Dim text =
<compilation>
<file name="a.vb">
Class C(Of T, U, V)
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
compilerInternalOptions:=SymbolDisplayCompilerInternalOptions.UseArityForGenericTypes)
TestSymbolDescription(
text,
findSymbol,
format,
"C`3",
{
SymbolDisplayPartKind.ClassName,
InternalSymbolDisplayPartKind.Arity})
End Sub
<Fact()>
Public Sub TestGenericTypeParameters()
Dim text =
<compilation>
<file name="a.vb">
Class C(Of In T, Out U, V)
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C")
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters)
TestSymbolDescription(
text,
findSymbol,
format,
"C(Of T, U, V)",
{
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestGenericTypeParametersAndVariance()
Dim text =
<compilation>
<file name="a.vb">
Interface I(Of In T, Out U, V)
End Interface
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("I")
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance)
TestSymbolDescription(
text,
findSymbol,
format,
"I(Of In T, Out U, V)",
{
SymbolDisplayPartKind.InterfaceName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestGenericTypeConstraints()
Dim text =
<compilation>
<file name="a.vb">
Class C(Of T As C(Of T))
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C")
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeTypeConstraints)
TestSymbolDescription(
text,
findSymbol,
format,
"C(Of T As C(Of T))",
{
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestGenericMethodParameters()
Dim text =
<compilation>
<file name="a.vb">
Class C
Public Sub M(Of In T, Out U, V)()
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters)
TestSymbolDescription(
text,
findSymbol,
format,
"M(Of T, U, V)",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestGenericMethodParametersAndVariance()
Dim text =
<compilation>
<file name="a.vb">
Class C
Public Sub M(Of In T, Out U, V)()
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeVariance)
TestSymbolDescription(
text,
findSymbol,
format,
"M(Of T, U, V)",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestGenericMethodConstraints()
Dim text =
<compilation>
<file name="a.vb">
Class C(Of T)
Public Sub M(Of U, V As {T, Class, U})()
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters Or SymbolDisplayGenericsOptions.IncludeTypeConstraints)
TestSymbolDescription(
text,
findSymbol,
format,
"M(Of U, V As {Class, T, U})",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.TypeParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestMemberMethodNone()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub M(p as Integer)
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"M",
{SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestMemberMethodAll()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub M(p as Integer)
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Sub C.M()", {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestMemberDeclareMethodAll()
Dim text =
<compilation>
<file name="a.vb">
Class C
Declare Unicode Sub M Lib "goo" (p as Integer)
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Declare Unicode Sub C.M Lib ""goo"" ()", {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StringLiteral,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestMemberDeclareMethod_NoType()
Dim text =
<compilation>
<file name="a.vb">
Class C
Declare Unicode Sub M Lib "goo" (p as Integer)
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters)
TestSymbolDescription(
text,
findSymbol,
format,
"Public C.M()", {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestMemberDeclareMethod_NoAccessibility_NoContainingType_NoParameters()
Dim text =
<compilation>
<file name="a.vb">
Class C
Declare Unicode Sub M Lib "goo" Alias "bar" (p as Integer)
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Declare Unicode Sub M Lib ""goo"" Alias ""bar""", {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StringLiteral,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StringLiteral})
End Sub
<Fact()>
Public Sub TestMemberDeclareMethodNone()
Dim text =
<compilation>
<file name="a.vb">
Class C
Declare Unicode Sub M Lib "goo" (p as Integer)
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"M", {
SymbolDisplayPartKind.MethodName})
End Sub
<Fact()>
Public Sub TestMemberFieldNone()
Dim text =
<compilation>
<file name="a.vb">
Class C
dim f as Integer
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"f",
{SymbolDisplayPartKind.FieldName})
End Sub
<Fact()>
Public Sub TestMemberFieldAll()
Dim text =
<compilation>
<file name="a.vb">
Class C
dim f as Integer
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType)
TestSymbolDescription(
text,
findSymbol,
format,
"Private C.f As Int32",
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName
})
End Sub
<Fact>
Public Sub TestConstantFieldValue()
Dim text =
<compilation>
<file name="a.vb">
Class C
Const f As Integer = 1
End Class
</file>
</compilation>
Dim findSymbol = Function(globalns As NamespaceSymbol) _
globalns.GetTypeMembers("C", 0).Single().
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType Or
SymbolDisplayMemberOptions.IncludeConstantValue)
TestSymbolDescription(
text,
findSymbol,
format,
"Private Const C.f As Int32 = 1",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NumericLiteral)
End Sub
<Fact>
Public Sub TestConstantFieldValue_EnumMember()
Dim text =
<compilation>
<file name="a.vb">
Enum E
A
B
C
End Enum
Class C
Const f As E = E.B
End Class
</file>
</compilation>
Dim findSymbol = Function(globalns As NamespaceSymbol) _
globalns.GetTypeMembers("C", 0).Single().
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType Or
SymbolDisplayMemberOptions.IncludeConstantValue)
TestSymbolDescription(
text,
findSymbol,
format,
"Private Const C.f As E = E.B",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName)
End Sub
<Fact>
Public Sub TestConstantFieldValue_EnumMember_Flags()
Dim text =
<compilation>
<file name="a.vb">
<System.FlagsAttribute>
Enum E
A = 1
B = 2
C = 4
D = A Or B Or C
End Enum
Class C
Const f As E = E.D
End Class
</file>
</compilation>
Dim findSymbol = Function(globalns As NamespaceSymbol) _
globalns.GetTypeMembers("C", 0).Single().
GetMembers("f").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType Or
SymbolDisplayMemberOptions.IncludeConstantValue)
TestSymbolDescription(
text,
findSymbol,
format,
"Private Const C.f As E = E.D",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName)
End Sub
<Fact>
Public Sub TestEnumMember()
Dim text =
<compilation>
<file name="a.vb">
Enum E
A
B
C
End Enum
</file>
</compilation>
Dim findSymbol = Function(globalns As NamespaceSymbol) _
globalns.GetTypeMembers("E", 0).Single().
GetMembers("B").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType Or
SymbolDisplayMemberOptions.IncludeConstantValue)
TestSymbolDescription(
text,
findSymbol,
format,
"E.B = 1",
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NumericLiteral)
End Sub
<Fact>
Public Sub TestEnumMember_Flags()
Dim text =
<compilation>
<file name="a.vb">
<System.FlagsAttribute>
Enum E
A = 1
B = 2
C = 4
D = A Or B Or C
End Enum
</file>
</compilation>
Dim findSymbol = Function(globalns As NamespaceSymbol) _
globalns.GetTypeMembers("E", 0).Single().
GetMembers("D").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType Or
SymbolDisplayMemberOptions.IncludeConstantValue)
TestSymbolDescription(
text,
findSymbol,
format,
"E.D = E.A Or E.B Or E.C",
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName)
End Sub
<Fact>
Public Sub TestEnumMember_FlagsWithoutAttribute()
Dim text =
<compilation>
<file name="a.vb">
Enum E
A = 1
B = 2
C = 4
D = A Or B Or C
End Enum
</file>
</compilation>
Dim findSymbol = Function(globalns As NamespaceSymbol) _
globalns.GetTypeMembers("E", 0).Single().
GetMembers("D").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType Or
SymbolDisplayMemberOptions.IncludeConstantValue)
TestSymbolDescription(
text,
findSymbol,
format,
"E.D = 7",
SymbolDisplayPartKind.EnumName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NumericLiteral)
End Sub
<Fact()>
Public Sub TestMemberPropertyNone()
Dim text =
<compilation>
<file name="c.vb">
Class C
Private ReadOnly Property P As Integer
Get
Return 0
End Get
End Property
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("P").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"P",
{SymbolDisplayPartKind.PropertyName})
End Sub
<Fact()>
Public Sub TestMemberPropertyAll()
Dim text =
<compilation>
<file name="c.vb">
Class C
Public Default Readonly Property P(x As Object) as Integer
Get
return 23
End Get
End Property
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("P").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName)
TestSymbolDescription(
text,
findSymbol,
format,
"Public Default Property C.P(x As Object) As Int32",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName
})
End Sub
<Fact()>
Public Sub TestMemberPropertyGetSet()
Dim text =
<compilation>
<file name="c.vb">
Class C
Public ReadOnly Property P as integer
Get
Return 0
End Get
End Property
Public WriteOnly Property Q
Set
End Set
End Property
Public Property R
End Class
</file>
</compilation>
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
propertyStyle:=SymbolDisplayPropertyStyle.ShowReadWriteDescriptor)
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMembers("P").Single(),
format,
"ReadOnly Property P As Int32",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName
})
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMembers("Q").Single(),
format,
"WriteOnly Property Q As Object",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName
})
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMembers("R").Single(),
format,
"Property R As Object",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName
})
End Sub
<Fact()>
Public Sub TestPropertyGetAccessor()
Dim text =
<compilation>
<file name="c.vb">
Class C
Private Property P As Integer
Get
Return 0
End Get
Set
End Set
End Property
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("get_P").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName)
TestSymbolDescription(
text,
findSymbol,
format,
"Private Property Get C.P() As Int32",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName
})
format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName)
TestSymbolDescription(
text,
findSymbol,
format,
"Private C.P() As Int32",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName
})
End Sub
<Fact()>
Public Sub TestPropertySetAccessor()
Dim text =
<compilation>
<file name="c.vb">
Class C
Private WriteOnly Property P As Integer
Set
End Set
End Property
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMembers("set_P").Single()
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeContainingType Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName)
TestSymbolDescription(
text,
findSymbol,
format,
"Private Property Set C.P(Value As Int32)",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation
})
End Sub
<Fact()>
Public Sub TestParameterMethodNone()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub M(obj as object, byref s as short, i as integer = 1)
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=SymbolDisplayParameterOptions.None)
TestSymbolDescription(
text,
findSymbol,
format,
"M()",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestOptionalParameterBrackets()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub M(Optional i As Integer = 0)
End Sub
End Class
</file>
</compilation>
Dim findSymbol =
Function(globalns As NamespaceSymbol) globalns _
.GetMember(Of NamedTypeSymbol)("C") _
.GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeParamsRefOut Or
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName Or
SymbolDisplayParameterOptions.IncludeOptionalBrackets)
TestSymbolDescription(
text,
findSymbol,
format,
"M([i As Int32])",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestOptionalParameterValue_String()
Dim text =
<compilation>
<file name="a.vb">
Imports Microsoft.VisualBasic
Class C
Sub M(Optional s As String = ChrW(&HFFFE) & "a" & ChrW(0) & vbCrLf)
End Sub
End Class
</file>
</compilation>
Dim findSymbol =
Function(globalns As NamespaceSymbol) globalns _
.GetMember(Of NamedTypeSymbol)("C") _
.GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeParamsRefOut Or
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName Or
SymbolDisplayParameterOptions.IncludeDefaultValue)
TestSymbolDescription(
text,
findSymbol,
format,
"M(s As String = ChrW(&HFFFE) & ""a"" & vbNullChar & vbCrLf)",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.NumericLiteral,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StringLiteral,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation})
End Sub
<Fact()>
Public Sub TestOptionalParameterValue_Char()
Dim text =
<compilation>
<file name="a.vb">
Imports Microsoft.VisualBasic
Class C
Sub M(Optional a As Char = ChrW(&HFFFE), Optional b As Char = ChrW(8))
End Sub
End Class
</file>
</compilation>
Dim findSymbol =
Function(globalns As NamespaceSymbol) globalns _
.GetMember(Of NamedTypeSymbol)("C") _
.GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeParamsRefOut Or
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName Or
SymbolDisplayParameterOptions.IncludeDefaultValue)
TestSymbolDescription(
text,
findSymbol,
format,
"M(a As Char = ChrW(&HFFFE), b As Char = vbBack)",
{
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.NumericLiteral,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Punctuation
})
End Sub
<Fact()>
Public Sub TestOptionalParameterValue_InvariantCulture1()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub M(
Optional p1 as SByte = -1,
Optional p2 as Short = -1,
Optional p3 as Integer = -1,
Optional p4 as Long = -1,
Optional p5 as Single = -0.5,
Optional p6 as Double = -0.5,
Optional p7 as Decimal = -0.5)
End Sub
End Class
</file>
</compilation>
Dim oldCulture = Thread.CurrentThread.CurrentCulture
Try
Thread.CurrentThread.CurrentCulture = CType(oldCulture.Clone(), CultureInfo)
Thread.CurrentThread.CurrentCulture.NumberFormat.NegativeSign = "~"
Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator = ","
Dim Compilation = CreateCompilationWithMscorlib40(text)
Compilation.VerifyDiagnostics()
Dim methodSymbol = Compilation.GlobalNamespace.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M")
Assert.Equal("Sub C.M(" +
"[p1 As System.SByte = -1], " +
"[p2 As System.Int16 = -1], " +
"[p3 As System.Int32 = -1], " +
"[p4 As System.Int64 = -1], " +
"[p5 As System.Single = -0.5], " +
"[p6 As System.Double = -0.5], " +
"[p7 As System.Decimal = -0.5])", methodSymbol.ToTestDisplayString())
Finally
Thread.CurrentThread.CurrentCulture = oldCulture
End Try
End Sub
<Fact()>
Public Sub TestOptionalParameterValue_InvariantCulture()
Dim text =
<compilation>
<file name="a.vb">
Class C
Sub M(
Optional p1 as SByte = -1,
Optional p2 as Short = -1,
Optional p3 as Integer = -1,
Optional p4 as Long = -1,
Optional p5 as Single = -0.5,
Optional p6 as Double = -0.5,
Optional p7 as Decimal = -0.5)
End Sub
End Class
</file>
</compilation>
Dim oldCulture = Thread.CurrentThread.CurrentCulture
Try
Thread.CurrentThread.CurrentCulture = CType(oldCulture.Clone(), CultureInfo)
Thread.CurrentThread.CurrentCulture.NumberFormat.NegativeSign = "~"
Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator = ","
Dim Compilation = CreateCompilationWithMscorlib40(text)
Compilation.VerifyDiagnostics()
Dim methodSymbol = Compilation.GlobalNamespace.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M")
Assert.Equal("Sub C.M(" +
"[p1 As System.SByte = -1], " +
"[p2 As System.Int16 = -1], " +
"[p3 As System.Int32 = -1], " +
"[p4 As System.Int64 = -1], " +
"[p5 As System.Single = -0.5], " +
"[p6 As System.Double = -0.5], " +
"[p7 As System.Decimal = -0.5])", methodSymbol.ToTestDisplayString())
Finally
Thread.CurrentThread.CurrentCulture = oldCulture
End Try
End Sub
<Fact()>
Public Sub TestMethodReturnType1()
Dim text =
<compilation>
<file name="a.vb">
Class C
shared function M() as Integer
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Function M() As System.Int32",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.StructName
})
End Sub
<Fact()>
Public Sub TestMethodReturnType2()
Dim text =
<compilation>
<file name="a.vb">
Class C
shared sub M()
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").
GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword)
TestSymbolDescription(
text,
findSymbol,
format,
"Sub M()",
{
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation
})
End Sub
<Fact()>
Public Sub TestParameterMethodNameTypeModifiers()
Dim text =
<compilation>
<file name="a.vb">
Class C
Public Sub M(byref s as short, i as integer , ParamArray args as string())
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M")
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeParamsRefOut Or
SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName)
TestSymbolDescription(
text,
findSymbol,
format,
"M(ByRef s As Int16, i As Int32, ParamArray args As String())",
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation)
' Without SymbolDisplayParameterOptions.IncludeParamsRefOut.
TestSymbolDescription(
text,
findSymbol,
format.WithParameterOptions(SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeName),
"M(s As Int16, i As Int32, args As String())",
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation)
' Without SymbolDisplayParameterOptions.IncludeType.
TestSymbolDescription(
text,
findSymbol,
format.WithParameterOptions(SymbolDisplayParameterOptions.IncludeParamsRefOut Or SymbolDisplayParameterOptions.IncludeName),
"M(ByRef s, i, ParamArray args)",
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Punctuation)
End Sub
' "Public" and "MustOverride" should not be included for interface members.
<Fact()>
Public Sub TestInterfaceMembers()
Dim text =
<compilation>
<file name="a.vb">
Interface I
Property P As Integer
Function F() As Object
End Interface
MustInherit Class C
MustOverride Function F() As Object
Interface I
Sub M()
End Interface
End Class
</file>
</compilation>
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
propertyStyle:=
SymbolDisplayPropertyStyle.ShowReadWriteDescriptor,
miscellaneousOptions:=
SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("I", 0).Single().GetMembers("P").Single(),
format,
"Property P As Integer")
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("I", 0).Single().GetMembers("F").Single(),
format,
"Function F() As Object")
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMembers("F").Single(),
format,
"Public MustOverride Function F() As Object")
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetTypeMembers("I", 0).Single().GetMember(Of MethodSymbol)("M"),
format,
"Sub M()")
End Sub
' "Shared" should not be included for Module members.
<Fact()>
Public Sub TestSharedMembers()
Dim text =
<compilation>
<file name="a.vb">
Class C
Shared Sub M()
End Sub
Public Shared F As Integer
Public Shared P As Object
End Class
Module M
Sub M()
End Sub
Public F As Integer
Public P As Object
End Module
</file>
</compilation>
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
miscellaneousOptions:=
SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMember(Of MethodSymbol)("M"),
format,
"Public Shared Sub M()")
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMembers("F").Single(),
format,
"Public Shared F As Integer")
TestSymbolDescription(
text,
Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMembers("P").Single(),
format,
"Public Shared P As Object")
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("M", 0).Single().GetMember(Of MethodSymbol)("M"),
format,
"Public Sub M()")
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("M", 0).Single().GetMembers("F").Single(),
format,
"Public F As Integer")
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("M", 0).Single().GetMembers("P").Single(),
format,
"Public P As Object")
End Sub
<WorkItem(540253, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540253")>
<Fact()>
Public Sub TestOverloads()
Dim text =
<compilation>
<file name="a.vb">
MustInherit Class B
Protected MustOverride Overloads Function M(s As Single)
Overloads Sub M()
End Sub
Friend NotOverridable Overloads WriteOnly Property P(x)
Set(value)
End Set
End Property
Overloads ReadOnly Property P(x, y)
Get
Return Nothing
End Get
End Property
Public Overridable Overloads ReadOnly Property Q
Get
Return Nothing
End Get
End Property
End Class
</file>
</compilation>
Dim format = New SymbolDisplayFormat(
memberOptions:=
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeExplicitInterface Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
propertyStyle:=
SymbolDisplayPropertyStyle.ShowReadWriteDescriptor,
parameterOptions:=
SymbolDisplayParameterOptions.IncludeName Or
SymbolDisplayParameterOptions.IncludeType)
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("B", 0).Single().GetMembers("M").First(),
format,
"Protected MustOverride Overloads Function M(s As Single) As Object")
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("B", 0).Single().GetMembers("P").First(),
format,
"Friend NotOverridable Overloads WriteOnly Property P(x As Object) As Object")
TestSymbolDescription(
text,
Function(globalns) globalns.GetTypeMembers("B", 0).Single().GetMembers("Q").First(),
format,
"Public Overridable Overloads ReadOnly Property Q As Object")
End Sub
<Fact>
Public Sub TestAlias1()
Dim text =
<compilation>
<file name="a.vb">Imports Goo=N1.N2.N3
Namespace N1
NAmespace N2
NAmespace N3
class C1
class C2
End class
End class
ENd namespace
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces)
TestSymbolDescription(
text,
findSymbol,
format,
"Goo.C1.C2",
code.IndexOf("Namespace", StringComparison.Ordinal),
{
SymbolDisplayPartKind.AliasName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName}, True)
End Sub
<Fact>
Public Sub TestAlias2()
Dim text =
<compilation>
<file name="a.vb">Imports Goo=N1.N2.N3.C1
Namespace N1
NAmespace N2
NAmespace N3
class C1
class C2
End class
End class
ENd namespace
end namespace
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"}).
GetTypeMembers("C1").Single().
GetTypeMembers("C2").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
Dim format = New SymbolDisplayFormat(
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces)
TestSymbolDescription(
text,
findSymbol,
format,
"Goo.C2",
code.IndexOf("Namespace", StringComparison.Ordinal),
{
SymbolDisplayPartKind.AliasName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName}, True)
End Sub
<Fact>
Public Sub TestAlias3()
Dim text =
<compilation>
<file name="a.vb">Imports Goo = N1.C1
Namespace N1
Class C1
End Class
Class Goo
End Class
end namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.LookupNestedNamespace({"N1"}).
GetTypeMembers("C1").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
Dim format = SymbolDisplayFormat.MinimallyQualifiedFormat
TestSymbolDescription(
text,
findSymbol,
format,
"C1",
code.IndexOf("Class Goo", StringComparison.Ordinal),
{
SymbolDisplayPartKind.ClassName}, True)
End Sub
<Fact>
Public Sub TestMinimalNamespace1()
Dim text =
<compilation>
<file name="a.vb">
Imports Microsoft
Imports OUTER
namespace N0
end namespace
namespace N1
namespace N2
namespace N3
class C1
class C2
end class
end class
end namespace
end namespace
end namespace
Module Program
Sub Main(args As String())
Dim x As Microsoft.VisualBasic.Collection
Dim y As OUTER.INNER.GOO
End Sub
End Module
Namespace OUTER
Namespace INNER
Friend Class GOO
End Class
End Namespace
End Namespace
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Return globalns.LookupNestedNamespace({"N1"}).
LookupNestedNamespace({"N2"}).
LookupNestedNamespace({"N3"})
End Function
Dim format = New SymbolDisplayFormat()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, format,
"N1.N2.N3",
code.IndexOf("N0", StringComparison.Ordinal), {
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName}, True)
TestSymbolDescription(text, findSymbol, format,
"N1.N2.N3",
text.Value.IndexOf("N1", StringComparison.Ordinal), {
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName}, True)
TestSymbolDescription(text, findSymbol, format,
"N2.N3",
text.Value.IndexOf("N2", StringComparison.Ordinal), {
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName}, True)
TestSymbolDescription(text, findSymbol, format,
"N3",
text.Value.IndexOf("C1", StringComparison.Ordinal),
{SymbolDisplayPartKind.NamespaceName}, True)
TestSymbolDescription(text, findSymbol, format,
"N3",
text.Value.IndexOf("C2", StringComparison.Ordinal),
{SymbolDisplayPartKind.NamespaceName}, True)
Dim findGOO As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Return globalns.LookupNestedNamespace({"OUTER"}).
LookupNestedNamespace({"INNER"}).GetTypeMembers("Goo").Single()
End Function
TestSymbolDescription(text, findGOO, format,
"INNER.GOO",
text.Value.IndexOf("OUTER.INNER.GOO", StringComparison.Ordinal),
{SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName}, True)
Dim findCollection As Func(Of NamespaceSymbol, Symbol) = Function(globalns)
Return globalns.LookupNestedNamespace({"Microsoft"}).
LookupNestedNamespace({"VisualBasic"}).GetTypeMembers("Collection").Single()
End Function
TestSymbolDescription(text, findCollection, format,
"VisualBasic.Collection",
text.Value.IndexOf("Microsoft.VisualBasic.Collection", StringComparison.Ordinal),
{SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName}, minimal:=True, references:={SystemRef, MsvbRef})
End Sub
<Fact>
Public Sub TestMinimalClass1()
Dim text =
<compilation>
<file name="a.vb">
imports System.Collections.Generic
class C1
Dim Private goo as System.Collections.Generic.IDictionary(Of System.Collections.Generic.IList(Of System.Int32), System.String)
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("C1").Single().
GetMembers("goo").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, Nothing,
"C1.goo As IDictionary(Of IList(Of Integer), String)",
code.IndexOf("goo", StringComparison.Ordinal), {
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.InterfaceName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.InterfaceName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation}, minimal:=True)
End Sub
<Fact()>
Public Sub TestRemoveAttributeSuffix1()
Dim text =
<compilation>
<file name="a.vb">
Class Class1Attribute
Inherits System.Attribute
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("Class1Attribute").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, New SymbolDisplayFormat(),
"Class1Attribute",
SymbolDisplayPartKind.ClassName)
TestSymbolDescription(text, findSymbol, New SymbolDisplayFormat(miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.RemoveAttributeSuffix),
"Class1",
code.IndexOf("Inherits System.Attribute", StringComparison.Ordinal), {
SymbolDisplayPartKind.ClassName}, minimal:=True)
End Sub
<Fact>
Public Sub TestRemoveAttributeSuffix2()
Dim text =
<compilation>
<file name="a.vb">
Class ClassAttribute
Inherits System.Attribute
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("ClassAttribute").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, New SymbolDisplayFormat(),
"ClassAttribute",
SymbolDisplayPartKind.ClassName)
TestSymbolDescription(text, findSymbol,
New SymbolDisplayFormat(miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.RemoveAttributeSuffix),
"ClassAttribute",
SymbolDisplayPartKind.ClassName)
End Sub
<Fact>
Public Sub TestRemoveAttributeSuffix3()
Dim text =
<compilation>
<file name="a.vb">
Class _Attribute
Inherits System.Attribute
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("_Attribute").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, New SymbolDisplayFormat(),
"_Attribute",
SymbolDisplayPartKind.ClassName)
TestSymbolDescription(text, findSymbol,
New SymbolDisplayFormat(miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.RemoveAttributeSuffix),
"_Attribute",
SymbolDisplayPartKind.ClassName)
End Sub
<Fact>
Public Sub TestRemoveAttributeSuffix4()
Dim text =
<compilation>
<file name="a.vb">
Class Class1Attribute
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("Class1Attribute").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, New SymbolDisplayFormat(),
"Class1Attribute",
SymbolDisplayPartKind.ClassName)
TestSymbolDescription(text, findSymbol,
New SymbolDisplayFormat(miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.RemoveAttributeSuffix),
"Class1Attribute",
SymbolDisplayPartKind.ClassName)
End Sub
<WorkItem(537447, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537447")>
<Fact>
Public Sub TestBug2239()
Dim text =
<compilation>
<file name="a.vb">Imports Goo=N1.N2.N3
class GC1(Of T)
end class
class X
inherits GC1(Of BOGUS)
End class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("X").Single.BaseType
Dim format = New SymbolDisplayFormat(
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters)
TestSymbolDescription(
text,
findSymbol,
format,
"GC1(Of BOGUS)",
{
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ErrorTypeName,
SymbolDisplayPartKind.Punctuation})
End Sub
<WorkItem(538954, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538954")>
<Fact>
Public Sub ParameterOptionsIncludeName()
Dim text =
<compilation>
<file name="a.vb">
Class Class1
Sub Sub1(ByVal param1 As Integer)
End Sub
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) =
Function(globalns)
Dim sub1 = CType(globalns.GetTypeMembers("Class1").Single().GetMembers("Sub1").Single(), MethodSymbol)
Return sub1.Parameters.Single()
End Function
Dim format = New SymbolDisplayFormat(parameterOptions:=SymbolDisplayParameterOptions.IncludeName)
TestSymbolDescription(
text,
findSymbol,
format,
"param1",
{SymbolDisplayPartKind.ParameterName})
End Sub
<WorkItem(539076, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539076")>
<Fact>
Public Sub Bug4878()
Dim text =
<compilation>
<file name="a.vb">
Namespace Global
Namespace Global ' invalid because nested, would need escaping
Public Class c1
End Class
End Namespace
End Namespace
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(text)
Assert.Equal("[Global]", comp.SourceModule.GlobalNamespace.GetMembers().Single().ToDisplayString())
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces)
Assert.Equal("Global.Global", comp.SourceModule.GlobalNamespace.GetMembers().Single().ToDisplayString(format))
Assert.Equal("Global.Global.c1", comp.SourceModule.GlobalNamespace.LookupNestedNamespace({"Global"}).GetTypeMembers.Single().ToDisplayString(format))
End Sub
<WorkItem(541005, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541005")>
<Fact>
Public Sub Bug7515()
Dim text =
<compilation>
<file name="a.vb">
Public Class C1
Delegate Sub MyDel(x as MyDel)
End Class
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(text)
Dim m_DelegateSignatureFormat As New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.GlobalNamespaceStyle,
typeQualificationStyle:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.TypeQualificationStyle,
genericsOptions:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.GenericsOptions,
memberOptions:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.MemberOptions,
parameterOptions:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.ParameterOptions,
propertyStyle:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.PropertyStyle,
localOptions:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.LocalOptions,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword Or SymbolDisplayKindOptions.IncludeNamespaceKeyword Or SymbolDisplayKindOptions.IncludeTypeKeyword,
delegateStyle:=SymbolDisplayDelegateStyle.NameAndSignature,
miscellaneousOptions:=SymbolDisplayFormat.VisualBasicErrorMessageFormat.MiscellaneousOptions)
Assert.Equal("Delegate Sub C1.MyDel(x As C1.MyDel)", comp.SourceModule.GlobalNamespace.GetTypeMembers("C1").Single().
GetMembers("MyDel").Single().ToDisplayString(m_DelegateSignatureFormat))
End Sub
<WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")>
<Fact>
Public Sub Bug9913()
Dim text =
<compilation>
<file name="a.vb">
Public Class Test
Public Class System
Public Class Action
End Class
End Class
Public field As Global.System.Action
Public field2 As System.Action
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) =
Function(globalns)
Dim field = CType(globalns.GetTypeMembers("Test").Single().GetMembers("field").Single(), FieldSymbol)
Return field.Type
End Function
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.TypeQualificationStyle,
genericsOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.GenericsOptions,
memberOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MemberOptions,
delegateStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.DelegateStyle,
extensionMethodStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.ExtensionMethodStyle,
parameterOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.ParameterOptions,
propertyStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.PropertyStyle,
localOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.LocalOptions,
kindOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.KindOptions,
miscellaneousOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MiscellaneousOptions)
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(
text,
findSymbol,
format,
"Global.System.Action",
code.IndexOf("Global.System.Action", StringComparison.Ordinal),
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.DelegateName},
minimal:=True)
End Sub
<WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")>
<Fact>
Public Sub Bug9913_2()
Dim text =
<compilation>
<file name="a.vb">
Public Class Test
Public Class System
Public Class Action
End Class
End Class
Public field As Global.System.Action
Public field2 As System.Action
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) =
Function(globalns)
Dim field = CType(globalns.GetTypeMembers("Test").Single().GetMembers("field").Single(), FieldSymbol)
Return field.Type
End Function
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.OmittedAsContaining,
typeQualificationStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.TypeQualificationStyle,
genericsOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.GenericsOptions,
memberOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MemberOptions,
delegateStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.DelegateStyle,
extensionMethodStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.ExtensionMethodStyle,
parameterOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.ParameterOptions,
propertyStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.PropertyStyle,
localOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.LocalOptions,
kindOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.KindOptions,
miscellaneousOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MiscellaneousOptions)
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(
text,
findSymbol,
format,
"System.Action",
code.IndexOf("Global.System.Action", StringComparison.Ordinal),
{SymbolDisplayPartKind.NamespaceName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.DelegateName},
minimal:=True)
End Sub
<WorkItem(542619, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542619")>
<Fact>
Public Sub Bug9913_3()
Dim text =
<compilation>
<file name="a.vb">
Public Class Test
Public Class System
Public Class Action
End Class
End Class
Public field2 As System.Action
Public field As Global.System.Action
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) =
Function(globalns)
Dim field = CType(globalns.GetTypeMembers("Test").Single().GetMembers("field2").Single(), FieldSymbol)
Return field.Type
End Function
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.TypeQualificationStyle,
genericsOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.GenericsOptions,
memberOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MemberOptions,
delegateStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.DelegateStyle,
extensionMethodStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.ExtensionMethodStyle,
parameterOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.ParameterOptions,
propertyStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.PropertyStyle,
localOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.LocalOptions,
kindOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.KindOptions,
miscellaneousOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MiscellaneousOptions)
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(
text,
findSymbol,
format,
"System.Action",
code.IndexOf("System.Action", StringComparison.Ordinal),
{SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName},
minimal:=True)
End Sub
<Fact()>
Public Sub TestMinimalOfContextualKeywordAsIdentifier()
Dim text =
<compilation>
<file name="a.vb">
Class Take
Class X
Public Shared Sub Goo
End Sub
End Class
End Class
Class Z(Of T)
Inherits Take
End Class
Module M
Sub Main()
Dim x = From y In ""
Z(Of Integer).X.Goo ' Simplify Z(Of Integer).X
End Sub
End Module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("Take").Single().
GetTypeMembers("X").Single().
GetMembers("Goo").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, Nothing,
"Sub [Take].X.Goo()",
code.IndexOf("Z(Of Integer).X.Goo", StringComparison.Ordinal), {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation}, minimal:=True)
End Sub
<Fact()>
Public Sub TestMinimalOfContextualKeywordAsIdentifierTypeKeyword()
Dim text =
<compilation>
<file name="a.vb">
Class [Type]
Class X
Public Shared Sub Goo
End Sub
End Class
End Class
Class Z(Of T)
Inherits [Type]
End Class
Module M
Sub Main()
Dim x = From y In ""
Z(Of Integer).X.Goo ' Simplify Z(Of Integer).X
End Sub
End Module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("Type").Single().
GetTypeMembers("X").Single().
GetMembers("Goo").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, Nothing,
"Sub Type.X.Goo()",
code.IndexOf("Z(Of Integer).X.Goo", StringComparison.Ordinal), {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation}, minimal:=True)
text =
<compilation>
<file name="a.vb">
Imports System
Class Goo
Public Bar as Type
End Class
</file>
</compilation>
findSymbol = Function(globalns) globalns.GetTypeMembers("Goo").Single().GetMembers("Bar").Single()
code = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, Nothing,
"Goo.Bar As Type",
code.IndexOf("Public Bar as Type", StringComparison.Ordinal), {
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName}, minimal:=True)
End Sub
<WorkItem(543938, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543938")>
<Fact>
Public Sub Bug12025()
Dim text =
<compilation>
<file name="a.vb">
Class CBase
Public Overridable Property [Class] As Integer
End Class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) =
Function(globalns)
Dim field = CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Class").Single(), PropertySymbol)
Return field
End Function
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.TypeQualificationStyle,
genericsOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.GenericsOptions,
memberOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MemberOptions,
delegateStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.DelegateStyle,
extensionMethodStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.ExtensionMethodStyle,
parameterOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.ParameterOptions,
propertyStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.PropertyStyle,
localOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.LocalOptions,
kindOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.KindOptions,
miscellaneousOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MiscellaneousOptions)
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(
text,
findSymbol,
format,
"Property CBase.Class As Integer",
code.IndexOf("Public Overridable Property [Class] As Integer", StringComparison.Ordinal),
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword},
minimal:=True)
End Sub
<Fact, WorkItem(544414, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544414")>
Public Sub Bug12724()
Dim text =
<compilation>
<file name="a.vb">
Class CBase
Public Overridable Property [Class] As Integer
Public [Interface] As Integer
Event [Event]()
Public Overridable Sub [Sub]()
Public Overridable Function [Function]()
Class [Dim]
End Class
End Class
</file>
</compilation>
Dim findProperty As Func(Of NamespaceSymbol, Symbol) =
Function(globalns)
Dim field = CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Class").Single(), PropertySymbol)
Return field
End Function
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.TypeQualificationStyle,
genericsOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.GenericsOptions,
memberOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MemberOptions,
delegateStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.DelegateStyle,
extensionMethodStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.ExtensionMethodStyle,
parameterOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.ParameterOptions,
propertyStyle:=SymbolDisplayFormat.MinimallyQualifiedFormat.PropertyStyle,
localOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.LocalOptions,
kindOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.KindOptions,
miscellaneousOptions:=SymbolDisplayFormat.MinimallyQualifiedFormat.MiscellaneousOptions)
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(
text,
findProperty,
format,
"Property CBase.Class As Integer",
code.IndexOf("Public Overridable Property [Class] As Integer", StringComparison.Ordinal),
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword},
minimal:=True)
Dim findSub As Func(Of NamespaceSymbol, Symbol) =
Function(globalns) CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Sub").Single(), MethodSymbol)
TestSymbolDescription(
text,
findSub,
format,
"Sub CBase.Sub()",
code.IndexOf("Public Overridable Sub [Sub]()", StringComparison.Ordinal),
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation},
minimal:=True)
Dim findFunction As Func(Of NamespaceSymbol, Symbol) =
Function(globalns) CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Function").Single(), MethodSymbol)
TestSymbolDescription(
text,
findFunction,
format,
"Function CBase.Function() As Object",
code.IndexOf("Public Overridable Function [Function]()", StringComparison.Ordinal),
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword},
minimal:=True)
Dim findField As Func(Of NamespaceSymbol, Symbol) =
Function(globalns) CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Interface").Single(), FieldSymbol)
TestSymbolDescription(
text,
findField,
format,
"CBase.Interface As Integer",
code.IndexOf("Public [Interface] As Integer", StringComparison.Ordinal),
{SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword},
minimal:=True)
Dim findEvent As Func(Of NamespaceSymbol, Symbol) =
Function(globalns) CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Event").Single(), EventSymbol)
TestSymbolDescription(
text,
findEvent,
format,
"Event CBase.Event()",
code.IndexOf("Event [Event]()", StringComparison.Ordinal),
{SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.EventName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation},
minimal:=True)
Dim findClass As Func(Of NamespaceSymbol, Symbol) =
Function(globalns) CType(globalns.GetTypeMembers("CBase").Single().GetMembers("Dim").Single(), NamedTypeSymbol)
TestSymbolDescription(
text,
findClass,
New SymbolDisplayFormat(typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces),
"CBase.Dim",
code.IndexOf("Class [Dim]", StringComparison.Ordinal),
{SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName},
minimal:=False)
End Sub
<Fact, WorkItem(543806, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543806")>
Public Sub Bug11752()
Dim text =
<compilation>
<file name="a.vb">
Class Explicit
Class X
Public Shared Sub Goo
End Sub
End Class
End Class
Class Z(Of T)
Inherits Take
End Class
Module M
Sub Main()
Dim x = From y In ""
Z(Of Integer).X.Goo ' Simplify Z(Of Integer).X
End Sub
End Module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("Explicit").Single().
GetTypeMembers("X").Single().
GetMembers("Goo").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, Nothing,
"Sub Explicit.X.Goo()",
code.IndexOf("Z(Of Integer).X.Goo", StringComparison.Ordinal), {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation}, minimal:=True)
End Sub
<Fact(), WorkItem(529764, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529764")>
Public Sub TypeParameterFromMetadata()
Dim src1 =
<compilation>
<file name="lib.vb">
Public Class LibG(Of T)
End Class
</file>
</compilation>
Dim src2 =
<compilation>
<file name="use.vb">
Public Class Gen(Of V)
Public Sub M(p as LibG(Of V))
End Sub
Public Function F(p as Object) As Object
End Function
End Class
</file>
</compilation>
Dim dummy =
<compilation>
<file name="app.vb">
</file>
</compilation>
Dim complib = CreateCompilationWithMscorlib40(src1)
Dim compref = New VisualBasicCompilationReference(complib)
Dim comp1 = CreateCompilationWithMscorlib40AndReferences(src2, references:={compref})
Dim mtdata = comp1.EmitToArray()
Dim mtref = MetadataReference.CreateFromImage(mtdata)
Dim comp2 = CreateCompilationWithMscorlib40AndReferences(dummy, references:={mtref})
Dim tsym1 = comp1.SourceModule.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Gen")
Assert.NotNull(tsym1)
Dim msym1 = tsym1.GetMember(Of MethodSymbol)("M")
Assert.NotNull(msym1)
' Public Sub M(p As LibG(Of V))
' C# is like - Gen(Of V).M(LibG(Of V))
Assert.Equal("Public Sub M(p As LibG(Of V))", msym1.ToDisplayString())
Dim tsym2 = comp2.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Gen")
Assert.NotNull(tsym2)
Dim msym2 = tsym2.GetMember(Of MethodSymbol)("M")
Assert.NotNull(msym2)
Assert.Equal(msym1.ToDisplayString(), msym2.ToDisplayString())
End Sub
<Fact, WorkItem(545625, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545625")>
Public Sub ReverseArrayRankSpecifiers()
Dim text =
<compilation>
<file name="a.vb">
class C
Private F as C()(,)
end class
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetMember(Of NamedTypeSymbol)("C").GetMember(Of FieldSymbol)("F").Type
Dim normalFormat As New SymbolDisplayFormat()
Dim reverseFormat As New SymbolDisplayFormat(
compilerInternalOptions:=SymbolDisplayCompilerInternalOptions.ReverseArrayRankSpecifiers)
TestSymbolDescription(
text,
findSymbol,
normalFormat,
"C()(,)",
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation)
TestSymbolDescription(
text,
findSymbol,
reverseFormat,
"C(,)()",
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation)
End Sub
<Fact>
Public Sub TestMethodCSharp()
Dim text =
<text>
class A
{
public void Goo(int a)
{
}
}
</text>.Value
Dim format = New SymbolDisplayFormat(memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or
SymbolDisplayMemberOptions.IncludeModifiers Or
SymbolDisplayMemberOptions.IncludeAccessibility Or
SymbolDisplayMemberOptions.IncludeType,
kindOptions:=SymbolDisplayKindOptions.IncludeMemberKeyword,
parameterOptions:=SymbolDisplayParameterOptions.IncludeType Or
SymbolDisplayParameterOptions.IncludeName Or
SymbolDisplayParameterOptions.IncludeDefaultValue,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
Dim comp = CreateCSharpCompilation("c", text)
Dim a = DirectCast(comp.GlobalNamespace.GetMembers("A").Single(), ITypeSymbol)
Dim goo = a.GetMembers("Goo").Single()
Dim parts = VisualBasic.SymbolDisplay.ToDisplayParts(goo, format)
Verify(parts,
"Public Sub Goo(a As Integer)",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.ParameterName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation)
End Sub
<Fact>
Public Sub SupportSpeculativeSemanticModel()
Dim text =
<compilation>
<file name="a.vb">
Class Explicit
Class X
Public Shared Sub Goo
End Sub
End Class
End Class
Class Z(Of T)
Inherits Take
End Class
Module M
Sub Main()
Dim x = From y In ""
Z(Of Integer).X.Goo ' Simplify Z(Of Integer).X
End Sub
End Module
</file>
</compilation>
Dim findSymbol As Func(Of NamespaceSymbol, Symbol) = Function(globalns) globalns.GetTypeMembers("Explicit").Single().
GetTypeMembers("X").Single().
GetMembers("Goo").Single()
Dim code As String = DirectCast(text.FirstNode, XElement).FirstNode.ToString
TestSymbolDescription(text, findSymbol, Nothing,
"Sub Explicit.X.Goo()",
code.IndexOf("Z(Of Integer).X.Goo", StringComparison.Ordinal), {
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Operator,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation},
useSpeculativeSemanticModel:=True,
minimal:=True)
End Sub
<WorkItem(765287, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/765287")>
<Fact>
Public Sub TestCSharpSymbols()
Dim csComp = CreateCSharpCompilation("CSharp", <![CDATA[
class Outer
{
class Inner<T> { }
void M<U>() { }
string P { set { } }
int F;
event System.Action E;
delegate void D();
Missing Error() { }
}
]]>)
Dim outer = DirectCast(csComp.GlobalNamespace.GetMembers("Outer").Single(), INamedTypeSymbol)
Dim type = outer.GetMembers("Inner").Single()
Dim method = outer.GetMembers("M").Single()
Dim [property] = outer.GetMembers("P").Single()
Dim field = outer.GetMembers("F").Single()
Dim [event] = outer.GetMembers("E").Single()
Dim [delegate] = outer.GetMembers("D").Single()
Dim [error] = outer.GetMembers("Error").Single()
Assert.IsNotType(Of Symbol)(type)
Assert.IsNotType(Of Symbol)(method)
Assert.IsNotType(Of Symbol)([property])
Assert.IsNotType(Of Symbol)(field)
Assert.IsNotType(Of Symbol)([event])
Assert.IsNotType(Of Symbol)([delegate])
Assert.IsNotType(Of Symbol)([error])
' 1) Looks like VB.
' 2) Doesn't blow up.
Assert.Equal("Outer.Inner(Of T)", VisualBasic.SymbolDisplay.ToDisplayString(type, SymbolDisplayFormat.TestFormat))
Assert.Equal("Sub Outer.M(Of U)()", VisualBasic.SymbolDisplay.ToDisplayString(method, SymbolDisplayFormat.TestFormat))
Assert.Equal("WriteOnly Property Outer.P As System.String", VisualBasic.SymbolDisplay.ToDisplayString([property], SymbolDisplayFormat.TestFormat))
Assert.Equal("Outer.F As System.Int32", VisualBasic.SymbolDisplay.ToDisplayString(field, SymbolDisplayFormat.TestFormat))
Assert.Equal("Event Outer.E As System.Action", VisualBasic.SymbolDisplay.ToDisplayString([event], SymbolDisplayFormat.TestFormat))
Assert.Equal("Outer.D", VisualBasic.SymbolDisplay.ToDisplayString([delegate], SymbolDisplayFormat.TestFormat))
Assert.Equal("Function Outer.Error() As Missing", VisualBasic.SymbolDisplay.ToDisplayString([error], SymbolDisplayFormat.TestFormat))
End Sub
<Fact>
Public Sub FormatPrimitive()
Assert.Equal("Nothing", SymbolDisplay.FormatPrimitive(Nothing, quoteStrings:=True, useHexadecimalNumbers:=True))
Assert.Equal("3", SymbolDisplay.FormatPrimitive(OutputKind.NetModule, quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H00000003", SymbolDisplay.FormatPrimitive(OutputKind.NetModule, quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("""x""c", SymbolDisplay.FormatPrimitive("x"c, quoteStrings:=True, useHexadecimalNumbers:=True))
Assert.Equal("x", SymbolDisplay.FormatPrimitive("x"c, quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("""x""c", SymbolDisplay.FormatPrimitive("x"c, quoteStrings:=True, useHexadecimalNumbers:=False))
Assert.Equal("x", SymbolDisplay.FormatPrimitive("x"c, quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("x", SymbolDisplay.FormatPrimitive("x", quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("""x""", SymbolDisplay.FormatPrimitive("x", quoteStrings:=True, useHexadecimalNumbers:=False))
Assert.Equal("True", SymbolDisplay.FormatPrimitive(True, quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(1, quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H00000001", SymbolDisplay.FormatPrimitive(1, quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CUInt(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H00000001", SymbolDisplay.FormatPrimitive(CUInt(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CByte(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H01", SymbolDisplay.FormatPrimitive(CByte(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CSByte(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H01", SymbolDisplay.FormatPrimitive(CSByte(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CShort(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H0001", SymbolDisplay.FormatPrimitive(CShort(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CUShort(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H0001", SymbolDisplay.FormatPrimitive(CUShort(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CLng(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H0000000000000001", SymbolDisplay.FormatPrimitive(CLng(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1", SymbolDisplay.FormatPrimitive(CULng(1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("&H0000000000000001", SymbolDisplay.FormatPrimitive(CULng(1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1.1", SymbolDisplay.FormatPrimitive(1.1, quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("1.1", SymbolDisplay.FormatPrimitive(1.1, quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1.1", SymbolDisplay.FormatPrimitive(CSng(1.1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("1.1", SymbolDisplay.FormatPrimitive(CSng(1.1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("1.1", SymbolDisplay.FormatPrimitive(CDec(1.1), quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("1.1", SymbolDisplay.FormatPrimitive(CDec(1.1), quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal("#1/1/2000 12:00:00 AM#", SymbolDisplay.FormatPrimitive(#1/1/2000#, quoteStrings:=False, useHexadecimalNumbers:=False))
Assert.Equal("#1/1/2000 12:00:00 AM#", SymbolDisplay.FormatPrimitive(#1/1/2000#, quoteStrings:=False, useHexadecimalNumbers:=True))
Assert.Equal(Nothing, SymbolDisplay.FormatPrimitive(New Object(), quoteStrings:=False, useHexadecimalNumbers:=False))
End Sub
<Fact()>
Public Sub Tuple()
TestSymbolDescription(
<compilation>
<file name="a.vb">
Class C
Private f As (Integer, String)
End Class
</file>
</compilation>,
FindSymbol("C.f"),
New SymbolDisplayFormat(memberOptions:=SymbolDisplayMemberOptions.IncludeType),
"f As (Int32, String)",
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation)
End Sub
<WorkItem(18311, "https://github.com/dotnet/roslyn/issues/18311")>
<Fact()>
Public Sub TupleWith1Arity()
TestSymbolDescription(
<compilation>
<file name="a.vb">
Imports System
Class C
Private f As ValueTuple(Of Integer)
End Class
</file>
</compilation>,
FindSymbol("C.f"),
New SymbolDisplayFormat(memberOptions:=SymbolDisplayMemberOptions.IncludeType,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters),
"f As ValueTuple(Of Int32)",
0,
{SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation},
references:={MetadataReference.CreateFromImage(TestResources.NetFX.ValueTuple.tuplelib)})
End Sub
<Fact()>
Public Sub TupleWithNames()
TestSymbolDescription(
<compilation>
<file name="a.vb">
Class C
Private f As (x As Integer, y As String)
End Class
</file>
</compilation>,
FindSymbol("C.f"),
New SymbolDisplayFormat(memberOptions:=SymbolDisplayMemberOptions.IncludeType),
"f As (x As Int32, y As String)",
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.ClassName,
SymbolDisplayPartKind.Punctuation)
End Sub
<Fact()>
Public Sub LongTupleWithSpecialTypes()
TestSymbolDescription(
<compilation>
<file name="a.vb">
Class C
Private f As (Integer, String, Boolean, Byte, Long, ULong, Short, UShort)
End Class
</file>
</compilation>,
FindSymbol("C.f"),
New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes),
"f As (Integer, String, Boolean, Byte, Long, ULong, Short, UShort)",
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation)
End Sub
<Fact()>
Public Sub TupleProperty()
TestSymbolDescription(
<compilation>
<file name="a.vb">
Class C
Property P As (Item1 As Integer, Item2 As String)
End Class
</file>
</compilation>,
FindSymbol("C.P"),
New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes),
"P As (Item1 As Integer, Item2 As String)",
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation)
End Sub
<Fact()>
Public Sub TupleQualifiedNames()
Dim text =
"Imports NAB = N.A.B
Namespace N
Class A
Friend Class B
End Class
End Class
Class C(Of T)
' offset 1
End Class
End Namespace
Class C
Private f As (One As Integer, N.C(Of (Object(), Two As NAB)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As N.A)
' offset 2
End Class"
Dim source =
<compilation>
<file name="a.vb"><%= text %></file>
</compilation>
Dim format = New SymbolDisplayFormat(
globalNamespaceStyle:=SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle:=SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
genericsOptions:=SymbolDisplayGenericsOptions.IncludeTypeParameters,
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(source, references:={SystemRuntimeFacadeRef, ValueTupleRef})
comp.VerifyDiagnostics()
Dim symbol = comp.GetMember("C.f")
' Fully qualified format.
Verify(
SymbolDisplay.ToDisplayParts(symbol, format),
"f As (One As Integer, Global.N.C(Of (Object(), Two As Global.N.A.B)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As Global.N.A)")
' Minimally qualified format.
Verify(
SymbolDisplay.ToDisplayParts(symbol, SymbolDisplayFormat.MinimallyQualifiedFormat),
"C.f As (One As Integer, C(Of (Object(), Two As B)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As A)")
' ToMinimalDisplayParts.
Dim model = comp.GetSemanticModel(comp.SyntaxTrees(0))
Verify(
SymbolDisplay.ToMinimalDisplayParts(symbol, model, text.IndexOf("offset 1"), format),
"f As (One As Integer, C(Of (Object(), Two As NAB)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As A)")
Verify(
SymbolDisplay.ToMinimalDisplayParts(symbol, model, text.IndexOf("offset 2"), format),
"f As (One As Integer, N.C(Of (Object(), Two As NAB)), Integer, Four As Object, Integer, Object, Integer, Object, Nine As N.A)")
End Sub
' A tuple type symbol that is not Microsoft.CodeAnalysis.VisualBasic.Symbols.TupleTypeSymbol.
<Fact()>
Public Sub NonTupleTypeSymbol()
Dim source =
"class C
{
#pragma warning disable CS0169
(int Alice, string Bob) F;
(int, string) G;
#pragma warning restore CS0169
}"
Dim format = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeType,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
Dim comp = CreateCSharpCompilation(GetUniqueName(), source, referencedAssemblies:={MscorlibRef, SystemRuntimeFacadeRef, ValueTupleRef})
comp.VerifyDiagnostics()
Dim type = comp.GlobalNamespace.GetTypeMembers("C").Single()
Verify(
SymbolDisplay.ToDisplayParts(type.GetMembers("F").Single(), format),
"F As (Alice As Integer, Bob As String)",
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation)
Verify(
SymbolDisplay.ToDisplayParts(type.GetMembers("G").Single(), format),
"G As (Integer, String)",
SymbolDisplayPartKind.FieldName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation)
End Sub
' SymbolDisplayMemberOptions.IncludeRef is ignored in VB.
<WorkItem(11356, "https://github.com/dotnet/roslyn/issues/11356")>
<Fact()>
Public Sub RefReturn()
Dim sourceA =
"public delegate ref int D();
public class C
{
public ref int F(ref int i) => ref i;
int _p;
public ref int P => ref _p;
public ref int this[int i] => ref _p;
}"
Dim compA = CreateCSharpCompilation(GetUniqueName(), sourceA)
compA.VerifyDiagnostics()
Dim refA = compA.EmitToImageReference()
' From C# symbols.
RefReturnInternal(compA)
Dim sourceB =
<compilation>
<file name="b.vb">
</file>
</compilation>
Dim compB = CompilationUtils.CreateCompilationWithMscorlib40(sourceB, references:={refA})
compB.VerifyDiagnostics()
' From VB symbols.
RefReturnInternal(compB)
End Sub
Private Shared Sub RefReturnInternal(comp As Compilation)
Dim formatWithRef = New SymbolDisplayFormat(
memberOptions:=SymbolDisplayMemberOptions.IncludeParameters Or SymbolDisplayMemberOptions.IncludeType Or SymbolDisplayMemberOptions.IncludeRef,
parameterOptions:=SymbolDisplayParameterOptions.IncludeType Or SymbolDisplayParameterOptions.IncludeParamsRefOut,
propertyStyle:=SymbolDisplayPropertyStyle.ShowReadWriteDescriptor,
delegateStyle:=SymbolDisplayDelegateStyle.NameAndSignature,
miscellaneousOptions:=SymbolDisplayMiscellaneousOptions.UseSpecialTypes)
Dim [global] = comp.GlobalNamespace
Dim type = [global].GetTypeMembers("C").Single()
Dim method = type.GetMembers("F").Single()
Dim [property] = type.GetMembers("P").Single()
Dim indexer = type.GetMembers().Where(Function(m) m.Kind = SymbolKind.Property AndAlso DirectCast(m, IPropertySymbol).IsIndexer).Single()
Dim [delegate] = [global].GetTypeMembers("D").Single()
' Method with IncludeRef.
' https://github.com/dotnet/roslyn/issues/14683: missing ByRef for C# parameters.
If comp.Language = "C#" Then
Verify(
SymbolDisplay.ToDisplayParts(method, formatWithRef),
"ByRef F(Integer) As Integer",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword)
Else
Verify(
SymbolDisplay.ToDisplayParts(method, formatWithRef),
"ByRef F(ByRef Integer) As Integer",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.MethodName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword)
End If
' Property with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts([property], formatWithRef),
"ReadOnly ByRef P As Integer",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword)
' Indexer with IncludeRef.
' https://github.com/dotnet/roslyn/issues/14684: "this[]" for C# indexer.
If comp.Language = "C#" Then
Verify(
SymbolDisplay.ToDisplayParts(indexer, formatWithRef),
"ReadOnly ByRef this[](Integer) As Integer",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword)
Else
Verify(
SymbolDisplay.ToDisplayParts(indexer, formatWithRef),
"ReadOnly ByRef Item(Integer) As Integer",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.PropertyName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword)
End If
' Delegate with IncludeRef.
Verify(
SymbolDisplay.ToDisplayParts([delegate], formatWithRef),
"ByRef Function D() As Integer",
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.DelegateName,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Punctuation,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword,
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.Keyword)
End Sub
<Fact>
Public Sub AliasInSpeculativeSemanticModel()
Dim text =
<compilation>
<file name="a.vb">
Imports A = N.M
Namespace N.M
Class B
End Class
End Namespace
Class C
Shared Sub M()
Dim o = 1
End Sub
End Class
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(text)
Dim tree = comp.SyntaxTrees.First()
Dim model = comp.GetSemanticModel(tree)
Dim methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MethodBlockBaseSyntax)().First()
Dim position = methodDecl.Statements(0).SpanStart
tree = VisualBasicSyntaxTree.ParseText("
Class C
Shared Sub M()
Dim o = 1
End Sub
End Class")
methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MethodBlockBaseSyntax)().First()
Assert.True(model.TryGetSpeculativeSemanticModelForMethodBody(position, methodDecl, model))
Dim symbol = comp.GetMember(Of NamedTypeSymbol)("N.M.B")
position = methodDecl.Statements(0).SpanStart
Dim description = symbol.ToMinimalDisplayParts(model, position, SymbolDisplayFormat.MinimallyQualifiedFormat)
Verify(description, "A.B", SymbolDisplayPartKind.AliasName, SymbolDisplayPartKind.Operator, SymbolDisplayPartKind.ClassName)
End Sub
#Region "Helpers"
Private Shared Sub TestSymbolDescription(
text As XElement,
findSymbol As Func(Of NamespaceSymbol, Symbol),
format As SymbolDisplayFormat,
expectedText As String,
position As Integer,
kinds As SymbolDisplayPartKind(),
Optional minimal As Boolean = False,
Optional useSpeculativeSemanticModel As Boolean = False,
Optional references As IEnumerable(Of MetadataReference) = Nothing)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(text)
If references IsNot Nothing Then
comp = comp.AddReferences(references.ToArray())
End If
Dim symbol = findSymbol(comp.GlobalNamespace)
Dim description As ImmutableArray(Of SymbolDisplayPart)
If minimal Then
Dim tree = comp.SyntaxTrees.First()
Dim semanticModel As SemanticModel = comp.GetSemanticModel(tree)
Dim tokenPosition = tree.GetRoot().FindToken(position).SpanStart
If useSpeculativeSemanticModel Then
Dim newTree = tree.WithChangedText(tree.GetText())
Dim token = newTree.GetRoot().FindToken(position)
tokenPosition = token.SpanStart
Dim member = token.Parent.FirstAncestorOrSelf(Of MethodBlockBaseSyntax)()
Dim speculativeModel As SemanticModel = Nothing
semanticModel.TryGetSpeculativeSemanticModelForMethodBody(member.BlockStatement.Span.End, member, speculativeModel)
semanticModel = speculativeModel
End If
description = VisualBasic.SymbolDisplay.ToMinimalDisplayParts(symbol, semanticModel, tokenPosition, format)
Else
description = VisualBasic.SymbolDisplay.ToDisplayParts(symbol, format)
End If
Verify(description, expectedText, kinds)
End Sub
Private Shared Sub TestSymbolDescription(
text As XElement,
findSymbol As Func(Of NamespaceSymbol, Symbol),
format As SymbolDisplayFormat,
expectedText As String,
ParamArray kinds As SymbolDisplayPartKind())
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(text, references:={SystemCoreRef})
' symbol:
Dim symbol = findSymbol(comp.GlobalNamespace)
Dim description = VisualBasic.SymbolDisplay.ToDisplayParts(symbol, format)
Verify(description, expectedText, kinds)
' retargeted symbol:
Dim retargetedAssembly = New Microsoft.CodeAnalysis.VisualBasic.Symbols.Retargeting.RetargetingAssemblySymbol(comp.SourceAssembly, isLinked:=False)
retargetedAssembly.SetCorLibrary(comp.SourceAssembly.CorLibrary)
Dim retargetedSymbol = findSymbol(retargetedAssembly.GlobalNamespace)
Dim retargetedDescription = VisualBasic.SymbolDisplay.ToDisplayParts(retargetedSymbol, format)
Verify(retargetedDescription, expectedText, kinds)
End Sub
Private Shared Function Verify(parts As ImmutableArray(Of SymbolDisplayPart), expectedText As String, ParamArray kinds As SymbolDisplayPartKind()) As ImmutableArray(Of SymbolDisplayPart)
Assert.Equal(expectedText, parts.ToDisplayString())
If (kinds.Length > 0) Then
AssertEx.Equal(kinds, parts.Select(Function(p) p.Kind), itemInspector:=Function(p) $" SymbolDisplayPartKind.{p}")
End If
Return parts
End Function
Private Shared Function FindSymbol(qualifiedName As String) As Func(Of NamespaceSymbol, Symbol)
Return Function([namespace]) [namespace].GetMember(qualifiedName)
End Function
#End Region
End Class
End Namespace
|
lorcanmooney/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb
|
Visual Basic
|
apache-2.0
| 219,345
|
Namespace MonitoringDatabase
Public Class AgentData
Public Property AgentID As Int64
Public Property AgentName As String
Public Property AgentClass As String
Public Property AgentProperty As String
Public Property AgentValue As Double
Public Property AgentCollectDate As Date? = Nothing
End Class
End Namespace
|
philipcwhite/MonitoringServer
|
MonitoringEventEngine/MonitoringEventEngine/EventEngine/Database/Models/AgentData.vb
|
Visual Basic
|
apache-2.0
| 369
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.CSharp
Imports Microsoft.CodeAnalysis.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata
Public Class InAttributeModifierTests
Inherits BasicTestBase
<Fact>
Public Sub ReadOnlySignaturesAreRead_Methods_Parameters_Static()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public static void M(in int x)
{
System.Console.WriteLine(x);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
TestRef.M(x)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="5")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreRead_Methods_Parameters_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public void M(in int x)
{
System.Console.WriteLine(x);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
Dim obj = New TestRef()
obj.M(x)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="5")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreRead_Indexers_Parameters_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public int this[in int p]
{
set
{
System.Console.WriteLine(p);
}
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
Dim obj = New TestRef()
obj(x) = 0
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="5")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreRead_Constructors()
Dim reference = CreateCSharpCompilation("
public struct TestRef
{
public TestRef(in int value)
{
System.Console.WriteLine(value);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj1 = New TestRef(4)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="4")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_Parameters_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual void M(in int x)
{
System.Console.WriteLine(x);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
Dim obj = New TestRef()
obj.M(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M(x)
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_Parameters_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract void M(in int x);
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim x = 5
obj.M(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M(x)
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public virtual ref readonly int M()
{
return ref value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
obj.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract ref readonly int M();
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
obj.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_Static()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private static int value = 0;
public static ref readonly int M()
{
return ref value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
TestRef.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
TestRef.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public ref readonly int M()
{
return ref value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
obj.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public virtual ref readonly int P => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'P' is of an unsupported type.
Dim value = obj.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_Static()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private static int value = 0;
public static ref readonly int P => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim value = TestRef.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'P' is of an unsupported type.
Dim value = TestRef.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public ref readonly int P => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'P' is of an unsupported type.
Dim value = obj.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract ref readonly int P { get; }
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim value = obj.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'P' is of an unsupported type.
Dim value = obj.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_Parameters_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual int this[in int p] => 0;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim p = 0
Dim obj = New TestRef()
Dim value = obj(p)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As )' is of an unsupported type.
Dim value = obj(p)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_Parameters_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract int this[in int p] { set; }
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim p = 0
Dim value = obj(p)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As )' is of an unsupported type.
Dim value = obj(p)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_ReturnTypes_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public virtual ref readonly int this[int p] => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj(0)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As )' is of an unsupported type.
Dim value = obj(0)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_ReturnTypes_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract ref readonly int this[int p] { get; }
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim value = obj(0)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As )' is of an unsupported type.
Dim value = obj(0)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_ReturnTypes_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public ref readonly int this[int p] => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj(0)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As )' is of an unsupported type.
Dim value = obj(0)
~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfInDelegatesIsNotSupported_Invoke_Parameters()
Dim reference = CreateCSharpCompilation("
public delegate void D(in int p);
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = 0
lambda(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'D' has a return type that is not supported or parameter types that are not supported.
lambda(x)
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfInDelegatesIsNotSupported_BeginInvoke_Parameters()
Dim reference = CreateCSharpCompilation("
public delegate void D(in int p);
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = 0
lambda.BeginInvoke(x, Nothing, Nothing)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'BeginInvoke' has a return type that is not supported or parameter types that are not supported.
lambda.BeginInvoke(x, Nothing, Nothing)
~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfInDelegatesIsNotSupported_EndInvoke_Parameters()
Dim reference = CreateCSharpCompilation("
public delegate void D(in int p);
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = 0
lambda.EndInvoke(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'EndInvoke' has a return type that is not supported or parameter types that are not supported.
lambda.EndInvoke(x)
~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfRefReadOnlyDelegatesIsNotSupported_Invoke_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public delegate ref readonly int D();
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = lambda()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'D' has a return type that is not supported or parameter types that are not supported.
Dim x = lambda()
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfRefReadOnlyDelegatesIsNotSupported_EndInvoke_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public delegate ref readonly int D();
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
lambda.EndInvoke()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'EndInvoke' has a return type that is not supported or parameter types that are not supported.
lambda.EndInvoke()
~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Methods_Parameters()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual void PrintMul(in int x)
{
System.Console.WriteLine(x * 2);
}
public void PrintMul(in long x)
{
System.Console.WriteLine(x * 4);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim value As Integer = 5
Dim obj = New TestRef()
obj.PrintMul(value)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="20")
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Methods_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 5;
public ref readonly int PrintMul(int x)
{
value = value * 2;
return ref value;
}
public int PrintMul(long x)
{
value = value * 4;
return value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
System.Console.WriteLine(obj.PrintMul(0))
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="20")
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Indexers_Parameters()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual int this[in int x]
{
set
{
System.Console.WriteLine(x * 2);
}
}
public int this[in long x]
{
set
{
System.Console.WriteLine(x * 4);
}
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim value As Integer = 5
Dim obj = New TestRef()
obj(value) = 0
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="20")
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Indexers_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 5;
public ref readonly int this[int x]
{
get
{
value = value * 2;
return ref value;
}
}
public int this[long x]
{
get
{
value = value * 4;
return value;
}
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
System.Console.WriteLine(obj(0))
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, additionalRefs:={reference}, expectedOutput:="20")
End Sub
End Class
End Namespace
|
pdelvo/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Metadata/PE/InAttributeModifierTests.vb
|
Visual Basic
|
apache-2.0
| 25,172
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
Imports Roslyn.Test.Utilities
Imports ERRID = Microsoft.CodeAnalysis.VisualBasic.ERRID
Public Class PreprocessorEETests
Private Function ParseExpression(text As XElement) As ExpressionSyntax
Return ParseExpression(text.Value)
End Function
Private Function ParseExpressionAsRhs(text As String, Optional expectsErrors As Boolean = False) As ExpressionSyntax
Dim modText =
<Module>
Module M1
Dim x =<%= text %>
End Module
</Module>.Value
Dim prog = DirectCast(VisualBasic.SyntaxFactory.ParseCompilationUnit(modText).Green, CompilationUnitSyntax)
Dim modTree = DirectCast(prog.Members(0), TypeBlockSyntax)
Dim varDecl = DirectCast(modTree.Members(0), FieldDeclarationSyntax)
Return DirectCast(varDecl.Declarators(0), VariableDeclaratorSyntax).Initializer.Value
End Function
Private Function ParseExpression(text As String, Optional expectsErrors As Boolean = False) As ExpressionSyntax
Dim expr = VisualBasic.SyntaxFactory.ParseExpression(text)
Return DirectCast(expr.Green, ExpressionSyntax)
End Function
<Fact>
Public Sub CCExpressionsSimpleBoolLiterals()
#Const x = True Or True
Dim tree = ParseExpression("True Or True")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(True, res.ValueAsObject)
#Const x = Not True
tree = ParseExpression("Not True")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(False, res.ValueAsObject)
#Const x = True Xor False
tree = ParseExpression("True Xor False")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(True, res.ValueAsObject)
#Const x = True + False
tree = ParseExpression("True + False")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(-1S, res.ValueAsObject)
#Const x = True * False
tree = ParseExpression("True * False")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(0S, res.ValueAsObject)
#Const x = True ^ False
tree = ParseExpression("True ^ False")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(1.0, res.ValueAsObject)
#Const x = True >> False
tree = ParseExpression("True >> False")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(-1S, res.ValueAsObject)
End Sub
<Fact>
Public Sub CCExpressionsSimpleDateLiterals()
#Const x = #4/10/2012#
Dim tree = ParseExpressionAsRhs("#4/10/2012#")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(#4/10/2012#, res.ValueAsObject)
End Sub
<Fact>
Public Sub CCExpressionsSimpleTernaryExp()
#Const x = If(True, 42, 43)
Dim tree = ParseExpression(" If(True, 42, 43)")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(42, res.ValueAsObject)
End Sub
<Fact>
Public Sub CCExpressionsSimpleIntegralLiterals()
#Const x = 1
Dim tree = ParseExpression("1 + 1")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(2, res.ValueAsObject)
#Const x = 1US + 1S
tree = ParseExpression("1US - 1S")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(0, res.ValueAsObject)
#Const x = 1UL + 2UL
tree = ParseExpression("1UL + 2UL")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(3UL, res.ValueAsObject)
#Const x = 5US + 5S
tree = ParseExpression("5US + 5S")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(10, res.ValueAsObject)
#Const x = -5US + 5S
tree = ParseExpression("-5US + 5S")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(0, res.ValueAsObject)
#Const x = -5US / 5S
tree = ParseExpression("-5US / 5S")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(-1.0, res.ValueAsObject)
#Const x = -5US \ 5S
tree = ParseExpression("-5US \ 5S")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(-1, res.ValueAsObject)
#Const x = 1L + 1UL
tree = ParseExpression("1L + 1UL")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(2D, res.ValueAsObject)
#Const x = 1 ^ 2
tree = ParseExpression("1 ^ 2")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(1.0, res.ValueAsObject)
#Const x = 16 >> 2US
tree = ParseExpression("16 >> 2US")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(4, res.ValueAsObject)
End Sub
<Fact>
Public Sub CCExpressionsSimpleRelational()
#Const x = 2 > 1
Dim tree = ParseExpression(" 2 > 1")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(True, res.ValueAsObject)
#Const x = (-1 = 3 > 1)
tree = ParseExpression("(-1 = 3 > 1)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(False, res.ValueAsObject)
End Sub
<Fact>
Public Sub CCExpressionsSimpleIsTrue()
Dim tree = ParseExpression("""qqqq""")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal("qqqq", res.ValueAsObject)
Dim cond = ExpressionEvaluator.EvaluateCondition(tree)
Assert.Equal(True, cond.IsBad)
Assert.Equal(CInt(ERRID.ERR_RequiredConstConversion2), DirectCast(cond, BadCConst).ErrorId)
Assert.Equal(False, cond.IsBooleanTrue)
tree = ParseExpression("True >> False = -1")
cond = ExpressionEvaluator.EvaluateCondition(tree)
Assert.Equal(True, cond.IsBooleanTrue)
tree = ParseExpression("If(True > False, 42, True >> False) < 0")
cond = ExpressionEvaluator.EvaluateCondition(tree)
Assert.Equal(True, cond.IsBooleanTrue)
End Sub
<Fact>
Public Sub CCExpressionsSimpleNames()
Dim tree = ParseExpression("""qqqq""")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal("qqqq", res.ValueAsObject)
Dim table = ImmutableDictionary.Create(Of String, CConst)(StringComparer.InvariantCultureIgnoreCase).Add("X", res)
tree = ParseExpression("X")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal("qqqq", res.ValueAsObject)
table = table.Add("Y", CConst.Create("W"c))
tree = ParseExpression("X + Y")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal("qqqqW", res.ValueAsObject)
' CC allows type chars as long as they match constant type.
tree = ParseExpression("X$ + Y")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal("qqqqW", res.ValueAsObject)
' y should hide Y
table = table.Remove("y")
table = table.Add("y", CConst.Create("QWE"))
tree = ParseExpression("X & Y")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal("qqqqQWE", res.ValueAsObject)
' bracketed
tree = ParseExpression("X & [Y]")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal("qqqqQWE", res.ValueAsObject)
' error
tree = ParseExpression("X + 1")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal(True, res.IsBad)
Assert.Equal(CInt(ERRID.ERR_RequiredConstConversion2), DirectCast(res, BadCConst).ErrorId)
table = table.SetItem("X", res)
tree = ParseExpression("X")
res = ExpressionEvaluator.EvaluateExpression(tree, table)
Assert.Equal(True, res.IsBad)
Assert.Equal(0, DirectCast(res, BadCConst).ErrorId)
End Sub
<WorkItem(882921, "DevDiv/Personal")>
<Fact>
Public Sub CCCastExpression()
Dim tree = ParseExpression("CBool(WIN32)")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(False, res.ValueAsObject)
End Sub
<WorkItem(888301, "DevDiv/Personal")>
<Fact>
Public Sub CCNotUndefinedConst()
Dim tree = ParseExpression("Not OE_WIN9X")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
#If Not OE_WIN9X = -1 Then
Assert.Equal(-1, res.ValueAsObject)
#Else
Assert.Equal(False, res.ValueAsObject)
#End If
End Sub
<WorkItem(888303, "DevDiv/Personal")>
<Fact>
Public Sub CCDateGreaterThanNow()
Dim tree = ParseExpressionAsRhs("#7/1/2003# > Now") ' Note, "Now" is undefined, thus has value Nothing.
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(True, res.ValueAsObject)
End Sub
<WorkItem(888305, "DevDiv/Personal")>
<Fact>
Public Sub CCCharEqualsChar()
Dim tree = ParseExpression("""A""c = ""a""c")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
#If "A"c = "a"c Then
Assert.Equal(True, res.ValueAsObject)
#Else
Assert.Equal(False, res.ValueAsObject)
#End If
End Sub
<WorkItem(888316, "DevDiv/Personal")>
<Fact>
Public Sub CCCast()
Dim tree = ParseExpression("DirectCast(42, Integer)")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(42, res.ValueAsObject)
tree = ParseExpression("TryCast(42, Short)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(Nothing, res.ValueAsObject)
Assert.Equal(ERRID.ERR_TryCastOfValueType1, res.ErrorId)
tree = ParseExpression("CType(42, UShort)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(42US, res.ValueAsObject)
tree = ParseExpression("DirectCast(42UI, UInteger)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(42UI, res.ValueAsObject)
tree = ParseExpression("TryCast(-420000, Long)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(Nothing, res.ValueAsObject)
Assert.Equal(ERRID.ERR_TryCastOfValueType1, res.ErrorId)
tree = ParseExpression("CType(420000, ULong)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(420000UL, res.ValueAsObject)
tree = ParseExpression("DirectCast(42.2D, Decimal)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(42.2D, res.ValueAsObject)
tree = ParseExpression("TryCast(-42.222, Single)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(Nothing, res.ValueAsObject)
Assert.Equal(ERRID.ERR_TryCastOfValueType1, res.ErrorId)
tree = ParseExpression("CType(-42, SByte)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(CSByte(-42), res.ValueAsObject)
tree = ParseExpression("DirectCast(CByte(42), Byte)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(CByte(42), res.ValueAsObject)
tree = ParseExpression("TryCast(""4"", Char)")
res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(Nothing, res.ValueAsObject)
Assert.Equal(ERRID.ERR_TryCastOfValueType1, res.ErrorId)
End Sub
<WorkItem(906041, "DevDiv/Personal")>
<Fact>
Public Sub CCCastObject()
Dim tree = ParseExpression("DirectCast(Nothing, Object)")
Dim res = ExpressionEvaluator.EvaluateExpression(tree)
Assert.Equal(Nothing, res.ValueAsObject)
Assert.False(res.IsBad)
End Sub
End Class
|
AlekseyTs/roslyn
|
src/Compilers/VisualBasic/Test/Syntax/PreprocessorEETests.vb
|
Visual Basic
|
mit
| 12,015
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundConversionOrCast
Public MustOverride ReadOnly Property Operand As BoundExpression
Public MustOverride ReadOnly Property ConversionKind As ConversionKind
Public MustOverride ReadOnly Property ExplicitCastInCode As Boolean
End Class
End Namespace
|
AmadeusW/roslyn
|
src/Compilers/VisualBasic/Portable/BoundTree/BoundConversionOrCast.vb
|
Visual Basic
|
apache-2.0
| 552
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Option Strict Off
Imports System
Module Module1
Sub Main()
PrintResult("False + False", False + False)
PrintResult("False + True", False + True)
PrintResult("False + System.SByte.MinValue", False + System.SByte.MinValue)
PrintResult("False + System.Byte.MaxValue", False + System.Byte.MaxValue)
PrintResult("False + -3S", False + -3S)
PrintResult("False + 24US", False + 24US)
PrintResult("False + -5I", False + -5I)
PrintResult("False + 26UI", False + 26UI)
PrintResult("False + -7L", False + -7L)
PrintResult("False + 28UL", False + 28UL)
PrintResult("False + -9D", False + -9D)
PrintResult("False + 10.0F", False + 10.0F)
PrintResult("False + -11.0R", False + -11.0R)
PrintResult("False + ""12""", False + "12")
PrintResult("False + TypeCode.Double", False + TypeCode.Double)
PrintResult("True + False", True + False)
PrintResult("True + True", True + True)
PrintResult("True + System.SByte.MaxValue", True + System.SByte.MaxValue)
PrintResult("True + System.Byte.MaxValue", True + System.Byte.MaxValue)
PrintResult("True + -3S", True + -3S)
PrintResult("True + 24US", True + 24US)
PrintResult("True + -5I", True + -5I)
PrintResult("True + 26UI", True + 26UI)
PrintResult("True + -7L", True + -7L)
PrintResult("True + 28UL", True + 28UL)
PrintResult("True + -9D", True + -9D)
PrintResult("True + 10.0F", True + 10.0F)
PrintResult("True + -11.0R", True + -11.0R)
PrintResult("True + ""12""", True + "12")
PrintResult("True + TypeCode.Double", True + TypeCode.Double)
PrintResult("System.SByte.MinValue + False", System.SByte.MinValue + False)
PrintResult("System.SByte.MaxValue + True", System.SByte.MaxValue + True)
PrintResult("System.SByte.MinValue + System.SByte.MaxValue", System.SByte.MinValue + System.SByte.MaxValue)
PrintResult("System.SByte.MinValue + System.Byte.MaxValue", System.SByte.MinValue + System.Byte.MaxValue)
PrintResult("System.SByte.MinValue + -3S", System.SByte.MinValue + -3S)
PrintResult("System.SByte.MinValue + 24US", System.SByte.MinValue + 24US)
PrintResult("System.SByte.MinValue + -5I", System.SByte.MinValue + -5I)
PrintResult("System.SByte.MinValue + 26UI", System.SByte.MinValue + 26UI)
PrintResult("System.SByte.MinValue + -7L", System.SByte.MinValue + -7L)
PrintResult("System.SByte.MinValue + 28UL", System.SByte.MinValue + 28UL)
PrintResult("System.SByte.MinValue + -9D", System.SByte.MinValue + -9D)
PrintResult("System.SByte.MinValue + 10.0F", System.SByte.MinValue + 10.0F)
PrintResult("System.SByte.MinValue + -11.0R", System.SByte.MinValue + -11.0R)
PrintResult("System.SByte.MinValue + ""12""", System.SByte.MinValue + "12")
PrintResult("System.SByte.MinValue + TypeCode.Double", System.SByte.MinValue + TypeCode.Double)
PrintResult("System.Byte.MaxValue + False", System.Byte.MaxValue + False)
PrintResult("System.Byte.MaxValue + True", System.Byte.MaxValue + True)
PrintResult("System.Byte.MaxValue + System.SByte.MinValue", System.Byte.MaxValue + System.SByte.MinValue)
PrintResult("System.Byte.MaxValue + System.Byte.MinValue", System.Byte.MaxValue + System.Byte.MinValue)
PrintResult("System.Byte.MaxValue + -3S", System.Byte.MaxValue + -3S)
PrintResult("System.Byte.MaxValue + 24US", System.Byte.MaxValue + 24US)
PrintResult("System.Byte.MaxValue + -5I", System.Byte.MaxValue + -5I)
PrintResult("System.Byte.MaxValue + 26UI", System.Byte.MaxValue + 26UI)
PrintResult("System.Byte.MaxValue + -7L", System.Byte.MaxValue + -7L)
PrintResult("System.Byte.MaxValue + 28UL", System.Byte.MaxValue + 28UL)
PrintResult("System.Byte.MaxValue + -9D", System.Byte.MaxValue + -9D)
PrintResult("System.Byte.MaxValue + 10.0F", System.Byte.MaxValue + 10.0F)
PrintResult("System.Byte.MaxValue + -11.0R", System.Byte.MaxValue + -11.0R)
PrintResult("System.Byte.MaxValue + ""12""", System.Byte.MaxValue + "12")
PrintResult("System.Byte.MaxValue + TypeCode.Double", System.Byte.MaxValue + TypeCode.Double)
PrintResult("-3S + False", -3S + False)
PrintResult("-3S + True", -3S + True)
PrintResult("-3S + System.SByte.MinValue", -3S + System.SByte.MinValue)
PrintResult("-3S + System.Byte.MaxValue", -3S + System.Byte.MaxValue)
PrintResult("-3S + -3S", -3S + -3S)
PrintResult("-3S + 24US", -3S + 24US)
PrintResult("-3S + -5I", -3S + -5I)
PrintResult("-3S + 26UI", -3S + 26UI)
PrintResult("-3S + -7L", -3S + -7L)
PrintResult("-3S + 28UL", -3S + 28UL)
PrintResult("-3S + -9D", -3S + -9D)
PrintResult("-3S + 10.0F", -3S + 10.0F)
PrintResult("-3S + -11.0R", -3S + -11.0R)
PrintResult("-3S + ""12""", -3S + "12")
PrintResult("-3S + TypeCode.Double", -3S + TypeCode.Double)
PrintResult("24US + False", 24US + False)
PrintResult("24US + True", 24US + True)
PrintResult("24US + System.SByte.MinValue", 24US + System.SByte.MinValue)
PrintResult("24US + System.Byte.MaxValue", 24US + System.Byte.MaxValue)
PrintResult("24US + -3S", 24US + -3S)
PrintResult("24US + 24US", 24US + 24US)
PrintResult("24US + -5I", 24US + -5I)
PrintResult("24US + 26UI", 24US + 26UI)
PrintResult("24US + -7L", 24US + -7L)
PrintResult("24US + 28UL", 24US + 28UL)
PrintResult("24US + -9D", 24US + -9D)
PrintResult("24US + 10.0F", 24US + 10.0F)
PrintResult("24US + -11.0R", 24US + -11.0R)
PrintResult("24US + ""12""", 24US + "12")
PrintResult("24US + TypeCode.Double", 24US + TypeCode.Double)
PrintResult("-5I + False", -5I + False)
PrintResult("-5I + True", -5I + True)
PrintResult("-5I + System.SByte.MinValue", -5I + System.SByte.MinValue)
PrintResult("-5I + System.Byte.MaxValue", -5I + System.Byte.MaxValue)
PrintResult("-5I + -3S", -5I + -3S)
PrintResult("-5I + 24US", -5I + 24US)
PrintResult("-5I + -5I", -5I + -5I)
PrintResult("-5I + 26UI", -5I + 26UI)
PrintResult("-5I + -7L", -5I + -7L)
PrintResult("-5I + 28UL", -5I + 28UL)
PrintResult("-5I + -9D", -5I + -9D)
PrintResult("-5I + 10.0F", -5I + 10.0F)
PrintResult("-5I + -11.0R", -5I + -11.0R)
PrintResult("-5I + ""12""", -5I + "12")
PrintResult("-5I + TypeCode.Double", -5I + TypeCode.Double)
PrintResult("26UI + False", 26UI + False)
PrintResult("26UI + True", 26UI + True)
PrintResult("26UI + System.SByte.MinValue", 26UI + System.SByte.MinValue)
PrintResult("26UI + System.Byte.MaxValue", 26UI + System.Byte.MaxValue)
PrintResult("26UI + -3S", 26UI + -3S)
PrintResult("26UI + 24US", 26UI + 24US)
PrintResult("26UI + -5I", 26UI + -5I)
PrintResult("26UI + 26UI", 26UI + 26UI)
PrintResult("26UI + -7L", 26UI + -7L)
PrintResult("26UI + 28UL", 26UI + 28UL)
PrintResult("26UI + -9D", 26UI + -9D)
PrintResult("26UI + 10.0F", 26UI + 10.0F)
PrintResult("26UI + -11.0R", 26UI + -11.0R)
PrintResult("26UI + ""12""", 26UI + "12")
PrintResult("26UI + TypeCode.Double", 26UI + TypeCode.Double)
PrintResult("-7L + False", -7L + False)
PrintResult("-7L + True", -7L + True)
PrintResult("-7L + System.SByte.MinValue", -7L + System.SByte.MinValue)
PrintResult("-7L + System.Byte.MaxValue", -7L + System.Byte.MaxValue)
PrintResult("-7L + -3S", -7L + -3S)
PrintResult("-7L + 24US", -7L + 24US)
PrintResult("-7L + -5I", -7L + -5I)
PrintResult("-7L + 26UI", -7L + 26UI)
PrintResult("-7L + -7L", -7L + -7L)
PrintResult("-7L + 28UL", -7L + 28UL)
PrintResult("-7L + -9D", -7L + -9D)
PrintResult("-7L + 10.0F", -7L + 10.0F)
PrintResult("-7L + -11.0R", -7L + -11.0R)
PrintResult("-7L + ""12""", -7L + "12")
PrintResult("-7L + TypeCode.Double", -7L + TypeCode.Double)
PrintResult("28UL + False", 28UL + False)
PrintResult("28UL + True", 28UL + True)
PrintResult("28UL + System.SByte.MinValue", 28UL + System.SByte.MinValue)
PrintResult("28UL + System.Byte.MaxValue", 28UL + System.Byte.MaxValue)
PrintResult("28UL + -3S", 28UL + -3S)
PrintResult("28UL + 24US", 28UL + 24US)
PrintResult("28UL + -5I", 28UL + -5I)
PrintResult("28UL + 26UI", 28UL + 26UI)
PrintResult("28UL + -7L", 28UL + -7L)
PrintResult("28UL + 28UL", 28UL + 28UL)
PrintResult("28UL + -9D", 28UL + -9D)
PrintResult("28UL + 10.0F", 28UL + 10.0F)
PrintResult("28UL + -11.0R", 28UL + -11.0R)
PrintResult("28UL + ""12""", 28UL + "12")
PrintResult("28UL + TypeCode.Double", 28UL + TypeCode.Double)
PrintResult("-9D + False", -9D + False)
PrintResult("-9D + True", -9D + True)
PrintResult("-9D + System.SByte.MinValue", -9D + System.SByte.MinValue)
PrintResult("-9D + System.Byte.MaxValue", -9D + System.Byte.MaxValue)
PrintResult("-9D + -3S", -9D + -3S)
PrintResult("-9D + 24US", -9D + 24US)
PrintResult("-9D + -5I", -9D + -5I)
PrintResult("-9D + 26UI", -9D + 26UI)
PrintResult("-9D + -7L", -9D + -7L)
PrintResult("-9D + 28UL", -9D + 28UL)
PrintResult("-9D + -9D", -9D + -9D)
PrintResult("-9D + 10.0F", -9D + 10.0F)
PrintResult("-9D + -11.0R", -9D + -11.0R)
PrintResult("-9D + ""12""", -9D + "12")
PrintResult("-9D + TypeCode.Double", -9D + TypeCode.Double)
PrintResult("10.0F + False", 10.0F + False)
PrintResult("10.0F + True", 10.0F + True)
PrintResult("10.0F + System.SByte.MinValue", 10.0F + System.SByte.MinValue)
PrintResult("10.0F + System.Byte.MaxValue", 10.0F + System.Byte.MaxValue)
PrintResult("10.0F + -3S", 10.0F + -3S)
PrintResult("10.0F + 24US", 10.0F + 24US)
PrintResult("10.0F + -5I", 10.0F + -5I)
PrintResult("10.0F + 26UI", 10.0F + 26UI)
PrintResult("10.0F + -7L", 10.0F + -7L)
PrintResult("10.0F + 28UL", 10.0F + 28UL)
PrintResult("10.0F + -9D", 10.0F + -9D)
PrintResult("10.0F + 10.0F", 10.0F + 10.0F)
PrintResult("10.0F + -11.0R", 10.0F + -11.0R)
PrintResult("10.0F + ""12""", 10.0F + "12")
PrintResult("10.0F + TypeCode.Double", 10.0F + TypeCode.Double)
PrintResult("-11.0R + False", -11.0R + False)
PrintResult("-11.0R + True", -11.0R + True)
PrintResult("-11.0R + System.SByte.MinValue", -11.0R + System.SByte.MinValue)
PrintResult("-11.0R + System.Byte.MaxValue", -11.0R + System.Byte.MaxValue)
PrintResult("-11.0R + -3S", -11.0R + -3S)
PrintResult("-11.0R + 24US", -11.0R + 24US)
PrintResult("-11.0R + -5I", -11.0R + -5I)
PrintResult("-11.0R + 26UI", -11.0R + 26UI)
PrintResult("-11.0R + -7L", -11.0R + -7L)
PrintResult("-11.0R + 28UL", -11.0R + 28UL)
PrintResult("-11.0R + -9D", -11.0R + -9D)
PrintResult("-11.0R + 10.0F", -11.0R + 10.0F)
PrintResult("-11.0R + -11.0R", -11.0R + -11.0R)
PrintResult("-11.0R + ""12""", -11.0R + "12")
PrintResult("-11.0R + TypeCode.Double", -11.0R + TypeCode.Double)
PrintResult("""12"" + False", "12" + False)
PrintResult("""12"" + True", "12" + True)
PrintResult("""12"" + System.SByte.MinValue", "12" + System.SByte.MinValue)
PrintResult("""12"" + System.Byte.MaxValue", "12" + System.Byte.MaxValue)
PrintResult("""12"" + -3S", "12" + -3S)
PrintResult("""12"" + 24US", "12" + 24US)
PrintResult("""12"" + -5I", "12" + -5I)
PrintResult("""12"" + 26UI", "12" + 26UI)
PrintResult("""12"" + -7L", "12" + -7L)
PrintResult("""12"" + 28UL", "12" + 28UL)
PrintResult("""12"" + -9D", "12" + -9D)
PrintResult("""12"" + 10.0F", "12" + 10.0F)
PrintResult("""12"" + -11.0R", "12" + -11.0R)
PrintResult("""12"" + ""12""", "12" + "12")
PrintResult("""12"" + TypeCode.Double", "12" + TypeCode.Double)
PrintResult("TypeCode.Double + False", TypeCode.Double + False)
PrintResult("TypeCode.Double + True", TypeCode.Double + True)
PrintResult("TypeCode.Double + System.SByte.MinValue", TypeCode.Double + System.SByte.MinValue)
PrintResult("TypeCode.Double + System.Byte.MaxValue", TypeCode.Double + System.Byte.MaxValue)
PrintResult("TypeCode.Double + -3S", TypeCode.Double + -3S)
PrintResult("TypeCode.Double + 24US", TypeCode.Double + 24US)
PrintResult("TypeCode.Double + -5I", TypeCode.Double + -5I)
PrintResult("TypeCode.Double + 26UI", TypeCode.Double + 26UI)
PrintResult("TypeCode.Double + -7L", TypeCode.Double + -7L)
PrintResult("TypeCode.Double + 28UL", TypeCode.Double + 28UL)
PrintResult("TypeCode.Double + -9D", TypeCode.Double + -9D)
PrintResult("TypeCode.Double + 10.0F", TypeCode.Double + 10.0F)
PrintResult("TypeCode.Double + -11.0R", TypeCode.Double + -11.0R)
PrintResult("TypeCode.Double + ""12""", TypeCode.Double + "12")
PrintResult("TypeCode.Double + TypeCode.Double", TypeCode.Double + TypeCode.Double)
PrintResult("False - False", False - False)
PrintResult("False - True", False - True)
PrintResult("False - System.SByte.MaxValue", False - System.SByte.MaxValue)
PrintResult("False - System.Byte.MaxValue", False - System.Byte.MaxValue)
PrintResult("False - -3S", False - -3S)
PrintResult("False - 24US", False - 24US)
PrintResult("False - -5I", False - -5I)
PrintResult("False - 26UI", False - 26UI)
PrintResult("False - -7L", False - -7L)
PrintResult("False - 28UL", False - 28UL)
PrintResult("False - -9D", False - -9D)
PrintResult("False - 10.0F", False - 10.0F)
PrintResult("False - -11.0R", False - -11.0R)
PrintResult("False - ""12""", False - "12")
PrintResult("False - TypeCode.Double", False - TypeCode.Double)
PrintResult("True - False", True - False)
PrintResult("True - True", True - True)
PrintResult("True - System.SByte.MinValue", True - System.SByte.MinValue)
PrintResult("True - System.Byte.MaxValue", True - System.Byte.MaxValue)
PrintResult("True - -3S", True - -3S)
PrintResult("True - 24US", True - 24US)
PrintResult("True - -5I", True - -5I)
PrintResult("True - 26UI", True - 26UI)
PrintResult("True - -7L", True - -7L)
PrintResult("True - 28UL", True - 28UL)
PrintResult("True - -9D", True - -9D)
PrintResult("True - 10.0F", True - 10.0F)
PrintResult("True - -11.0R", True - -11.0R)
PrintResult("True - ""12""", True - "12")
PrintResult("True - TypeCode.Double", True - TypeCode.Double)
PrintResult("System.SByte.MinValue - False", System.SByte.MinValue - False)
PrintResult("System.SByte.MinValue - True", System.SByte.MinValue - True)
PrintResult("System.SByte.MinValue - System.SByte.MinValue", System.SByte.MinValue - System.SByte.MinValue)
PrintResult("System.SByte.MinValue - System.Byte.MaxValue", System.SByte.MinValue - System.Byte.MaxValue)
PrintResult("System.SByte.MinValue - -3S", System.SByte.MinValue - -3S)
PrintResult("System.SByte.MinValue - 24US", System.SByte.MinValue - 24US)
PrintResult("System.SByte.MinValue - -5I", System.SByte.MinValue - -5I)
PrintResult("System.SByte.MinValue - 26UI", System.SByte.MinValue - 26UI)
PrintResult("System.SByte.MinValue - -7L", System.SByte.MinValue - -7L)
PrintResult("System.SByte.MinValue - 28UL", System.SByte.MinValue - 28UL)
PrintResult("System.SByte.MinValue - -9D", System.SByte.MinValue - -9D)
PrintResult("System.SByte.MinValue - 10.0F", System.SByte.MinValue - 10.0F)
PrintResult("System.SByte.MinValue - -11.0R", System.SByte.MinValue - -11.0R)
PrintResult("System.SByte.MinValue - ""12""", System.SByte.MinValue - "12")
PrintResult("System.SByte.MinValue - TypeCode.Double", System.SByte.MinValue - TypeCode.Double)
PrintResult("System.Byte.MaxValue - False", System.Byte.MaxValue - False)
PrintResult("System.Byte.MaxValue - True", System.Byte.MaxValue - True)
PrintResult("System.Byte.MaxValue - System.SByte.MinValue", System.Byte.MaxValue - System.SByte.MinValue)
PrintResult("System.Byte.MaxValue - System.Byte.MaxValue", System.Byte.MaxValue - System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue - -3S", System.Byte.MaxValue - -3S)
PrintResult("System.Byte.MaxValue - -5I", System.Byte.MaxValue - -5I)
PrintResult("System.Byte.MaxValue - -7L", System.Byte.MaxValue - -7L)
PrintResult("System.Byte.MaxValue - -9D", System.Byte.MaxValue - -9D)
PrintResult("System.Byte.MaxValue - 10.0F", System.Byte.MaxValue - 10.0F)
PrintResult("System.Byte.MaxValue - -11.0R", System.Byte.MaxValue - -11.0R)
PrintResult("System.Byte.MaxValue - ""12""", System.Byte.MaxValue - "12")
PrintResult("System.Byte.MaxValue - TypeCode.Double", System.Byte.MaxValue - TypeCode.Double)
PrintResult("-3S - False", -3S - False)
PrintResult("-3S - True", -3S - True)
PrintResult("-3S - System.SByte.MinValue", -3S - System.SByte.MinValue)
PrintResult("-3S - System.Byte.MaxValue", -3S - System.Byte.MaxValue)
PrintResult("-3S - -3S", -3S - -3S)
PrintResult("-3S - 24US", -3S - 24US)
PrintResult("-3S - -5I", -3S - -5I)
PrintResult("-3S - 26UI", -3S - 26UI)
PrintResult("-3S - -7L", -3S - -7L)
PrintResult("-3S - 28UL", -3S - 28UL)
PrintResult("-3S - -9D", -3S - -9D)
PrintResult("-3S - 10.0F", -3S - 10.0F)
PrintResult("-3S - -11.0R", -3S - -11.0R)
PrintResult("-3S - ""12""", -3S - "12")
PrintResult("-3S - TypeCode.Double", -3S - TypeCode.Double)
PrintResult("24US - False", 24US - False)
PrintResult("24US - True", 24US - True)
PrintResult("24US - System.SByte.MinValue", 24US - System.SByte.MinValue)
PrintResult("System.UInt16.MaxValue - System.Byte.MaxValue", System.UInt16.MaxValue - System.Byte.MaxValue)
PrintResult("24US - -3S", 24US - -3S)
PrintResult("24US - 24US", 24US - 24US)
PrintResult("24US - -5I", 24US - -5I)
PrintResult("24US - -7L", 24US - -7L)
PrintResult("24US - -9D", 24US - -9D)
PrintResult("24US - 10.0F", 24US - 10.0F)
PrintResult("24US - -11.0R", 24US - -11.0R)
PrintResult("24US - ""12""", 24US - "12")
PrintResult("24US - TypeCode.Double", 24US - TypeCode.Double)
PrintResult("-5I - False", -5I - False)
PrintResult("-5I - True", -5I - True)
PrintResult("-5I - System.SByte.MinValue", -5I - System.SByte.MinValue)
PrintResult("-5I - System.Byte.MaxValue", -5I - System.Byte.MaxValue)
PrintResult("-5I - -3S", -5I - -3S)
PrintResult("-5I - 24US", -5I - 24US)
PrintResult("-5I - -5I", -5I - -5I)
PrintResult("-5I - 26UI", -5I - 26UI)
PrintResult("-5I - -7L", -5I - -7L)
PrintResult("-5I - 28UL", -5I - 28UL)
PrintResult("-5I - -9D", -5I - -9D)
PrintResult("-5I - 10.0F", -5I - 10.0F)
PrintResult("-5I - -11.0R", -5I - -11.0R)
PrintResult("-5I - ""12""", -5I - "12")
PrintResult("-5I - TypeCode.Double", -5I - TypeCode.Double)
PrintResult("26UI - False", 26UI - False)
PrintResult("26UI - True", 26UI - True)
PrintResult("26UI - System.SByte.MinValue", 26UI - System.SByte.MinValue)
PrintResult("System.UInt32.MaxValue - System.Byte.MaxValue", System.UInt32.MaxValue - System.Byte.MaxValue)
PrintResult("26UI - -3S", 26UI - -3S)
PrintResult("26UI - 24US", 26UI - 24US)
PrintResult("26UI - -5I", 26UI - -5I)
PrintResult("26UI - 26UI", 26UI - 26UI)
PrintResult("26UI - -7L", 26UI - -7L)
PrintResult("26UI - -9D", 26UI - -9D)
PrintResult("26UI - 10.0F", 26UI - 10.0F)
PrintResult("26UI - -11.0R", 26UI - -11.0R)
PrintResult("26UI - ""12""", 26UI - "12")
PrintResult("26UI - TypeCode.Double", 26UI - TypeCode.Double)
PrintResult("-7L - False", -7L - False)
PrintResult("-7L - True", -7L - True)
PrintResult("-7L - System.SByte.MinValue", -7L - System.SByte.MinValue)
PrintResult("-7L - System.Byte.MaxValue", -7L - System.Byte.MaxValue)
PrintResult("-7L - -3S", -7L - -3S)
PrintResult("-7L - 24US", -7L - 24US)
PrintResult("-7L - -5I", -7L - -5I)
PrintResult("-7L - 26UI", -7L - 26UI)
PrintResult("-7L - -7L", -7L - -7L)
PrintResult("-7L - 28UL", -7L - 28UL)
PrintResult("-7L - -9D", -7L - -9D)
PrintResult("-7L - 10.0F", -7L - 10.0F)
PrintResult("-7L - -11.0R", -7L - -11.0R)
PrintResult("-7L - ""12""", -7L - "12")
PrintResult("-7L - TypeCode.Double", -7L - TypeCode.Double)
PrintResult("28UL - False", 28UL - False)
PrintResult("28UL - True", 28UL - True)
PrintResult("28UL - System.SByte.MinValue", 28UL - System.SByte.MinValue)
PrintResult("System.UInt64.MaxValue - System.Byte.MaxValue", System.UInt64.MaxValue - System.Byte.MaxValue)
PrintResult("28UL - -3S", 28UL - -3S)
PrintResult("28UL - 24US", 28UL - 24US)
PrintResult("28UL - -5I", 28UL - -5I)
PrintResult("28UL - 26UI", 28UL - 26UI)
PrintResult("28UL - -7L", 28UL - -7L)
PrintResult("28UL - 28UL", 28UL - 28UL)
PrintResult("28UL - -9D", 28UL - -9D)
PrintResult("28UL - 10.0F", 28UL - 10.0F)
PrintResult("28UL - -11.0R", 28UL - -11.0R)
PrintResult("28UL - ""12""", 28UL - "12")
PrintResult("28UL - TypeCode.Double", 28UL - TypeCode.Double)
PrintResult("-9D - False", -9D - False)
PrintResult("-9D - True", -9D - True)
PrintResult("-9D - System.SByte.MinValue", -9D - System.SByte.MinValue)
PrintResult("-9D - System.Byte.MaxValue", -9D - System.Byte.MaxValue)
PrintResult("-9D - -3S", -9D - -3S)
PrintResult("-9D - 24US", -9D - 24US)
PrintResult("-9D - -5I", -9D - -5I)
PrintResult("-9D - 26UI", -9D - 26UI)
PrintResult("-9D - -7L", -9D - -7L)
PrintResult("-9D - 28UL", -9D - 28UL)
PrintResult("-9D - -9D", -9D - -9D)
PrintResult("-9D - 10.0F", -9D - 10.0F)
PrintResult("-9D - -11.0R", -9D - -11.0R)
PrintResult("-9D - ""12""", -9D - "12")
PrintResult("-9D - TypeCode.Double", -9D - TypeCode.Double)
PrintResult("10.0F - False", 10.0F - False)
PrintResult("10.0F - True", 10.0F - True)
PrintResult("10.0F - System.SByte.MinValue", 10.0F - System.SByte.MinValue)
PrintResult("10.0F - System.Byte.MaxValue", 10.0F - System.Byte.MaxValue)
PrintResult("10.0F - -3S", 10.0F - -3S)
PrintResult("10.0F - 24US", 10.0F - 24US)
PrintResult("10.0F - -5I", 10.0F - -5I)
PrintResult("10.0F - 26UI", 10.0F - 26UI)
PrintResult("10.0F - -7L", 10.0F - -7L)
PrintResult("10.0F - 28UL", 10.0F - 28UL)
PrintResult("10.0F - -9D", 10.0F - -9D)
PrintResult("10.0F - 10.0F", 10.0F - 10.0F)
PrintResult("10.0F - -11.0R", 10.0F - -11.0R)
PrintResult("10.0F - ""12""", 10.0F - "12")
PrintResult("10.0F - TypeCode.Double", 10.0F - TypeCode.Double)
PrintResult("-11.0R - False", -11.0R - False)
PrintResult("-11.0R - True", -11.0R - True)
PrintResult("-11.0R - System.SByte.MinValue", -11.0R - System.SByte.MinValue)
PrintResult("-11.0R - System.Byte.MaxValue", -11.0R - System.Byte.MaxValue)
PrintResult("-11.0R - -3S", -11.0R - -3S)
PrintResult("-11.0R - 24US", -11.0R - 24US)
PrintResult("-11.0R - -5I", -11.0R - -5I)
PrintResult("-11.0R - 26UI", -11.0R - 26UI)
PrintResult("-11.0R - -7L", -11.0R - -7L)
PrintResult("-11.0R - 28UL", -11.0R - 28UL)
PrintResult("-11.0R - -9D", -11.0R - -9D)
PrintResult("-11.0R - 10.0F", -11.0R - 10.0F)
PrintResult("-11.0R - -11.0R", -11.0R - -11.0R)
PrintResult("-11.0R - ""12""", -11.0R - "12")
PrintResult("-11.0R - TypeCode.Double", -11.0R - TypeCode.Double)
PrintResult("""12"" - False", "12" - False)
PrintResult("""12"" - True", "12" - True)
PrintResult("""12"" - System.SByte.MinValue", "12" - System.SByte.MinValue)
PrintResult("""12"" - System.Byte.MaxValue", "12" - System.Byte.MaxValue)
PrintResult("""12"" - -3S", "12" - -3S)
PrintResult("""12"" - 24US", "12" - 24US)
PrintResult("""12"" - -5I", "12" - -5I)
PrintResult("""12"" - 26UI", "12" - 26UI)
PrintResult("""12"" - -7L", "12" - -7L)
PrintResult("""12"" - 28UL", "12" - 28UL)
PrintResult("""12"" - -9D", "12" - -9D)
PrintResult("""12"" - 10.0F", "12" - 10.0F)
PrintResult("""12"" - -11.0R", "12" - -11.0R)
PrintResult("""12"" - ""12""", "12" - "12")
PrintResult("""12"" - TypeCode.Double", "12" - TypeCode.Double)
PrintResult("TypeCode.Double - False", TypeCode.Double - False)
PrintResult("TypeCode.Double - True", TypeCode.Double - True)
PrintResult("TypeCode.Double - System.SByte.MinValue", TypeCode.Double - System.SByte.MinValue)
PrintResult("TypeCode.Double - System.Byte.MaxValue", TypeCode.Double - System.Byte.MaxValue)
PrintResult("TypeCode.Double - -3S", TypeCode.Double - -3S)
PrintResult("TypeCode.Double - 24US", TypeCode.Double - 24US)
PrintResult("TypeCode.Double - -5I", TypeCode.Double - -5I)
PrintResult("TypeCode.Double - 26UI", TypeCode.Double - 26UI)
PrintResult("TypeCode.Double - -7L", TypeCode.Double - -7L)
PrintResult("TypeCode.Double - 28UL", TypeCode.Double - 28UL)
PrintResult("TypeCode.Double - -9D", TypeCode.Double - -9D)
PrintResult("TypeCode.Double - 10.0F", TypeCode.Double - 10.0F)
PrintResult("TypeCode.Double - -11.0R", TypeCode.Double - -11.0R)
PrintResult("TypeCode.Double - ""12""", TypeCode.Double - "12")
PrintResult("TypeCode.Double - TypeCode.Double", TypeCode.Double - TypeCode.Double)
PrintResult("False * False", False * False)
PrintResult("False * True", False * True)
PrintResult("False * System.SByte.MinValue", False * System.SByte.MinValue)
PrintResult("False * System.Byte.MaxValue", False * System.Byte.MaxValue)
PrintResult("False * -3S", False * -3S)
PrintResult("False * 24US", False * 24US)
PrintResult("False * -5I", False * -5I)
PrintResult("False * 26UI", False * 26UI)
PrintResult("False * -7L", False * -7L)
PrintResult("False * 28UL", False * 28UL)
PrintResult("False * -9D", False * -9D)
PrintResult("False * 10.0F", False * 10.0F)
PrintResult("False * -11.0R", False * -11.0R)
PrintResult("False * ""12""", False * "12")
PrintResult("False * TypeCode.Double", False * TypeCode.Double)
PrintResult("True * False", True * False)
PrintResult("True * True", True * True)
PrintResult("True * System.SByte.MaxValue", True * System.SByte.MaxValue)
PrintResult("True * System.Byte.MaxValue", True * System.Byte.MaxValue)
PrintResult("True * -3S", True * -3S)
PrintResult("True * 24US", True * 24US)
PrintResult("True * -5I", True * -5I)
PrintResult("True * 26UI", True * 26UI)
PrintResult("True * -7L", True * -7L)
PrintResult("True * 28UL", True * 28UL)
PrintResult("True * -9D", True * -9D)
PrintResult("True * 10.0F", True * 10.0F)
PrintResult("True * -11.0R", True * -11.0R)
PrintResult("True * ""12""", True * "12")
PrintResult("True * TypeCode.Double", True * TypeCode.Double)
PrintResult("System.SByte.MinValue * False", System.SByte.MinValue * False)
PrintResult("System.SByte.MaxValue * True", System.SByte.MaxValue * True)
PrintResult("System.SByte.MinValue * (-(System.SByte.MinValue + System.SByte.MaxValue))", System.SByte.MinValue * (-(System.SByte.MinValue + System.SByte.MaxValue)))
PrintResult("System.SByte.MinValue * System.Byte.MaxValue", System.SByte.MinValue * System.Byte.MaxValue)
PrintResult("System.SByte.MinValue * -3S", System.SByte.MinValue * -3S)
PrintResult("System.SByte.MinValue * 24US", System.SByte.MinValue * 24US)
PrintResult("System.SByte.MinValue * -5I", System.SByte.MinValue * -5I)
PrintResult("System.SByte.MinValue * 26UI", System.SByte.MinValue * 26UI)
PrintResult("System.SByte.MinValue * -7L", System.SByte.MinValue * -7L)
PrintResult("System.SByte.MinValue * 28UL", System.SByte.MinValue * 28UL)
PrintResult("System.SByte.MinValue * -9D", System.SByte.MinValue * -9D)
PrintResult("System.SByte.MinValue * 10.0F", System.SByte.MinValue * 10.0F)
PrintResult("System.SByte.MinValue * -11.0R", System.SByte.MinValue * -11.0R)
PrintResult("System.SByte.MinValue * ""12""", System.SByte.MinValue * "12")
PrintResult("System.SByte.MinValue * TypeCode.Double", System.SByte.MinValue * TypeCode.Double)
PrintResult("System.Byte.MaxValue * False", System.Byte.MaxValue * False)
PrintResult("System.Byte.MaxValue * True", System.Byte.MaxValue * True)
PrintResult("System.Byte.MaxValue * System.SByte.MinValue", System.Byte.MaxValue * System.SByte.MinValue)
PrintResult("System.Byte.MaxValue * -3S", System.Byte.MaxValue * -3S)
PrintResult("System.Byte.MaxValue * 24US", System.Byte.MaxValue * 24US)
PrintResult("System.Byte.MaxValue * -5I", System.Byte.MaxValue * -5I)
PrintResult("System.Byte.MaxValue * 26UI", System.Byte.MaxValue * 26UI)
PrintResult("System.Byte.MaxValue * -7L", System.Byte.MaxValue * -7L)
PrintResult("System.Byte.MaxValue * 28UL", System.Byte.MaxValue * 28UL)
PrintResult("System.Byte.MaxValue * -9D", System.Byte.MaxValue * -9D)
PrintResult("System.Byte.MaxValue * 10.0F", System.Byte.MaxValue * 10.0F)
PrintResult("System.Byte.MaxValue * -11.0R", System.Byte.MaxValue * -11.0R)
PrintResult("System.Byte.MaxValue * ""12""", System.Byte.MaxValue * "12")
PrintResult("System.Byte.MaxValue * TypeCode.Double", System.Byte.MaxValue * TypeCode.Double)
PrintResult("-3S * False", -3S * False)
PrintResult("-3S * True", -3S * True)
PrintResult("-3S * System.SByte.MinValue", -3S * System.SByte.MinValue)
PrintResult("-3S * System.Byte.MaxValue", -3S * System.Byte.MaxValue)
PrintResult("-3S * -3S", -3S * -3S)
PrintResult("-3S * 24US", -3S * 24US)
PrintResult("-3S * -5I", -3S * -5I)
PrintResult("-3S * 26UI", -3S * 26UI)
PrintResult("-3S * -7L", -3S * -7L)
PrintResult("-3S * 28UL", -3S * 28UL)
PrintResult("-3S * -9D", -3S * -9D)
PrintResult("-3S * 10.0F", -3S * 10.0F)
PrintResult("-3S * -11.0R", -3S * -11.0R)
PrintResult("-3S * ""12""", -3S * "12")
PrintResult("-3S * TypeCode.Double", -3S * TypeCode.Double)
PrintResult("24US * False", 24US * False)
PrintResult("24US * True", 24US * True)
PrintResult("24US * System.SByte.MinValue", 24US * System.SByte.MinValue)
PrintResult("24US * System.Byte.MaxValue", 24US * System.Byte.MaxValue)
PrintResult("24US * -3S", 24US * -3S)
PrintResult("24US * 24US", 24US * 24US)
PrintResult("24US * -5I", 24US * -5I)
PrintResult("24US * 26UI", 24US * 26UI)
PrintResult("24US * -7L", 24US * -7L)
PrintResult("24US * 28UL", 24US * 28UL)
PrintResult("24US * -9D", 24US * -9D)
PrintResult("24US * 10.0F", 24US * 10.0F)
PrintResult("24US * -11.0R", 24US * -11.0R)
PrintResult("24US * ""12""", 24US * "12")
PrintResult("24US * TypeCode.Double", 24US * TypeCode.Double)
PrintResult("-5I * False", -5I * False)
PrintResult("-5I * True", -5I * True)
PrintResult("-5I * System.SByte.MinValue", -5I * System.SByte.MinValue)
PrintResult("-5I * System.Byte.MaxValue", -5I * System.Byte.MaxValue)
PrintResult("-5I * -3S", -5I * -3S)
PrintResult("-5I * 24US", -5I * 24US)
PrintResult("-5I * -5I", -5I * -5I)
PrintResult("-5I * 26UI", -5I * 26UI)
PrintResult("-5I * -7L", -5I * -7L)
PrintResult("-5I * 28UL", -5I * 28UL)
PrintResult("-5I * -9D", -5I * -9D)
PrintResult("-5I * 10.0F", -5I * 10.0F)
PrintResult("-5I * -11.0R", -5I * -11.0R)
PrintResult("-5I * ""12""", -5I * "12")
PrintResult("-5I * TypeCode.Double", -5I * TypeCode.Double)
PrintResult("26UI * False", 26UI * False)
PrintResult("26UI * True", 26UI * True)
PrintResult("26UI * System.SByte.MinValue", 26UI * System.SByte.MinValue)
PrintResult("26UI * System.Byte.MaxValue", 26UI * System.Byte.MaxValue)
PrintResult("26UI * -3S", 26UI * -3S)
PrintResult("26UI * 24US", 26UI * 24US)
PrintResult("26UI * -5I", 26UI * -5I)
PrintResult("26UI * 26UI", 26UI * 26UI)
PrintResult("26UI * -7L", 26UI * -7L)
PrintResult("26UI * 28UL", 26UI * 28UL)
PrintResult("26UI * -9D", 26UI * -9D)
PrintResult("26UI * 10.0F", 26UI * 10.0F)
PrintResult("26UI * -11.0R", 26UI * -11.0R)
PrintResult("26UI * ""12""", 26UI * "12")
PrintResult("26UI * TypeCode.Double", 26UI * TypeCode.Double)
PrintResult("-7L * False", -7L * False)
PrintResult("-7L * True", -7L * True)
PrintResult("-7L * System.SByte.MinValue", -7L * System.SByte.MinValue)
PrintResult("-7L * System.Byte.MaxValue", -7L * System.Byte.MaxValue)
PrintResult("-7L * -3S", -7L * -3S)
PrintResult("-7L * 24US", -7L * 24US)
PrintResult("-7L * -5I", -7L * -5I)
PrintResult("-7L * 26UI", -7L * 26UI)
PrintResult("-7L * -7L", -7L * -7L)
PrintResult("-7L * 28UL", -7L * 28UL)
PrintResult("-7L * -9D", -7L * -9D)
PrintResult("-7L * 10.0F", -7L * 10.0F)
PrintResult("-7L * -11.0R", -7L * -11.0R)
PrintResult("-7L * ""12""", -7L * "12")
PrintResult("-7L * TypeCode.Double", -7L * TypeCode.Double)
PrintResult("28UL * False", 28UL * False)
PrintResult("28UL * True", 28UL * True)
PrintResult("28UL * System.SByte.MinValue", 28UL * System.SByte.MinValue)
PrintResult("28UL * System.Byte.MaxValue", 28UL * System.Byte.MaxValue)
PrintResult("28UL * -3S", 28UL * -3S)
PrintResult("28UL * 24US", 28UL * 24US)
PrintResult("28UL * -5I", 28UL * -5I)
PrintResult("28UL * 26UI", 28UL * 26UI)
PrintResult("28UL * -7L", 28UL * -7L)
PrintResult("28UL * 28UL", 28UL * 28UL)
PrintResult("28UL * -9D", 28UL * -9D)
PrintResult("28UL * 10.0F", 28UL * 10.0F)
PrintResult("28UL * -11.0R", 28UL * -11.0R)
PrintResult("28UL * ""12""", 28UL * "12")
PrintResult("28UL * TypeCode.Double", 28UL * TypeCode.Double)
PrintResult("-9D * False", -9D * False)
PrintResult("-9D * True", -9D * True)
PrintResult("-9D * System.SByte.MinValue", -9D * System.SByte.MinValue)
PrintResult("-9D * System.Byte.MaxValue", -9D * System.Byte.MaxValue)
PrintResult("-9D * -3S", -9D * -3S)
PrintResult("-9D * 24US", -9D * 24US)
PrintResult("-9D * -5I", -9D * -5I)
PrintResult("-9D * 26UI", -9D * 26UI)
PrintResult("-9D * -7L", -9D * -7L)
PrintResult("-9D * 28UL", -9D * 28UL)
PrintResult("-9D * -9D", -9D * -9D)
PrintResult("-9D * 10.0F", -9D * 10.0F)
PrintResult("-9D * -11.0R", -9D * -11.0R)
PrintResult("-9D * ""12""", -9D * "12")
PrintResult("-9D * TypeCode.Double", -9D * TypeCode.Double)
PrintResult("10.0F * False", 10.0F * False)
PrintResult("10.0F * True", 10.0F * True)
PrintResult("10.0F * System.SByte.MinValue", 10.0F * System.SByte.MinValue)
PrintResult("10.0F * System.Byte.MaxValue", 10.0F * System.Byte.MaxValue)
PrintResult("10.0F * -3S", 10.0F * -3S)
PrintResult("10.0F * 24US", 10.0F * 24US)
PrintResult("10.0F * -5I", 10.0F * -5I)
PrintResult("10.0F * 26UI", 10.0F * 26UI)
PrintResult("10.0F * -7L", 10.0F * -7L)
PrintResult("10.0F * 28UL", 10.0F * 28UL)
PrintResult("10.0F * -9D", 10.0F * -9D)
PrintResult("10.0F * 10.0F", 10.0F * 10.0F)
PrintResult("10.0F * -11.0R", 10.0F * -11.0R)
PrintResult("10.0F * ""12""", 10.0F * "12")
PrintResult("10.0F * TypeCode.Double", 10.0F * TypeCode.Double)
PrintResult("-11.0R * False", -11.0R * False)
PrintResult("-11.0R * True", -11.0R * True)
PrintResult("-11.0R * System.SByte.MinValue", -11.0R * System.SByte.MinValue)
PrintResult("-11.0R * System.Byte.MaxValue", -11.0R * System.Byte.MaxValue)
PrintResult("-11.0R * -3S", -11.0R * -3S)
PrintResult("-11.0R * 24US", -11.0R * 24US)
PrintResult("-11.0R * -5I", -11.0R * -5I)
PrintResult("-11.0R * 26UI", -11.0R * 26UI)
PrintResult("-11.0R * -7L", -11.0R * -7L)
PrintResult("-11.0R * 28UL", -11.0R * 28UL)
PrintResult("-11.0R * -9D", -11.0R * -9D)
PrintResult("-11.0R * 10.0F", -11.0R * 10.0F)
PrintResult("-11.0R * -11.0R", -11.0R * -11.0R)
PrintResult("-11.0R * ""12""", -11.0R * "12")
PrintResult("-11.0R * TypeCode.Double", -11.0R * TypeCode.Double)
PrintResult("""12"" * False", "12" * False)
PrintResult("""12"" * True", "12" * True)
PrintResult("""12"" * System.SByte.MinValue", "12" * System.SByte.MinValue)
PrintResult("""12"" * System.Byte.MaxValue", "12" * System.Byte.MaxValue)
PrintResult("""12"" * -3S", "12" * -3S)
PrintResult("""12"" * 24US", "12" * 24US)
PrintResult("""12"" * -5I", "12" * -5I)
PrintResult("""12"" * 26UI", "12" * 26UI)
PrintResult("""12"" * -7L", "12" * -7L)
PrintResult("""12"" * 28UL", "12" * 28UL)
PrintResult("""12"" * -9D", "12" * -9D)
PrintResult("""12"" * 10.0F", "12" * 10.0F)
PrintResult("""12"" * -11.0R", "12" * -11.0R)
PrintResult("""12"" * ""12""", "12" * "12")
PrintResult("""12"" * TypeCode.Double", "12" * TypeCode.Double)
PrintResult("TypeCode.Double * False", TypeCode.Double * False)
PrintResult("TypeCode.Double * True", TypeCode.Double * True)
PrintResult("TypeCode.Double * System.SByte.MinValue", TypeCode.Double * System.SByte.MinValue)
PrintResult("TypeCode.Double * System.Byte.MaxValue", TypeCode.Double * System.Byte.MaxValue)
PrintResult("TypeCode.Double * -3S", TypeCode.Double * -3S)
PrintResult("TypeCode.Double * 24US", TypeCode.Double * 24US)
PrintResult("TypeCode.Double * -5I", TypeCode.Double * -5I)
PrintResult("TypeCode.Double * 26UI", TypeCode.Double * 26UI)
PrintResult("TypeCode.Double * -7L", TypeCode.Double * -7L)
PrintResult("TypeCode.Double * 28UL", TypeCode.Double * 28UL)
PrintResult("TypeCode.Double * -9D", TypeCode.Double * -9D)
PrintResult("TypeCode.Double * 10.0F", TypeCode.Double * 10.0F)
PrintResult("TypeCode.Double * -11.0R", TypeCode.Double * -11.0R)
PrintResult("TypeCode.Double * ""12""", TypeCode.Double * "12")
PrintResult("TypeCode.Double * TypeCode.Double", TypeCode.Double * TypeCode.Double)
PrintResult("False / False", False / False)
PrintResult("False / True", False / True)
PrintResult("False / System.SByte.MinValue", False / System.SByte.MinValue)
PrintResult("False / System.Byte.MaxValue", False / System.Byte.MaxValue)
PrintResult("False / -3S", False / -3S)
PrintResult("False / 24US", False / 24US)
PrintResult("False / -5I", False / -5I)
PrintResult("False / 26UI", False / 26UI)
PrintResult("False / -7L", False / -7L)
PrintResult("False / 28UL", False / 28UL)
PrintResult("False / -9D", False / -9D)
PrintResult("False / 10.0F", False / 10.0F)
PrintResult("False / -11.0R", False / -11.0R)
PrintResult("False / ""12""", False / "12")
PrintResult("False / TypeCode.Double", False / TypeCode.Double)
PrintResult("True / False", True / False)
PrintResult("True / True", True / True)
PrintResult("True / System.SByte.MinValue", True / System.SByte.MinValue)
PrintResult("True / System.Byte.MaxValue", True / System.Byte.MaxValue)
PrintResult("True / -3S", True / -3S)
PrintResult("True / 24US", True / 24US)
PrintResult("True / -5I", True / -5I)
PrintResult("True / 26UI", True / 26UI)
PrintResult("True / -7L", True / -7L)
PrintResult("True / 28UL", True / 28UL)
PrintResult("True / -9D", True / -9D)
PrintResult("True / 10.0F", True / 10.0F)
PrintResult("True / -11.0R", True / -11.0R)
PrintResult("True / ""12""", True / "12")
PrintResult("True / TypeCode.Double", True / TypeCode.Double)
PrintResult("System.SByte.MinValue / False", System.SByte.MinValue / False)
PrintResult("System.SByte.MinValue / True", System.SByte.MinValue / True)
PrintResult("System.SByte.MinValue / System.SByte.MinValue", System.SByte.MinValue / System.SByte.MinValue)
PrintResult("System.SByte.MinValue / System.Byte.MaxValue", System.SByte.MinValue / System.Byte.MaxValue)
PrintResult("System.SByte.MinValue / -3S", System.SByte.MinValue / -3S)
PrintResult("System.SByte.MinValue / 24US", System.SByte.MinValue / 24US)
PrintResult("System.SByte.MinValue / -5I", System.SByte.MinValue / -5I)
PrintResult("System.SByte.MinValue / 26UI", System.SByte.MinValue / 26UI)
PrintResult("System.SByte.MinValue / -7L", System.SByte.MinValue / -7L)
PrintResult("System.SByte.MinValue / 28UL", System.SByte.MinValue / 28UL)
PrintResult("System.SByte.MinValue / -9D", System.SByte.MinValue / -9D)
PrintResult("System.SByte.MinValue / 10.0F", System.SByte.MinValue / 10.0F)
PrintResult("System.SByte.MinValue / -11.0R", System.SByte.MinValue / -11.0R)
PrintResult("System.SByte.MinValue / ""12""", System.SByte.MinValue / "12")
PrintResult("System.SByte.MinValue / TypeCode.Double", System.SByte.MinValue / TypeCode.Double)
PrintResult("System.Byte.MaxValue / False", System.Byte.MaxValue / False)
PrintResult("System.Byte.MaxValue / True", System.Byte.MaxValue / True)
PrintResult("System.Byte.MaxValue / System.SByte.MinValue", System.Byte.MaxValue / System.SByte.MinValue)
PrintResult("System.Byte.MaxValue / System.Byte.MaxValue", System.Byte.MaxValue / System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue / -3S", System.Byte.MaxValue / -3S)
PrintResult("System.Byte.MaxValue / 24US", System.Byte.MaxValue / 24US)
PrintResult("System.Byte.MaxValue / -5I", System.Byte.MaxValue / -5I)
PrintResult("System.Byte.MaxValue / 26UI", System.Byte.MaxValue / 26UI)
PrintResult("System.Byte.MaxValue / -7L", System.Byte.MaxValue / -7L)
PrintResult("System.Byte.MaxValue / 28UL", System.Byte.MaxValue / 28UL)
PrintResult("System.Byte.MaxValue / -9D", System.Byte.MaxValue / -9D)
PrintResult("System.Byte.MaxValue / 10.0F", System.Byte.MaxValue / 10.0F)
PrintResult("System.Byte.MaxValue / -11.0R", System.Byte.MaxValue / -11.0R)
PrintResult("System.Byte.MaxValue / ""12""", System.Byte.MaxValue / "12")
PrintResult("System.Byte.MaxValue / TypeCode.Double", System.Byte.MaxValue / TypeCode.Double)
PrintResult("-3S / False", -3S / False)
PrintResult("-3S / True", -3S / True)
PrintResult("-3S / System.SByte.MinValue", -3S / System.SByte.MinValue)
PrintResult("-3S / System.Byte.MaxValue", -3S / System.Byte.MaxValue)
PrintResult("-3S / -3S", -3S / -3S)
PrintResult("-3S / 24US", -3S / 24US)
PrintResult("-3S / -5I", -3S / -5I)
PrintResult("-3S / 26UI", -3S / 26UI)
PrintResult("-3S / -7L", -3S / -7L)
PrintResult("-3S / 28UL", -3S / 28UL)
PrintResult("-3S / -9D", -3S / -9D)
PrintResult("-3S / 10.0F", -3S / 10.0F)
PrintResult("-3S / -11.0R", -3S / -11.0R)
PrintResult("-3S / ""12""", -3S / "12")
PrintResult("-3S / TypeCode.Double", -3S / TypeCode.Double)
PrintResult("24US / False", 24US / False)
PrintResult("24US / True", 24US / True)
PrintResult("24US / System.SByte.MinValue", 24US / System.SByte.MinValue)
PrintResult("24US / System.Byte.MaxValue", 24US / System.Byte.MaxValue)
PrintResult("24US / -3S", 24US / -3S)
PrintResult("24US / 24US", 24US / 24US)
PrintResult("24US / -5I", 24US / -5I)
PrintResult("24US / 26UI", 24US / 26UI)
PrintResult("24US / -7L", 24US / -7L)
PrintResult("24US / 28UL", 24US / 28UL)
PrintResult("24US / -9D", 24US / -9D)
PrintResult("24US / 10.0F", 24US / 10.0F)
PrintResult("24US / -11.0R", 24US / -11.0R)
PrintResult("24US / ""12""", 24US / "12")
PrintResult("24US / TypeCode.Double", 24US / TypeCode.Double)
PrintResult("-5I / False", -5I / False)
PrintResult("-5I / True", -5I / True)
PrintResult("-5I / System.SByte.MinValue", -5I / System.SByte.MinValue)
PrintResult("-5I / System.Byte.MaxValue", -5I / System.Byte.MaxValue)
PrintResult("-5I / -3S", -5I / -3S)
PrintResult("-5I / 24US", -5I / 24US)
PrintResult("-5I / -5I", -5I / -5I)
PrintResult("-5I / 26UI", -5I / 26UI)
PrintResult("-5I / -7L", -5I / -7L)
PrintResult("-5I / 28UL", -5I / 28UL)
PrintResult("-5I / -9D", -5I / -9D)
PrintResult("-5I / 10.0F", -5I / 10.0F)
PrintResult("-5I / -11.0R", -5I / -11.0R)
PrintResult("-5I / ""12""", -5I / "12")
PrintResult("-5I / TypeCode.Double", -5I / TypeCode.Double)
PrintResult("26UI / False", 26UI / False)
PrintResult("26UI / True", 26UI / True)
PrintResult("26UI / System.SByte.MinValue", 26UI / System.SByte.MinValue)
PrintResult("26UI / System.Byte.MaxValue", 26UI / System.Byte.MaxValue)
PrintResult("26UI / -3S", 26UI / -3S)
PrintResult("26UI / 24US", 26UI / 24US)
PrintResult("26UI / -5I", 26UI / -5I)
PrintResult("26UI / 26UI", 26UI / 26UI)
PrintResult("26UI / -7L", 26UI / -7L)
PrintResult("26UI / 28UL", 26UI / 28UL)
PrintResult("26UI / -9D", 26UI / -9D)
PrintResult("26UI / 10.0F", 26UI / 10.0F)
PrintResult("26UI / -11.0R", 26UI / -11.0R)
PrintResult("26UI / ""12""", 26UI / "12")
PrintResult("26UI / TypeCode.Double", 26UI / TypeCode.Double)
PrintResult("-7L / False", -7L / False)
PrintResult("-7L / True", -7L / True)
PrintResult("-7L / System.SByte.MinValue", -7L / System.SByte.MinValue)
PrintResult("-7L / System.Byte.MaxValue", -7L / System.Byte.MaxValue)
PrintResult("-7L / -3S", -7L / -3S)
PrintResult("-7L / 24US", -7L / 24US)
PrintResult("-7L / -5I", -7L / -5I)
PrintResult("-7L / 26UI", -7L / 26UI)
PrintResult("-7L / -7L", -7L / -7L)
PrintResult("-7L / 28UL", -7L / 28UL)
PrintResult("-7L / -9D", -7L / -9D)
PrintResult("-7L / 10.0F", -7L / 10.0F)
PrintResult("-7L / -11.0R", -7L / -11.0R)
PrintResult("-7L / ""12""", -7L / "12")
PrintResult("-7L / TypeCode.Double", -7L / TypeCode.Double)
PrintResult("28UL / False", 28UL / False)
PrintResult("28UL / True", 28UL / True)
PrintResult("28UL / System.SByte.MinValue", 28UL / System.SByte.MinValue)
PrintResult("28UL / System.Byte.MaxValue", 28UL / System.Byte.MaxValue)
PrintResult("28UL / -3S", 28UL / -3S)
PrintResult("28UL / 24US", 28UL / 24US)
PrintResult("28UL / -5I", 28UL / -5I)
PrintResult("28UL / 26UI", 28UL / 26UI)
PrintResult("28UL / -7L", 28UL / -7L)
PrintResult("28UL / 28UL", 28UL / 28UL)
PrintResult("28UL / -9D", 28UL / -9D)
PrintResult("28UL / 10.0F", 28UL / 10.0F)
PrintResult("28UL / -11.0R", 28UL / -11.0R)
PrintResult("28UL / ""12""", 28UL / "12")
PrintResult("28UL / TypeCode.Double", 28UL / TypeCode.Double)
PrintResult("-9D / True", -9D / True)
PrintResult("-9D / System.SByte.MinValue", -9D / System.SByte.MinValue)
PrintResult("-9D / System.Byte.MaxValue", -9D / System.Byte.MaxValue)
PrintResult("-9D / -3S", -9D / -3S)
PrintResult("-9D / 24US", -9D / 24US)
PrintResult("-9D / -5I", -9D / -5I)
PrintResult("-9D / 26UI", -9D / 26UI)
PrintResult("-9D / -7L", -9D / -7L)
PrintResult("-9D / 28UL", -9D / 28UL)
PrintResult("-9D / -9D", -9D / -9D)
PrintResult("-9D / 10.0F", -9D / 10.0F)
PrintResult("-9D / -11.0R", -9D / -11.0R)
PrintResult("-9D / ""12""", -9D / "12")
PrintResult("-9D / TypeCode.Double", -9D / TypeCode.Double)
PrintResult("10.0F / False", 10.0F / False)
PrintResult("10.0F / True", 10.0F / True)
PrintResult("10.0F / System.SByte.MinValue", 10.0F / System.SByte.MinValue)
PrintResult("10.0F / System.Byte.MaxValue", 10.0F / System.Byte.MaxValue)
PrintResult("10.0F / -3S", 10.0F / -3S)
PrintResult("10.0F / 24US", 10.0F / 24US)
PrintResult("10.0F / -5I", 10.0F / -5I)
PrintResult("10.0F / 26UI", 10.0F / 26UI)
PrintResult("10.0F / -7L", 10.0F / -7L)
PrintResult("10.0F / 28UL", 10.0F / 28UL)
PrintResult("10.0F / -9D", 10.0F / -9D)
PrintResult("10.0F / 10.0F", 10.0F / 10.0F)
PrintResult("10.0F / -11.0R", 10.0F / -11.0R)
PrintResult("10.0F / ""12""", 10.0F / "12")
PrintResult("10.0F / TypeCode.Double", 10.0F / TypeCode.Double)
PrintResult("-11.0R / False", -11.0R / False)
PrintResult("-11.0R / True", -11.0R / True)
PrintResult("-11.0R / System.SByte.MinValue", -11.0R / System.SByte.MinValue)
PrintResult("-11.0R / System.Byte.MaxValue", -11.0R / System.Byte.MaxValue)
PrintResult("-11.0R / -3S", -11.0R / -3S)
PrintResult("-11.0R / 24US", -11.0R / 24US)
PrintResult("-11.0R / -5I", -11.0R / -5I)
PrintResult("-11.0R / 26UI", -11.0R / 26UI)
PrintResult("-11.0R / -7L", -11.0R / -7L)
PrintResult("-11.0R / 28UL", -11.0R / 28UL)
PrintResult("-11.0R / -9D", -11.0R / -9D)
PrintResult("-11.0R / 10.0F", -11.0R / 10.0F)
PrintResult("-11.0R / -11.0R", -11.0R / -11.0R)
PrintResult("-11.0R / ""12""", -11.0R / "12")
PrintResult("-11.0R / TypeCode.Double", -11.0R / TypeCode.Double)
PrintResult("""12"" / False", "12" / False)
PrintResult("""12"" / True", "12" / True)
PrintResult("""12"" / System.SByte.MinValue", "12" / System.SByte.MinValue)
PrintResult("""12"" / System.Byte.MaxValue", "12" / System.Byte.MaxValue)
PrintResult("""12"" / -3S", "12" / -3S)
PrintResult("""12"" / 24US", "12" / 24US)
PrintResult("""12"" / -5I", "12" / -5I)
PrintResult("""12"" / 26UI", "12" / 26UI)
PrintResult("""12"" / -7L", "12" / -7L)
PrintResult("""12"" / 28UL", "12" / 28UL)
PrintResult("""12"" / -9D", "12" / -9D)
PrintResult("""12"" / 10.0F", "12" / 10.0F)
PrintResult("""12"" / -11.0R", "12" / -11.0R)
PrintResult("""12"" / ""12""", "12" / "12")
PrintResult("""12"" / TypeCode.Double", "12" / TypeCode.Double)
PrintResult("TypeCode.Double / False", TypeCode.Double / False)
PrintResult("TypeCode.Double / True", TypeCode.Double / True)
PrintResult("TypeCode.Double / System.SByte.MinValue", TypeCode.Double / System.SByte.MinValue)
PrintResult("TypeCode.Double / System.Byte.MaxValue", TypeCode.Double / System.Byte.MaxValue)
PrintResult("TypeCode.Double / -3S", TypeCode.Double / -3S)
PrintResult("TypeCode.Double / 24US", TypeCode.Double / 24US)
PrintResult("TypeCode.Double / -5I", TypeCode.Double / -5I)
PrintResult("TypeCode.Double / 26UI", TypeCode.Double / 26UI)
PrintResult("TypeCode.Double / -7L", TypeCode.Double / -7L)
PrintResult("TypeCode.Double / 28UL", TypeCode.Double / 28UL)
PrintResult("TypeCode.Double / -9D", TypeCode.Double / -9D)
PrintResult("TypeCode.Double / 10.0F", TypeCode.Double / 10.0F)
PrintResult("TypeCode.Double / -11.0R", TypeCode.Double / -11.0R)
PrintResult("TypeCode.Double / ""12""", TypeCode.Double / "12")
PrintResult("TypeCode.Double / TypeCode.Double", TypeCode.Double / TypeCode.Double)
PrintResult("False \ True", False \ True)
PrintResult("False \ System.SByte.MinValue", False \ System.SByte.MinValue)
PrintResult("False \ System.Byte.MaxValue", False \ System.Byte.MaxValue)
PrintResult("False \ -3S", False \ -3S)
PrintResult("False \ 24US", False \ 24US)
PrintResult("False \ -5I", False \ -5I)
PrintResult("False \ 26UI", False \ 26UI)
PrintResult("False \ -7L", False \ -7L)
PrintResult("False \ 28UL", False \ 28UL)
PrintResult("False \ -9D", False \ -9D)
PrintResult("False \ 10.0F", False \ 10.0F)
PrintResult("False \ -11.0R", False \ -11.0R)
PrintResult("False \ ""12""", False \ "12")
PrintResult("False \ TypeCode.Double", False \ TypeCode.Double)
PrintResult("True \ True", True \ True)
PrintResult("True \ System.SByte.MinValue", True \ System.SByte.MinValue)
PrintResult("True \ System.Byte.MaxValue", True \ System.Byte.MaxValue)
PrintResult("True \ -3S", True \ -3S)
PrintResult("True \ 24US", True \ 24US)
PrintResult("True \ -5I", True \ -5I)
PrintResult("True \ 26UI", True \ 26UI)
PrintResult("True \ -7L", True \ -7L)
PrintResult("True \ 28UL", True \ 28UL)
PrintResult("True \ -9D", True \ -9D)
PrintResult("True \ 10.0F", True \ 10.0F)
PrintResult("True \ -11.0R", True \ -11.0R)
PrintResult("True \ ""12""", True \ "12")
PrintResult("True \ TypeCode.Double", True \ TypeCode.Double)
PrintResult("System.SByte.MaxValue \ True", System.SByte.MaxValue \ True)
PrintResult("System.SByte.MinValue \ System.SByte.MinValue", System.SByte.MinValue \ System.SByte.MinValue)
PrintResult("System.SByte.MinValue \ System.Byte.MaxValue", System.SByte.MinValue \ System.Byte.MaxValue)
PrintResult("System.SByte.MinValue \ -3S", System.SByte.MinValue \ -3S)
PrintResult("System.SByte.MinValue \ 24US", System.SByte.MinValue \ 24US)
PrintResult("System.SByte.MinValue \ -5I", System.SByte.MinValue \ -5I)
PrintResult("System.SByte.MinValue \ 26UI", System.SByte.MinValue \ 26UI)
PrintResult("System.SByte.MinValue \ -7L", System.SByte.MinValue \ -7L)
PrintResult("System.SByte.MinValue \ 28UL", System.SByte.MinValue \ 28UL)
PrintResult("System.SByte.MinValue \ -9D", System.SByte.MinValue \ -9D)
PrintResult("System.SByte.MinValue \ 10.0F", System.SByte.MinValue \ 10.0F)
PrintResult("System.SByte.MinValue \ -11.0R", System.SByte.MinValue \ -11.0R)
PrintResult("System.SByte.MinValue \ ""12""", System.SByte.MinValue \ "12")
PrintResult("System.SByte.MinValue \ TypeCode.Double", System.SByte.MinValue \ TypeCode.Double)
PrintResult("System.Byte.MaxValue \ True", System.Byte.MaxValue \ True)
PrintResult("System.Byte.MaxValue \ System.SByte.MinValue", System.Byte.MaxValue \ System.SByte.MinValue)
PrintResult("System.Byte.MaxValue \ System.Byte.MaxValue", System.Byte.MaxValue \ System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue \ -3S", System.Byte.MaxValue \ -3S)
PrintResult("System.Byte.MaxValue \ 24US", System.Byte.MaxValue \ 24US)
PrintResult("System.Byte.MaxValue \ -5I", System.Byte.MaxValue \ -5I)
PrintResult("System.Byte.MaxValue \ 26UI", System.Byte.MaxValue \ 26UI)
PrintResult("System.Byte.MaxValue \ -7L", System.Byte.MaxValue \ -7L)
PrintResult("System.Byte.MaxValue \ 28UL", System.Byte.MaxValue \ 28UL)
PrintResult("System.Byte.MaxValue \ -9D", System.Byte.MaxValue \ -9D)
PrintResult("System.Byte.MaxValue \ 10.0F", System.Byte.MaxValue \ 10.0F)
PrintResult("System.Byte.MaxValue \ -11.0R", System.Byte.MaxValue \ -11.0R)
PrintResult("System.Byte.MaxValue \ ""12""", System.Byte.MaxValue \ "12")
PrintResult("System.Byte.MaxValue \ TypeCode.Double", System.Byte.MaxValue \ TypeCode.Double)
PrintResult("-3S \ True", -3S \ True)
PrintResult("-3S \ System.SByte.MinValue", -3S \ System.SByte.MinValue)
PrintResult("-3S \ System.Byte.MaxValue", -3S \ System.Byte.MaxValue)
PrintResult("-3S \ -3S", -3S \ -3S)
PrintResult("-3S \ 24US", -3S \ 24US)
PrintResult("-3S \ -5I", -3S \ -5I)
PrintResult("-3S \ 26UI", -3S \ 26UI)
PrintResult("-3S \ -7L", -3S \ -7L)
PrintResult("-3S \ 28UL", -3S \ 28UL)
PrintResult("-3S \ -9D", -3S \ -9D)
PrintResult("-3S \ 10.0F", -3S \ 10.0F)
PrintResult("-3S \ -11.0R", -3S \ -11.0R)
PrintResult("-3S \ ""12""", -3S \ "12")
PrintResult("-3S \ TypeCode.Double", -3S \ TypeCode.Double)
PrintResult("24US \ True", 24US \ True)
PrintResult("24US \ System.SByte.MinValue", 24US \ System.SByte.MinValue)
PrintResult("24US \ System.Byte.MaxValue", 24US \ System.Byte.MaxValue)
PrintResult("24US \ -3S", 24US \ -3S)
PrintResult("24US \ 24US", 24US \ 24US)
PrintResult("24US \ -5I", 24US \ -5I)
PrintResult("24US \ 26UI", 24US \ 26UI)
PrintResult("24US \ -7L", 24US \ -7L)
PrintResult("24US \ 28UL", 24US \ 28UL)
PrintResult("24US \ -9D", 24US \ -9D)
PrintResult("24US \ 10.0F", 24US \ 10.0F)
PrintResult("24US \ -11.0R", 24US \ -11.0R)
PrintResult("24US \ ""12""", 24US \ "12")
PrintResult("24US \ TypeCode.Double", 24US \ TypeCode.Double)
PrintResult("-5I \ True", -5I \ True)
PrintResult("-5I \ System.SByte.MinValue", -5I \ System.SByte.MinValue)
PrintResult("-5I \ System.Byte.MaxValue", -5I \ System.Byte.MaxValue)
PrintResult("-5I \ -3S", -5I \ -3S)
PrintResult("-5I \ 24US", -5I \ 24US)
PrintResult("-5I \ -5I", -5I \ -5I)
PrintResult("-5I \ 26UI", -5I \ 26UI)
PrintResult("-5I \ -7L", -5I \ -7L)
PrintResult("-5I \ 28UL", -5I \ 28UL)
PrintResult("-5I \ -9D", -5I \ -9D)
PrintResult("-5I \ 10.0F", -5I \ 10.0F)
PrintResult("-5I \ -11.0R", -5I \ -11.0R)
PrintResult("-5I \ ""12""", -5I \ "12")
PrintResult("-5I \ TypeCode.Double", -5I \ TypeCode.Double)
PrintResult("26UI \ True", 26UI \ True)
PrintResult("26UI \ System.SByte.MinValue", 26UI \ System.SByte.MinValue)
PrintResult("26UI \ System.Byte.MaxValue", 26UI \ System.Byte.MaxValue)
PrintResult("26UI \ -3S", 26UI \ -3S)
PrintResult("26UI \ 24US", 26UI \ 24US)
PrintResult("26UI \ -5I", 26UI \ -5I)
PrintResult("26UI \ 26UI", 26UI \ 26UI)
PrintResult("26UI \ -7L", 26UI \ -7L)
PrintResult("26UI \ 28UL", 26UI \ 28UL)
PrintResult("26UI \ -9D", 26UI \ -9D)
PrintResult("26UI \ 10.0F", 26UI \ 10.0F)
PrintResult("26UI \ -11.0R", 26UI \ -11.0R)
PrintResult("26UI \ ""12""", 26UI \ "12")
PrintResult("26UI \ TypeCode.Double", 26UI \ TypeCode.Double)
PrintResult("-7L \ True", -7L \ True)
PrintResult("-7L \ System.SByte.MinValue", -7L \ System.SByte.MinValue)
PrintResult("-7L \ System.Byte.MaxValue", -7L \ System.Byte.MaxValue)
PrintResult("-7L \ -3S", -7L \ -3S)
PrintResult("-7L \ 24US", -7L \ 24US)
PrintResult("-7L \ -5I", -7L \ -5I)
PrintResult("-7L \ 26UI", -7L \ 26UI)
PrintResult("-7L \ -7L", -7L \ -7L)
PrintResult("-7L \ 28UL", -7L \ 28UL)
PrintResult("-7L \ -9D", -7L \ -9D)
PrintResult("-7L \ 10.0F", -7L \ 10.0F)
PrintResult("-7L \ -11.0R", -7L \ -11.0R)
PrintResult("-7L \ ""12""", -7L \ "12")
PrintResult("-7L \ TypeCode.Double", -7L \ TypeCode.Double)
PrintResult("28UL \ True", 28UL \ True)
PrintResult("28UL \ System.SByte.MinValue", 28UL \ System.SByte.MinValue)
PrintResult("28UL \ System.Byte.MaxValue", 28UL \ System.Byte.MaxValue)
PrintResult("28UL \ -3S", 28UL \ -3S)
PrintResult("28UL \ 24US", 28UL \ 24US)
PrintResult("28UL \ -5I", 28UL \ -5I)
PrintResult("28UL \ 26UI", 28UL \ 26UI)
PrintResult("28UL \ -7L", 28UL \ -7L)
PrintResult("28UL \ 28UL", 28UL \ 28UL)
PrintResult("28UL \ -9D", 28UL \ -9D)
PrintResult("28UL \ 10.0F", 28UL \ 10.0F)
PrintResult("28UL \ -11.0R", 28UL \ -11.0R)
PrintResult("28UL \ ""12""", 28UL \ "12")
PrintResult("28UL \ TypeCode.Double", 28UL \ TypeCode.Double)
PrintResult("-9D \ True", -9D \ True)
PrintResult("-9D \ System.SByte.MinValue", -9D \ System.SByte.MinValue)
PrintResult("-9D \ System.Byte.MaxValue", -9D \ System.Byte.MaxValue)
PrintResult("-9D \ -3S", -9D \ -3S)
PrintResult("-9D \ 24US", -9D \ 24US)
PrintResult("-9D \ -5I", -9D \ -5I)
PrintResult("-9D \ 26UI", -9D \ 26UI)
PrintResult("-9D \ -7L", -9D \ -7L)
PrintResult("-9D \ 28UL", -9D \ 28UL)
PrintResult("-9D \ -9D", -9D \ -9D)
PrintResult("-9D \ 10.0F", -9D \ 10.0F)
PrintResult("-9D \ -11.0R", -9D \ -11.0R)
PrintResult("-9D \ ""12""", -9D \ "12")
PrintResult("-9D \ TypeCode.Double", -9D \ TypeCode.Double)
PrintResult("10.0F \ True", 10.0F \ True)
PrintResult("10.0F \ System.SByte.MinValue", 10.0F \ System.SByte.MinValue)
PrintResult("10.0F \ System.Byte.MaxValue", 10.0F \ System.Byte.MaxValue)
PrintResult("10.0F \ -3S", 10.0F \ -3S)
PrintResult("10.0F \ 24US", 10.0F \ 24US)
PrintResult("10.0F \ -5I", 10.0F \ -5I)
PrintResult("10.0F \ 26UI", 10.0F \ 26UI)
PrintResult("10.0F \ -7L", 10.0F \ -7L)
PrintResult("10.0F \ 28UL", 10.0F \ 28UL)
PrintResult("10.0F \ -9D", 10.0F \ -9D)
PrintResult("10.0F \ 10.0F", 10.0F \ 10.0F)
PrintResult("10.0F \ -11.0R", 10.0F \ -11.0R)
PrintResult("10.0F \ ""12""", 10.0F \ "12")
PrintResult("10.0F \ TypeCode.Double", 10.0F \ TypeCode.Double)
PrintResult("-11.0R \ True", -11.0R \ True)
PrintResult("-11.0R \ System.SByte.MinValue", -11.0R \ System.SByte.MinValue)
PrintResult("-11.0R \ System.Byte.MaxValue", -11.0R \ System.Byte.MaxValue)
PrintResult("-11.0R \ -3S", -11.0R \ -3S)
PrintResult("-11.0R \ 24US", -11.0R \ 24US)
PrintResult("-11.0R \ -5I", -11.0R \ -5I)
PrintResult("-11.0R \ 26UI", -11.0R \ 26UI)
PrintResult("-11.0R \ -7L", -11.0R \ -7L)
PrintResult("-11.0R \ 28UL", -11.0R \ 28UL)
PrintResult("-11.0R \ -9D", -11.0R \ -9D)
PrintResult("-11.0R \ 10.0F", -11.0R \ 10.0F)
PrintResult("-11.0R \ -11.0R", -11.0R \ -11.0R)
PrintResult("-11.0R \ ""12""", -11.0R \ "12")
PrintResult("-11.0R \ TypeCode.Double", -11.0R \ TypeCode.Double)
PrintResult("""12"" \ True", "12" \ True)
PrintResult("""12"" \ System.SByte.MinValue", "12" \ System.SByte.MinValue)
PrintResult("""12"" \ System.Byte.MaxValue", "12" \ System.Byte.MaxValue)
PrintResult("""12"" \ -3S", "12" \ -3S)
PrintResult("""12"" \ 24US", "12" \ 24US)
PrintResult("""12"" \ -5I", "12" \ -5I)
PrintResult("""12"" \ 26UI", "12" \ 26UI)
PrintResult("""12"" \ -7L", "12" \ -7L)
PrintResult("""12"" \ 28UL", "12" \ 28UL)
PrintResult("""12"" \ -9D", "12" \ -9D)
PrintResult("""12"" \ 10.0F", "12" \ 10.0F)
PrintResult("""12"" \ -11.0R", "12" \ -11.0R)
PrintResult("""12"" \ ""12""", "12" \ "12")
PrintResult("""12"" \ TypeCode.Double", "12" \ TypeCode.Double)
PrintResult("TypeCode.Double \ True", TypeCode.Double \ True)
PrintResult("TypeCode.Double \ System.SByte.MinValue", TypeCode.Double \ System.SByte.MinValue)
PrintResult("TypeCode.Double \ System.Byte.MaxValue", TypeCode.Double \ System.Byte.MaxValue)
PrintResult("TypeCode.Double \ -3S", TypeCode.Double \ -3S)
PrintResult("TypeCode.Double \ 24US", TypeCode.Double \ 24US)
PrintResult("TypeCode.Double \ -5I", TypeCode.Double \ -5I)
PrintResult("TypeCode.Double \ 26UI", TypeCode.Double \ 26UI)
PrintResult("TypeCode.Double \ -7L", TypeCode.Double \ -7L)
PrintResult("TypeCode.Double \ 28UL", TypeCode.Double \ 28UL)
PrintResult("TypeCode.Double \ -9D", TypeCode.Double \ -9D)
PrintResult("TypeCode.Double \ 10.0F", TypeCode.Double \ 10.0F)
PrintResult("TypeCode.Double \ -11.0R", TypeCode.Double \ -11.0R)
PrintResult("TypeCode.Double \ ""12""", TypeCode.Double \ "12")
PrintResult("TypeCode.Double \ TypeCode.Double", TypeCode.Double \ TypeCode.Double)
PrintResult("False Mod True", False Mod True)
PrintResult("False Mod System.SByte.MinValue", False Mod System.SByte.MinValue)
PrintResult("False Mod System.Byte.MaxValue", False Mod System.Byte.MaxValue)
PrintResult("False Mod -3S", False Mod -3S)
PrintResult("False Mod 24US", False Mod 24US)
PrintResult("False Mod -5I", False Mod -5I)
PrintResult("False Mod 26UI", False Mod 26UI)
PrintResult("False Mod -7L", False Mod -7L)
PrintResult("False Mod 28UL", False Mod 28UL)
PrintResult("False Mod -9D", False Mod -9D)
PrintResult("False Mod 10.0F", False Mod 10.0F)
PrintResult("False Mod -11.0R", False Mod -11.0R)
PrintResult("False Mod ""12""", False Mod "12")
PrintResult("False Mod TypeCode.Double", False Mod TypeCode.Double)
PrintResult("True Mod True", True Mod True)
PrintResult("True Mod System.SByte.MinValue", True Mod System.SByte.MinValue)
PrintResult("True Mod System.Byte.MaxValue", True Mod System.Byte.MaxValue)
PrintResult("True Mod -3S", True Mod -3S)
PrintResult("True Mod 24US", True Mod 24US)
PrintResult("True Mod -5I", True Mod -5I)
PrintResult("True Mod 26UI", True Mod 26UI)
PrintResult("True Mod -7L", True Mod -7L)
PrintResult("True Mod 28UL", True Mod 28UL)
PrintResult("True Mod -9D", True Mod -9D)
PrintResult("True Mod 10.0F", True Mod 10.0F)
PrintResult("True Mod -11.0R", True Mod -11.0R)
PrintResult("True Mod ""12""", True Mod "12")
PrintResult("True Mod TypeCode.Double", True Mod TypeCode.Double)
PrintResult("System.SByte.MinValue Mod True", System.SByte.MinValue Mod True)
PrintResult("System.SByte.MinValue Mod System.SByte.MinValue", System.SByte.MinValue Mod System.SByte.MinValue)
PrintResult("System.SByte.MinValue Mod System.Byte.MaxValue", System.SByte.MinValue Mod System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Mod -3S", System.SByte.MinValue Mod -3S)
PrintResult("System.SByte.MinValue Mod 24US", System.SByte.MinValue Mod 24US)
PrintResult("System.SByte.MinValue Mod -5I", System.SByte.MinValue Mod -5I)
PrintResult("System.SByte.MinValue Mod 26UI", System.SByte.MinValue Mod 26UI)
PrintResult("System.SByte.MinValue Mod -7L", System.SByte.MinValue Mod -7L)
PrintResult("System.SByte.MinValue Mod 28UL", System.SByte.MinValue Mod 28UL)
PrintResult("System.SByte.MinValue Mod -9D", System.SByte.MinValue Mod -9D)
PrintResult("System.SByte.MinValue Mod 10.0F", System.SByte.MinValue Mod 10.0F)
PrintResult("System.SByte.MinValue Mod -11.0R", System.SByte.MinValue Mod -11.0R)
PrintResult("System.SByte.MinValue Mod ""12""", System.SByte.MinValue Mod "12")
PrintResult("System.SByte.MinValue Mod TypeCode.Double", System.SByte.MinValue Mod TypeCode.Double)
PrintResult("System.Byte.MaxValue Mod True", System.Byte.MaxValue Mod True)
PrintResult("System.Byte.MaxValue Mod System.SByte.MinValue", System.Byte.MaxValue Mod System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Mod System.Byte.MaxValue", System.Byte.MaxValue Mod System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Mod -3S", System.Byte.MaxValue Mod -3S)
PrintResult("System.Byte.MaxValue Mod 24US", System.Byte.MaxValue Mod 24US)
PrintResult("System.Byte.MaxValue Mod -5I", System.Byte.MaxValue Mod -5I)
PrintResult("System.Byte.MaxValue Mod 26UI", System.Byte.MaxValue Mod 26UI)
PrintResult("System.Byte.MaxValue Mod -7L", System.Byte.MaxValue Mod -7L)
PrintResult("System.Byte.MaxValue Mod 28UL", System.Byte.MaxValue Mod 28UL)
PrintResult("System.Byte.MaxValue Mod -9D", System.Byte.MaxValue Mod -9D)
PrintResult("System.Byte.MaxValue Mod 10.0F", System.Byte.MaxValue Mod 10.0F)
PrintResult("System.Byte.MaxValue Mod -11.0R", System.Byte.MaxValue Mod -11.0R)
PrintResult("System.Byte.MaxValue Mod ""12""", System.Byte.MaxValue Mod "12")
PrintResult("System.Byte.MaxValue Mod TypeCode.Double", System.Byte.MaxValue Mod TypeCode.Double)
PrintResult("-3S Mod True", -3S Mod True)
PrintResult("-3S Mod System.SByte.MinValue", -3S Mod System.SByte.MinValue)
PrintResult("-3S Mod System.Byte.MaxValue", -3S Mod System.Byte.MaxValue)
PrintResult("-3S Mod -3S", -3S Mod -3S)
PrintResult("-3S Mod 24US", -3S Mod 24US)
PrintResult("-3S Mod -5I", -3S Mod -5I)
PrintResult("-3S Mod 26UI", -3S Mod 26UI)
PrintResult("-3S Mod -7L", -3S Mod -7L)
PrintResult("-3S Mod 28UL", -3S Mod 28UL)
PrintResult("-3S Mod -9D", -3S Mod -9D)
PrintResult("-3S Mod 10.0F", -3S Mod 10.0F)
PrintResult("-3S Mod -11.0R", -3S Mod -11.0R)
PrintResult("-3S Mod ""12""", -3S Mod "12")
PrintResult("-3S Mod TypeCode.Double", -3S Mod TypeCode.Double)
PrintResult("24US Mod True", 24US Mod True)
PrintResult("24US Mod System.SByte.MinValue", 24US Mod System.SByte.MinValue)
PrintResult("24US Mod System.Byte.MaxValue", 24US Mod System.Byte.MaxValue)
PrintResult("24US Mod -3S", 24US Mod -3S)
PrintResult("24US Mod 24US", 24US Mod 24US)
PrintResult("24US Mod -5I", 24US Mod -5I)
PrintResult("24US Mod 26UI", 24US Mod 26UI)
PrintResult("24US Mod -7L", 24US Mod -7L)
PrintResult("24US Mod 28UL", 24US Mod 28UL)
PrintResult("24US Mod -9D", 24US Mod -9D)
PrintResult("24US Mod 10.0F", 24US Mod 10.0F)
PrintResult("24US Mod -11.0R", 24US Mod -11.0R)
PrintResult("24US Mod ""12""", 24US Mod "12")
PrintResult("24US Mod TypeCode.Double", 24US Mod TypeCode.Double)
PrintResult("-5I Mod True", -5I Mod True)
PrintResult("-5I Mod System.SByte.MinValue", -5I Mod System.SByte.MinValue)
PrintResult("-5I Mod System.Byte.MaxValue", -5I Mod System.Byte.MaxValue)
PrintResult("-5I Mod -3S", -5I Mod -3S)
PrintResult("-5I Mod 24US", -5I Mod 24US)
PrintResult("-5I Mod -5I", -5I Mod -5I)
PrintResult("-5I Mod 26UI", -5I Mod 26UI)
PrintResult("-5I Mod -7L", -5I Mod -7L)
PrintResult("-5I Mod 28UL", -5I Mod 28UL)
PrintResult("-5I Mod -9D", -5I Mod -9D)
PrintResult("-5I Mod 10.0F", -5I Mod 10.0F)
PrintResult("-5I Mod -11.0R", -5I Mod -11.0R)
PrintResult("-5I Mod ""12""", -5I Mod "12")
PrintResult("-5I Mod TypeCode.Double", -5I Mod TypeCode.Double)
PrintResult("26UI Mod True", 26UI Mod True)
PrintResult("26UI Mod System.SByte.MinValue", 26UI Mod System.SByte.MinValue)
PrintResult("26UI Mod System.Byte.MaxValue", 26UI Mod System.Byte.MaxValue)
PrintResult("26UI Mod -3S", 26UI Mod -3S)
PrintResult("26UI Mod 24US", 26UI Mod 24US)
PrintResult("26UI Mod -5I", 26UI Mod -5I)
PrintResult("26UI Mod 26UI", 26UI Mod 26UI)
PrintResult("26UI Mod -7L", 26UI Mod -7L)
PrintResult("26UI Mod 28UL", 26UI Mod 28UL)
PrintResult("26UI Mod -9D", 26UI Mod -9D)
PrintResult("26UI Mod 10.0F", 26UI Mod 10.0F)
PrintResult("26UI Mod -11.0R", 26UI Mod -11.0R)
PrintResult("26UI Mod ""12""", 26UI Mod "12")
PrintResult("26UI Mod TypeCode.Double", 26UI Mod TypeCode.Double)
PrintResult("-7L Mod True", -7L Mod True)
PrintResult("-7L Mod System.SByte.MinValue", -7L Mod System.SByte.MinValue)
PrintResult("-7L Mod System.Byte.MaxValue", -7L Mod System.Byte.MaxValue)
PrintResult("-7L Mod -3S", -7L Mod -3S)
PrintResult("-7L Mod 24US", -7L Mod 24US)
PrintResult("-7L Mod -5I", -7L Mod -5I)
PrintResult("-7L Mod 26UI", -7L Mod 26UI)
PrintResult("-7L Mod -7L", -7L Mod -7L)
PrintResult("-7L Mod 28UL", -7L Mod 28UL)
PrintResult("-7L Mod -9D", -7L Mod -9D)
PrintResult("-7L Mod 10.0F", -7L Mod 10.0F)
PrintResult("-7L Mod -11.0R", -7L Mod -11.0R)
PrintResult("-7L Mod ""12""", -7L Mod "12")
PrintResult("-7L Mod TypeCode.Double", -7L Mod TypeCode.Double)
PrintResult("28UL Mod True", 28UL Mod True)
PrintResult("28UL Mod System.SByte.MinValue", 28UL Mod System.SByte.MinValue)
PrintResult("28UL Mod System.Byte.MaxValue", 28UL Mod System.Byte.MaxValue)
PrintResult("28UL Mod -3S", 28UL Mod -3S)
PrintResult("28UL Mod 24US", 28UL Mod 24US)
PrintResult("28UL Mod -5I", 28UL Mod -5I)
PrintResult("28UL Mod 26UI", 28UL Mod 26UI)
PrintResult("28UL Mod -7L", 28UL Mod -7L)
PrintResult("28UL Mod 28UL", 28UL Mod 28UL)
PrintResult("28UL Mod -9D", 28UL Mod -9D)
PrintResult("28UL Mod 10.0F", 28UL Mod 10.0F)
PrintResult("28UL Mod -11.0R", 28UL Mod -11.0R)
PrintResult("28UL Mod ""12""", 28UL Mod "12")
PrintResult("28UL Mod TypeCode.Double", 28UL Mod TypeCode.Double)
PrintResult("-9D Mod True", -9D Mod True)
PrintResult("-9D Mod System.SByte.MinValue", -9D Mod System.SByte.MinValue)
PrintResult("-9D Mod System.Byte.MaxValue", -9D Mod System.Byte.MaxValue)
PrintResult("-9D Mod -3S", -9D Mod -3S)
PrintResult("-9D Mod 24US", -9D Mod 24US)
PrintResult("-9D Mod -5I", -9D Mod -5I)
PrintResult("-9D Mod 26UI", -9D Mod 26UI)
PrintResult("-9D Mod -7L", -9D Mod -7L)
PrintResult("-9D Mod 28UL", -9D Mod 28UL)
PrintResult("-9D Mod -9D", -9D Mod -9D)
PrintResult("-9D Mod 10.0F", -9D Mod 10.0F)
PrintResult("-9D Mod -11.0R", -9D Mod -11.0R)
PrintResult("-9D Mod ""12""", -9D Mod "12")
PrintResult("-9D Mod TypeCode.Double", -9D Mod TypeCode.Double)
PrintResult("10.0F Mod True", 10.0F Mod True)
PrintResult("10.0F Mod System.SByte.MinValue", 10.0F Mod System.SByte.MinValue)
PrintResult("10.0F Mod System.Byte.MaxValue", 10.0F Mod System.Byte.MaxValue)
PrintResult("10.0F Mod -3S", 10.0F Mod -3S)
PrintResult("10.0F Mod 24US", 10.0F Mod 24US)
PrintResult("10.0F Mod -5I", 10.0F Mod -5I)
PrintResult("10.0F Mod 26UI", 10.0F Mod 26UI)
PrintResult("10.0F Mod -7L", 10.0F Mod -7L)
PrintResult("10.0F Mod 28UL", 10.0F Mod 28UL)
PrintResult("10.0F Mod -9D", 10.0F Mod -9D)
PrintResult("10.0F Mod 10.0F", 10.0F Mod 10.0F)
PrintResult("10.0F Mod -11.0R", 10.0F Mod -11.0R)
PrintResult("10.0F Mod ""12""", 10.0F Mod "12")
PrintResult("10.0F Mod TypeCode.Double", 10.0F Mod TypeCode.Double)
PrintResult("-11.0R Mod True", -11.0R Mod True)
PrintResult("-11.0R Mod System.SByte.MinValue", -11.0R Mod System.SByte.MinValue)
PrintResult("-11.0R Mod System.Byte.MaxValue", -11.0R Mod System.Byte.MaxValue)
PrintResult("-11.0R Mod -3S", -11.0R Mod -3S)
PrintResult("-11.0R Mod 24US", -11.0R Mod 24US)
PrintResult("-11.0R Mod -5I", -11.0R Mod -5I)
PrintResult("-11.0R Mod 26UI", -11.0R Mod 26UI)
PrintResult("-11.0R Mod -7L", -11.0R Mod -7L)
PrintResult("-11.0R Mod 28UL", -11.0R Mod 28UL)
PrintResult("-11.0R Mod -9D", -11.0R Mod -9D)
PrintResult("-11.0R Mod 10.0F", -11.0R Mod 10.0F)
PrintResult("-11.0R Mod -11.0R", -11.0R Mod -11.0R)
PrintResult("-11.0R Mod ""12""", -11.0R Mod "12")
PrintResult("-11.0R Mod TypeCode.Double", -11.0R Mod TypeCode.Double)
PrintResult("""12"" Mod True", "12" Mod True)
PrintResult("""12"" Mod System.SByte.MinValue", "12" Mod System.SByte.MinValue)
PrintResult("""12"" Mod System.Byte.MaxValue", "12" Mod System.Byte.MaxValue)
PrintResult("""12"" Mod -3S", "12" Mod -3S)
PrintResult("""12"" Mod 24US", "12" Mod 24US)
PrintResult("""12"" Mod -5I", "12" Mod -5I)
PrintResult("""12"" Mod 26UI", "12" Mod 26UI)
PrintResult("""12"" Mod -7L", "12" Mod -7L)
PrintResult("""12"" Mod 28UL", "12" Mod 28UL)
PrintResult("""12"" Mod -9D", "12" Mod -9D)
PrintResult("""12"" Mod 10.0F", "12" Mod 10.0F)
PrintResult("""12"" Mod -11.0R", "12" Mod -11.0R)
PrintResult("""12"" Mod ""12""", "12" Mod "12")
PrintResult("""12"" Mod TypeCode.Double", "12" Mod TypeCode.Double)
PrintResult("TypeCode.Double Mod True", TypeCode.Double Mod True)
PrintResult("TypeCode.Double Mod System.SByte.MinValue", TypeCode.Double Mod System.SByte.MinValue)
PrintResult("TypeCode.Double Mod System.Byte.MaxValue", TypeCode.Double Mod System.Byte.MaxValue)
PrintResult("TypeCode.Double Mod -3S", TypeCode.Double Mod -3S)
PrintResult("TypeCode.Double Mod 24US", TypeCode.Double Mod 24US)
PrintResult("TypeCode.Double Mod -5I", TypeCode.Double Mod -5I)
PrintResult("TypeCode.Double Mod 26UI", TypeCode.Double Mod 26UI)
PrintResult("TypeCode.Double Mod -7L", TypeCode.Double Mod -7L)
PrintResult("TypeCode.Double Mod 28UL", TypeCode.Double Mod 28UL)
PrintResult("TypeCode.Double Mod -9D", TypeCode.Double Mod -9D)
PrintResult("TypeCode.Double Mod 10.0F", TypeCode.Double Mod 10.0F)
PrintResult("TypeCode.Double Mod -11.0R", TypeCode.Double Mod -11.0R)
PrintResult("TypeCode.Double Mod ""12""", TypeCode.Double Mod "12")
PrintResult("TypeCode.Double Mod TypeCode.Double", TypeCode.Double Mod TypeCode.Double)
PrintResult("False ^ False", False ^ False)
PrintResult("False ^ True", False ^ True)
PrintResult("False ^ System.SByte.MinValue", False ^ System.SByte.MinValue)
PrintResult("False ^ System.Byte.MaxValue", False ^ System.Byte.MaxValue)
PrintResult("False ^ -3S", False ^ -3S)
PrintResult("False ^ 24US", False ^ 24US)
PrintResult("False ^ -5I", False ^ -5I)
PrintResult("False ^ 26UI", False ^ 26UI)
PrintResult("False ^ -7L", False ^ -7L)
PrintResult("False ^ 28UL", False ^ 28UL)
PrintResult("False ^ -9D", False ^ -9D)
PrintResult("False ^ 10.0F", False ^ 10.0F)
PrintResult("False ^ -11.0R", False ^ -11.0R)
PrintResult("False ^ ""12""", False ^ "12")
PrintResult("False ^ TypeCode.Double", False ^ TypeCode.Double)
PrintResult("True ^ False", True ^ False)
PrintResult("True ^ True", True ^ True)
PrintResult("True ^ System.SByte.MinValue", True ^ System.SByte.MinValue)
PrintResult("True ^ System.Byte.MaxValue", True ^ System.Byte.MaxValue)
PrintResult("True ^ -3S", True ^ -3S)
PrintResult("True ^ 24US", True ^ 24US)
PrintResult("True ^ -5I", True ^ -5I)
PrintResult("True ^ 26UI", True ^ 26UI)
PrintResult("True ^ -7L", True ^ -7L)
PrintResult("True ^ 28UL", True ^ 28UL)
PrintResult("True ^ -9D", True ^ -9D)
PrintResult("True ^ 10.0F", True ^ 10.0F)
PrintResult("True ^ -11.0R", True ^ -11.0R)
PrintResult("True ^ ""12""", True ^ "12")
PrintResult("True ^ TypeCode.Double", True ^ TypeCode.Double)
PrintResult("System.SByte.MinValue ^ False", System.SByte.MinValue ^ False)
PrintResult("System.SByte.MinValue ^ True", System.SByte.MinValue ^ True)
PrintResult("System.SByte.MinValue ^ System.SByte.MinValue", System.SByte.MinValue ^ System.SByte.MinValue)
PrintResult("System.SByte.MinValue ^ System.Byte.MaxValue", System.SByte.MinValue ^ System.Byte.MaxValue)
PrintResult("System.SByte.MinValue ^ -3S", System.SByte.MinValue ^ -3S)
PrintResult("System.SByte.MinValue ^ 24US", System.SByte.MinValue ^ 24US)
PrintResult("System.SByte.MinValue ^ -5I", System.SByte.MinValue ^ -5I)
PrintResult("System.SByte.MinValue ^ 26UI", System.SByte.MinValue ^ 26UI)
PrintResult("System.SByte.MinValue ^ -7L", System.SByte.MinValue ^ -7L)
PrintResult("System.SByte.MinValue ^ 28UL", System.SByte.MinValue ^ 28UL)
PrintResult("System.SByte.MinValue ^ -9D", System.SByte.MinValue ^ -9D)
PrintResult("System.SByte.MinValue ^ 10.0F", System.SByte.MinValue ^ 10.0F)
PrintResult("System.SByte.MinValue ^ -11.0R", System.SByte.MinValue ^ -11.0R)
PrintResult("System.SByte.MinValue ^ ""12""", System.SByte.MinValue ^ "12")
PrintResult("System.SByte.MinValue ^ TypeCode.Double", System.SByte.MinValue ^ TypeCode.Double)
PrintResult("System.Byte.MaxValue ^ False", System.Byte.MaxValue ^ False)
PrintResult("System.Byte.MaxValue ^ True", System.Byte.MaxValue ^ True)
PrintResult("System.Byte.MaxValue ^ System.SByte.MinValue", System.Byte.MaxValue ^ System.SByte.MinValue)
PrintResult("System.Byte.MaxValue ^ System.Byte.MaxValue", System.Byte.MaxValue ^ System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue ^ -3S", System.Byte.MaxValue ^ -3S)
PrintResult("System.Byte.MaxValue ^ 24US", System.Byte.MaxValue ^ 24US)
PrintResult("System.Byte.MaxValue ^ -5I", System.Byte.MaxValue ^ -5I)
PrintResult("System.Byte.MaxValue ^ 26UI", System.Byte.MaxValue ^ 26UI)
PrintResult("System.Byte.MaxValue ^ -7L", System.Byte.MaxValue ^ -7L)
PrintResult("System.Byte.MaxValue ^ 28UL", System.Byte.MaxValue ^ 28UL)
PrintResult("System.Byte.MaxValue ^ -9D", System.Byte.MaxValue ^ -9D)
PrintResult("System.Byte.MaxValue ^ 10.0F", System.Byte.MaxValue ^ 10.0F)
PrintResult("System.Byte.MaxValue ^ -11.0R", System.Byte.MaxValue ^ -11.0R)
PrintResult("System.Byte.MaxValue ^ ""12""", System.Byte.MaxValue ^ "12")
PrintResult("System.Byte.MaxValue ^ TypeCode.Double", System.Byte.MaxValue ^ TypeCode.Double)
PrintResult("-3S ^ False", -3S ^ False)
PrintResult("-3S ^ True", -3S ^ True)
PrintResult("-3S ^ System.SByte.MinValue", -3S ^ System.SByte.MinValue)
PrintResult("-3S ^ System.Byte.MaxValue", -3S ^ System.Byte.MaxValue)
PrintResult("-3S ^ -3S", -3S ^ -3S)
PrintResult("-3S ^ 24US", -3S ^ 24US)
PrintResult("-3S ^ -5I", -3S ^ -5I)
PrintResult("-3S ^ 26UI", -3S ^ 26UI)
PrintResult("-3S ^ -7L", -3S ^ -7L)
PrintResult("-3S ^ 28UL", -3S ^ 28UL)
PrintResult("-3S ^ -9D", -3S ^ -9D)
PrintResult("-3S ^ 10.0F", -3S ^ 10.0F)
PrintResult("-3S ^ -11.0R", -3S ^ -11.0R)
PrintResult("-3S ^ ""12""", -3S ^ "12")
PrintResult("-3S ^ TypeCode.Double", -3S ^ TypeCode.Double)
PrintResult("24US ^ False", 24US ^ False)
PrintResult("24US ^ True", 24US ^ True)
PrintResult("24US ^ System.SByte.MinValue", 24US ^ System.SByte.MinValue)
PrintResult("24US ^ System.Byte.MaxValue", 24US ^ System.Byte.MaxValue)
PrintResult("24US ^ -3S", 24US ^ -3S)
PrintResult("24US ^ 24US", 24US ^ 24US)
PrintResult("24US ^ -5I", 24US ^ -5I)
PrintResult("24US ^ 26UI", 24US ^ 26UI)
PrintResult("24US ^ -7L", 24US ^ -7L)
PrintResult("24US ^ 28UL", 24US ^ 28UL)
PrintResult("24US ^ -9D", 24US ^ -9D)
PrintResult("24US ^ 10.0F", 24US ^ 10.0F)
PrintResult("24US ^ -11.0R", 24US ^ -11.0R)
PrintResult("24US ^ ""12""", 24US ^ "12")
PrintResult("24US ^ TypeCode.Double", 24US ^ TypeCode.Double)
PrintResult("-5I ^ False", -5I ^ False)
PrintResult("-5I ^ True", -5I ^ True)
PrintResult("-5I ^ System.SByte.MinValue", -5I ^ System.SByte.MinValue)
PrintResult("-5I ^ System.Byte.MaxValue", -5I ^ System.Byte.MaxValue)
PrintResult("-5I ^ -3S", -5I ^ -3S)
PrintResult("-5I ^ 24US", -5I ^ 24US)
PrintResult("-5I ^ -5I", -5I ^ -5I)
PrintResult("-5I ^ 26UI", -5I ^ 26UI)
PrintResult("-5I ^ -7L", -5I ^ -7L)
PrintResult("-5I ^ 28UL", -5I ^ 28UL)
PrintResult("-5I ^ -9D", -5I ^ -9D)
PrintResult("-5I ^ 10.0F", -5I ^ 10.0F)
PrintResult("-5I ^ -11.0R", -5I ^ -11.0R)
PrintResult("-5I ^ ""12""", -5I ^ "12")
PrintResult("-5I ^ TypeCode.Double", -5I ^ TypeCode.Double)
PrintResult("26UI ^ False", 26UI ^ False)
PrintResult("26UI ^ True", 26UI ^ True)
PrintResult("26UI ^ System.SByte.MinValue", 26UI ^ System.SByte.MinValue)
PrintResult("26UI ^ System.Byte.MaxValue", 26UI ^ System.Byte.MaxValue)
PrintResult("26UI ^ -3S", 26UI ^ -3S)
PrintResult("26UI ^ 24US", 26UI ^ 24US)
PrintResult("26UI ^ -5I", 26UI ^ -5I)
PrintResult("26UI ^ 26UI", 26UI ^ 26UI)
PrintResult("26UI ^ -7L", 26UI ^ -7L)
PrintResult("26UI ^ 28UL", 26UI ^ 28UL)
PrintResult("26UI ^ -9D", 26UI ^ -9D)
PrintResult("26UI ^ 10.0F", 26UI ^ 10.0F)
PrintResult("26UI ^ -11.0R", 26UI ^ -11.0R)
PrintResult("26UI ^ ""12""", 26UI ^ "12")
PrintResult("26UI ^ TypeCode.Double", 26UI ^ TypeCode.Double)
PrintResult("-7L ^ False", -7L ^ False)
PrintResult("-7L ^ True", -7L ^ True)
PrintResult("-7L ^ System.SByte.MinValue", -7L ^ System.SByte.MinValue)
PrintResult("-7L ^ System.Byte.MaxValue", -7L ^ System.Byte.MaxValue)
PrintResult("-7L ^ -3S", -7L ^ -3S)
PrintResult("-7L ^ 24US", -7L ^ 24US)
PrintResult("-7L ^ -5I", -7L ^ -5I)
PrintResult("-7L ^ 26UI", -7L ^ 26UI)
PrintResult("-7L ^ -7L", -7L ^ -7L)
PrintResult("-7L ^ 28UL", -7L ^ 28UL)
PrintResult("-7L ^ -9D", -7L ^ -9D)
PrintResult("-7L ^ 10.0F", -7L ^ 10.0F)
PrintResult("-7L ^ -11.0R", -7L ^ -11.0R)
PrintResult("-7L ^ ""12""", -7L ^ "12")
PrintResult("-7L ^ TypeCode.Double", -7L ^ TypeCode.Double)
PrintResult("28UL ^ False", 28UL ^ False)
PrintResult("28UL ^ True", 28UL ^ True)
PrintResult("28UL ^ System.SByte.MinValue", 28UL ^ System.SByte.MinValue)
PrintResult("28UL ^ System.Byte.MaxValue", 28UL ^ System.Byte.MaxValue)
PrintResult("28UL ^ -3S", 28UL ^ -3S)
PrintResult("28UL ^ 24US", 28UL ^ 24US)
PrintResult("28UL ^ -5I", 28UL ^ -5I)
PrintResult("28UL ^ 26UI", 28UL ^ 26UI)
PrintResult("28UL ^ -7L", 28UL ^ -7L)
PrintResult("28UL ^ 28UL", 28UL ^ 28UL)
PrintResult("28UL ^ -9D", 28UL ^ -9D)
PrintResult("28UL ^ 10.0F", 28UL ^ 10.0F)
PrintResult("28UL ^ -11.0R", 28UL ^ -11.0R)
PrintResult("28UL ^ ""12""", 28UL ^ "12")
PrintResult("28UL ^ TypeCode.Double", 28UL ^ TypeCode.Double)
PrintResult("-9D ^ False", -9D ^ False)
PrintResult("-9D ^ True", -9D ^ True)
PrintResult("-9D ^ System.SByte.MinValue", -9D ^ System.SByte.MinValue)
PrintResult("-9D ^ System.Byte.MaxValue", -9D ^ System.Byte.MaxValue)
PrintResult("-9D ^ -3S", -9D ^ -3S)
PrintResult("-9D ^ 24US", -9D ^ 24US)
PrintResult("-9D ^ -5I", -9D ^ -5I)
PrintResult("-9D ^ 26UI", -9D ^ 26UI)
PrintResult("-9D ^ -7L", -9D ^ -7L)
PrintResult("-9D ^ 28UL", -9D ^ 28UL)
PrintResult("-9D ^ -9D", -9D ^ -9D)
PrintResult("-9D ^ 10.0F", -9D ^ 10.0F)
PrintResult("-9D ^ -11.0R", -9D ^ -11.0R)
PrintResult("-9D ^ ""12""", -9D ^ "12")
PrintResult("-9D ^ TypeCode.Double", -9D ^ TypeCode.Double)
PrintResult("10.0F ^ False", 10.0F ^ False)
PrintResult("10.0F ^ True", 10.0F ^ True)
PrintResult("10.0F ^ System.SByte.MinValue", 10.0F ^ System.SByte.MinValue)
PrintResult("10.0F ^ System.Byte.MaxValue", 10.0F ^ System.Byte.MaxValue)
PrintResult("10.0F ^ -3S", 10.0F ^ -3S)
PrintResult("10.0F ^ 24US", 10.0F ^ 24US)
PrintResult("10.0F ^ -5I", 10.0F ^ -5I)
PrintResult("10.0F ^ 26UI", 10.0F ^ 26UI)
PrintResult("10.0F ^ -7L", 10.0F ^ -7L)
PrintResult("10.0F ^ 28UL", 10.0F ^ 28UL)
PrintResult("10.0F ^ -9D", 10.0F ^ -9D)
PrintResult("10.0F ^ 10.0F", 10.0F ^ 10.0F)
PrintResult("10.0F ^ -11.0R", 10.0F ^ -11.0R)
PrintResult("10.0F ^ ""12""", 10.0F ^ "12")
PrintResult("10.0F ^ TypeCode.Double", 10.0F ^ TypeCode.Double)
PrintResult("-11.0R ^ False", -11.0R ^ False)
PrintResult("-11.0R ^ True", -11.0R ^ True)
PrintResult("-11.0R ^ System.SByte.MinValue", -11.0R ^ System.SByte.MinValue)
PrintResult("-11.0R ^ System.Byte.MaxValue", -11.0R ^ System.Byte.MaxValue)
PrintResult("-11.0R ^ -3S", -11.0R ^ -3S)
PrintResult("-11.0R ^ 24US", -11.0R ^ 24US)
PrintResult("-11.0R ^ -5I", -11.0R ^ -5I)
PrintResult("-11.0R ^ 26UI", -11.0R ^ 26UI)
PrintResult("-11.0R ^ -7L", -11.0R ^ -7L)
PrintResult("-11.0R ^ 28UL", -11.0R ^ 28UL)
PrintResult("-11.0R ^ -9D", -11.0R ^ -9D)
PrintResult("-11.0R ^ 10.0F", -11.0R ^ 10.0F)
PrintResult("-11.0R ^ -11.0R", -11.0R ^ -11.0R)
PrintResult("-11.0R ^ ""12""", -11.0R ^ "12")
PrintResult("-11.0R ^ TypeCode.Double", -11.0R ^ TypeCode.Double)
PrintResult("""12"" ^ False", "12" ^ False)
PrintResult("""12"" ^ True", "12" ^ True)
PrintResult("""12"" ^ System.SByte.MinValue", "12" ^ System.SByte.MinValue)
PrintResult("""12"" ^ System.Byte.MaxValue", "12" ^ System.Byte.MaxValue)
PrintResult("""12"" ^ -3S", "12" ^ -3S)
PrintResult("""12"" ^ 24US", "12" ^ 24US)
PrintResult("""12"" ^ -5I", "12" ^ -5I)
PrintResult("""12"" ^ 26UI", "12" ^ 26UI)
PrintResult("""12"" ^ -7L", "12" ^ -7L)
PrintResult("""12"" ^ 28UL", "12" ^ 28UL)
PrintResult("""12"" ^ -9D", "12" ^ -9D)
PrintResult("""12"" ^ 10.0F", "12" ^ 10.0F)
PrintResult("""12"" ^ -11.0R", "12" ^ -11.0R)
PrintResult("""12"" ^ ""12""", "12" ^ "12")
PrintResult("""12"" ^ TypeCode.Double", "12" ^ TypeCode.Double)
PrintResult("TypeCode.Double ^ False", TypeCode.Double ^ False)
PrintResult("TypeCode.Double ^ True", TypeCode.Double ^ True)
PrintResult("TypeCode.Double ^ System.SByte.MinValue", TypeCode.Double ^ System.SByte.MinValue)
PrintResult("TypeCode.Double ^ System.Byte.MaxValue", TypeCode.Double ^ System.Byte.MaxValue)
PrintResult("TypeCode.Double ^ -3S", TypeCode.Double ^ -3S)
PrintResult("TypeCode.Double ^ 24US", TypeCode.Double ^ 24US)
PrintResult("TypeCode.Double ^ -5I", TypeCode.Double ^ -5I)
PrintResult("TypeCode.Double ^ 26UI", TypeCode.Double ^ 26UI)
PrintResult("TypeCode.Double ^ -7L", TypeCode.Double ^ -7L)
PrintResult("TypeCode.Double ^ 28UL", TypeCode.Double ^ 28UL)
PrintResult("TypeCode.Double ^ -9D", TypeCode.Double ^ -9D)
PrintResult("TypeCode.Double ^ 10.0F", TypeCode.Double ^ 10.0F)
PrintResult("TypeCode.Double ^ -11.0R", TypeCode.Double ^ -11.0R)
PrintResult("TypeCode.Double ^ ""12""", TypeCode.Double ^ "12")
PrintResult("TypeCode.Double ^ TypeCode.Double", TypeCode.Double ^ TypeCode.Double)
PrintResult("False << False", False << False)
PrintResult("False << True", False << True)
PrintResult("False << System.SByte.MinValue", False << System.SByte.MinValue)
PrintResult("False << System.Byte.MaxValue", False << System.Byte.MaxValue)
PrintResult("False << -3S", False << -3S)
PrintResult("False << 24US", False << 24US)
PrintResult("False << -5I", False << -5I)
PrintResult("False << 26UI", False << 26UI)
PrintResult("False << -7L", False << -7L)
PrintResult("False << 28UL", False << 28UL)
PrintResult("False << -9D", False << -9D)
PrintResult("False << 10.0F", False << 10.0F)
PrintResult("False << -11.0R", False << -11.0R)
PrintResult("False << ""12""", False << "12")
PrintResult("False << TypeCode.Double", False << TypeCode.Double)
PrintResult("True << False", True << False)
PrintResult("True << True", True << True)
PrintResult("True << System.SByte.MinValue", True << System.SByte.MinValue)
PrintResult("True << System.Byte.MaxValue", True << System.Byte.MaxValue)
PrintResult("True << -3S", True << -3S)
PrintResult("True << 24US", True << 24US)
PrintResult("True << -5I", True << -5I)
PrintResult("True << 26UI", True << 26UI)
PrintResult("True << -7L", True << -7L)
PrintResult("True << 28UL", True << 28UL)
PrintResult("True << -9D", True << -9D)
PrintResult("True << 10.0F", True << 10.0F)
PrintResult("True << -11.0R", True << -11.0R)
PrintResult("True << ""12""", True << "12")
PrintResult("True << TypeCode.Double", True << TypeCode.Double)
PrintResult("System.SByte.MinValue << False", System.SByte.MinValue << False)
PrintResult("System.SByte.MinValue << True", System.SByte.MinValue << True)
PrintResult("System.SByte.MinValue << System.SByte.MinValue", System.SByte.MinValue << System.SByte.MinValue)
PrintResult("System.SByte.MinValue << System.Byte.MaxValue", System.SByte.MinValue << System.Byte.MaxValue)
PrintResult("System.SByte.MinValue << -3S", System.SByte.MinValue << -3S)
PrintResult("System.SByte.MinValue << 24US", System.SByte.MinValue << 24US)
PrintResult("System.SByte.MinValue << -5I", System.SByte.MinValue << -5I)
PrintResult("System.SByte.MinValue << 26UI", System.SByte.MinValue << 26UI)
PrintResult("System.SByte.MinValue << -7L", System.SByte.MinValue << -7L)
PrintResult("System.SByte.MinValue << 28UL", System.SByte.MinValue << 28UL)
PrintResult("System.SByte.MinValue << -9D", System.SByte.MinValue << -9D)
PrintResult("System.SByte.MinValue << 10.0F", System.SByte.MinValue << 10.0F)
PrintResult("System.SByte.MinValue << -11.0R", System.SByte.MinValue << -11.0R)
PrintResult("System.SByte.MinValue << ""12""", System.SByte.MinValue << "12")
PrintResult("System.SByte.MinValue << TypeCode.Double", System.SByte.MinValue << TypeCode.Double)
PrintResult("System.Byte.MaxValue << False", System.Byte.MaxValue << False)
PrintResult("System.Byte.MaxValue << True", System.Byte.MaxValue << True)
PrintResult("System.Byte.MaxValue << System.SByte.MinValue", System.Byte.MaxValue << System.SByte.MinValue)
PrintResult("System.Byte.MaxValue << System.Byte.MaxValue", System.Byte.MaxValue << System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue << -3S", System.Byte.MaxValue << -3S)
PrintResult("System.Byte.MaxValue << 24US", System.Byte.MaxValue << 24US)
PrintResult("System.Byte.MaxValue << -5I", System.Byte.MaxValue << -5I)
PrintResult("System.Byte.MaxValue << 26UI", System.Byte.MaxValue << 26UI)
PrintResult("System.Byte.MaxValue << -7L", System.Byte.MaxValue << -7L)
PrintResult("System.Byte.MaxValue << 28UL", System.Byte.MaxValue << 28UL)
PrintResult("System.Byte.MaxValue << -9D", System.Byte.MaxValue << -9D)
PrintResult("System.Byte.MaxValue << 10.0F", System.Byte.MaxValue << 10.0F)
PrintResult("System.Byte.MaxValue << -11.0R", System.Byte.MaxValue << -11.0R)
PrintResult("System.Byte.MaxValue << ""12""", System.Byte.MaxValue << "12")
PrintResult("System.Byte.MaxValue << TypeCode.Double", System.Byte.MaxValue << TypeCode.Double)
PrintResult("-3S << False", -3S << False)
PrintResult("-3S << True", -3S << True)
PrintResult("-3S << System.SByte.MinValue", -3S << System.SByte.MinValue)
PrintResult("-3S << System.Byte.MaxValue", -3S << System.Byte.MaxValue)
PrintResult("-3S << -3S", -3S << -3S)
PrintResult("-3S << 24US", -3S << 24US)
PrintResult("-3S << -5I", -3S << -5I)
PrintResult("-3S << 26UI", -3S << 26UI)
PrintResult("-3S << -7L", -3S << -7L)
PrintResult("-3S << 28UL", -3S << 28UL)
PrintResult("-3S << -9D", -3S << -9D)
PrintResult("-3S << 10.0F", -3S << 10.0F)
PrintResult("-3S << -11.0R", -3S << -11.0R)
PrintResult("-3S << ""12""", -3S << "12")
PrintResult("-3S << TypeCode.Double", -3S << TypeCode.Double)
PrintResult("24US << False", 24US << False)
PrintResult("24US << True", 24US << True)
PrintResult("24US << System.SByte.MinValue", 24US << System.SByte.MinValue)
PrintResult("24US << System.Byte.MaxValue", 24US << System.Byte.MaxValue)
PrintResult("24US << -3S", 24US << -3S)
PrintResult("24US << 24US", 24US << 24US)
PrintResult("24US << -5I", 24US << -5I)
PrintResult("24US << 26UI", 24US << 26UI)
PrintResult("24US << -7L", 24US << -7L)
PrintResult("24US << 28UL", 24US << 28UL)
PrintResult("24US << -9D", 24US << -9D)
PrintResult("24US << 10.0F", 24US << 10.0F)
PrintResult("24US << -11.0R", 24US << -11.0R)
PrintResult("24US << ""12""", 24US << "12")
PrintResult("24US << TypeCode.Double", 24US << TypeCode.Double)
PrintResult("-5I << False", -5I << False)
PrintResult("-5I << True", -5I << True)
PrintResult("-5I << System.SByte.MinValue", -5I << System.SByte.MinValue)
PrintResult("-5I << System.Byte.MaxValue", -5I << System.Byte.MaxValue)
PrintResult("-5I << -3S", -5I << -3S)
PrintResult("-5I << 24US", -5I << 24US)
PrintResult("-5I << -5I", -5I << -5I)
PrintResult("-5I << 26UI", -5I << 26UI)
PrintResult("-5I << -7L", -5I << -7L)
PrintResult("-5I << 28UL", -5I << 28UL)
PrintResult("-5I << -9D", -5I << -9D)
PrintResult("-5I << 10.0F", -5I << 10.0F)
PrintResult("-5I << -11.0R", -5I << -11.0R)
PrintResult("-5I << ""12""", -5I << "12")
PrintResult("-5I << TypeCode.Double", -5I << TypeCode.Double)
PrintResult("26UI << False", 26UI << False)
PrintResult("26UI << True", 26UI << True)
PrintResult("26UI << System.SByte.MinValue", 26UI << System.SByte.MinValue)
PrintResult("26UI << System.Byte.MaxValue", 26UI << System.Byte.MaxValue)
PrintResult("26UI << -3S", 26UI << -3S)
PrintResult("26UI << 24US", 26UI << 24US)
PrintResult("26UI << -5I", 26UI << -5I)
PrintResult("26UI << 26UI", 26UI << 26UI)
PrintResult("26UI << -7L", 26UI << -7L)
PrintResult("26UI << 28UL", 26UI << 28UL)
PrintResult("26UI << -9D", 26UI << -9D)
PrintResult("26UI << 10.0F", 26UI << 10.0F)
PrintResult("26UI << -11.0R", 26UI << -11.0R)
PrintResult("26UI << ""12""", 26UI << "12")
PrintResult("26UI << TypeCode.Double", 26UI << TypeCode.Double)
PrintResult("-7L << False", -7L << False)
PrintResult("-7L << True", -7L << True)
PrintResult("-7L << System.SByte.MinValue", -7L << System.SByte.MinValue)
PrintResult("-7L << System.Byte.MaxValue", -7L << System.Byte.MaxValue)
PrintResult("-7L << -3S", -7L << -3S)
PrintResult("-7L << 24US", -7L << 24US)
PrintResult("-7L << -5I", -7L << -5I)
PrintResult("-7L << 26UI", -7L << 26UI)
PrintResult("-7L << -7L", -7L << -7L)
PrintResult("-7L << 28UL", -7L << 28UL)
PrintResult("-7L << -9D", -7L << -9D)
PrintResult("-7L << 10.0F", -7L << 10.0F)
PrintResult("-7L << -11.0R", -7L << -11.0R)
PrintResult("-7L << ""12""", -7L << "12")
PrintResult("-7L << TypeCode.Double", -7L << TypeCode.Double)
PrintResult("28UL << False", 28UL << False)
PrintResult("28UL << True", 28UL << True)
PrintResult("28UL << System.SByte.MinValue", 28UL << System.SByte.MinValue)
PrintResult("28UL << System.Byte.MaxValue", 28UL << System.Byte.MaxValue)
PrintResult("28UL << -3S", 28UL << -3S)
PrintResult("28UL << 24US", 28UL << 24US)
PrintResult("28UL << -5I", 28UL << -5I)
PrintResult("28UL << 26UI", 28UL << 26UI)
PrintResult("28UL << -7L", 28UL << -7L)
PrintResult("28UL << 28UL", 28UL << 28UL)
PrintResult("28UL << -9D", 28UL << -9D)
PrintResult("28UL << 10.0F", 28UL << 10.0F)
PrintResult("28UL << -11.0R", 28UL << -11.0R)
PrintResult("28UL << ""12""", 28UL << "12")
PrintResult("28UL << TypeCode.Double", 28UL << TypeCode.Double)
PrintResult("-9D << False", -9D << False)
PrintResult("-9D << True", -9D << True)
PrintResult("-9D << System.SByte.MinValue", -9D << System.SByte.MinValue)
PrintResult("-9D << System.Byte.MaxValue", -9D << System.Byte.MaxValue)
PrintResult("-9D << -3S", -9D << -3S)
PrintResult("-9D << 24US", -9D << 24US)
PrintResult("-9D << -5I", -9D << -5I)
PrintResult("-9D << 26UI", -9D << 26UI)
PrintResult("-9D << -7L", -9D << -7L)
PrintResult("-9D << 28UL", -9D << 28UL)
PrintResult("-9D << -9D", -9D << -9D)
PrintResult("-9D << 10.0F", -9D << 10.0F)
PrintResult("-9D << -11.0R", -9D << -11.0R)
PrintResult("-9D << ""12""", -9D << "12")
PrintResult("-9D << TypeCode.Double", -9D << TypeCode.Double)
PrintResult("10.0F << False", 10.0F << False)
PrintResult("10.0F << True", 10.0F << True)
PrintResult("10.0F << System.SByte.MinValue", 10.0F << System.SByte.MinValue)
PrintResult("10.0F << System.Byte.MaxValue", 10.0F << System.Byte.MaxValue)
PrintResult("10.0F << -3S", 10.0F << -3S)
PrintResult("10.0F << 24US", 10.0F << 24US)
PrintResult("10.0F << -5I", 10.0F << -5I)
PrintResult("10.0F << 26UI", 10.0F << 26UI)
PrintResult("10.0F << -7L", 10.0F << -7L)
PrintResult("10.0F << 28UL", 10.0F << 28UL)
PrintResult("10.0F << -9D", 10.0F << -9D)
PrintResult("10.0F << 10.0F", 10.0F << 10.0F)
PrintResult("10.0F << -11.0R", 10.0F << -11.0R)
PrintResult("10.0F << ""12""", 10.0F << "12")
PrintResult("10.0F << TypeCode.Double", 10.0F << TypeCode.Double)
PrintResult("-11.0R << False", -11.0R << False)
PrintResult("-11.0R << True", -11.0R << True)
PrintResult("-11.0R << System.SByte.MinValue", -11.0R << System.SByte.MinValue)
PrintResult("-11.0R << System.Byte.MaxValue", -11.0R << System.Byte.MaxValue)
PrintResult("-11.0R << -3S", -11.0R << -3S)
PrintResult("-11.0R << 24US", -11.0R << 24US)
PrintResult("-11.0R << -5I", -11.0R << -5I)
PrintResult("-11.0R << 26UI", -11.0R << 26UI)
PrintResult("-11.0R << -7L", -11.0R << -7L)
PrintResult("-11.0R << 28UL", -11.0R << 28UL)
PrintResult("-11.0R << -9D", -11.0R << -9D)
PrintResult("-11.0R << 10.0F", -11.0R << 10.0F)
PrintResult("-11.0R << -11.0R", -11.0R << -11.0R)
PrintResult("-11.0R << ""12""", -11.0R << "12")
PrintResult("-11.0R << TypeCode.Double", -11.0R << TypeCode.Double)
PrintResult("""12"" << False", "12" << False)
PrintResult("""12"" << True", "12" << True)
PrintResult("""12"" << System.SByte.MinValue", "12" << System.SByte.MinValue)
PrintResult("""12"" << System.Byte.MaxValue", "12" << System.Byte.MaxValue)
PrintResult("""12"" << -3S", "12" << -3S)
PrintResult("""12"" << 24US", "12" << 24US)
PrintResult("""12"" << -5I", "12" << -5I)
PrintResult("""12"" << 26UI", "12" << 26UI)
PrintResult("""12"" << -7L", "12" << -7L)
PrintResult("""12"" << 28UL", "12" << 28UL)
PrintResult("""12"" << -9D", "12" << -9D)
PrintResult("""12"" << 10.0F", "12" << 10.0F)
PrintResult("""12"" << -11.0R", "12" << -11.0R)
PrintResult("""12"" << ""12""", "12" << "12")
PrintResult("""12"" << TypeCode.Double", "12" << TypeCode.Double)
PrintResult("TypeCode.Double << False", TypeCode.Double << False)
PrintResult("TypeCode.Double << True", TypeCode.Double << True)
PrintResult("TypeCode.Double << System.SByte.MinValue", TypeCode.Double << System.SByte.MinValue)
PrintResult("TypeCode.Double << System.Byte.MaxValue", TypeCode.Double << System.Byte.MaxValue)
PrintResult("TypeCode.Double << -3S", TypeCode.Double << -3S)
PrintResult("TypeCode.Double << 24US", TypeCode.Double << 24US)
PrintResult("TypeCode.Double << -5I", TypeCode.Double << -5I)
PrintResult("TypeCode.Double << 26UI", TypeCode.Double << 26UI)
PrintResult("TypeCode.Double << -7L", TypeCode.Double << -7L)
PrintResult("TypeCode.Double << 28UL", TypeCode.Double << 28UL)
PrintResult("TypeCode.Double << -9D", TypeCode.Double << -9D)
PrintResult("TypeCode.Double << 10.0F", TypeCode.Double << 10.0F)
PrintResult("TypeCode.Double << -11.0R", TypeCode.Double << -11.0R)
PrintResult("TypeCode.Double << ""12""", TypeCode.Double << "12")
PrintResult("TypeCode.Double << TypeCode.Double", TypeCode.Double << TypeCode.Double)
PrintResult("False >> False", False >> False)
PrintResult("False >> True", False >> True)
PrintResult("False >> System.SByte.MinValue", False >> System.SByte.MinValue)
PrintResult("False >> System.Byte.MaxValue", False >> System.Byte.MaxValue)
PrintResult("False >> -3S", False >> -3S)
PrintResult("False >> 24US", False >> 24US)
PrintResult("False >> -5I", False >> -5I)
PrintResult("False >> 26UI", False >> 26UI)
PrintResult("False >> -7L", False >> -7L)
PrintResult("False >> 28UL", False >> 28UL)
PrintResult("False >> -9D", False >> -9D)
PrintResult("False >> 10.0F", False >> 10.0F)
PrintResult("False >> -11.0R", False >> -11.0R)
PrintResult("False >> ""12""", False >> "12")
PrintResult("False >> TypeCode.Double", False >> TypeCode.Double)
PrintResult("True >> False", True >> False)
PrintResult("True >> True", True >> True)
PrintResult("True >> System.SByte.MinValue", True >> System.SByte.MinValue)
PrintResult("True >> System.Byte.MaxValue", True >> System.Byte.MaxValue)
PrintResult("True >> -3S", True >> -3S)
PrintResult("True >> 24US", True >> 24US)
PrintResult("True >> -5I", True >> -5I)
PrintResult("True >> 26UI", True >> 26UI)
PrintResult("True >> -7L", True >> -7L)
PrintResult("True >> 28UL", True >> 28UL)
PrintResult("True >> -9D", True >> -9D)
PrintResult("True >> 10.0F", True >> 10.0F)
PrintResult("True >> -11.0R", True >> -11.0R)
PrintResult("True >> ""12""", True >> "12")
PrintResult("True >> TypeCode.Double", True >> TypeCode.Double)
PrintResult("System.SByte.MinValue >> False", System.SByte.MinValue >> False)
PrintResult("System.SByte.MinValue >> True", System.SByte.MinValue >> True)
PrintResult("System.SByte.MinValue >> System.SByte.MinValue", System.SByte.MinValue >> System.SByte.MinValue)
PrintResult("System.SByte.MinValue >> System.Byte.MaxValue", System.SByte.MinValue >> System.Byte.MaxValue)
PrintResult("System.SByte.MinValue >> -3S", System.SByte.MinValue >> -3S)
PrintResult("System.SByte.MinValue >> 24US", System.SByte.MinValue >> 24US)
PrintResult("System.SByte.MinValue >> -5I", System.SByte.MinValue >> -5I)
PrintResult("System.SByte.MinValue >> 26UI", System.SByte.MinValue >> 26UI)
PrintResult("System.SByte.MinValue >> -7L", System.SByte.MinValue >> -7L)
PrintResult("System.SByte.MinValue >> 28UL", System.SByte.MinValue >> 28UL)
PrintResult("System.SByte.MinValue >> -9D", System.SByte.MinValue >> -9D)
PrintResult("System.SByte.MinValue >> 10.0F", System.SByte.MinValue >> 10.0F)
PrintResult("System.SByte.MinValue >> -11.0R", System.SByte.MinValue >> -11.0R)
PrintResult("System.SByte.MinValue >> ""12""", System.SByte.MinValue >> "12")
PrintResult("System.SByte.MinValue >> TypeCode.Double", System.SByte.MinValue >> TypeCode.Double)
PrintResult("System.Byte.MaxValue >> False", System.Byte.MaxValue >> False)
PrintResult("System.Byte.MaxValue >> True", System.Byte.MaxValue >> True)
PrintResult("System.Byte.MaxValue >> System.SByte.MinValue", System.Byte.MaxValue >> System.SByte.MinValue)
PrintResult("System.Byte.MaxValue >> System.Byte.MaxValue", System.Byte.MaxValue >> System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue >> -3S", System.Byte.MaxValue >> -3S)
PrintResult("System.Byte.MaxValue >> 24US", System.Byte.MaxValue >> 24US)
PrintResult("System.Byte.MaxValue >> -5I", System.Byte.MaxValue >> -5I)
PrintResult("System.Byte.MaxValue >> 26UI", System.Byte.MaxValue >> 26UI)
PrintResult("System.Byte.MaxValue >> -7L", System.Byte.MaxValue >> -7L)
PrintResult("System.Byte.MaxValue >> 28UL", System.Byte.MaxValue >> 28UL)
PrintResult("System.Byte.MaxValue >> -9D", System.Byte.MaxValue >> -9D)
PrintResult("System.Byte.MaxValue >> 10.0F", System.Byte.MaxValue >> 10.0F)
PrintResult("System.Byte.MaxValue >> -11.0R", System.Byte.MaxValue >> -11.0R)
PrintResult("System.Byte.MaxValue >> ""12""", System.Byte.MaxValue >> "12")
PrintResult("System.Byte.MaxValue >> TypeCode.Double", System.Byte.MaxValue >> TypeCode.Double)
PrintResult("-3S >> False", -3S >> False)
PrintResult("-3S >> True", -3S >> True)
PrintResult("-3S >> System.SByte.MinValue", -3S >> System.SByte.MinValue)
PrintResult("-3S >> System.Byte.MaxValue", -3S >> System.Byte.MaxValue)
PrintResult("-3S >> -3S", -3S >> -3S)
PrintResult("-3S >> 24US", -3S >> 24US)
PrintResult("-3S >> -5I", -3S >> -5I)
PrintResult("-3S >> 26UI", -3S >> 26UI)
PrintResult("-3S >> -7L", -3S >> -7L)
PrintResult("-3S >> 28UL", -3S >> 28UL)
PrintResult("-3S >> -9D", -3S >> -9D)
PrintResult("-3S >> 10.0F", -3S >> 10.0F)
PrintResult("-3S >> -11.0R", -3S >> -11.0R)
PrintResult("-3S >> ""12""", -3S >> "12")
PrintResult("-3S >> TypeCode.Double", -3S >> TypeCode.Double)
PrintResult("24US >> False", 24US >> False)
PrintResult("24US >> True", 24US >> True)
PrintResult("24US >> System.SByte.MinValue", 24US >> System.SByte.MinValue)
PrintResult("24US >> System.Byte.MaxValue", 24US >> System.Byte.MaxValue)
PrintResult("24US >> -3S", 24US >> -3S)
PrintResult("24US >> 24US", 24US >> 24US)
PrintResult("24US >> -5I", 24US >> -5I)
PrintResult("24US >> 26UI", 24US >> 26UI)
PrintResult("24US >> -7L", 24US >> -7L)
PrintResult("24US >> 28UL", 24US >> 28UL)
PrintResult("24US >> -9D", 24US >> -9D)
PrintResult("24US >> 10.0F", 24US >> 10.0F)
PrintResult("24US >> -11.0R", 24US >> -11.0R)
PrintResult("24US >> ""12""", 24US >> "12")
PrintResult("24US >> TypeCode.Double", 24US >> TypeCode.Double)
PrintResult("-5I >> False", -5I >> False)
PrintResult("-5I >> True", -5I >> True)
PrintResult("-5I >> System.SByte.MinValue", -5I >> System.SByte.MinValue)
PrintResult("-5I >> System.Byte.MaxValue", -5I >> System.Byte.MaxValue)
PrintResult("-5I >> -3S", -5I >> -3S)
PrintResult("-5I >> 24US", -5I >> 24US)
PrintResult("-5I >> -5I", -5I >> -5I)
PrintResult("-5I >> 26UI", -5I >> 26UI)
PrintResult("-5I >> -7L", -5I >> -7L)
PrintResult("-5I >> 28UL", -5I >> 28UL)
PrintResult("-5I >> -9D", -5I >> -9D)
PrintResult("-5I >> 10.0F", -5I >> 10.0F)
PrintResult("-5I >> -11.0R", -5I >> -11.0R)
PrintResult("-5I >> ""12""", -5I >> "12")
PrintResult("-5I >> TypeCode.Double", -5I >> TypeCode.Double)
PrintResult("26UI >> False", 26UI >> False)
PrintResult("26UI >> True", 26UI >> True)
PrintResult("26UI >> System.SByte.MinValue", 26UI >> System.SByte.MinValue)
PrintResult("26UI >> System.Byte.MaxValue", 26UI >> System.Byte.MaxValue)
PrintResult("26UI >> -3S", 26UI >> -3S)
PrintResult("26UI >> 24US", 26UI >> 24US)
PrintResult("26UI >> -5I", 26UI >> -5I)
PrintResult("26UI >> 26UI", 26UI >> 26UI)
PrintResult("26UI >> -7L", 26UI >> -7L)
PrintResult("26UI >> 28UL", 26UI >> 28UL)
PrintResult("26UI >> -9D", 26UI >> -9D)
PrintResult("26UI >> 10.0F", 26UI >> 10.0F)
PrintResult("26UI >> -11.0R", 26UI >> -11.0R)
PrintResult("26UI >> ""12""", 26UI >> "12")
PrintResult("26UI >> TypeCode.Double", 26UI >> TypeCode.Double)
PrintResult("-7L >> False", -7L >> False)
PrintResult("-7L >> True", -7L >> True)
PrintResult("-7L >> System.SByte.MinValue", -7L >> System.SByte.MinValue)
PrintResult("-7L >> System.Byte.MaxValue", -7L >> System.Byte.MaxValue)
PrintResult("-7L >> -3S", -7L >> -3S)
PrintResult("-7L >> 24US", -7L >> 24US)
PrintResult("-7L >> -5I", -7L >> -5I)
PrintResult("-7L >> 26UI", -7L >> 26UI)
PrintResult("-7L >> -7L", -7L >> -7L)
PrintResult("-7L >> 28UL", -7L >> 28UL)
PrintResult("-7L >> -9D", -7L >> -9D)
PrintResult("-7L >> 10.0F", -7L >> 10.0F)
PrintResult("-7L >> -11.0R", -7L >> -11.0R)
PrintResult("-7L >> ""12""", -7L >> "12")
PrintResult("-7L >> TypeCode.Double", -7L >> TypeCode.Double)
PrintResult("28UL >> False", 28UL >> False)
PrintResult("28UL >> True", 28UL >> True)
PrintResult("28UL >> System.SByte.MinValue", 28UL >> System.SByte.MinValue)
PrintResult("28UL >> System.Byte.MaxValue", 28UL >> System.Byte.MaxValue)
PrintResult("28UL >> -3S", 28UL >> -3S)
PrintResult("28UL >> 24US", 28UL >> 24US)
PrintResult("28UL >> -5I", 28UL >> -5I)
PrintResult("28UL >> 26UI", 28UL >> 26UI)
PrintResult("28UL >> -7L", 28UL >> -7L)
PrintResult("28UL >> 28UL", 28UL >> 28UL)
PrintResult("28UL >> -9D", 28UL >> -9D)
PrintResult("28UL >> 10.0F", 28UL >> 10.0F)
PrintResult("28UL >> -11.0R", 28UL >> -11.0R)
PrintResult("28UL >> ""12""", 28UL >> "12")
PrintResult("28UL >> TypeCode.Double", 28UL >> TypeCode.Double)
PrintResult("-9D >> False", -9D >> False)
PrintResult("-9D >> True", -9D >> True)
PrintResult("-9D >> System.SByte.MinValue", -9D >> System.SByte.MinValue)
PrintResult("-9D >> System.Byte.MaxValue", -9D >> System.Byte.MaxValue)
PrintResult("-9D >> -3S", -9D >> -3S)
PrintResult("-9D >> 24US", -9D >> 24US)
PrintResult("-9D >> -5I", -9D >> -5I)
PrintResult("-9D >> 26UI", -9D >> 26UI)
PrintResult("-9D >> -7L", -9D >> -7L)
PrintResult("-9D >> 28UL", -9D >> 28UL)
PrintResult("-9D >> -9D", -9D >> -9D)
PrintResult("-9D >> 10.0F", -9D >> 10.0F)
PrintResult("-9D >> -11.0R", -9D >> -11.0R)
PrintResult("-9D >> ""12""", -9D >> "12")
PrintResult("-9D >> TypeCode.Double", -9D >> TypeCode.Double)
PrintResult("10.0F >> False", 10.0F >> False)
PrintResult("10.0F >> True", 10.0F >> True)
PrintResult("10.0F >> System.SByte.MinValue", 10.0F >> System.SByte.MinValue)
PrintResult("10.0F >> System.Byte.MaxValue", 10.0F >> System.Byte.MaxValue)
PrintResult("10.0F >> -3S", 10.0F >> -3S)
PrintResult("10.0F >> 24US", 10.0F >> 24US)
PrintResult("10.0F >> -5I", 10.0F >> -5I)
PrintResult("10.0F >> 26UI", 10.0F >> 26UI)
PrintResult("10.0F >> -7L", 10.0F >> -7L)
PrintResult("10.0F >> 28UL", 10.0F >> 28UL)
PrintResult("10.0F >> -9D", 10.0F >> -9D)
PrintResult("10.0F >> 10.0F", 10.0F >> 10.0F)
PrintResult("10.0F >> -11.0R", 10.0F >> -11.0R)
PrintResult("10.0F >> ""12""", 10.0F >> "12")
PrintResult("10.0F >> TypeCode.Double", 10.0F >> TypeCode.Double)
PrintResult("-11.0R >> False", -11.0R >> False)
PrintResult("-11.0R >> True", -11.0R >> True)
PrintResult("-11.0R >> System.SByte.MinValue", -11.0R >> System.SByte.MinValue)
PrintResult("-11.0R >> System.Byte.MaxValue", -11.0R >> System.Byte.MaxValue)
PrintResult("-11.0R >> -3S", -11.0R >> -3S)
PrintResult("-11.0R >> 24US", -11.0R >> 24US)
PrintResult("-11.0R >> -5I", -11.0R >> -5I)
PrintResult("-11.0R >> 26UI", -11.0R >> 26UI)
PrintResult("-11.0R >> -7L", -11.0R >> -7L)
PrintResult("-11.0R >> 28UL", -11.0R >> 28UL)
PrintResult("-11.0R >> -9D", -11.0R >> -9D)
PrintResult("-11.0R >> 10.0F", -11.0R >> 10.0F)
PrintResult("-11.0R >> -11.0R", -11.0R >> -11.0R)
PrintResult("-11.0R >> ""12""", -11.0R >> "12")
PrintResult("-11.0R >> TypeCode.Double", -11.0R >> TypeCode.Double)
PrintResult("""12"" >> False", "12" >> False)
PrintResult("""12"" >> True", "12" >> True)
PrintResult("""12"" >> System.SByte.MinValue", "12" >> System.SByte.MinValue)
PrintResult("""12"" >> System.Byte.MaxValue", "12" >> System.Byte.MaxValue)
PrintResult("""12"" >> -3S", "12" >> -3S)
PrintResult("""12"" >> 24US", "12" >> 24US)
PrintResult("""12"" >> -5I", "12" >> -5I)
PrintResult("""12"" >> 26UI", "12" >> 26UI)
PrintResult("""12"" >> -7L", "12" >> -7L)
PrintResult("""12"" >> 28UL", "12" >> 28UL)
PrintResult("""12"" >> -9D", "12" >> -9D)
PrintResult("""12"" >> 10.0F", "12" >> 10.0F)
PrintResult("""12"" >> -11.0R", "12" >> -11.0R)
PrintResult("""12"" >> ""12""", "12" >> "12")
PrintResult("""12"" >> TypeCode.Double", "12" >> TypeCode.Double)
PrintResult("TypeCode.Double >> False", TypeCode.Double >> False)
PrintResult("TypeCode.Double >> True", TypeCode.Double >> True)
PrintResult("TypeCode.Double >> System.SByte.MinValue", TypeCode.Double >> System.SByte.MinValue)
PrintResult("TypeCode.Double >> System.Byte.MaxValue", TypeCode.Double >> System.Byte.MaxValue)
PrintResult("TypeCode.Double >> -3S", TypeCode.Double >> -3S)
PrintResult("TypeCode.Double >> 24US", TypeCode.Double >> 24US)
PrintResult("TypeCode.Double >> -5I", TypeCode.Double >> -5I)
PrintResult("TypeCode.Double >> 26UI", TypeCode.Double >> 26UI)
PrintResult("TypeCode.Double >> -7L", TypeCode.Double >> -7L)
PrintResult("TypeCode.Double >> 28UL", TypeCode.Double >> 28UL)
PrintResult("TypeCode.Double >> -9D", TypeCode.Double >> -9D)
PrintResult("TypeCode.Double >> 10.0F", TypeCode.Double >> 10.0F)
PrintResult("TypeCode.Double >> -11.0R", TypeCode.Double >> -11.0R)
PrintResult("TypeCode.Double >> ""12""", TypeCode.Double >> "12")
PrintResult("TypeCode.Double >> TypeCode.Double", TypeCode.Double >> TypeCode.Double)
PrintResult("False OrElse False", False OrElse False)
PrintResult("False OrElse True", False OrElse True)
PrintResult("False OrElse System.SByte.MinValue", False OrElse System.SByte.MinValue)
PrintResult("False OrElse System.Byte.MaxValue", False OrElse System.Byte.MaxValue)
PrintResult("False OrElse -3S", False OrElse -3S)
PrintResult("False OrElse 24US", False OrElse 24US)
PrintResult("False OrElse -5I", False OrElse -5I)
PrintResult("False OrElse 26UI", False OrElse 26UI)
PrintResult("False OrElse -7L", False OrElse -7L)
PrintResult("False OrElse 28UL", False OrElse 28UL)
PrintResult("False OrElse -9D", False OrElse -9D)
PrintResult("False OrElse 10.0F", False OrElse 10.0F)
PrintResult("False OrElse -11.0R", False OrElse -11.0R)
PrintResult("False OrElse ""12""", False OrElse "12")
PrintResult("False OrElse TypeCode.Double", False OrElse TypeCode.Double)
PrintResult("True OrElse False", True OrElse False)
PrintResult("True OrElse True", True OrElse True)
PrintResult("True OrElse System.SByte.MinValue", True OrElse System.SByte.MinValue)
PrintResult("True OrElse System.Byte.MaxValue", True OrElse System.Byte.MaxValue)
PrintResult("True OrElse -3S", True OrElse -3S)
PrintResult("True OrElse 24US", True OrElse 24US)
PrintResult("True OrElse -5I", True OrElse -5I)
PrintResult("True OrElse 26UI", True OrElse 26UI)
PrintResult("True OrElse -7L", True OrElse -7L)
PrintResult("True OrElse 28UL", True OrElse 28UL)
PrintResult("True OrElse -9D", True OrElse -9D)
PrintResult("True OrElse 10.0F", True OrElse 10.0F)
PrintResult("True OrElse -11.0R", True OrElse -11.0R)
PrintResult("True OrElse ""12""", True OrElse "12")
PrintResult("True OrElse TypeCode.Double", True OrElse TypeCode.Double)
PrintResult("System.SByte.MinValue OrElse False", System.SByte.MinValue OrElse False)
PrintResult("System.SByte.MinValue OrElse True", System.SByte.MinValue OrElse True)
PrintResult("System.SByte.MinValue OrElse System.SByte.MinValue", System.SByte.MinValue OrElse System.SByte.MinValue)
PrintResult("System.SByte.MinValue OrElse System.Byte.MaxValue", System.SByte.MinValue OrElse System.Byte.MaxValue)
PrintResult("System.SByte.MinValue OrElse -3S", System.SByte.MinValue OrElse -3S)
PrintResult("System.SByte.MinValue OrElse 24US", System.SByte.MinValue OrElse 24US)
PrintResult("System.SByte.MinValue OrElse -5I", System.SByte.MinValue OrElse -5I)
PrintResult("System.SByte.MinValue OrElse 26UI", System.SByte.MinValue OrElse 26UI)
PrintResult("System.SByte.MinValue OrElse -7L", System.SByte.MinValue OrElse -7L)
PrintResult("System.SByte.MinValue OrElse 28UL", System.SByte.MinValue OrElse 28UL)
PrintResult("System.SByte.MinValue OrElse -9D", System.SByte.MinValue OrElse -9D)
PrintResult("System.SByte.MinValue OrElse 10.0F", System.SByte.MinValue OrElse 10.0F)
PrintResult("System.SByte.MinValue OrElse -11.0R", System.SByte.MinValue OrElse -11.0R)
PrintResult("System.SByte.MinValue OrElse ""12""", System.SByte.MinValue OrElse "12")
PrintResult("System.SByte.MinValue OrElse TypeCode.Double", System.SByte.MinValue OrElse TypeCode.Double)
PrintResult("System.Byte.MaxValue OrElse False", System.Byte.MaxValue OrElse False)
PrintResult("System.Byte.MaxValue OrElse True", System.Byte.MaxValue OrElse True)
PrintResult("System.Byte.MaxValue OrElse System.SByte.MinValue", System.Byte.MaxValue OrElse System.SByte.MinValue)
PrintResult("System.Byte.MaxValue OrElse System.Byte.MaxValue", System.Byte.MaxValue OrElse System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue OrElse -3S", System.Byte.MaxValue OrElse -3S)
PrintResult("System.Byte.MaxValue OrElse 24US", System.Byte.MaxValue OrElse 24US)
PrintResult("System.Byte.MaxValue OrElse -5I", System.Byte.MaxValue OrElse -5I)
PrintResult("System.Byte.MaxValue OrElse 26UI", System.Byte.MaxValue OrElse 26UI)
PrintResult("System.Byte.MaxValue OrElse -7L", System.Byte.MaxValue OrElse -7L)
PrintResult("System.Byte.MaxValue OrElse 28UL", System.Byte.MaxValue OrElse 28UL)
PrintResult("System.Byte.MaxValue OrElse -9D", System.Byte.MaxValue OrElse -9D)
PrintResult("System.Byte.MaxValue OrElse 10.0F", System.Byte.MaxValue OrElse 10.0F)
PrintResult("System.Byte.MaxValue OrElse -11.0R", System.Byte.MaxValue OrElse -11.0R)
PrintResult("System.Byte.MaxValue OrElse ""12""", System.Byte.MaxValue OrElse "12")
PrintResult("System.Byte.MaxValue OrElse TypeCode.Double", System.Byte.MaxValue OrElse TypeCode.Double)
PrintResult("-3S OrElse False", -3S OrElse False)
PrintResult("-3S OrElse True", -3S OrElse True)
PrintResult("-3S OrElse System.SByte.MinValue", -3S OrElse System.SByte.MinValue)
PrintResult("-3S OrElse System.Byte.MaxValue", -3S OrElse System.Byte.MaxValue)
PrintResult("-3S OrElse -3S", -3S OrElse -3S)
PrintResult("-3S OrElse 24US", -3S OrElse 24US)
PrintResult("-3S OrElse -5I", -3S OrElse -5I)
PrintResult("-3S OrElse 26UI", -3S OrElse 26UI)
PrintResult("-3S OrElse -7L", -3S OrElse -7L)
PrintResult("-3S OrElse 28UL", -3S OrElse 28UL)
PrintResult("-3S OrElse -9D", -3S OrElse -9D)
PrintResult("-3S OrElse 10.0F", -3S OrElse 10.0F)
PrintResult("-3S OrElse -11.0R", -3S OrElse -11.0R)
PrintResult("-3S OrElse ""12""", -3S OrElse "12")
PrintResult("-3S OrElse TypeCode.Double", -3S OrElse TypeCode.Double)
PrintResult("24US OrElse False", 24US OrElse False)
PrintResult("24US OrElse True", 24US OrElse True)
PrintResult("24US OrElse System.SByte.MinValue", 24US OrElse System.SByte.MinValue)
PrintResult("24US OrElse System.Byte.MaxValue", 24US OrElse System.Byte.MaxValue)
PrintResult("24US OrElse -3S", 24US OrElse -3S)
PrintResult("24US OrElse 24US", 24US OrElse 24US)
PrintResult("24US OrElse -5I", 24US OrElse -5I)
PrintResult("24US OrElse 26UI", 24US OrElse 26UI)
PrintResult("24US OrElse -7L", 24US OrElse -7L)
PrintResult("24US OrElse 28UL", 24US OrElse 28UL)
PrintResult("24US OrElse -9D", 24US OrElse -9D)
PrintResult("24US OrElse 10.0F", 24US OrElse 10.0F)
PrintResult("24US OrElse -11.0R", 24US OrElse -11.0R)
PrintResult("24US OrElse ""12""", 24US OrElse "12")
PrintResult("24US OrElse TypeCode.Double", 24US OrElse TypeCode.Double)
PrintResult("-5I OrElse False", -5I OrElse False)
PrintResult("-5I OrElse True", -5I OrElse True)
PrintResult("-5I OrElse System.SByte.MinValue", -5I OrElse System.SByte.MinValue)
PrintResult("-5I OrElse System.Byte.MaxValue", -5I OrElse System.Byte.MaxValue)
PrintResult("-5I OrElse -3S", -5I OrElse -3S)
PrintResult("-5I OrElse 24US", -5I OrElse 24US)
PrintResult("-5I OrElse -5I", -5I OrElse -5I)
PrintResult("-5I OrElse 26UI", -5I OrElse 26UI)
PrintResult("-5I OrElse -7L", -5I OrElse -7L)
PrintResult("-5I OrElse 28UL", -5I OrElse 28UL)
PrintResult("-5I OrElse -9D", -5I OrElse -9D)
PrintResult("-5I OrElse 10.0F", -5I OrElse 10.0F)
PrintResult("-5I OrElse -11.0R", -5I OrElse -11.0R)
PrintResult("-5I OrElse ""12""", -5I OrElse "12")
PrintResult("-5I OrElse TypeCode.Double", -5I OrElse TypeCode.Double)
PrintResult("26UI OrElse False", 26UI OrElse False)
PrintResult("26UI OrElse True", 26UI OrElse True)
PrintResult("26UI OrElse System.SByte.MinValue", 26UI OrElse System.SByte.MinValue)
PrintResult("26UI OrElse System.Byte.MaxValue", 26UI OrElse System.Byte.MaxValue)
PrintResult("26UI OrElse -3S", 26UI OrElse -3S)
PrintResult("26UI OrElse 24US", 26UI OrElse 24US)
PrintResult("26UI OrElse -5I", 26UI OrElse -5I)
PrintResult("26UI OrElse 26UI", 26UI OrElse 26UI)
PrintResult("26UI OrElse -7L", 26UI OrElse -7L)
PrintResult("26UI OrElse 28UL", 26UI OrElse 28UL)
PrintResult("26UI OrElse -9D", 26UI OrElse -9D)
PrintResult("26UI OrElse 10.0F", 26UI OrElse 10.0F)
PrintResult("26UI OrElse -11.0R", 26UI OrElse -11.0R)
PrintResult("26UI OrElse ""12""", 26UI OrElse "12")
PrintResult("26UI OrElse TypeCode.Double", 26UI OrElse TypeCode.Double)
PrintResult("-7L OrElse False", -7L OrElse False)
PrintResult("-7L OrElse True", -7L OrElse True)
PrintResult("-7L OrElse System.SByte.MinValue", -7L OrElse System.SByte.MinValue)
PrintResult("-7L OrElse System.Byte.MaxValue", -7L OrElse System.Byte.MaxValue)
PrintResult("-7L OrElse -3S", -7L OrElse -3S)
PrintResult("-7L OrElse 24US", -7L OrElse 24US)
PrintResult("-7L OrElse -5I", -7L OrElse -5I)
PrintResult("-7L OrElse 26UI", -7L OrElse 26UI)
PrintResult("-7L OrElse -7L", -7L OrElse -7L)
PrintResult("-7L OrElse 28UL", -7L OrElse 28UL)
PrintResult("-7L OrElse -9D", -7L OrElse -9D)
PrintResult("-7L OrElse 10.0F", -7L OrElse 10.0F)
PrintResult("-7L OrElse -11.0R", -7L OrElse -11.0R)
PrintResult("-7L OrElse ""12""", -7L OrElse "12")
PrintResult("-7L OrElse TypeCode.Double", -7L OrElse TypeCode.Double)
PrintResult("28UL OrElse False", 28UL OrElse False)
PrintResult("28UL OrElse True", 28UL OrElse True)
PrintResult("28UL OrElse System.SByte.MinValue", 28UL OrElse System.SByte.MinValue)
PrintResult("28UL OrElse System.Byte.MaxValue", 28UL OrElse System.Byte.MaxValue)
PrintResult("28UL OrElse -3S", 28UL OrElse -3S)
PrintResult("28UL OrElse 24US", 28UL OrElse 24US)
PrintResult("28UL OrElse -5I", 28UL OrElse -5I)
PrintResult("28UL OrElse 26UI", 28UL OrElse 26UI)
PrintResult("28UL OrElse -7L", 28UL OrElse -7L)
PrintResult("28UL OrElse 28UL", 28UL OrElse 28UL)
PrintResult("28UL OrElse -9D", 28UL OrElse -9D)
PrintResult("28UL OrElse 10.0F", 28UL OrElse 10.0F)
PrintResult("28UL OrElse -11.0R", 28UL OrElse -11.0R)
PrintResult("28UL OrElse ""12""", 28UL OrElse "12")
PrintResult("28UL OrElse TypeCode.Double", 28UL OrElse TypeCode.Double)
PrintResult("-9D OrElse False", -9D OrElse False)
PrintResult("-9D OrElse True", -9D OrElse True)
PrintResult("-9D OrElse System.SByte.MinValue", -9D OrElse System.SByte.MinValue)
PrintResult("-9D OrElse System.Byte.MaxValue", -9D OrElse System.Byte.MaxValue)
PrintResult("-9D OrElse -3S", -9D OrElse -3S)
PrintResult("-9D OrElse 24US", -9D OrElse 24US)
PrintResult("-9D OrElse -5I", -9D OrElse -5I)
PrintResult("-9D OrElse 26UI", -9D OrElse 26UI)
PrintResult("-9D OrElse -7L", -9D OrElse -7L)
PrintResult("-9D OrElse 28UL", -9D OrElse 28UL)
PrintResult("-9D OrElse -9D", -9D OrElse -9D)
PrintResult("-9D OrElse 10.0F", -9D OrElse 10.0F)
PrintResult("-9D OrElse -11.0R", -9D OrElse -11.0R)
PrintResult("-9D OrElse ""12""", -9D OrElse "12")
PrintResult("-9D OrElse TypeCode.Double", -9D OrElse TypeCode.Double)
PrintResult("10.0F OrElse False", 10.0F OrElse False)
PrintResult("10.0F OrElse True", 10.0F OrElse True)
PrintResult("10.0F OrElse System.SByte.MinValue", 10.0F OrElse System.SByte.MinValue)
PrintResult("10.0F OrElse System.Byte.MaxValue", 10.0F OrElse System.Byte.MaxValue)
PrintResult("10.0F OrElse -3S", 10.0F OrElse -3S)
PrintResult("10.0F OrElse 24US", 10.0F OrElse 24US)
PrintResult("10.0F OrElse -5I", 10.0F OrElse -5I)
PrintResult("10.0F OrElse 26UI", 10.0F OrElse 26UI)
PrintResult("10.0F OrElse -7L", 10.0F OrElse -7L)
PrintResult("10.0F OrElse 28UL", 10.0F OrElse 28UL)
PrintResult("10.0F OrElse -9D", 10.0F OrElse -9D)
PrintResult("10.0F OrElse 10.0F", 10.0F OrElse 10.0F)
PrintResult("10.0F OrElse -11.0R", 10.0F OrElse -11.0R)
PrintResult("10.0F OrElse ""12""", 10.0F OrElse "12")
PrintResult("10.0F OrElse TypeCode.Double", 10.0F OrElse TypeCode.Double)
PrintResult("-11.0R OrElse False", -11.0R OrElse False)
PrintResult("-11.0R OrElse True", -11.0R OrElse True)
PrintResult("-11.0R OrElse System.SByte.MinValue", -11.0R OrElse System.SByte.MinValue)
PrintResult("-11.0R OrElse System.Byte.MaxValue", -11.0R OrElse System.Byte.MaxValue)
PrintResult("-11.0R OrElse -3S", -11.0R OrElse -3S)
PrintResult("-11.0R OrElse 24US", -11.0R OrElse 24US)
PrintResult("-11.0R OrElse -5I", -11.0R OrElse -5I)
PrintResult("-11.0R OrElse 26UI", -11.0R OrElse 26UI)
PrintResult("-11.0R OrElse -7L", -11.0R OrElse -7L)
PrintResult("-11.0R OrElse 28UL", -11.0R OrElse 28UL)
PrintResult("-11.0R OrElse -9D", -11.0R OrElse -9D)
PrintResult("-11.0R OrElse 10.0F", -11.0R OrElse 10.0F)
PrintResult("-11.0R OrElse -11.0R", -11.0R OrElse -11.0R)
PrintResult("-11.0R OrElse ""12""", -11.0R OrElse "12")
PrintResult("-11.0R OrElse TypeCode.Double", -11.0R OrElse TypeCode.Double)
PrintResult("""12"" OrElse False", "12" OrElse False)
PrintResult("""12"" OrElse True", "12" OrElse True)
PrintResult("""12"" OrElse System.SByte.MinValue", "12" OrElse System.SByte.MinValue)
PrintResult("""12"" OrElse System.Byte.MaxValue", "12" OrElse System.Byte.MaxValue)
PrintResult("""12"" OrElse -3S", "12" OrElse -3S)
PrintResult("""12"" OrElse 24US", "12" OrElse 24US)
PrintResult("""12"" OrElse -5I", "12" OrElse -5I)
PrintResult("""12"" OrElse 26UI", "12" OrElse 26UI)
PrintResult("""12"" OrElse -7L", "12" OrElse -7L)
PrintResult("""12"" OrElse 28UL", "12" OrElse 28UL)
PrintResult("""12"" OrElse -9D", "12" OrElse -9D)
PrintResult("""12"" OrElse 10.0F", "12" OrElse 10.0F)
PrintResult("""12"" OrElse -11.0R", "12" OrElse -11.0R)
PrintResult("""12"" OrElse ""12""", "12" OrElse "12")
PrintResult("""12"" OrElse TypeCode.Double", "12" OrElse TypeCode.Double)
PrintResult("TypeCode.Double OrElse False", TypeCode.Double OrElse False)
PrintResult("TypeCode.Double OrElse True", TypeCode.Double OrElse True)
PrintResult("TypeCode.Double OrElse System.SByte.MinValue", TypeCode.Double OrElse System.SByte.MinValue)
PrintResult("TypeCode.Double OrElse System.Byte.MaxValue", TypeCode.Double OrElse System.Byte.MaxValue)
PrintResult("TypeCode.Double OrElse -3S", TypeCode.Double OrElse -3S)
PrintResult("TypeCode.Double OrElse 24US", TypeCode.Double OrElse 24US)
PrintResult("TypeCode.Double OrElse -5I", TypeCode.Double OrElse -5I)
PrintResult("TypeCode.Double OrElse 26UI", TypeCode.Double OrElse 26UI)
PrintResult("TypeCode.Double OrElse -7L", TypeCode.Double OrElse -7L)
PrintResult("TypeCode.Double OrElse 28UL", TypeCode.Double OrElse 28UL)
PrintResult("TypeCode.Double OrElse -9D", TypeCode.Double OrElse -9D)
PrintResult("TypeCode.Double OrElse 10.0F", TypeCode.Double OrElse 10.0F)
PrintResult("TypeCode.Double OrElse -11.0R", TypeCode.Double OrElse -11.0R)
PrintResult("TypeCode.Double OrElse ""12""", TypeCode.Double OrElse "12")
PrintResult("TypeCode.Double OrElse TypeCode.Double", TypeCode.Double OrElse TypeCode.Double)
PrintResult("False AndAlso False", False AndAlso False)
PrintResult("False AndAlso True", False AndAlso True)
PrintResult("False AndAlso System.SByte.MinValue", False AndAlso System.SByte.MinValue)
PrintResult("False AndAlso System.Byte.MaxValue", False AndAlso System.Byte.MaxValue)
PrintResult("False AndAlso -3S", False AndAlso -3S)
PrintResult("False AndAlso 24US", False AndAlso 24US)
PrintResult("False AndAlso -5I", False AndAlso -5I)
PrintResult("False AndAlso 26UI", False AndAlso 26UI)
PrintResult("False AndAlso -7L", False AndAlso -7L)
PrintResult("False AndAlso 28UL", False AndAlso 28UL)
PrintResult("False AndAlso -9D", False AndAlso -9D)
PrintResult("False AndAlso 10.0F", False AndAlso 10.0F)
PrintResult("False AndAlso -11.0R", False AndAlso -11.0R)
PrintResult("False AndAlso ""12""", False AndAlso "12")
PrintResult("False AndAlso TypeCode.Double", False AndAlso TypeCode.Double)
PrintResult("True AndAlso False", True AndAlso False)
PrintResult("True AndAlso True", True AndAlso True)
PrintResult("True AndAlso System.SByte.MinValue", True AndAlso System.SByte.MinValue)
PrintResult("True AndAlso System.Byte.MaxValue", True AndAlso System.Byte.MaxValue)
PrintResult("True AndAlso -3S", True AndAlso -3S)
PrintResult("True AndAlso 24US", True AndAlso 24US)
PrintResult("True AndAlso -5I", True AndAlso -5I)
PrintResult("True AndAlso 26UI", True AndAlso 26UI)
PrintResult("True AndAlso -7L", True AndAlso -7L)
PrintResult("True AndAlso 28UL", True AndAlso 28UL)
PrintResult("True AndAlso -9D", True AndAlso -9D)
PrintResult("True AndAlso 10.0F", True AndAlso 10.0F)
PrintResult("True AndAlso -11.0R", True AndAlso -11.0R)
PrintResult("True AndAlso ""12""", True AndAlso "12")
PrintResult("True AndAlso TypeCode.Double", True AndAlso TypeCode.Double)
PrintResult("System.SByte.MinValue AndAlso False", System.SByte.MinValue AndAlso False)
PrintResult("System.SByte.MinValue AndAlso True", System.SByte.MinValue AndAlso True)
PrintResult("System.SByte.MinValue AndAlso System.SByte.MinValue", System.SByte.MinValue AndAlso System.SByte.MinValue)
PrintResult("System.SByte.MinValue AndAlso System.Byte.MaxValue", System.SByte.MinValue AndAlso System.Byte.MaxValue)
PrintResult("System.SByte.MinValue AndAlso -3S", System.SByte.MinValue AndAlso -3S)
PrintResult("System.SByte.MinValue AndAlso 24US", System.SByte.MinValue AndAlso 24US)
PrintResult("System.SByte.MinValue AndAlso -5I", System.SByte.MinValue AndAlso -5I)
PrintResult("System.SByte.MinValue AndAlso 26UI", System.SByte.MinValue AndAlso 26UI)
PrintResult("System.SByte.MinValue AndAlso -7L", System.SByte.MinValue AndAlso -7L)
PrintResult("System.SByte.MinValue AndAlso 28UL", System.SByte.MinValue AndAlso 28UL)
PrintResult("System.SByte.MinValue AndAlso -9D", System.SByte.MinValue AndAlso -9D)
PrintResult("System.SByte.MinValue AndAlso 10.0F", System.SByte.MinValue AndAlso 10.0F)
PrintResult("System.SByte.MinValue AndAlso -11.0R", System.SByte.MinValue AndAlso -11.0R)
PrintResult("System.SByte.MinValue AndAlso ""12""", System.SByte.MinValue AndAlso "12")
PrintResult("System.SByte.MinValue AndAlso TypeCode.Double", System.SByte.MinValue AndAlso TypeCode.Double)
PrintResult("System.Byte.MaxValue AndAlso False", System.Byte.MaxValue AndAlso False)
PrintResult("System.Byte.MaxValue AndAlso True", System.Byte.MaxValue AndAlso True)
PrintResult("System.Byte.MaxValue AndAlso System.SByte.MinValue", System.Byte.MaxValue AndAlso System.SByte.MinValue)
PrintResult("System.Byte.MaxValue AndAlso System.Byte.MaxValue", System.Byte.MaxValue AndAlso System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue AndAlso -3S", System.Byte.MaxValue AndAlso -3S)
PrintResult("System.Byte.MaxValue AndAlso 24US", System.Byte.MaxValue AndAlso 24US)
PrintResult("System.Byte.MaxValue AndAlso -5I", System.Byte.MaxValue AndAlso -5I)
PrintResult("System.Byte.MaxValue AndAlso 26UI", System.Byte.MaxValue AndAlso 26UI)
PrintResult("System.Byte.MaxValue AndAlso -7L", System.Byte.MaxValue AndAlso -7L)
PrintResult("System.Byte.MaxValue AndAlso 28UL", System.Byte.MaxValue AndAlso 28UL)
PrintResult("System.Byte.MaxValue AndAlso -9D", System.Byte.MaxValue AndAlso -9D)
PrintResult("System.Byte.MaxValue AndAlso 10.0F", System.Byte.MaxValue AndAlso 10.0F)
PrintResult("System.Byte.MaxValue AndAlso -11.0R", System.Byte.MaxValue AndAlso -11.0R)
PrintResult("System.Byte.MaxValue AndAlso ""12""", System.Byte.MaxValue AndAlso "12")
PrintResult("System.Byte.MaxValue AndAlso TypeCode.Double", System.Byte.MaxValue AndAlso TypeCode.Double)
PrintResult("-3S AndAlso False", -3S AndAlso False)
PrintResult("-3S AndAlso True", -3S AndAlso True)
PrintResult("-3S AndAlso System.SByte.MinValue", -3S AndAlso System.SByte.MinValue)
PrintResult("-3S AndAlso System.Byte.MaxValue", -3S AndAlso System.Byte.MaxValue)
PrintResult("-3S AndAlso -3S", -3S AndAlso -3S)
PrintResult("-3S AndAlso 24US", -3S AndAlso 24US)
PrintResult("-3S AndAlso -5I", -3S AndAlso -5I)
PrintResult("-3S AndAlso 26UI", -3S AndAlso 26UI)
PrintResult("-3S AndAlso -7L", -3S AndAlso -7L)
PrintResult("-3S AndAlso 28UL", -3S AndAlso 28UL)
PrintResult("-3S AndAlso -9D", -3S AndAlso -9D)
PrintResult("-3S AndAlso 10.0F", -3S AndAlso 10.0F)
PrintResult("-3S AndAlso -11.0R", -3S AndAlso -11.0R)
PrintResult("-3S AndAlso ""12""", -3S AndAlso "12")
PrintResult("-3S AndAlso TypeCode.Double", -3S AndAlso TypeCode.Double)
PrintResult("24US AndAlso False", 24US AndAlso False)
PrintResult("24US AndAlso True", 24US AndAlso True)
PrintResult("24US AndAlso System.SByte.MinValue", 24US AndAlso System.SByte.MinValue)
PrintResult("24US AndAlso System.Byte.MaxValue", 24US AndAlso System.Byte.MaxValue)
PrintResult("24US AndAlso -3S", 24US AndAlso -3S)
PrintResult("24US AndAlso 24US", 24US AndAlso 24US)
PrintResult("24US AndAlso -5I", 24US AndAlso -5I)
PrintResult("24US AndAlso 26UI", 24US AndAlso 26UI)
PrintResult("24US AndAlso -7L", 24US AndAlso -7L)
PrintResult("24US AndAlso 28UL", 24US AndAlso 28UL)
PrintResult("24US AndAlso -9D", 24US AndAlso -9D)
PrintResult("24US AndAlso 10.0F", 24US AndAlso 10.0F)
PrintResult("24US AndAlso -11.0R", 24US AndAlso -11.0R)
PrintResult("24US AndAlso ""12""", 24US AndAlso "12")
PrintResult("24US AndAlso TypeCode.Double", 24US AndAlso TypeCode.Double)
PrintResult("-5I AndAlso False", -5I AndAlso False)
PrintResult("-5I AndAlso True", -5I AndAlso True)
PrintResult("-5I AndAlso System.SByte.MinValue", -5I AndAlso System.SByte.MinValue)
PrintResult("-5I AndAlso System.Byte.MaxValue", -5I AndAlso System.Byte.MaxValue)
PrintResult("-5I AndAlso -3S", -5I AndAlso -3S)
PrintResult("-5I AndAlso 24US", -5I AndAlso 24US)
PrintResult("-5I AndAlso -5I", -5I AndAlso -5I)
PrintResult("-5I AndAlso 26UI", -5I AndAlso 26UI)
PrintResult("-5I AndAlso -7L", -5I AndAlso -7L)
PrintResult("-5I AndAlso 28UL", -5I AndAlso 28UL)
PrintResult("-5I AndAlso -9D", -5I AndAlso -9D)
PrintResult("-5I AndAlso 10.0F", -5I AndAlso 10.0F)
PrintResult("-5I AndAlso -11.0R", -5I AndAlso -11.0R)
PrintResult("-5I AndAlso ""12""", -5I AndAlso "12")
PrintResult("-5I AndAlso TypeCode.Double", -5I AndAlso TypeCode.Double)
PrintResult("26UI AndAlso False", 26UI AndAlso False)
PrintResult("26UI AndAlso True", 26UI AndAlso True)
PrintResult("26UI AndAlso System.SByte.MinValue", 26UI AndAlso System.SByte.MinValue)
PrintResult("26UI AndAlso System.Byte.MaxValue", 26UI AndAlso System.Byte.MaxValue)
PrintResult("26UI AndAlso -3S", 26UI AndAlso -3S)
PrintResult("26UI AndAlso 24US", 26UI AndAlso 24US)
PrintResult("26UI AndAlso -5I", 26UI AndAlso -5I)
PrintResult("26UI AndAlso 26UI", 26UI AndAlso 26UI)
PrintResult("26UI AndAlso -7L", 26UI AndAlso -7L)
PrintResult("26UI AndAlso 28UL", 26UI AndAlso 28UL)
PrintResult("26UI AndAlso -9D", 26UI AndAlso -9D)
PrintResult("26UI AndAlso 10.0F", 26UI AndAlso 10.0F)
PrintResult("26UI AndAlso -11.0R", 26UI AndAlso -11.0R)
PrintResult("26UI AndAlso ""12""", 26UI AndAlso "12")
PrintResult("26UI AndAlso TypeCode.Double", 26UI AndAlso TypeCode.Double)
PrintResult("-7L AndAlso False", -7L AndAlso False)
PrintResult("-7L AndAlso True", -7L AndAlso True)
PrintResult("-7L AndAlso System.SByte.MinValue", -7L AndAlso System.SByte.MinValue)
PrintResult("-7L AndAlso System.Byte.MaxValue", -7L AndAlso System.Byte.MaxValue)
PrintResult("-7L AndAlso -3S", -7L AndAlso -3S)
PrintResult("-7L AndAlso 24US", -7L AndAlso 24US)
PrintResult("-7L AndAlso -5I", -7L AndAlso -5I)
PrintResult("-7L AndAlso 26UI", -7L AndAlso 26UI)
PrintResult("-7L AndAlso -7L", -7L AndAlso -7L)
PrintResult("-7L AndAlso 28UL", -7L AndAlso 28UL)
PrintResult("-7L AndAlso -9D", -7L AndAlso -9D)
PrintResult("-7L AndAlso 10.0F", -7L AndAlso 10.0F)
PrintResult("-7L AndAlso -11.0R", -7L AndAlso -11.0R)
PrintResult("-7L AndAlso ""12""", -7L AndAlso "12")
PrintResult("-7L AndAlso TypeCode.Double", -7L AndAlso TypeCode.Double)
PrintResult("28UL AndAlso False", 28UL AndAlso False)
PrintResult("28UL AndAlso True", 28UL AndAlso True)
PrintResult("28UL AndAlso System.SByte.MinValue", 28UL AndAlso System.SByte.MinValue)
PrintResult("28UL AndAlso System.Byte.MaxValue", 28UL AndAlso System.Byte.MaxValue)
PrintResult("28UL AndAlso -3S", 28UL AndAlso -3S)
PrintResult("28UL AndAlso 24US", 28UL AndAlso 24US)
PrintResult("28UL AndAlso -5I", 28UL AndAlso -5I)
PrintResult("28UL AndAlso 26UI", 28UL AndAlso 26UI)
PrintResult("28UL AndAlso -7L", 28UL AndAlso -7L)
PrintResult("28UL AndAlso 28UL", 28UL AndAlso 28UL)
PrintResult("28UL AndAlso -9D", 28UL AndAlso -9D)
PrintResult("28UL AndAlso 10.0F", 28UL AndAlso 10.0F)
PrintResult("28UL AndAlso -11.0R", 28UL AndAlso -11.0R)
PrintResult("28UL AndAlso ""12""", 28UL AndAlso "12")
PrintResult("28UL AndAlso TypeCode.Double", 28UL AndAlso TypeCode.Double)
PrintResult("-9D AndAlso False", -9D AndAlso False)
PrintResult("-9D AndAlso True", -9D AndAlso True)
PrintResult("-9D AndAlso System.SByte.MinValue", -9D AndAlso System.SByte.MinValue)
PrintResult("-9D AndAlso System.Byte.MaxValue", -9D AndAlso System.Byte.MaxValue)
PrintResult("-9D AndAlso -3S", -9D AndAlso -3S)
PrintResult("-9D AndAlso 24US", -9D AndAlso 24US)
PrintResult("-9D AndAlso -5I", -9D AndAlso -5I)
PrintResult("-9D AndAlso 26UI", -9D AndAlso 26UI)
PrintResult("-9D AndAlso -7L", -9D AndAlso -7L)
PrintResult("-9D AndAlso 28UL", -9D AndAlso 28UL)
PrintResult("-9D AndAlso -9D", -9D AndAlso -9D)
PrintResult("-9D AndAlso 10.0F", -9D AndAlso 10.0F)
PrintResult("-9D AndAlso -11.0R", -9D AndAlso -11.0R)
PrintResult("-9D AndAlso ""12""", -9D AndAlso "12")
PrintResult("-9D AndAlso TypeCode.Double", -9D AndAlso TypeCode.Double)
PrintResult("10.0F AndAlso False", 10.0F AndAlso False)
PrintResult("10.0F AndAlso True", 10.0F AndAlso True)
PrintResult("10.0F AndAlso System.SByte.MinValue", 10.0F AndAlso System.SByte.MinValue)
PrintResult("10.0F AndAlso System.Byte.MaxValue", 10.0F AndAlso System.Byte.MaxValue)
PrintResult("10.0F AndAlso -3S", 10.0F AndAlso -3S)
PrintResult("10.0F AndAlso 24US", 10.0F AndAlso 24US)
PrintResult("10.0F AndAlso -5I", 10.0F AndAlso -5I)
PrintResult("10.0F AndAlso 26UI", 10.0F AndAlso 26UI)
PrintResult("10.0F AndAlso -7L", 10.0F AndAlso -7L)
PrintResult("10.0F AndAlso 28UL", 10.0F AndAlso 28UL)
PrintResult("10.0F AndAlso -9D", 10.0F AndAlso -9D)
PrintResult("10.0F AndAlso 10.0F", 10.0F AndAlso 10.0F)
PrintResult("10.0F AndAlso -11.0R", 10.0F AndAlso -11.0R)
PrintResult("10.0F AndAlso ""12""", 10.0F AndAlso "12")
PrintResult("10.0F AndAlso TypeCode.Double", 10.0F AndAlso TypeCode.Double)
PrintResult("-11.0R AndAlso False", -11.0R AndAlso False)
PrintResult("-11.0R AndAlso True", -11.0R AndAlso True)
PrintResult("-11.0R AndAlso System.SByte.MinValue", -11.0R AndAlso System.SByte.MinValue)
PrintResult("-11.0R AndAlso System.Byte.MaxValue", -11.0R AndAlso System.Byte.MaxValue)
PrintResult("-11.0R AndAlso -3S", -11.0R AndAlso -3S)
PrintResult("-11.0R AndAlso 24US", -11.0R AndAlso 24US)
PrintResult("-11.0R AndAlso -5I", -11.0R AndAlso -5I)
PrintResult("-11.0R AndAlso 26UI", -11.0R AndAlso 26UI)
PrintResult("-11.0R AndAlso -7L", -11.0R AndAlso -7L)
PrintResult("-11.0R AndAlso 28UL", -11.0R AndAlso 28UL)
PrintResult("-11.0R AndAlso -9D", -11.0R AndAlso -9D)
PrintResult("-11.0R AndAlso 10.0F", -11.0R AndAlso 10.0F)
PrintResult("-11.0R AndAlso -11.0R", -11.0R AndAlso -11.0R)
PrintResult("-11.0R AndAlso ""12""", -11.0R AndAlso "12")
PrintResult("-11.0R AndAlso TypeCode.Double", -11.0R AndAlso TypeCode.Double)
PrintResult("""12"" AndAlso False", "12" AndAlso False)
PrintResult("""12"" AndAlso True", "12" AndAlso True)
PrintResult("""12"" AndAlso System.SByte.MinValue", "12" AndAlso System.SByte.MinValue)
PrintResult("""12"" AndAlso System.Byte.MaxValue", "12" AndAlso System.Byte.MaxValue)
PrintResult("""12"" AndAlso -3S", "12" AndAlso -3S)
PrintResult("""12"" AndAlso 24US", "12" AndAlso 24US)
PrintResult("""12"" AndAlso -5I", "12" AndAlso -5I)
PrintResult("""12"" AndAlso 26UI", "12" AndAlso 26UI)
PrintResult("""12"" AndAlso -7L", "12" AndAlso -7L)
PrintResult("""12"" AndAlso 28UL", "12" AndAlso 28UL)
PrintResult("""12"" AndAlso -9D", "12" AndAlso -9D)
PrintResult("""12"" AndAlso 10.0F", "12" AndAlso 10.0F)
PrintResult("""12"" AndAlso -11.0R", "12" AndAlso -11.0R)
PrintResult("""12"" AndAlso ""12""", "12" AndAlso "12")
PrintResult("""12"" AndAlso TypeCode.Double", "12" AndAlso TypeCode.Double)
PrintResult("TypeCode.Double AndAlso False", TypeCode.Double AndAlso False)
PrintResult("TypeCode.Double AndAlso True", TypeCode.Double AndAlso True)
PrintResult("TypeCode.Double AndAlso System.SByte.MinValue", TypeCode.Double AndAlso System.SByte.MinValue)
PrintResult("TypeCode.Double AndAlso System.Byte.MaxValue", TypeCode.Double AndAlso System.Byte.MaxValue)
PrintResult("TypeCode.Double AndAlso -3S", TypeCode.Double AndAlso -3S)
PrintResult("TypeCode.Double AndAlso 24US", TypeCode.Double AndAlso 24US)
PrintResult("TypeCode.Double AndAlso -5I", TypeCode.Double AndAlso -5I)
PrintResult("TypeCode.Double AndAlso 26UI", TypeCode.Double AndAlso 26UI)
PrintResult("TypeCode.Double AndAlso -7L", TypeCode.Double AndAlso -7L)
PrintResult("TypeCode.Double AndAlso 28UL", TypeCode.Double AndAlso 28UL)
PrintResult("TypeCode.Double AndAlso -9D", TypeCode.Double AndAlso -9D)
PrintResult("TypeCode.Double AndAlso 10.0F", TypeCode.Double AndAlso 10.0F)
PrintResult("TypeCode.Double AndAlso -11.0R", TypeCode.Double AndAlso -11.0R)
PrintResult("TypeCode.Double AndAlso ""12""", TypeCode.Double AndAlso "12")
PrintResult("TypeCode.Double AndAlso TypeCode.Double", TypeCode.Double AndAlso TypeCode.Double)
PrintResult("False & False", False & False)
PrintResult("False & True", False & True)
PrintResult("False & System.SByte.MinValue", False & System.SByte.MinValue)
PrintResult("False & System.Byte.MaxValue", False & System.Byte.MaxValue)
PrintResult("False & -3S", False & -3S)
PrintResult("False & 24US", False & 24US)
PrintResult("False & -5I", False & -5I)
PrintResult("False & 26UI", False & 26UI)
PrintResult("False & -7L", False & -7L)
PrintResult("False & 28UL", False & 28UL)
PrintResult("False & -9D", False & -9D)
PrintResult("False & 10.0F", False & 10.0F)
PrintResult("False & -11.0R", False & -11.0R)
PrintResult("False & ""12""", False & "12")
PrintResult("False & TypeCode.Double", False & TypeCode.Double)
PrintResult("True & False", True & False)
PrintResult("True & True", True & True)
PrintResult("True & System.SByte.MinValue", True & System.SByte.MinValue)
PrintResult("True & System.Byte.MaxValue", True & System.Byte.MaxValue)
PrintResult("True & -3S", True & -3S)
PrintResult("True & 24US", True & 24US)
PrintResult("True & -5I", True & -5I)
PrintResult("True & 26UI", True & 26UI)
PrintResult("True & -7L", True & -7L)
PrintResult("True & 28UL", True & 28UL)
PrintResult("True & -9D", True & -9D)
PrintResult("True & 10.0F", True & 10.0F)
PrintResult("True & -11.0R", True & -11.0R)
PrintResult("True & ""12""", True & "12")
PrintResult("True & TypeCode.Double", True & TypeCode.Double)
PrintResult("System.SByte.MinValue & False", System.SByte.MinValue & False)
PrintResult("System.SByte.MinValue & True", System.SByte.MinValue & True)
PrintResult("System.SByte.MinValue & System.SByte.MinValue", System.SByte.MinValue & System.SByte.MinValue)
PrintResult("System.SByte.MinValue & System.Byte.MaxValue", System.SByte.MinValue & System.Byte.MaxValue)
PrintResult("System.SByte.MinValue & -3S", System.SByte.MinValue & -3S)
PrintResult("System.SByte.MinValue & 24US", System.SByte.MinValue & 24US)
PrintResult("System.SByte.MinValue & -5I", System.SByte.MinValue & -5I)
PrintResult("System.SByte.MinValue & 26UI", System.SByte.MinValue & 26UI)
PrintResult("System.SByte.MinValue & -7L", System.SByte.MinValue & -7L)
PrintResult("System.SByte.MinValue & 28UL", System.SByte.MinValue & 28UL)
PrintResult("System.SByte.MinValue & -9D", System.SByte.MinValue & -9D)
PrintResult("System.SByte.MinValue & 10.0F", System.SByte.MinValue & 10.0F)
PrintResult("System.SByte.MinValue & -11.0R", System.SByte.MinValue & -11.0R)
PrintResult("System.SByte.MinValue & ""12""", System.SByte.MinValue & "12")
PrintResult("System.SByte.MinValue & TypeCode.Double", System.SByte.MinValue & TypeCode.Double)
PrintResult("System.Byte.MaxValue & False", System.Byte.MaxValue & False)
PrintResult("System.Byte.MaxValue & True", System.Byte.MaxValue & True)
PrintResult("System.Byte.MaxValue & System.SByte.MinValue", System.Byte.MaxValue & System.SByte.MinValue)
PrintResult("System.Byte.MaxValue & System.Byte.MaxValue", System.Byte.MaxValue & System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue & -3S", System.Byte.MaxValue & -3S)
PrintResult("System.Byte.MaxValue & 24US", System.Byte.MaxValue & 24US)
PrintResult("System.Byte.MaxValue & -5I", System.Byte.MaxValue & -5I)
PrintResult("System.Byte.MaxValue & 26UI", System.Byte.MaxValue & 26UI)
PrintResult("System.Byte.MaxValue & -7L", System.Byte.MaxValue & -7L)
PrintResult("System.Byte.MaxValue & 28UL", System.Byte.MaxValue & 28UL)
PrintResult("System.Byte.MaxValue & -9D", System.Byte.MaxValue & -9D)
PrintResult("System.Byte.MaxValue & 10.0F", System.Byte.MaxValue & 10.0F)
PrintResult("System.Byte.MaxValue & -11.0R", System.Byte.MaxValue & -11.0R)
PrintResult("System.Byte.MaxValue & ""12""", System.Byte.MaxValue & "12")
PrintResult("System.Byte.MaxValue & TypeCode.Double", System.Byte.MaxValue & TypeCode.Double)
PrintResult("-3S & False", -3S & False)
PrintResult("-3S & True", -3S & True)
PrintResult("-3S & System.SByte.MinValue", -3S & System.SByte.MinValue)
PrintResult("-3S & System.Byte.MaxValue", -3S & System.Byte.MaxValue)
PrintResult("-3S & -3S", -3S & -3S)
PrintResult("-3S & 24US", -3S & 24US)
PrintResult("-3S & -5I", -3S & -5I)
PrintResult("-3S & 26UI", -3S & 26UI)
PrintResult("-3S & -7L", -3S & -7L)
PrintResult("-3S & 28UL", -3S & 28UL)
PrintResult("-3S & -9D", -3S & -9D)
PrintResult("-3S & 10.0F", -3S & 10.0F)
PrintResult("-3S & -11.0R", -3S & -11.0R)
PrintResult("-3S & ""12""", -3S & "12")
PrintResult("-3S & TypeCode.Double", -3S & TypeCode.Double)
PrintResult("24US & False", 24US & False)
PrintResult("24US & True", 24US & True)
PrintResult("24US & System.SByte.MinValue", 24US & System.SByte.MinValue)
PrintResult("24US & System.Byte.MaxValue", 24US & System.Byte.MaxValue)
PrintResult("24US & -3S", 24US & -3S)
PrintResult("24US & 24US", 24US & 24US)
PrintResult("24US & -5I", 24US & -5I)
PrintResult("24US & 26UI", 24US & 26UI)
PrintResult("24US & -7L", 24US & -7L)
PrintResult("24US & 28UL", 24US & 28UL)
PrintResult("24US & -9D", 24US & -9D)
PrintResult("24US & 10.0F", 24US & 10.0F)
PrintResult("24US & -11.0R", 24US & -11.0R)
PrintResult("24US & ""12""", 24US & "12")
PrintResult("24US & TypeCode.Double", 24US & TypeCode.Double)
PrintResult("-5I & False", -5I & False)
PrintResult("-5I & True", -5I & True)
PrintResult("-5I & System.SByte.MinValue", -5I & System.SByte.MinValue)
PrintResult("-5I & System.Byte.MaxValue", -5I & System.Byte.MaxValue)
PrintResult("-5I & -3S", -5I & -3S)
PrintResult("-5I & 24US", -5I & 24US)
PrintResult("-5I & -5I", -5I & -5I)
PrintResult("-5I & 26UI", -5I & 26UI)
PrintResult("-5I & -7L", -5I & -7L)
PrintResult("-5I & 28UL", -5I & 28UL)
PrintResult("-5I & -9D", -5I & -9D)
PrintResult("-5I & 10.0F", -5I & 10.0F)
PrintResult("-5I & -11.0R", -5I & -11.0R)
PrintResult("-5I & ""12""", -5I & "12")
PrintResult("-5I & TypeCode.Double", -5I & TypeCode.Double)
PrintResult("26UI & False", 26UI & False)
PrintResult("26UI & True", 26UI & True)
PrintResult("26UI & System.SByte.MinValue", 26UI & System.SByte.MinValue)
PrintResult("26UI & System.Byte.MaxValue", 26UI & System.Byte.MaxValue)
PrintResult("26UI & -3S", 26UI & -3S)
PrintResult("26UI & 24US", 26UI & 24US)
PrintResult("26UI & -5I", 26UI & -5I)
PrintResult("26UI & 26UI", 26UI & 26UI)
PrintResult("26UI & -7L", 26UI & -7L)
PrintResult("26UI & 28UL", 26UI & 28UL)
PrintResult("26UI & -9D", 26UI & -9D)
PrintResult("26UI & 10.0F", 26UI & 10.0F)
PrintResult("26UI & -11.0R", 26UI & -11.0R)
PrintResult("26UI & ""12""", 26UI & "12")
PrintResult("26UI & TypeCode.Double", 26UI & TypeCode.Double)
PrintResult("-7L & False", -7L & False)
PrintResult("-7L & True", -7L & True)
PrintResult("-7L & System.SByte.MinValue", -7L & System.SByte.MinValue)
PrintResult("-7L & System.Byte.MaxValue", -7L & System.Byte.MaxValue)
PrintResult("-7L & -3S", -7L & -3S)
PrintResult("-7L & 24US", -7L & 24US)
PrintResult("-7L & -5I", -7L & -5I)
PrintResult("-7L & 26UI", -7L & 26UI)
PrintResult("-7L & -7L", -7L & -7L)
PrintResult("-7L & 28UL", -7L & 28UL)
PrintResult("-7L & -9D", -7L & -9D)
PrintResult("-7L & 10.0F", -7L & 10.0F)
PrintResult("-7L & -11.0R", -7L & -11.0R)
PrintResult("-7L & ""12""", -7L & "12")
PrintResult("-7L & TypeCode.Double", -7L & TypeCode.Double)
PrintResult("28UL & False", 28UL & False)
PrintResult("28UL & True", 28UL & True)
PrintResult("28UL & System.SByte.MinValue", 28UL & System.SByte.MinValue)
PrintResult("28UL & System.Byte.MaxValue", 28UL & System.Byte.MaxValue)
PrintResult("28UL & -3S", 28UL & -3S)
PrintResult("28UL & 24US", 28UL & 24US)
PrintResult("28UL & -5I", 28UL & -5I)
PrintResult("28UL & 26UI", 28UL & 26UI)
PrintResult("28UL & -7L", 28UL & -7L)
PrintResult("28UL & 28UL", 28UL & 28UL)
PrintResult("28UL & -9D", 28UL & -9D)
PrintResult("28UL & 10.0F", 28UL & 10.0F)
PrintResult("28UL & -11.0R", 28UL & -11.0R)
PrintResult("28UL & ""12""", 28UL & "12")
PrintResult("28UL & TypeCode.Double", 28UL & TypeCode.Double)
PrintResult("-9D & False", -9D & False)
PrintResult("-9D & True", -9D & True)
PrintResult("-9D & System.SByte.MinValue", -9D & System.SByte.MinValue)
PrintResult("-9D & System.Byte.MaxValue", -9D & System.Byte.MaxValue)
PrintResult("-9D & -3S", -9D & -3S)
PrintResult("-9D & 24US", -9D & 24US)
PrintResult("-9D & -5I", -9D & -5I)
PrintResult("-9D & 26UI", -9D & 26UI)
PrintResult("-9D & -7L", -9D & -7L)
PrintResult("-9D & 28UL", -9D & 28UL)
PrintResult("-9D & -9D", -9D & -9D)
PrintResult("-9D & 10.0F", -9D & 10.0F)
PrintResult("-9D & -11.0R", -9D & -11.0R)
PrintResult("-9D & ""12""", -9D & "12")
PrintResult("-9D & TypeCode.Double", -9D & TypeCode.Double)
PrintResult("10.0F & False", 10.0F & False)
PrintResult("10.0F & True", 10.0F & True)
PrintResult("10.0F & System.SByte.MinValue", 10.0F & System.SByte.MinValue)
PrintResult("10.0F & System.Byte.MaxValue", 10.0F & System.Byte.MaxValue)
PrintResult("10.0F & -3S", 10.0F & -3S)
PrintResult("10.0F & 24US", 10.0F & 24US)
PrintResult("10.0F & -5I", 10.0F & -5I)
PrintResult("10.0F & 26UI", 10.0F & 26UI)
PrintResult("10.0F & -7L", 10.0F & -7L)
PrintResult("10.0F & 28UL", 10.0F & 28UL)
PrintResult("10.0F & -9D", 10.0F & -9D)
PrintResult("10.0F & 10.0F", 10.0F & 10.0F)
PrintResult("10.0F & -11.0R", 10.0F & -11.0R)
PrintResult("10.0F & ""12""", 10.0F & "12")
PrintResult("10.0F & TypeCode.Double", 10.0F & TypeCode.Double)
PrintResult("-11.0R & False", -11.0R & False)
PrintResult("-11.0R & True", -11.0R & True)
PrintResult("-11.0R & System.SByte.MinValue", -11.0R & System.SByte.MinValue)
PrintResult("-11.0R & System.Byte.MaxValue", -11.0R & System.Byte.MaxValue)
PrintResult("-11.0R & -3S", -11.0R & -3S)
PrintResult("-11.0R & 24US", -11.0R & 24US)
PrintResult("-11.0R & -5I", -11.0R & -5I)
PrintResult("-11.0R & 26UI", -11.0R & 26UI)
PrintResult("-11.0R & -7L", -11.0R & -7L)
PrintResult("-11.0R & 28UL", -11.0R & 28UL)
PrintResult("-11.0R & -9D", -11.0R & -9D)
PrintResult("-11.0R & 10.0F", -11.0R & 10.0F)
PrintResult("-11.0R & -11.0R", -11.0R & -11.0R)
PrintResult("-11.0R & ""12""", -11.0R & "12")
PrintResult("-11.0R & TypeCode.Double", -11.0R & TypeCode.Double)
PrintResult("""12"" & False", "12" & False)
PrintResult("""12"" & True", "12" & True)
PrintResult("""12"" & System.SByte.MinValue", "12" & System.SByte.MinValue)
PrintResult("""12"" & System.Byte.MaxValue", "12" & System.Byte.MaxValue)
PrintResult("""12"" & -3S", "12" & -3S)
PrintResult("""12"" & 24US", "12" & 24US)
PrintResult("""12"" & -5I", "12" & -5I)
PrintResult("""12"" & 26UI", "12" & 26UI)
PrintResult("""12"" & -7L", "12" & -7L)
PrintResult("""12"" & 28UL", "12" & 28UL)
PrintResult("""12"" & -9D", "12" & -9D)
PrintResult("""12"" & 10.0F", "12" & 10.0F)
PrintResult("""12"" & -11.0R", "12" & -11.0R)
PrintResult("""12"" & ""12""", "12" & "12")
PrintResult("""12"" & TypeCode.Double", "12" & TypeCode.Double)
PrintResult("TypeCode.Double & False", TypeCode.Double & False)
PrintResult("TypeCode.Double & True", TypeCode.Double & True)
PrintResult("TypeCode.Double & System.SByte.MinValue", TypeCode.Double & System.SByte.MinValue)
PrintResult("TypeCode.Double & System.Byte.MaxValue", TypeCode.Double & System.Byte.MaxValue)
PrintResult("TypeCode.Double & -3S", TypeCode.Double & -3S)
PrintResult("TypeCode.Double & 24US", TypeCode.Double & 24US)
PrintResult("TypeCode.Double & -5I", TypeCode.Double & -5I)
PrintResult("TypeCode.Double & 26UI", TypeCode.Double & 26UI)
PrintResult("TypeCode.Double & -7L", TypeCode.Double & -7L)
PrintResult("TypeCode.Double & 28UL", TypeCode.Double & 28UL)
PrintResult("TypeCode.Double & -9D", TypeCode.Double & -9D)
PrintResult("TypeCode.Double & 10.0F", TypeCode.Double & 10.0F)
PrintResult("TypeCode.Double & -11.0R", TypeCode.Double & -11.0R)
PrintResult("TypeCode.Double & ""12""", TypeCode.Double & "12")
PrintResult("TypeCode.Double & TypeCode.Double", TypeCode.Double & TypeCode.Double)
PrintResult("False Like False", False Like False)
PrintResult("False Like True", False Like True)
PrintResult("False Like System.SByte.MinValue", False Like System.SByte.MinValue)
PrintResult("False Like System.Byte.MaxValue", False Like System.Byte.MaxValue)
PrintResult("False Like -3S", False Like -3S)
PrintResult("False Like 24US", False Like 24US)
PrintResult("False Like -5I", False Like -5I)
PrintResult("False Like 26UI", False Like 26UI)
PrintResult("False Like -7L", False Like -7L)
PrintResult("False Like 28UL", False Like 28UL)
PrintResult("False Like -9D", False Like -9D)
PrintResult("False Like 10.0F", False Like 10.0F)
PrintResult("False Like -11.0R", False Like -11.0R)
PrintResult("False Like ""12""", False Like "12")
PrintResult("False Like TypeCode.Double", False Like TypeCode.Double)
PrintResult("True Like False", True Like False)
PrintResult("True Like True", True Like True)
PrintResult("True Like System.SByte.MinValue", True Like System.SByte.MinValue)
PrintResult("True Like System.Byte.MaxValue", True Like System.Byte.MaxValue)
PrintResult("True Like -3S", True Like -3S)
PrintResult("True Like 24US", True Like 24US)
PrintResult("True Like -5I", True Like -5I)
PrintResult("True Like 26UI", True Like 26UI)
PrintResult("True Like -7L", True Like -7L)
PrintResult("True Like 28UL", True Like 28UL)
PrintResult("True Like -9D", True Like -9D)
PrintResult("True Like 10.0F", True Like 10.0F)
PrintResult("True Like -11.0R", True Like -11.0R)
PrintResult("True Like ""12""", True Like "12")
PrintResult("True Like TypeCode.Double", True Like TypeCode.Double)
PrintResult("System.SByte.MinValue Like False", System.SByte.MinValue Like False)
PrintResult("System.SByte.MinValue Like True", System.SByte.MinValue Like True)
PrintResult("System.SByte.MinValue Like System.SByte.MinValue", System.SByte.MinValue Like System.SByte.MinValue)
PrintResult("System.SByte.MinValue Like System.Byte.MaxValue", System.SByte.MinValue Like System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Like -3S", System.SByte.MinValue Like -3S)
PrintResult("System.SByte.MinValue Like 24US", System.SByte.MinValue Like 24US)
PrintResult("System.SByte.MinValue Like -5I", System.SByte.MinValue Like -5I)
PrintResult("System.SByte.MinValue Like 26UI", System.SByte.MinValue Like 26UI)
PrintResult("System.SByte.MinValue Like -7L", System.SByte.MinValue Like -7L)
PrintResult("System.SByte.MinValue Like 28UL", System.SByte.MinValue Like 28UL)
PrintResult("System.SByte.MinValue Like -9D", System.SByte.MinValue Like -9D)
PrintResult("System.SByte.MinValue Like 10.0F", System.SByte.MinValue Like 10.0F)
PrintResult("System.SByte.MinValue Like -11.0R", System.SByte.MinValue Like -11.0R)
PrintResult("System.SByte.MinValue Like ""12""", System.SByte.MinValue Like "12")
PrintResult("System.SByte.MinValue Like TypeCode.Double", System.SByte.MinValue Like TypeCode.Double)
PrintResult("System.Byte.MaxValue Like False", System.Byte.MaxValue Like False)
PrintResult("System.Byte.MaxValue Like True", System.Byte.MaxValue Like True)
PrintResult("System.Byte.MaxValue Like System.SByte.MinValue", System.Byte.MaxValue Like System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Like System.Byte.MaxValue", System.Byte.MaxValue Like System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Like -3S", System.Byte.MaxValue Like -3S)
PrintResult("System.Byte.MaxValue Like 24US", System.Byte.MaxValue Like 24US)
PrintResult("System.Byte.MaxValue Like -5I", System.Byte.MaxValue Like -5I)
PrintResult("System.Byte.MaxValue Like 26UI", System.Byte.MaxValue Like 26UI)
PrintResult("System.Byte.MaxValue Like -7L", System.Byte.MaxValue Like -7L)
PrintResult("System.Byte.MaxValue Like 28UL", System.Byte.MaxValue Like 28UL)
PrintResult("System.Byte.MaxValue Like -9D", System.Byte.MaxValue Like -9D)
PrintResult("System.Byte.MaxValue Like 10.0F", System.Byte.MaxValue Like 10.0F)
PrintResult("System.Byte.MaxValue Like -11.0R", System.Byte.MaxValue Like -11.0R)
PrintResult("System.Byte.MaxValue Like ""12""", System.Byte.MaxValue Like "12")
PrintResult("System.Byte.MaxValue Like TypeCode.Double", System.Byte.MaxValue Like TypeCode.Double)
PrintResult("-3S Like False", -3S Like False)
PrintResult("-3S Like True", -3S Like True)
PrintResult("-3S Like System.SByte.MinValue", -3S Like System.SByte.MinValue)
PrintResult("-3S Like System.Byte.MaxValue", -3S Like System.Byte.MaxValue)
PrintResult("-3S Like -3S", -3S Like -3S)
PrintResult("-3S Like 24US", -3S Like 24US)
PrintResult("-3S Like -5I", -3S Like -5I)
PrintResult("-3S Like 26UI", -3S Like 26UI)
PrintResult("-3S Like -7L", -3S Like -7L)
PrintResult("-3S Like 28UL", -3S Like 28UL)
PrintResult("-3S Like -9D", -3S Like -9D)
PrintResult("-3S Like 10.0F", -3S Like 10.0F)
PrintResult("-3S Like -11.0R", -3S Like -11.0R)
PrintResult("-3S Like ""12""", -3S Like "12")
PrintResult("-3S Like TypeCode.Double", -3S Like TypeCode.Double)
PrintResult("24US Like False", 24US Like False)
PrintResult("24US Like True", 24US Like True)
PrintResult("24US Like System.SByte.MinValue", 24US Like System.SByte.MinValue)
PrintResult("24US Like System.Byte.MaxValue", 24US Like System.Byte.MaxValue)
PrintResult("24US Like -3S", 24US Like -3S)
PrintResult("24US Like 24US", 24US Like 24US)
PrintResult("24US Like -5I", 24US Like -5I)
PrintResult("24US Like 26UI", 24US Like 26UI)
PrintResult("24US Like -7L", 24US Like -7L)
PrintResult("24US Like 28UL", 24US Like 28UL)
PrintResult("24US Like -9D", 24US Like -9D)
PrintResult("24US Like 10.0F", 24US Like 10.0F)
PrintResult("24US Like -11.0R", 24US Like -11.0R)
PrintResult("24US Like ""12""", 24US Like "12")
PrintResult("24US Like TypeCode.Double", 24US Like TypeCode.Double)
PrintResult("-5I Like False", -5I Like False)
PrintResult("-5I Like True", -5I Like True)
PrintResult("-5I Like System.SByte.MinValue", -5I Like System.SByte.MinValue)
PrintResult("-5I Like System.Byte.MaxValue", -5I Like System.Byte.MaxValue)
PrintResult("-5I Like -3S", -5I Like -3S)
PrintResult("-5I Like 24US", -5I Like 24US)
PrintResult("-5I Like -5I", -5I Like -5I)
PrintResult("-5I Like 26UI", -5I Like 26UI)
PrintResult("-5I Like -7L", -5I Like -7L)
PrintResult("-5I Like 28UL", -5I Like 28UL)
PrintResult("-5I Like -9D", -5I Like -9D)
PrintResult("-5I Like 10.0F", -5I Like 10.0F)
PrintResult("-5I Like -11.0R", -5I Like -11.0R)
PrintResult("-5I Like ""12""", -5I Like "12")
PrintResult("-5I Like TypeCode.Double", -5I Like TypeCode.Double)
PrintResult("26UI Like False", 26UI Like False)
PrintResult("26UI Like True", 26UI Like True)
PrintResult("26UI Like System.SByte.MinValue", 26UI Like System.SByte.MinValue)
PrintResult("26UI Like System.Byte.MaxValue", 26UI Like System.Byte.MaxValue)
PrintResult("26UI Like -3S", 26UI Like -3S)
PrintResult("26UI Like 24US", 26UI Like 24US)
PrintResult("26UI Like -5I", 26UI Like -5I)
PrintResult("26UI Like 26UI", 26UI Like 26UI)
PrintResult("26UI Like -7L", 26UI Like -7L)
PrintResult("26UI Like 28UL", 26UI Like 28UL)
PrintResult("26UI Like -9D", 26UI Like -9D)
PrintResult("26UI Like 10.0F", 26UI Like 10.0F)
PrintResult("26UI Like -11.0R", 26UI Like -11.0R)
PrintResult("26UI Like ""12""", 26UI Like "12")
PrintResult("26UI Like TypeCode.Double", 26UI Like TypeCode.Double)
PrintResult("-7L Like False", -7L Like False)
PrintResult("-7L Like True", -7L Like True)
PrintResult("-7L Like System.SByte.MinValue", -7L Like System.SByte.MinValue)
PrintResult("-7L Like System.Byte.MaxValue", -7L Like System.Byte.MaxValue)
PrintResult("-7L Like -3S", -7L Like -3S)
PrintResult("-7L Like 24US", -7L Like 24US)
PrintResult("-7L Like -5I", -7L Like -5I)
PrintResult("-7L Like 26UI", -7L Like 26UI)
PrintResult("-7L Like -7L", -7L Like -7L)
PrintResult("-7L Like 28UL", -7L Like 28UL)
PrintResult("-7L Like -9D", -7L Like -9D)
PrintResult("-7L Like 10.0F", -7L Like 10.0F)
PrintResult("-7L Like -11.0R", -7L Like -11.0R)
PrintResult("-7L Like ""12""", -7L Like "12")
PrintResult("-7L Like TypeCode.Double", -7L Like TypeCode.Double)
PrintResult("28UL Like False", 28UL Like False)
PrintResult("28UL Like True", 28UL Like True)
PrintResult("28UL Like System.SByte.MinValue", 28UL Like System.SByte.MinValue)
PrintResult("28UL Like System.Byte.MaxValue", 28UL Like System.Byte.MaxValue)
PrintResult("28UL Like -3S", 28UL Like -3S)
PrintResult("28UL Like 24US", 28UL Like 24US)
PrintResult("28UL Like -5I", 28UL Like -5I)
PrintResult("28UL Like 26UI", 28UL Like 26UI)
PrintResult("28UL Like -7L", 28UL Like -7L)
PrintResult("28UL Like 28UL", 28UL Like 28UL)
PrintResult("28UL Like -9D", 28UL Like -9D)
PrintResult("28UL Like 10.0F", 28UL Like 10.0F)
PrintResult("28UL Like -11.0R", 28UL Like -11.0R)
PrintResult("28UL Like ""12""", 28UL Like "12")
PrintResult("28UL Like TypeCode.Double", 28UL Like TypeCode.Double)
PrintResult("-9D Like False", -9D Like False)
PrintResult("-9D Like True", -9D Like True)
PrintResult("-9D Like System.SByte.MinValue", -9D Like System.SByte.MinValue)
PrintResult("-9D Like System.Byte.MaxValue", -9D Like System.Byte.MaxValue)
PrintResult("-9D Like -3S", -9D Like -3S)
PrintResult("-9D Like 24US", -9D Like 24US)
PrintResult("-9D Like -5I", -9D Like -5I)
PrintResult("-9D Like 26UI", -9D Like 26UI)
PrintResult("-9D Like -7L", -9D Like -7L)
PrintResult("-9D Like 28UL", -9D Like 28UL)
PrintResult("-9D Like -9D", -9D Like -9D)
PrintResult("-9D Like 10.0F", -9D Like 10.0F)
PrintResult("-9D Like -11.0R", -9D Like -11.0R)
PrintResult("-9D Like ""12""", -9D Like "12")
PrintResult("-9D Like TypeCode.Double", -9D Like TypeCode.Double)
PrintResult("10.0F Like False", 10.0F Like False)
PrintResult("10.0F Like True", 10.0F Like True)
PrintResult("10.0F Like System.SByte.MinValue", 10.0F Like System.SByte.MinValue)
PrintResult("10.0F Like System.Byte.MaxValue", 10.0F Like System.Byte.MaxValue)
PrintResult("10.0F Like -3S", 10.0F Like -3S)
PrintResult("10.0F Like 24US", 10.0F Like 24US)
PrintResult("10.0F Like -5I", 10.0F Like -5I)
PrintResult("10.0F Like 26UI", 10.0F Like 26UI)
PrintResult("10.0F Like -7L", 10.0F Like -7L)
PrintResult("10.0F Like 28UL", 10.0F Like 28UL)
PrintResult("10.0F Like -9D", 10.0F Like -9D)
PrintResult("10.0F Like 10.0F", 10.0F Like 10.0F)
PrintResult("10.0F Like -11.0R", 10.0F Like -11.0R)
PrintResult("10.0F Like ""12""", 10.0F Like "12")
PrintResult("10.0F Like TypeCode.Double", 10.0F Like TypeCode.Double)
PrintResult("-11.0R Like False", -11.0R Like False)
PrintResult("-11.0R Like True", -11.0R Like True)
PrintResult("-11.0R Like System.SByte.MinValue", -11.0R Like System.SByte.MinValue)
PrintResult("-11.0R Like System.Byte.MaxValue", -11.0R Like System.Byte.MaxValue)
PrintResult("-11.0R Like -3S", -11.0R Like -3S)
PrintResult("-11.0R Like 24US", -11.0R Like 24US)
PrintResult("-11.0R Like -5I", -11.0R Like -5I)
PrintResult("-11.0R Like 26UI", -11.0R Like 26UI)
PrintResult("-11.0R Like -7L", -11.0R Like -7L)
PrintResult("-11.0R Like 28UL", -11.0R Like 28UL)
PrintResult("-11.0R Like -9D", -11.0R Like -9D)
PrintResult("-11.0R Like 10.0F", -11.0R Like 10.0F)
PrintResult("-11.0R Like -11.0R", -11.0R Like -11.0R)
PrintResult("-11.0R Like ""12""", -11.0R Like "12")
PrintResult("-11.0R Like TypeCode.Double", -11.0R Like TypeCode.Double)
PrintResult("""12"" Like False", "12" Like False)
PrintResult("""12"" Like True", "12" Like True)
PrintResult("""12"" Like System.SByte.MinValue", "12" Like System.SByte.MinValue)
PrintResult("""12"" Like System.Byte.MaxValue", "12" Like System.Byte.MaxValue)
PrintResult("""12"" Like -3S", "12" Like -3S)
PrintResult("""12"" Like 24US", "12" Like 24US)
PrintResult("""12"" Like -5I", "12" Like -5I)
PrintResult("""12"" Like 26UI", "12" Like 26UI)
PrintResult("""12"" Like -7L", "12" Like -7L)
PrintResult("""12"" Like 28UL", "12" Like 28UL)
PrintResult("""12"" Like -9D", "12" Like -9D)
PrintResult("""12"" Like 10.0F", "12" Like 10.0F)
PrintResult("""12"" Like -11.0R", "12" Like -11.0R)
PrintResult("""12"" Like ""12""", "12" Like "12")
PrintResult("""12"" Like TypeCode.Double", "12" Like TypeCode.Double)
PrintResult("TypeCode.Double Like False", TypeCode.Double Like False)
PrintResult("TypeCode.Double Like True", TypeCode.Double Like True)
PrintResult("TypeCode.Double Like System.SByte.MinValue", TypeCode.Double Like System.SByte.MinValue)
PrintResult("TypeCode.Double Like System.Byte.MaxValue", TypeCode.Double Like System.Byte.MaxValue)
PrintResult("TypeCode.Double Like -3S", TypeCode.Double Like -3S)
PrintResult("TypeCode.Double Like 24US", TypeCode.Double Like 24US)
PrintResult("TypeCode.Double Like -5I", TypeCode.Double Like -5I)
PrintResult("TypeCode.Double Like 26UI", TypeCode.Double Like 26UI)
PrintResult("TypeCode.Double Like -7L", TypeCode.Double Like -7L)
PrintResult("TypeCode.Double Like 28UL", TypeCode.Double Like 28UL)
PrintResult("TypeCode.Double Like -9D", TypeCode.Double Like -9D)
PrintResult("TypeCode.Double Like 10.0F", TypeCode.Double Like 10.0F)
PrintResult("TypeCode.Double Like -11.0R", TypeCode.Double Like -11.0R)
PrintResult("TypeCode.Double Like ""12""", TypeCode.Double Like "12")
PrintResult("TypeCode.Double Like TypeCode.Double", TypeCode.Double Like TypeCode.Double)
PrintResult("False = False", False = False)
PrintResult("False = True", False = True)
PrintResult("False = System.SByte.MinValue", False = System.SByte.MinValue)
PrintResult("False = System.Byte.MaxValue", False = System.Byte.MaxValue)
PrintResult("False = -3S", False = -3S)
PrintResult("False = 24US", False = 24US)
PrintResult("False = -5I", False = -5I)
PrintResult("False = 26UI", False = 26UI)
PrintResult("False = -7L", False = -7L)
PrintResult("False = 28UL", False = 28UL)
PrintResult("False = -9D", False = -9D)
PrintResult("False = 10.0F", False = 10.0F)
PrintResult("False = -11.0R", False = -11.0R)
PrintResult("False = ""12""", False = "12")
PrintResult("False = TypeCode.Double", False = TypeCode.Double)
PrintResult("True = False", True = False)
PrintResult("True = True", True = True)
PrintResult("True = System.SByte.MinValue", True = System.SByte.MinValue)
PrintResult("True = System.Byte.MaxValue", True = System.Byte.MaxValue)
PrintResult("True = -3S", True = -3S)
PrintResult("True = 24US", True = 24US)
PrintResult("True = -5I", True = -5I)
PrintResult("True = 26UI", True = 26UI)
PrintResult("True = -7L", True = -7L)
PrintResult("True = 28UL", True = 28UL)
PrintResult("True = -9D", True = -9D)
PrintResult("True = 10.0F", True = 10.0F)
PrintResult("True = -11.0R", True = -11.0R)
PrintResult("True = ""12""", True = "12")
PrintResult("True = TypeCode.Double", True = TypeCode.Double)
PrintResult("System.SByte.MinValue = False", System.SByte.MinValue = False)
PrintResult("System.SByte.MinValue = True", System.SByte.MinValue = True)
PrintResult("System.SByte.MinValue = System.SByte.MinValue", System.SByte.MinValue = System.SByte.MinValue)
PrintResult("System.SByte.MinValue = System.Byte.MaxValue", System.SByte.MinValue = System.Byte.MaxValue)
PrintResult("System.SByte.MinValue = -3S", System.SByte.MinValue = -3S)
PrintResult("System.SByte.MinValue = 24US", System.SByte.MinValue = 24US)
PrintResult("System.SByte.MinValue = -5I", System.SByte.MinValue = -5I)
PrintResult("System.SByte.MinValue = 26UI", System.SByte.MinValue = 26UI)
PrintResult("System.SByte.MinValue = -7L", System.SByte.MinValue = -7L)
PrintResult("System.SByte.MinValue = 28UL", System.SByte.MinValue = 28UL)
PrintResult("System.SByte.MinValue = -9D", System.SByte.MinValue = -9D)
PrintResult("System.SByte.MinValue = 10.0F", System.SByte.MinValue = 10.0F)
PrintResult("System.SByte.MinValue = -11.0R", System.SByte.MinValue = -11.0R)
PrintResult("System.SByte.MinValue = ""12""", System.SByte.MinValue = "12")
PrintResult("System.SByte.MinValue = TypeCode.Double", System.SByte.MinValue = TypeCode.Double)
PrintResult("System.Byte.MaxValue = False", System.Byte.MaxValue = False)
PrintResult("System.Byte.MaxValue = True", System.Byte.MaxValue = True)
PrintResult("System.Byte.MaxValue = System.SByte.MinValue", System.Byte.MaxValue = System.SByte.MinValue)
PrintResult("System.Byte.MaxValue = System.Byte.MaxValue", System.Byte.MaxValue = System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue = -3S", System.Byte.MaxValue = -3S)
PrintResult("System.Byte.MaxValue = 24US", System.Byte.MaxValue = 24US)
PrintResult("System.Byte.MaxValue = -5I", System.Byte.MaxValue = -5I)
PrintResult("System.Byte.MaxValue = 26UI", System.Byte.MaxValue = 26UI)
PrintResult("System.Byte.MaxValue = -7L", System.Byte.MaxValue = -7L)
PrintResult("System.Byte.MaxValue = 28UL", System.Byte.MaxValue = 28UL)
PrintResult("System.Byte.MaxValue = -9D", System.Byte.MaxValue = -9D)
PrintResult("System.Byte.MaxValue = 10.0F", System.Byte.MaxValue = 10.0F)
PrintResult("System.Byte.MaxValue = -11.0R", System.Byte.MaxValue = -11.0R)
PrintResult("System.Byte.MaxValue = ""12""", System.Byte.MaxValue = "12")
PrintResult("System.Byte.MaxValue = TypeCode.Double", System.Byte.MaxValue = TypeCode.Double)
PrintResult("-3S = False", -3S = False)
PrintResult("-3S = True", -3S = True)
PrintResult("-3S = System.SByte.MinValue", -3S = System.SByte.MinValue)
PrintResult("-3S = System.Byte.MaxValue", -3S = System.Byte.MaxValue)
PrintResult("-3S = -3S", -3S = -3S)
PrintResult("-3S = 24US", -3S = 24US)
PrintResult("-3S = -5I", -3S = -5I)
PrintResult("-3S = 26UI", -3S = 26UI)
PrintResult("-3S = -7L", -3S = -7L)
PrintResult("-3S = 28UL", -3S = 28UL)
PrintResult("-3S = -9D", -3S = -9D)
PrintResult("-3S = 10.0F", -3S = 10.0F)
PrintResult("-3S = -11.0R", -3S = -11.0R)
PrintResult("-3S = ""12""", -3S = "12")
PrintResult("-3S = TypeCode.Double", -3S = TypeCode.Double)
PrintResult("24US = False", 24US = False)
PrintResult("24US = True", 24US = True)
PrintResult("24US = System.SByte.MinValue", 24US = System.SByte.MinValue)
PrintResult("24US = System.Byte.MaxValue", 24US = System.Byte.MaxValue)
PrintResult("24US = -3S", 24US = -3S)
PrintResult("24US = 24US", 24US = 24US)
PrintResult("24US = -5I", 24US = -5I)
PrintResult("24US = 26UI", 24US = 26UI)
PrintResult("24US = -7L", 24US = -7L)
PrintResult("24US = 28UL", 24US = 28UL)
PrintResult("24US = -9D", 24US = -9D)
PrintResult("24US = 10.0F", 24US = 10.0F)
PrintResult("24US = -11.0R", 24US = -11.0R)
PrintResult("24US = ""12""", 24US = "12")
PrintResult("24US = TypeCode.Double", 24US = TypeCode.Double)
PrintResult("-5I = False", -5I = False)
PrintResult("-5I = True", -5I = True)
PrintResult("-5I = System.SByte.MinValue", -5I = System.SByte.MinValue)
PrintResult("-5I = System.Byte.MaxValue", -5I = System.Byte.MaxValue)
PrintResult("-5I = -3S", -5I = -3S)
PrintResult("-5I = 24US", -5I = 24US)
PrintResult("-5I = -5I", -5I = -5I)
PrintResult("-5I = 26UI", -5I = 26UI)
PrintResult("-5I = -7L", -5I = -7L)
PrintResult("-5I = 28UL", -5I = 28UL)
PrintResult("-5I = -9D", -5I = -9D)
PrintResult("-5I = 10.0F", -5I = 10.0F)
PrintResult("-5I = -11.0R", -5I = -11.0R)
PrintResult("-5I = ""12""", -5I = "12")
PrintResult("-5I = TypeCode.Double", -5I = TypeCode.Double)
PrintResult("26UI = False", 26UI = False)
PrintResult("26UI = True", 26UI = True)
PrintResult("26UI = System.SByte.MinValue", 26UI = System.SByte.MinValue)
PrintResult("26UI = System.Byte.MaxValue", 26UI = System.Byte.MaxValue)
PrintResult("26UI = -3S", 26UI = -3S)
PrintResult("26UI = 24US", 26UI = 24US)
PrintResult("26UI = -5I", 26UI = -5I)
PrintResult("26UI = 26UI", 26UI = 26UI)
PrintResult("26UI = -7L", 26UI = -7L)
PrintResult("26UI = 28UL", 26UI = 28UL)
PrintResult("26UI = -9D", 26UI = -9D)
PrintResult("26UI = 10.0F", 26UI = 10.0F)
PrintResult("26UI = -11.0R", 26UI = -11.0R)
PrintResult("26UI = ""12""", 26UI = "12")
PrintResult("26UI = TypeCode.Double", 26UI = TypeCode.Double)
PrintResult("-7L = False", -7L = False)
PrintResult("-7L = True", -7L = True)
PrintResult("-7L = System.SByte.MinValue", -7L = System.SByte.MinValue)
PrintResult("-7L = System.Byte.MaxValue", -7L = System.Byte.MaxValue)
PrintResult("-7L = -3S", -7L = -3S)
PrintResult("-7L = 24US", -7L = 24US)
PrintResult("-7L = -5I", -7L = -5I)
PrintResult("-7L = 26UI", -7L = 26UI)
PrintResult("-7L = -7L", -7L = -7L)
PrintResult("-7L = 28UL", -7L = 28UL)
PrintResult("-7L = -9D", -7L = -9D)
PrintResult("-7L = 10.0F", -7L = 10.0F)
PrintResult("-7L = -11.0R", -7L = -11.0R)
PrintResult("-7L = ""12""", -7L = "12")
PrintResult("-7L = TypeCode.Double", -7L = TypeCode.Double)
PrintResult("28UL = False", 28UL = False)
PrintResult("28UL = True", 28UL = True)
PrintResult("28UL = System.SByte.MinValue", 28UL = System.SByte.MinValue)
PrintResult("28UL = System.Byte.MaxValue", 28UL = System.Byte.MaxValue)
PrintResult("28UL = -3S", 28UL = -3S)
PrintResult("28UL = 24US", 28UL = 24US)
PrintResult("28UL = -5I", 28UL = -5I)
PrintResult("28UL = 26UI", 28UL = 26UI)
PrintResult("28UL = -7L", 28UL = -7L)
PrintResult("28UL = 28UL", 28UL = 28UL)
PrintResult("28UL = -9D", 28UL = -9D)
PrintResult("28UL = 10.0F", 28UL = 10.0F)
PrintResult("28UL = -11.0R", 28UL = -11.0R)
PrintResult("28UL = ""12""", 28UL = "12")
PrintResult("28UL = TypeCode.Double", 28UL = TypeCode.Double)
PrintResult("-9D = False", -9D = False)
PrintResult("-9D = True", -9D = True)
PrintResult("-9D = System.SByte.MinValue", -9D = System.SByte.MinValue)
PrintResult("-9D = System.Byte.MaxValue", -9D = System.Byte.MaxValue)
PrintResult("-9D = -3S", -9D = -3S)
PrintResult("-9D = 24US", -9D = 24US)
PrintResult("-9D = -5I", -9D = -5I)
PrintResult("-9D = 26UI", -9D = 26UI)
PrintResult("-9D = -7L", -9D = -7L)
PrintResult("-9D = 28UL", -9D = 28UL)
PrintResult("-9D = -9D", -9D = -9D)
PrintResult("-9D = 10.0F", -9D = 10.0F)
PrintResult("-9D = -11.0R", -9D = -11.0R)
PrintResult("-9D = ""12""", -9D = "12")
PrintResult("-9D = TypeCode.Double", -9D = TypeCode.Double)
PrintResult("10.0F = False", 10.0F = False)
PrintResult("10.0F = True", 10.0F = True)
PrintResult("10.0F = System.SByte.MinValue", 10.0F = System.SByte.MinValue)
PrintResult("10.0F = System.Byte.MaxValue", 10.0F = System.Byte.MaxValue)
PrintResult("10.0F = -3S", 10.0F = -3S)
PrintResult("10.0F = 24US", 10.0F = 24US)
PrintResult("10.0F = -5I", 10.0F = -5I)
PrintResult("10.0F = 26UI", 10.0F = 26UI)
PrintResult("10.0F = -7L", 10.0F = -7L)
PrintResult("10.0F = 28UL", 10.0F = 28UL)
PrintResult("10.0F = -9D", 10.0F = -9D)
PrintResult("10.0F = 10.0F", 10.0F = 10.0F)
PrintResult("10.0F = -11.0R", 10.0F = -11.0R)
PrintResult("10.0F = ""12""", 10.0F = "12")
PrintResult("10.0F = TypeCode.Double", 10.0F = TypeCode.Double)
PrintResult("-11.0R = False", -11.0R = False)
PrintResult("-11.0R = True", -11.0R = True)
PrintResult("-11.0R = System.SByte.MinValue", -11.0R = System.SByte.MinValue)
PrintResult("-11.0R = System.Byte.MaxValue", -11.0R = System.Byte.MaxValue)
PrintResult("-11.0R = -3S", -11.0R = -3S)
PrintResult("-11.0R = 24US", -11.0R = 24US)
PrintResult("-11.0R = -5I", -11.0R = -5I)
PrintResult("-11.0R = 26UI", -11.0R = 26UI)
PrintResult("-11.0R = -7L", -11.0R = -7L)
PrintResult("-11.0R = 28UL", -11.0R = 28UL)
PrintResult("-11.0R = -9D", -11.0R = -9D)
PrintResult("-11.0R = 10.0F", -11.0R = 10.0F)
PrintResult("-11.0R = -11.0R", -11.0R = -11.0R)
PrintResult("-11.0R = ""12""", -11.0R = "12")
PrintResult("-11.0R = TypeCode.Double", -11.0R = TypeCode.Double)
PrintResult("""12"" = False", "12" = False)
PrintResult("""12"" = True", "12" = True)
PrintResult("""12"" = System.SByte.MinValue", "12" = System.SByte.MinValue)
PrintResult("""12"" = System.Byte.MaxValue", "12" = System.Byte.MaxValue)
PrintResult("""12"" = -3S", "12" = -3S)
PrintResult("""12"" = 24US", "12" = 24US)
PrintResult("""12"" = -5I", "12" = -5I)
PrintResult("""12"" = 26UI", "12" = 26UI)
PrintResult("""12"" = -7L", "12" = -7L)
PrintResult("""12"" = 28UL", "12" = 28UL)
PrintResult("""12"" = -9D", "12" = -9D)
PrintResult("""12"" = 10.0F", "12" = 10.0F)
PrintResult("""12"" = -11.0R", "12" = -11.0R)
PrintResult("""12"" = ""12""", "12" = "12")
PrintResult("""12"" = TypeCode.Double", "12" = TypeCode.Double)
PrintResult("TypeCode.Double = False", TypeCode.Double = False)
PrintResult("TypeCode.Double = True", TypeCode.Double = True)
PrintResult("TypeCode.Double = System.SByte.MinValue", TypeCode.Double = System.SByte.MinValue)
PrintResult("TypeCode.Double = System.Byte.MaxValue", TypeCode.Double = System.Byte.MaxValue)
PrintResult("TypeCode.Double = -3S", TypeCode.Double = -3S)
PrintResult("TypeCode.Double = 24US", TypeCode.Double = 24US)
PrintResult("TypeCode.Double = -5I", TypeCode.Double = -5I)
PrintResult("TypeCode.Double = 26UI", TypeCode.Double = 26UI)
PrintResult("TypeCode.Double = -7L", TypeCode.Double = -7L)
PrintResult("TypeCode.Double = 28UL", TypeCode.Double = 28UL)
PrintResult("TypeCode.Double = -9D", TypeCode.Double = -9D)
PrintResult("TypeCode.Double = 10.0F", TypeCode.Double = 10.0F)
PrintResult("TypeCode.Double = -11.0R", TypeCode.Double = -11.0R)
PrintResult("TypeCode.Double = ""12""", TypeCode.Double = "12")
PrintResult("TypeCode.Double = TypeCode.Double", TypeCode.Double = TypeCode.Double)
PrintResult("False <> False", False <> False)
PrintResult("False <> True", False <> True)
PrintResult("False <> System.SByte.MinValue", False <> System.SByte.MinValue)
PrintResult("False <> System.Byte.MaxValue", False <> System.Byte.MaxValue)
PrintResult("False <> -3S", False <> -3S)
PrintResult("False <> 24US", False <> 24US)
PrintResult("False <> -5I", False <> -5I)
PrintResult("False <> 26UI", False <> 26UI)
PrintResult("False <> -7L", False <> -7L)
PrintResult("False <> 28UL", False <> 28UL)
PrintResult("False <> -9D", False <> -9D)
PrintResult("False <> 10.0F", False <> 10.0F)
PrintResult("False <> -11.0R", False <> -11.0R)
PrintResult("False <> ""12""", False <> "12")
PrintResult("False <> TypeCode.Double", False <> TypeCode.Double)
PrintResult("True <> False", True <> False)
PrintResult("True <> True", True <> True)
PrintResult("True <> System.SByte.MinValue", True <> System.SByte.MinValue)
PrintResult("True <> System.Byte.MaxValue", True <> System.Byte.MaxValue)
PrintResult("True <> -3S", True <> -3S)
PrintResult("True <> 24US", True <> 24US)
PrintResult("True <> -5I", True <> -5I)
PrintResult("True <> 26UI", True <> 26UI)
PrintResult("True <> -7L", True <> -7L)
PrintResult("True <> 28UL", True <> 28UL)
PrintResult("True <> -9D", True <> -9D)
PrintResult("True <> 10.0F", True <> 10.0F)
PrintResult("True <> -11.0R", True <> -11.0R)
PrintResult("True <> ""12""", True <> "12")
PrintResult("True <> TypeCode.Double", True <> TypeCode.Double)
PrintResult("System.SByte.MinValue <> False", System.SByte.MinValue <> False)
PrintResult("System.SByte.MinValue <> True", System.SByte.MinValue <> True)
PrintResult("System.SByte.MinValue <> System.SByte.MinValue", System.SByte.MinValue <> System.SByte.MinValue)
PrintResult("System.SByte.MinValue <> System.Byte.MaxValue", System.SByte.MinValue <> System.Byte.MaxValue)
PrintResult("System.SByte.MinValue <> -3S", System.SByte.MinValue <> -3S)
PrintResult("System.SByte.MinValue <> 24US", System.SByte.MinValue <> 24US)
PrintResult("System.SByte.MinValue <> -5I", System.SByte.MinValue <> -5I)
PrintResult("System.SByte.MinValue <> 26UI", System.SByte.MinValue <> 26UI)
PrintResult("System.SByte.MinValue <> -7L", System.SByte.MinValue <> -7L)
PrintResult("System.SByte.MinValue <> 28UL", System.SByte.MinValue <> 28UL)
PrintResult("System.SByte.MinValue <> -9D", System.SByte.MinValue <> -9D)
PrintResult("System.SByte.MinValue <> 10.0F", System.SByte.MinValue <> 10.0F)
PrintResult("System.SByte.MinValue <> -11.0R", System.SByte.MinValue <> -11.0R)
PrintResult("System.SByte.MinValue <> ""12""", System.SByte.MinValue <> "12")
PrintResult("System.SByte.MinValue <> TypeCode.Double", System.SByte.MinValue <> TypeCode.Double)
PrintResult("System.Byte.MaxValue <> False", System.Byte.MaxValue <> False)
PrintResult("System.Byte.MaxValue <> True", System.Byte.MaxValue <> True)
PrintResult("System.Byte.MaxValue <> System.SByte.MinValue", System.Byte.MaxValue <> System.SByte.MinValue)
PrintResult("System.Byte.MaxValue <> System.Byte.MaxValue", System.Byte.MaxValue <> System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue <> -3S", System.Byte.MaxValue <> -3S)
PrintResult("System.Byte.MaxValue <> 24US", System.Byte.MaxValue <> 24US)
PrintResult("System.Byte.MaxValue <> -5I", System.Byte.MaxValue <> -5I)
PrintResult("System.Byte.MaxValue <> 26UI", System.Byte.MaxValue <> 26UI)
PrintResult("System.Byte.MaxValue <> -7L", System.Byte.MaxValue <> -7L)
PrintResult("System.Byte.MaxValue <> 28UL", System.Byte.MaxValue <> 28UL)
PrintResult("System.Byte.MaxValue <> -9D", System.Byte.MaxValue <> -9D)
PrintResult("System.Byte.MaxValue <> 10.0F", System.Byte.MaxValue <> 10.0F)
PrintResult("System.Byte.MaxValue <> -11.0R", System.Byte.MaxValue <> -11.0R)
PrintResult("System.Byte.MaxValue <> ""12""", System.Byte.MaxValue <> "12")
PrintResult("System.Byte.MaxValue <> TypeCode.Double", System.Byte.MaxValue <> TypeCode.Double)
PrintResult("-3S <> False", -3S <> False)
PrintResult("-3S <> True", -3S <> True)
PrintResult("-3S <> System.SByte.MinValue", -3S <> System.SByte.MinValue)
PrintResult("-3S <> System.Byte.MaxValue", -3S <> System.Byte.MaxValue)
PrintResult("-3S <> -3S", -3S <> -3S)
PrintResult("-3S <> 24US", -3S <> 24US)
PrintResult("-3S <> -5I", -3S <> -5I)
PrintResult("-3S <> 26UI", -3S <> 26UI)
PrintResult("-3S <> -7L", -3S <> -7L)
PrintResult("-3S <> 28UL", -3S <> 28UL)
PrintResult("-3S <> -9D", -3S <> -9D)
PrintResult("-3S <> 10.0F", -3S <> 10.0F)
PrintResult("-3S <> -11.0R", -3S <> -11.0R)
PrintResult("-3S <> ""12""", -3S <> "12")
PrintResult("-3S <> TypeCode.Double", -3S <> TypeCode.Double)
PrintResult("24US <> False", 24US <> False)
PrintResult("24US <> True", 24US <> True)
PrintResult("24US <> System.SByte.MinValue", 24US <> System.SByte.MinValue)
PrintResult("24US <> System.Byte.MaxValue", 24US <> System.Byte.MaxValue)
PrintResult("24US <> -3S", 24US <> -3S)
PrintResult("24US <> 24US", 24US <> 24US)
PrintResult("24US <> -5I", 24US <> -5I)
PrintResult("24US <> 26UI", 24US <> 26UI)
PrintResult("24US <> -7L", 24US <> -7L)
PrintResult("24US <> 28UL", 24US <> 28UL)
PrintResult("24US <> -9D", 24US <> -9D)
PrintResult("24US <> 10.0F", 24US <> 10.0F)
PrintResult("24US <> -11.0R", 24US <> -11.0R)
PrintResult("24US <> ""12""", 24US <> "12")
PrintResult("24US <> TypeCode.Double", 24US <> TypeCode.Double)
PrintResult("-5I <> False", -5I <> False)
PrintResult("-5I <> True", -5I <> True)
PrintResult("-5I <> System.SByte.MinValue", -5I <> System.SByte.MinValue)
PrintResult("-5I <> System.Byte.MaxValue", -5I <> System.Byte.MaxValue)
PrintResult("-5I <> -3S", -5I <> -3S)
PrintResult("-5I <> 24US", -5I <> 24US)
PrintResult("-5I <> -5I", -5I <> -5I)
PrintResult("-5I <> 26UI", -5I <> 26UI)
PrintResult("-5I <> -7L", -5I <> -7L)
PrintResult("-5I <> 28UL", -5I <> 28UL)
PrintResult("-5I <> -9D", -5I <> -9D)
PrintResult("-5I <> 10.0F", -5I <> 10.0F)
PrintResult("-5I <> -11.0R", -5I <> -11.0R)
PrintResult("-5I <> ""12""", -5I <> "12")
PrintResult("-5I <> TypeCode.Double", -5I <> TypeCode.Double)
PrintResult("26UI <> False", 26UI <> False)
PrintResult("26UI <> True", 26UI <> True)
PrintResult("26UI <> System.SByte.MinValue", 26UI <> System.SByte.MinValue)
PrintResult("26UI <> System.Byte.MaxValue", 26UI <> System.Byte.MaxValue)
PrintResult("26UI <> -3S", 26UI <> -3S)
PrintResult("26UI <> 24US", 26UI <> 24US)
PrintResult("26UI <> -5I", 26UI <> -5I)
PrintResult("26UI <> 26UI", 26UI <> 26UI)
PrintResult("26UI <> -7L", 26UI <> -7L)
PrintResult("26UI <> 28UL", 26UI <> 28UL)
PrintResult("26UI <> -9D", 26UI <> -9D)
PrintResult("26UI <> 10.0F", 26UI <> 10.0F)
PrintResult("26UI <> -11.0R", 26UI <> -11.0R)
PrintResult("26UI <> ""12""", 26UI <> "12")
PrintResult("26UI <> TypeCode.Double", 26UI <> TypeCode.Double)
PrintResult("-7L <> False", -7L <> False)
PrintResult("-7L <> True", -7L <> True)
PrintResult("-7L <> System.SByte.MinValue", -7L <> System.SByte.MinValue)
PrintResult("-7L <> System.Byte.MaxValue", -7L <> System.Byte.MaxValue)
PrintResult("-7L <> -3S", -7L <> -3S)
PrintResult("-7L <> 24US", -7L <> 24US)
PrintResult("-7L <> -5I", -7L <> -5I)
PrintResult("-7L <> 26UI", -7L <> 26UI)
PrintResult("-7L <> -7L", -7L <> -7L)
PrintResult("-7L <> 28UL", -7L <> 28UL)
PrintResult("-7L <> -9D", -7L <> -9D)
PrintResult("-7L <> 10.0F", -7L <> 10.0F)
PrintResult("-7L <> -11.0R", -7L <> -11.0R)
PrintResult("-7L <> ""12""", -7L <> "12")
PrintResult("-7L <> TypeCode.Double", -7L <> TypeCode.Double)
PrintResult("28UL <> False", 28UL <> False)
PrintResult("28UL <> True", 28UL <> True)
PrintResult("28UL <> System.SByte.MinValue", 28UL <> System.SByte.MinValue)
PrintResult("28UL <> System.Byte.MaxValue", 28UL <> System.Byte.MaxValue)
PrintResult("28UL <> -3S", 28UL <> -3S)
PrintResult("28UL <> 24US", 28UL <> 24US)
PrintResult("28UL <> -5I", 28UL <> -5I)
PrintResult("28UL <> 26UI", 28UL <> 26UI)
PrintResult("28UL <> -7L", 28UL <> -7L)
PrintResult("28UL <> 28UL", 28UL <> 28UL)
PrintResult("28UL <> -9D", 28UL <> -9D)
PrintResult("28UL <> 10.0F", 28UL <> 10.0F)
PrintResult("28UL <> -11.0R", 28UL <> -11.0R)
PrintResult("28UL <> ""12""", 28UL <> "12")
PrintResult("28UL <> TypeCode.Double", 28UL <> TypeCode.Double)
PrintResult("-9D <> False", -9D <> False)
PrintResult("-9D <> True", -9D <> True)
PrintResult("-9D <> System.SByte.MinValue", -9D <> System.SByte.MinValue)
PrintResult("-9D <> System.Byte.MaxValue", -9D <> System.Byte.MaxValue)
PrintResult("-9D <> -3S", -9D <> -3S)
PrintResult("-9D <> 24US", -9D <> 24US)
PrintResult("-9D <> -5I", -9D <> -5I)
PrintResult("-9D <> 26UI", -9D <> 26UI)
PrintResult("-9D <> -7L", -9D <> -7L)
PrintResult("-9D <> 28UL", -9D <> 28UL)
PrintResult("-9D <> -9D", -9D <> -9D)
PrintResult("-9D <> 10.0F", -9D <> 10.0F)
PrintResult("-9D <> -11.0R", -9D <> -11.0R)
PrintResult("-9D <> ""12""", -9D <> "12")
PrintResult("-9D <> TypeCode.Double", -9D <> TypeCode.Double)
PrintResult("10.0F <> False", 10.0F <> False)
PrintResult("10.0F <> True", 10.0F <> True)
PrintResult("10.0F <> System.SByte.MinValue", 10.0F <> System.SByte.MinValue)
PrintResult("10.0F <> System.Byte.MaxValue", 10.0F <> System.Byte.MaxValue)
PrintResult("10.0F <> -3S", 10.0F <> -3S)
PrintResult("10.0F <> 24US", 10.0F <> 24US)
PrintResult("10.0F <> -5I", 10.0F <> -5I)
PrintResult("10.0F <> 26UI", 10.0F <> 26UI)
PrintResult("10.0F <> -7L", 10.0F <> -7L)
PrintResult("10.0F <> 28UL", 10.0F <> 28UL)
PrintResult("10.0F <> -9D", 10.0F <> -9D)
PrintResult("10.0F <> 10.0F", 10.0F <> 10.0F)
PrintResult("10.0F <> -11.0R", 10.0F <> -11.0R)
PrintResult("10.0F <> ""12""", 10.0F <> "12")
PrintResult("10.0F <> TypeCode.Double", 10.0F <> TypeCode.Double)
PrintResult("-11.0R <> False", -11.0R <> False)
PrintResult("-11.0R <> True", -11.0R <> True)
PrintResult("-11.0R <> System.SByte.MinValue", -11.0R <> System.SByte.MinValue)
PrintResult("-11.0R <> System.Byte.MaxValue", -11.0R <> System.Byte.MaxValue)
PrintResult("-11.0R <> -3S", -11.0R <> -3S)
PrintResult("-11.0R <> 24US", -11.0R <> 24US)
PrintResult("-11.0R <> -5I", -11.0R <> -5I)
PrintResult("-11.0R <> 26UI", -11.0R <> 26UI)
PrintResult("-11.0R <> -7L", -11.0R <> -7L)
PrintResult("-11.0R <> 28UL", -11.0R <> 28UL)
PrintResult("-11.0R <> -9D", -11.0R <> -9D)
PrintResult("-11.0R <> 10.0F", -11.0R <> 10.0F)
PrintResult("-11.0R <> -11.0R", -11.0R <> -11.0R)
PrintResult("-11.0R <> ""12""", -11.0R <> "12")
PrintResult("-11.0R <> TypeCode.Double", -11.0R <> TypeCode.Double)
PrintResult("""12"" <> False", "12" <> False)
PrintResult("""12"" <> True", "12" <> True)
PrintResult("""12"" <> System.SByte.MinValue", "12" <> System.SByte.MinValue)
PrintResult("""12"" <> System.Byte.MaxValue", "12" <> System.Byte.MaxValue)
PrintResult("""12"" <> -3S", "12" <> -3S)
PrintResult("""12"" <> 24US", "12" <> 24US)
PrintResult("""12"" <> -5I", "12" <> -5I)
PrintResult("""12"" <> 26UI", "12" <> 26UI)
PrintResult("""12"" <> -7L", "12" <> -7L)
PrintResult("""12"" <> 28UL", "12" <> 28UL)
PrintResult("""12"" <> -9D", "12" <> -9D)
PrintResult("""12"" <> 10.0F", "12" <> 10.0F)
PrintResult("""12"" <> -11.0R", "12" <> -11.0R)
PrintResult("""12"" <> ""12""", "12" <> "12")
PrintResult("""12"" <> TypeCode.Double", "12" <> TypeCode.Double)
PrintResult("TypeCode.Double <> False", TypeCode.Double <> False)
PrintResult("TypeCode.Double <> True", TypeCode.Double <> True)
PrintResult("TypeCode.Double <> System.SByte.MinValue", TypeCode.Double <> System.SByte.MinValue)
PrintResult("TypeCode.Double <> System.Byte.MaxValue", TypeCode.Double <> System.Byte.MaxValue)
PrintResult("TypeCode.Double <> -3S", TypeCode.Double <> -3S)
PrintResult("TypeCode.Double <> 24US", TypeCode.Double <> 24US)
PrintResult("TypeCode.Double <> -5I", TypeCode.Double <> -5I)
PrintResult("TypeCode.Double <> 26UI", TypeCode.Double <> 26UI)
PrintResult("TypeCode.Double <> -7L", TypeCode.Double <> -7L)
PrintResult("TypeCode.Double <> 28UL", TypeCode.Double <> 28UL)
PrintResult("TypeCode.Double <> -9D", TypeCode.Double <> -9D)
PrintResult("TypeCode.Double <> 10.0F", TypeCode.Double <> 10.0F)
PrintResult("TypeCode.Double <> -11.0R", TypeCode.Double <> -11.0R)
PrintResult("TypeCode.Double <> ""12""", TypeCode.Double <> "12")
PrintResult("TypeCode.Double <> TypeCode.Double", TypeCode.Double <> TypeCode.Double)
PrintResult("False <= False", False <= False)
PrintResult("False <= True", False <= True)
PrintResult("False <= System.SByte.MinValue", False <= System.SByte.MinValue)
PrintResult("False <= System.Byte.MaxValue", False <= System.Byte.MaxValue)
PrintResult("False <= -3S", False <= -3S)
PrintResult("False <= 24US", False <= 24US)
PrintResult("False <= -5I", False <= -5I)
PrintResult("False <= 26UI", False <= 26UI)
PrintResult("False <= -7L", False <= -7L)
PrintResult("False <= 28UL", False <= 28UL)
PrintResult("False <= -9D", False <= -9D)
PrintResult("False <= 10.0F", False <= 10.0F)
PrintResult("False <= -11.0R", False <= -11.0R)
PrintResult("False <= ""12""", False <= "12")
PrintResult("False <= TypeCode.Double", False <= TypeCode.Double)
PrintResult("True <= False", True <= False)
PrintResult("True <= True", True <= True)
PrintResult("True <= System.SByte.MinValue", True <= System.SByte.MinValue)
PrintResult("True <= System.Byte.MaxValue", True <= System.Byte.MaxValue)
PrintResult("True <= -3S", True <= -3S)
PrintResult("True <= 24US", True <= 24US)
PrintResult("True <= -5I", True <= -5I)
PrintResult("True <= 26UI", True <= 26UI)
PrintResult("True <= -7L", True <= -7L)
PrintResult("True <= 28UL", True <= 28UL)
PrintResult("True <= -9D", True <= -9D)
PrintResult("True <= 10.0F", True <= 10.0F)
PrintResult("True <= -11.0R", True <= -11.0R)
PrintResult("True <= ""12""", True <= "12")
PrintResult("True <= TypeCode.Double", True <= TypeCode.Double)
PrintResult("System.SByte.MinValue <= False", System.SByte.MinValue <= False)
PrintResult("System.SByte.MinValue <= True", System.SByte.MinValue <= True)
PrintResult("System.SByte.MinValue <= System.SByte.MinValue", System.SByte.MinValue <= System.SByte.MinValue)
PrintResult("System.SByte.MinValue <= System.Byte.MaxValue", System.SByte.MinValue <= System.Byte.MaxValue)
PrintResult("System.SByte.MinValue <= -3S", System.SByte.MinValue <= -3S)
PrintResult("System.SByte.MinValue <= 24US", System.SByte.MinValue <= 24US)
PrintResult("System.SByte.MinValue <= -5I", System.SByte.MinValue <= -5I)
PrintResult("System.SByte.MinValue <= 26UI", System.SByte.MinValue <= 26UI)
PrintResult("System.SByte.MinValue <= -7L", System.SByte.MinValue <= -7L)
PrintResult("System.SByte.MinValue <= 28UL", System.SByte.MinValue <= 28UL)
PrintResult("System.SByte.MinValue <= -9D", System.SByte.MinValue <= -9D)
PrintResult("System.SByte.MinValue <= 10.0F", System.SByte.MinValue <= 10.0F)
PrintResult("System.SByte.MinValue <= -11.0R", System.SByte.MinValue <= -11.0R)
PrintResult("System.SByte.MinValue <= ""12""", System.SByte.MinValue <= "12")
PrintResult("System.SByte.MinValue <= TypeCode.Double", System.SByte.MinValue <= TypeCode.Double)
PrintResult("System.Byte.MaxValue <= False", System.Byte.MaxValue <= False)
PrintResult("System.Byte.MaxValue <= True", System.Byte.MaxValue <= True)
PrintResult("System.Byte.MaxValue <= System.SByte.MinValue", System.Byte.MaxValue <= System.SByte.MinValue)
PrintResult("System.Byte.MaxValue <= System.Byte.MaxValue", System.Byte.MaxValue <= System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue <= -3S", System.Byte.MaxValue <= -3S)
PrintResult("System.Byte.MaxValue <= 24US", System.Byte.MaxValue <= 24US)
PrintResult("System.Byte.MaxValue <= -5I", System.Byte.MaxValue <= -5I)
PrintResult("System.Byte.MaxValue <= 26UI", System.Byte.MaxValue <= 26UI)
PrintResult("System.Byte.MaxValue <= -7L", System.Byte.MaxValue <= -7L)
PrintResult("System.Byte.MaxValue <= 28UL", System.Byte.MaxValue <= 28UL)
PrintResult("System.Byte.MaxValue <= -9D", System.Byte.MaxValue <= -9D)
PrintResult("System.Byte.MaxValue <= 10.0F", System.Byte.MaxValue <= 10.0F)
PrintResult("System.Byte.MaxValue <= -11.0R", System.Byte.MaxValue <= -11.0R)
PrintResult("System.Byte.MaxValue <= ""12""", System.Byte.MaxValue <= "12")
PrintResult("System.Byte.MaxValue <= TypeCode.Double", System.Byte.MaxValue <= TypeCode.Double)
PrintResult("-3S <= False", -3S <= False)
PrintResult("-3S <= True", -3S <= True)
PrintResult("-3S <= System.SByte.MinValue", -3S <= System.SByte.MinValue)
PrintResult("-3S <= System.Byte.MaxValue", -3S <= System.Byte.MaxValue)
PrintResult("-3S <= -3S", -3S <= -3S)
PrintResult("-3S <= 24US", -3S <= 24US)
PrintResult("-3S <= -5I", -3S <= -5I)
PrintResult("-3S <= 26UI", -3S <= 26UI)
PrintResult("-3S <= -7L", -3S <= -7L)
PrintResult("-3S <= 28UL", -3S <= 28UL)
PrintResult("-3S <= -9D", -3S <= -9D)
PrintResult("-3S <= 10.0F", -3S <= 10.0F)
PrintResult("-3S <= -11.0R", -3S <= -11.0R)
PrintResult("-3S <= ""12""", -3S <= "12")
PrintResult("-3S <= TypeCode.Double", -3S <= TypeCode.Double)
PrintResult("24US <= False", 24US <= False)
PrintResult("24US <= True", 24US <= True)
PrintResult("24US <= System.SByte.MinValue", 24US <= System.SByte.MinValue)
PrintResult("24US <= System.Byte.MaxValue", 24US <= System.Byte.MaxValue)
PrintResult("24US <= -3S", 24US <= -3S)
PrintResult("24US <= 24US", 24US <= 24US)
PrintResult("24US <= -5I", 24US <= -5I)
PrintResult("24US <= 26UI", 24US <= 26UI)
PrintResult("24US <= -7L", 24US <= -7L)
PrintResult("24US <= 28UL", 24US <= 28UL)
PrintResult("24US <= -9D", 24US <= -9D)
PrintResult("24US <= 10.0F", 24US <= 10.0F)
PrintResult("24US <= -11.0R", 24US <= -11.0R)
PrintResult("24US <= ""12""", 24US <= "12")
PrintResult("24US <= TypeCode.Double", 24US <= TypeCode.Double)
PrintResult("-5I <= False", -5I <= False)
PrintResult("-5I <= True", -5I <= True)
PrintResult("-5I <= System.SByte.MinValue", -5I <= System.SByte.MinValue)
PrintResult("-5I <= System.Byte.MaxValue", -5I <= System.Byte.MaxValue)
PrintResult("-5I <= -3S", -5I <= -3S)
PrintResult("-5I <= 24US", -5I <= 24US)
PrintResult("-5I <= -5I", -5I <= -5I)
PrintResult("-5I <= 26UI", -5I <= 26UI)
PrintResult("-5I <= -7L", -5I <= -7L)
PrintResult("-5I <= 28UL", -5I <= 28UL)
PrintResult("-5I <= -9D", -5I <= -9D)
PrintResult("-5I <= 10.0F", -5I <= 10.0F)
PrintResult("-5I <= -11.0R", -5I <= -11.0R)
PrintResult("-5I <= ""12""", -5I <= "12")
PrintResult("-5I <= TypeCode.Double", -5I <= TypeCode.Double)
PrintResult("26UI <= False", 26UI <= False)
PrintResult("26UI <= True", 26UI <= True)
PrintResult("26UI <= System.SByte.MinValue", 26UI <= System.SByte.MinValue)
PrintResult("26UI <= System.Byte.MaxValue", 26UI <= System.Byte.MaxValue)
PrintResult("26UI <= -3S", 26UI <= -3S)
PrintResult("26UI <= 24US", 26UI <= 24US)
PrintResult("26UI <= -5I", 26UI <= -5I)
PrintResult("26UI <= 26UI", 26UI <= 26UI)
PrintResult("26UI <= -7L", 26UI <= -7L)
PrintResult("26UI <= 28UL", 26UI <= 28UL)
PrintResult("26UI <= -9D", 26UI <= -9D)
PrintResult("26UI <= 10.0F", 26UI <= 10.0F)
PrintResult("26UI <= -11.0R", 26UI <= -11.0R)
PrintResult("26UI <= ""12""", 26UI <= "12")
PrintResult("26UI <= TypeCode.Double", 26UI <= TypeCode.Double)
PrintResult("-7L <= False", -7L <= False)
PrintResult("-7L <= True", -7L <= True)
PrintResult("-7L <= System.SByte.MinValue", -7L <= System.SByte.MinValue)
PrintResult("-7L <= System.Byte.MaxValue", -7L <= System.Byte.MaxValue)
PrintResult("-7L <= -3S", -7L <= -3S)
PrintResult("-7L <= 24US", -7L <= 24US)
PrintResult("-7L <= -5I", -7L <= -5I)
PrintResult("-7L <= 26UI", -7L <= 26UI)
PrintResult("-7L <= -7L", -7L <= -7L)
PrintResult("-7L <= 28UL", -7L <= 28UL)
PrintResult("-7L <= -9D", -7L <= -9D)
PrintResult("-7L <= 10.0F", -7L <= 10.0F)
PrintResult("-7L <= -11.0R", -7L <= -11.0R)
PrintResult("-7L <= ""12""", -7L <= "12")
PrintResult("-7L <= TypeCode.Double", -7L <= TypeCode.Double)
PrintResult("28UL <= False", 28UL <= False)
PrintResult("28UL <= True", 28UL <= True)
PrintResult("28UL <= System.SByte.MinValue", 28UL <= System.SByte.MinValue)
PrintResult("28UL <= System.Byte.MaxValue", 28UL <= System.Byte.MaxValue)
PrintResult("28UL <= -3S", 28UL <= -3S)
PrintResult("28UL <= 24US", 28UL <= 24US)
PrintResult("28UL <= -5I", 28UL <= -5I)
PrintResult("28UL <= 26UI", 28UL <= 26UI)
PrintResult("28UL <= -7L", 28UL <= -7L)
PrintResult("28UL <= 28UL", 28UL <= 28UL)
PrintResult("28UL <= -9D", 28UL <= -9D)
PrintResult("28UL <= 10.0F", 28UL <= 10.0F)
PrintResult("28UL <= -11.0R", 28UL <= -11.0R)
PrintResult("28UL <= ""12""", 28UL <= "12")
PrintResult("28UL <= TypeCode.Double", 28UL <= TypeCode.Double)
PrintResult("-9D <= False", -9D <= False)
PrintResult("-9D <= True", -9D <= True)
PrintResult("-9D <= System.SByte.MinValue", -9D <= System.SByte.MinValue)
PrintResult("-9D <= System.Byte.MaxValue", -9D <= System.Byte.MaxValue)
PrintResult("-9D <= -3S", -9D <= -3S)
PrintResult("-9D <= 24US", -9D <= 24US)
PrintResult("-9D <= -5I", -9D <= -5I)
PrintResult("-9D <= 26UI", -9D <= 26UI)
PrintResult("-9D <= -7L", -9D <= -7L)
PrintResult("-9D <= 28UL", -9D <= 28UL)
PrintResult("-9D <= -9D", -9D <= -9D)
PrintResult("-9D <= 10.0F", -9D <= 10.0F)
PrintResult("-9D <= -11.0R", -9D <= -11.0R)
PrintResult("-9D <= ""12""", -9D <= "12")
PrintResult("-9D <= TypeCode.Double", -9D <= TypeCode.Double)
PrintResult("10.0F <= False", 10.0F <= False)
PrintResult("10.0F <= True", 10.0F <= True)
PrintResult("10.0F <= System.SByte.MinValue", 10.0F <= System.SByte.MinValue)
PrintResult("10.0F <= System.Byte.MaxValue", 10.0F <= System.Byte.MaxValue)
PrintResult("10.0F <= -3S", 10.0F <= -3S)
PrintResult("10.0F <= 24US", 10.0F <= 24US)
PrintResult("10.0F <= -5I", 10.0F <= -5I)
PrintResult("10.0F <= 26UI", 10.0F <= 26UI)
PrintResult("10.0F <= -7L", 10.0F <= -7L)
PrintResult("10.0F <= 28UL", 10.0F <= 28UL)
PrintResult("10.0F <= -9D", 10.0F <= -9D)
PrintResult("10.0F <= 10.0F", 10.0F <= 10.0F)
PrintResult("10.0F <= -11.0R", 10.0F <= -11.0R)
PrintResult("10.0F <= ""12""", 10.0F <= "12")
PrintResult("10.0F <= TypeCode.Double", 10.0F <= TypeCode.Double)
PrintResult("-11.0R <= False", -11.0R <= False)
PrintResult("-11.0R <= True", -11.0R <= True)
PrintResult("-11.0R <= System.SByte.MinValue", -11.0R <= System.SByte.MinValue)
PrintResult("-11.0R <= System.Byte.MaxValue", -11.0R <= System.Byte.MaxValue)
PrintResult("-11.0R <= -3S", -11.0R <= -3S)
PrintResult("-11.0R <= 24US", -11.0R <= 24US)
PrintResult("-11.0R <= -5I", -11.0R <= -5I)
PrintResult("-11.0R <= 26UI", -11.0R <= 26UI)
PrintResult("-11.0R <= -7L", -11.0R <= -7L)
PrintResult("-11.0R <= 28UL", -11.0R <= 28UL)
PrintResult("-11.0R <= -9D", -11.0R <= -9D)
PrintResult("-11.0R <= 10.0F", -11.0R <= 10.0F)
PrintResult("-11.0R <= -11.0R", -11.0R <= -11.0R)
PrintResult("-11.0R <= ""12""", -11.0R <= "12")
PrintResult("-11.0R <= TypeCode.Double", -11.0R <= TypeCode.Double)
PrintResult("""12"" <= False", "12" <= False)
PrintResult("""12"" <= True", "12" <= True)
PrintResult("""12"" <= System.SByte.MinValue", "12" <= System.SByte.MinValue)
PrintResult("""12"" <= System.Byte.MaxValue", "12" <= System.Byte.MaxValue)
PrintResult("""12"" <= -3S", "12" <= -3S)
PrintResult("""12"" <= 24US", "12" <= 24US)
PrintResult("""12"" <= -5I", "12" <= -5I)
PrintResult("""12"" <= 26UI", "12" <= 26UI)
PrintResult("""12"" <= -7L", "12" <= -7L)
PrintResult("""12"" <= 28UL", "12" <= 28UL)
PrintResult("""12"" <= -9D", "12" <= -9D)
PrintResult("""12"" <= 10.0F", "12" <= 10.0F)
PrintResult("""12"" <= -11.0R", "12" <= -11.0R)
PrintResult("""12"" <= ""12""", "12" <= "12")
PrintResult("""12"" <= TypeCode.Double", "12" <= TypeCode.Double)
PrintResult("TypeCode.Double <= False", TypeCode.Double <= False)
PrintResult("TypeCode.Double <= True", TypeCode.Double <= True)
PrintResult("TypeCode.Double <= System.SByte.MinValue", TypeCode.Double <= System.SByte.MinValue)
PrintResult("TypeCode.Double <= System.Byte.MaxValue", TypeCode.Double <= System.Byte.MaxValue)
PrintResult("TypeCode.Double <= -3S", TypeCode.Double <= -3S)
PrintResult("TypeCode.Double <= 24US", TypeCode.Double <= 24US)
PrintResult("TypeCode.Double <= -5I", TypeCode.Double <= -5I)
PrintResult("TypeCode.Double <= 26UI", TypeCode.Double <= 26UI)
PrintResult("TypeCode.Double <= -7L", TypeCode.Double <= -7L)
PrintResult("TypeCode.Double <= 28UL", TypeCode.Double <= 28UL)
PrintResult("TypeCode.Double <= -9D", TypeCode.Double <= -9D)
PrintResult("TypeCode.Double <= 10.0F", TypeCode.Double <= 10.0F)
PrintResult("TypeCode.Double <= -11.0R", TypeCode.Double <= -11.0R)
PrintResult("TypeCode.Double <= ""12""", TypeCode.Double <= "12")
PrintResult("TypeCode.Double <= TypeCode.Double", TypeCode.Double <= TypeCode.Double)
PrintResult("False >= False", False >= False)
PrintResult("False >= True", False >= True)
PrintResult("False >= System.SByte.MinValue", False >= System.SByte.MinValue)
PrintResult("False >= System.Byte.MaxValue", False >= System.Byte.MaxValue)
PrintResult("False >= -3S", False >= -3S)
PrintResult("False >= 24US", False >= 24US)
PrintResult("False >= -5I", False >= -5I)
PrintResult("False >= 26UI", False >= 26UI)
PrintResult("False >= -7L", False >= -7L)
PrintResult("False >= 28UL", False >= 28UL)
PrintResult("False >= -9D", False >= -9D)
PrintResult("False >= 10.0F", False >= 10.0F)
PrintResult("False >= -11.0R", False >= -11.0R)
PrintResult("False >= ""12""", False >= "12")
PrintResult("False >= TypeCode.Double", False >= TypeCode.Double)
PrintResult("True >= False", True >= False)
PrintResult("True >= True", True >= True)
PrintResult("True >= System.SByte.MinValue", True >= System.SByte.MinValue)
PrintResult("True >= System.Byte.MaxValue", True >= System.Byte.MaxValue)
PrintResult("True >= -3S", True >= -3S)
PrintResult("True >= 24US", True >= 24US)
PrintResult("True >= -5I", True >= -5I)
PrintResult("True >= 26UI", True >= 26UI)
PrintResult("True >= -7L", True >= -7L)
PrintResult("True >= 28UL", True >= 28UL)
PrintResult("True >= -9D", True >= -9D)
PrintResult("True >= 10.0F", True >= 10.0F)
PrintResult("True >= -11.0R", True >= -11.0R)
PrintResult("True >= ""12""", True >= "12")
PrintResult("True >= TypeCode.Double", True >= TypeCode.Double)
PrintResult("System.SByte.MinValue >= False", System.SByte.MinValue >= False)
PrintResult("System.SByte.MinValue >= True", System.SByte.MinValue >= True)
PrintResult("System.SByte.MinValue >= System.SByte.MinValue", System.SByte.MinValue >= System.SByte.MinValue)
PrintResult("System.SByte.MinValue >= System.Byte.MaxValue", System.SByte.MinValue >= System.Byte.MaxValue)
PrintResult("System.SByte.MinValue >= -3S", System.SByte.MinValue >= -3S)
PrintResult("System.SByte.MinValue >= 24US", System.SByte.MinValue >= 24US)
PrintResult("System.SByte.MinValue >= -5I", System.SByte.MinValue >= -5I)
PrintResult("System.SByte.MinValue >= 26UI", System.SByte.MinValue >= 26UI)
PrintResult("System.SByte.MinValue >= -7L", System.SByte.MinValue >= -7L)
PrintResult("System.SByte.MinValue >= 28UL", System.SByte.MinValue >= 28UL)
PrintResult("System.SByte.MinValue >= -9D", System.SByte.MinValue >= -9D)
PrintResult("System.SByte.MinValue >= 10.0F", System.SByte.MinValue >= 10.0F)
PrintResult("System.SByte.MinValue >= -11.0R", System.SByte.MinValue >= -11.0R)
PrintResult("System.SByte.MinValue >= ""12""", System.SByte.MinValue >= "12")
PrintResult("System.SByte.MinValue >= TypeCode.Double", System.SByte.MinValue >= TypeCode.Double)
PrintResult("System.Byte.MaxValue >= False", System.Byte.MaxValue >= False)
PrintResult("System.Byte.MaxValue >= True", System.Byte.MaxValue >= True)
PrintResult("System.Byte.MaxValue >= System.SByte.MinValue", System.Byte.MaxValue >= System.SByte.MinValue)
PrintResult("System.Byte.MaxValue >= System.Byte.MaxValue", System.Byte.MaxValue >= System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue >= -3S", System.Byte.MaxValue >= -3S)
PrintResult("System.Byte.MaxValue >= 24US", System.Byte.MaxValue >= 24US)
PrintResult("System.Byte.MaxValue >= -5I", System.Byte.MaxValue >= -5I)
PrintResult("System.Byte.MaxValue >= 26UI", System.Byte.MaxValue >= 26UI)
PrintResult("System.Byte.MaxValue >= -7L", System.Byte.MaxValue >= -7L)
PrintResult("System.Byte.MaxValue >= 28UL", System.Byte.MaxValue >= 28UL)
PrintResult("System.Byte.MaxValue >= -9D", System.Byte.MaxValue >= -9D)
PrintResult("System.Byte.MaxValue >= 10.0F", System.Byte.MaxValue >= 10.0F)
PrintResult("System.Byte.MaxValue >= -11.0R", System.Byte.MaxValue >= -11.0R)
PrintResult("System.Byte.MaxValue >= ""12""", System.Byte.MaxValue >= "12")
PrintResult("System.Byte.MaxValue >= TypeCode.Double", System.Byte.MaxValue >= TypeCode.Double)
PrintResult("-3S >= False", -3S >= False)
PrintResult("-3S >= True", -3S >= True)
PrintResult("-3S >= System.SByte.MinValue", -3S >= System.SByte.MinValue)
PrintResult("-3S >= System.Byte.MaxValue", -3S >= System.Byte.MaxValue)
PrintResult("-3S >= -3S", -3S >= -3S)
PrintResult("-3S >= 24US", -3S >= 24US)
PrintResult("-3S >= -5I", -3S >= -5I)
PrintResult("-3S >= 26UI", -3S >= 26UI)
PrintResult("-3S >= -7L", -3S >= -7L)
PrintResult("-3S >= 28UL", -3S >= 28UL)
PrintResult("-3S >= -9D", -3S >= -9D)
PrintResult("-3S >= 10.0F", -3S >= 10.0F)
PrintResult("-3S >= -11.0R", -3S >= -11.0R)
PrintResult("-3S >= ""12""", -3S >= "12")
PrintResult("-3S >= TypeCode.Double", -3S >= TypeCode.Double)
PrintResult("24US >= False", 24US >= False)
PrintResult("24US >= True", 24US >= True)
PrintResult("24US >= System.SByte.MinValue", 24US >= System.SByte.MinValue)
PrintResult("24US >= System.Byte.MaxValue", 24US >= System.Byte.MaxValue)
PrintResult("24US >= -3S", 24US >= -3S)
PrintResult("24US >= 24US", 24US >= 24US)
PrintResult("24US >= -5I", 24US >= -5I)
PrintResult("24US >= 26UI", 24US >= 26UI)
PrintResult("24US >= -7L", 24US >= -7L)
PrintResult("24US >= 28UL", 24US >= 28UL)
PrintResult("24US >= -9D", 24US >= -9D)
PrintResult("24US >= 10.0F", 24US >= 10.0F)
PrintResult("24US >= -11.0R", 24US >= -11.0R)
PrintResult("24US >= ""12""", 24US >= "12")
PrintResult("24US >= TypeCode.Double", 24US >= TypeCode.Double)
PrintResult("-5I >= False", -5I >= False)
PrintResult("-5I >= True", -5I >= True)
PrintResult("-5I >= System.SByte.MinValue", -5I >= System.SByte.MinValue)
PrintResult("-5I >= System.Byte.MaxValue", -5I >= System.Byte.MaxValue)
PrintResult("-5I >= -3S", -5I >= -3S)
PrintResult("-5I >= 24US", -5I >= 24US)
PrintResult("-5I >= -5I", -5I >= -5I)
PrintResult("-5I >= 26UI", -5I >= 26UI)
PrintResult("-5I >= -7L", -5I >= -7L)
PrintResult("-5I >= 28UL", -5I >= 28UL)
PrintResult("-5I >= -9D", -5I >= -9D)
PrintResult("-5I >= 10.0F", -5I >= 10.0F)
PrintResult("-5I >= -11.0R", -5I >= -11.0R)
PrintResult("-5I >= ""12""", -5I >= "12")
PrintResult("-5I >= TypeCode.Double", -5I >= TypeCode.Double)
PrintResult("26UI >= False", 26UI >= False)
PrintResult("26UI >= True", 26UI >= True)
PrintResult("26UI >= System.SByte.MinValue", 26UI >= System.SByte.MinValue)
PrintResult("26UI >= System.Byte.MaxValue", 26UI >= System.Byte.MaxValue)
PrintResult("26UI >= -3S", 26UI >= -3S)
PrintResult("26UI >= 24US", 26UI >= 24US)
PrintResult("26UI >= -5I", 26UI >= -5I)
PrintResult("26UI >= 26UI", 26UI >= 26UI)
PrintResult("26UI >= -7L", 26UI >= -7L)
PrintResult("26UI >= 28UL", 26UI >= 28UL)
PrintResult("26UI >= -9D", 26UI >= -9D)
PrintResult("26UI >= 10.0F", 26UI >= 10.0F)
PrintResult("26UI >= -11.0R", 26UI >= -11.0R)
PrintResult("26UI >= ""12""", 26UI >= "12")
PrintResult("26UI >= TypeCode.Double", 26UI >= TypeCode.Double)
PrintResult("-7L >= False", -7L >= False)
PrintResult("-7L >= True", -7L >= True)
PrintResult("-7L >= System.SByte.MinValue", -7L >= System.SByte.MinValue)
PrintResult("-7L >= System.Byte.MaxValue", -7L >= System.Byte.MaxValue)
PrintResult("-7L >= -3S", -7L >= -3S)
PrintResult("-7L >= 24US", -7L >= 24US)
PrintResult("-7L >= -5I", -7L >= -5I)
PrintResult("-7L >= 26UI", -7L >= 26UI)
PrintResult("-7L >= -7L", -7L >= -7L)
PrintResult("-7L >= 28UL", -7L >= 28UL)
PrintResult("-7L >= -9D", -7L >= -9D)
PrintResult("-7L >= 10.0F", -7L >= 10.0F)
PrintResult("-7L >= -11.0R", -7L >= -11.0R)
PrintResult("-7L >= ""12""", -7L >= "12")
PrintResult("-7L >= TypeCode.Double", -7L >= TypeCode.Double)
PrintResult("28UL >= False", 28UL >= False)
PrintResult("28UL >= True", 28UL >= True)
PrintResult("28UL >= System.SByte.MinValue", 28UL >= System.SByte.MinValue)
PrintResult("28UL >= System.Byte.MaxValue", 28UL >= System.Byte.MaxValue)
PrintResult("28UL >= -3S", 28UL >= -3S)
PrintResult("28UL >= 24US", 28UL >= 24US)
PrintResult("28UL >= -5I", 28UL >= -5I)
PrintResult("28UL >= 26UI", 28UL >= 26UI)
PrintResult("28UL >= -7L", 28UL >= -7L)
PrintResult("28UL >= 28UL", 28UL >= 28UL)
PrintResult("28UL >= -9D", 28UL >= -9D)
PrintResult("28UL >= 10.0F", 28UL >= 10.0F)
PrintResult("28UL >= -11.0R", 28UL >= -11.0R)
PrintResult("28UL >= ""12""", 28UL >= "12")
PrintResult("28UL >= TypeCode.Double", 28UL >= TypeCode.Double)
PrintResult("-9D >= False", -9D >= False)
PrintResult("-9D >= True", -9D >= True)
PrintResult("-9D >= System.SByte.MinValue", -9D >= System.SByte.MinValue)
PrintResult("-9D >= System.Byte.MaxValue", -9D >= System.Byte.MaxValue)
PrintResult("-9D >= -3S", -9D >= -3S)
PrintResult("-9D >= 24US", -9D >= 24US)
PrintResult("-9D >= -5I", -9D >= -5I)
PrintResult("-9D >= 26UI", -9D >= 26UI)
PrintResult("-9D >= -7L", -9D >= -7L)
PrintResult("-9D >= 28UL", -9D >= 28UL)
PrintResult("-9D >= -9D", -9D >= -9D)
PrintResult("-9D >= 10.0F", -9D >= 10.0F)
PrintResult("-9D >= -11.0R", -9D >= -11.0R)
PrintResult("-9D >= ""12""", -9D >= "12")
PrintResult("-9D >= TypeCode.Double", -9D >= TypeCode.Double)
PrintResult("10.0F >= False", 10.0F >= False)
PrintResult("10.0F >= True", 10.0F >= True)
PrintResult("10.0F >= System.SByte.MinValue", 10.0F >= System.SByte.MinValue)
PrintResult("10.0F >= System.Byte.MaxValue", 10.0F >= System.Byte.MaxValue)
PrintResult("10.0F >= -3S", 10.0F >= -3S)
PrintResult("10.0F >= 24US", 10.0F >= 24US)
PrintResult("10.0F >= -5I", 10.0F >= -5I)
PrintResult("10.0F >= 26UI", 10.0F >= 26UI)
PrintResult("10.0F >= -7L", 10.0F >= -7L)
PrintResult("10.0F >= 28UL", 10.0F >= 28UL)
PrintResult("10.0F >= -9D", 10.0F >= -9D)
PrintResult("10.0F >= 10.0F", 10.0F >= 10.0F)
PrintResult("10.0F >= -11.0R", 10.0F >= -11.0R)
PrintResult("10.0F >= ""12""", 10.0F >= "12")
PrintResult("10.0F >= TypeCode.Double", 10.0F >= TypeCode.Double)
PrintResult("-11.0R >= False", -11.0R >= False)
PrintResult("-11.0R >= True", -11.0R >= True)
PrintResult("-11.0R >= System.SByte.MinValue", -11.0R >= System.SByte.MinValue)
PrintResult("-11.0R >= System.Byte.MaxValue", -11.0R >= System.Byte.MaxValue)
PrintResult("-11.0R >= -3S", -11.0R >= -3S)
PrintResult("-11.0R >= 24US", -11.0R >= 24US)
PrintResult("-11.0R >= -5I", -11.0R >= -5I)
PrintResult("-11.0R >= 26UI", -11.0R >= 26UI)
PrintResult("-11.0R >= -7L", -11.0R >= -7L)
PrintResult("-11.0R >= 28UL", -11.0R >= 28UL)
PrintResult("-11.0R >= -9D", -11.0R >= -9D)
PrintResult("-11.0R >= 10.0F", -11.0R >= 10.0F)
PrintResult("-11.0R >= -11.0R", -11.0R >= -11.0R)
PrintResult("-11.0R >= ""12""", -11.0R >= "12")
PrintResult("-11.0R >= TypeCode.Double", -11.0R >= TypeCode.Double)
PrintResult("""12"" >= False", "12" >= False)
PrintResult("""12"" >= True", "12" >= True)
PrintResult("""12"" >= System.SByte.MinValue", "12" >= System.SByte.MinValue)
PrintResult("""12"" >= System.Byte.MaxValue", "12" >= System.Byte.MaxValue)
PrintResult("""12"" >= -3S", "12" >= -3S)
PrintResult("""12"" >= 24US", "12" >= 24US)
PrintResult("""12"" >= -5I", "12" >= -5I)
PrintResult("""12"" >= 26UI", "12" >= 26UI)
PrintResult("""12"" >= -7L", "12" >= -7L)
PrintResult("""12"" >= 28UL", "12" >= 28UL)
PrintResult("""12"" >= -9D", "12" >= -9D)
PrintResult("""12"" >= 10.0F", "12" >= 10.0F)
PrintResult("""12"" >= -11.0R", "12" >= -11.0R)
PrintResult("""12"" >= ""12""", "12" >= "12")
PrintResult("""12"" >= TypeCode.Double", "12" >= TypeCode.Double)
PrintResult("TypeCode.Double >= False", TypeCode.Double >= False)
PrintResult("TypeCode.Double >= True", TypeCode.Double >= True)
PrintResult("TypeCode.Double >= System.SByte.MinValue", TypeCode.Double >= System.SByte.MinValue)
PrintResult("TypeCode.Double >= System.Byte.MaxValue", TypeCode.Double >= System.Byte.MaxValue)
PrintResult("TypeCode.Double >= -3S", TypeCode.Double >= -3S)
PrintResult("TypeCode.Double >= 24US", TypeCode.Double >= 24US)
PrintResult("TypeCode.Double >= -5I", TypeCode.Double >= -5I)
PrintResult("TypeCode.Double >= 26UI", TypeCode.Double >= 26UI)
PrintResult("TypeCode.Double >= -7L", TypeCode.Double >= -7L)
PrintResult("TypeCode.Double >= 28UL", TypeCode.Double >= 28UL)
PrintResult("TypeCode.Double >= -9D", TypeCode.Double >= -9D)
PrintResult("TypeCode.Double >= 10.0F", TypeCode.Double >= 10.0F)
PrintResult("TypeCode.Double >= -11.0R", TypeCode.Double >= -11.0R)
PrintResult("TypeCode.Double >= ""12""", TypeCode.Double >= "12")
PrintResult("TypeCode.Double >= TypeCode.Double", TypeCode.Double >= TypeCode.Double)
PrintResult("False < False", False < False)
PrintResult("False < True", False < True)
PrintResult("False < System.SByte.MinValue", False < System.SByte.MinValue)
PrintResult("False < System.Byte.MaxValue", False < System.Byte.MaxValue)
PrintResult("False < -3S", False < -3S)
PrintResult("False < 24US", False < 24US)
PrintResult("False < -5I", False < -5I)
PrintResult("False < 26UI", False < 26UI)
PrintResult("False < -7L", False < -7L)
PrintResult("False < 28UL", False < 28UL)
PrintResult("False < -9D", False < -9D)
PrintResult("False < 10.0F", False < 10.0F)
PrintResult("False < -11.0R", False < -11.0R)
PrintResult("False < ""12""", False < "12")
PrintResult("False < TypeCode.Double", False < TypeCode.Double)
PrintResult("True < False", True < False)
PrintResult("True < True", True < True)
PrintResult("True < System.SByte.MinValue", True < System.SByte.MinValue)
PrintResult("True < System.Byte.MaxValue", True < System.Byte.MaxValue)
PrintResult("True < -3S", True < -3S)
PrintResult("True < 24US", True < 24US)
PrintResult("True < -5I", True < -5I)
PrintResult("True < 26UI", True < 26UI)
PrintResult("True < -7L", True < -7L)
PrintResult("True < 28UL", True < 28UL)
PrintResult("True < -9D", True < -9D)
PrintResult("True < 10.0F", True < 10.0F)
PrintResult("True < -11.0R", True < -11.0R)
PrintResult("True < ""12""", True < "12")
PrintResult("True < TypeCode.Double", True < TypeCode.Double)
PrintResult("System.SByte.MinValue < False", System.SByte.MinValue < False)
PrintResult("System.SByte.MinValue < True", System.SByte.MinValue < True)
PrintResult("System.SByte.MinValue < System.SByte.MinValue", System.SByte.MinValue < System.SByte.MinValue)
PrintResult("System.SByte.MinValue < System.Byte.MaxValue", System.SByte.MinValue < System.Byte.MaxValue)
PrintResult("System.SByte.MinValue < -3S", System.SByte.MinValue < -3S)
PrintResult("System.SByte.MinValue < 24US", System.SByte.MinValue < 24US)
PrintResult("System.SByte.MinValue < -5I", System.SByte.MinValue < -5I)
PrintResult("System.SByte.MinValue < 26UI", System.SByte.MinValue < 26UI)
PrintResult("System.SByte.MinValue < -7L", System.SByte.MinValue < -7L)
PrintResult("System.SByte.MinValue < 28UL", System.SByte.MinValue < 28UL)
PrintResult("System.SByte.MinValue < -9D", System.SByte.MinValue < -9D)
PrintResult("System.SByte.MinValue < 10.0F", System.SByte.MinValue < 10.0F)
PrintResult("System.SByte.MinValue < -11.0R", System.SByte.MinValue < -11.0R)
PrintResult("System.SByte.MinValue < ""12""", System.SByte.MinValue < "12")
PrintResult("System.SByte.MinValue < TypeCode.Double", System.SByte.MinValue < TypeCode.Double)
PrintResult("System.Byte.MaxValue < False", System.Byte.MaxValue < False)
PrintResult("System.Byte.MaxValue < True", System.Byte.MaxValue < True)
PrintResult("System.Byte.MaxValue < System.SByte.MinValue", System.Byte.MaxValue < System.SByte.MinValue)
PrintResult("System.Byte.MaxValue < System.Byte.MaxValue", System.Byte.MaxValue < System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue < -3S", System.Byte.MaxValue < -3S)
PrintResult("System.Byte.MaxValue < 24US", System.Byte.MaxValue < 24US)
PrintResult("System.Byte.MaxValue < -5I", System.Byte.MaxValue < -5I)
PrintResult("System.Byte.MaxValue < 26UI", System.Byte.MaxValue < 26UI)
PrintResult("System.Byte.MaxValue < -7L", System.Byte.MaxValue < -7L)
PrintResult("System.Byte.MaxValue < 28UL", System.Byte.MaxValue < 28UL)
PrintResult("System.Byte.MaxValue < -9D", System.Byte.MaxValue < -9D)
PrintResult("System.Byte.MaxValue < 10.0F", System.Byte.MaxValue < 10.0F)
PrintResult("System.Byte.MaxValue < -11.0R", System.Byte.MaxValue < -11.0R)
PrintResult("System.Byte.MaxValue < ""12""", System.Byte.MaxValue < "12")
PrintResult("System.Byte.MaxValue < TypeCode.Double", System.Byte.MaxValue < TypeCode.Double)
PrintResult("-3S < False", -3S < False)
PrintResult("-3S < True", -3S < True)
PrintResult("-3S < System.SByte.MinValue", -3S < System.SByte.MinValue)
PrintResult("-3S < System.Byte.MaxValue", -3S < System.Byte.MaxValue)
PrintResult("-3S < -3S", -3S < -3S)
PrintResult("-3S < 24US", -3S < 24US)
PrintResult("-3S < -5I", -3S < -5I)
PrintResult("-3S < 26UI", -3S < 26UI)
PrintResult("-3S < -7L", -3S < -7L)
PrintResult("-3S < 28UL", -3S < 28UL)
PrintResult("-3S < -9D", -3S < -9D)
PrintResult("-3S < 10.0F", -3S < 10.0F)
PrintResult("-3S < -11.0R", -3S < -11.0R)
PrintResult("-3S < ""12""", -3S < "12")
PrintResult("-3S < TypeCode.Double", -3S < TypeCode.Double)
PrintResult("24US < False", 24US < False)
PrintResult("24US < True", 24US < True)
PrintResult("24US < System.SByte.MinValue", 24US < System.SByte.MinValue)
PrintResult("24US < System.Byte.MaxValue", 24US < System.Byte.MaxValue)
PrintResult("24US < -3S", 24US < -3S)
PrintResult("24US < 24US", 24US < 24US)
PrintResult("24US < -5I", 24US < -5I)
PrintResult("24US < 26UI", 24US < 26UI)
PrintResult("24US < -7L", 24US < -7L)
PrintResult("24US < 28UL", 24US < 28UL)
PrintResult("24US < -9D", 24US < -9D)
PrintResult("24US < 10.0F", 24US < 10.0F)
PrintResult("24US < -11.0R", 24US < -11.0R)
PrintResult("24US < ""12""", 24US < "12")
PrintResult("24US < TypeCode.Double", 24US < TypeCode.Double)
PrintResult("-5I < False", -5I < False)
PrintResult("-5I < True", -5I < True)
PrintResult("-5I < System.SByte.MinValue", -5I < System.SByte.MinValue)
PrintResult("-5I < System.Byte.MaxValue", -5I < System.Byte.MaxValue)
PrintResult("-5I < -3S", -5I < -3S)
PrintResult("-5I < 24US", -5I < 24US)
PrintResult("-5I < -5I", -5I < -5I)
PrintResult("-5I < 26UI", -5I < 26UI)
PrintResult("-5I < -7L", -5I < -7L)
PrintResult("-5I < 28UL", -5I < 28UL)
PrintResult("-5I < -9D", -5I < -9D)
PrintResult("-5I < 10.0F", -5I < 10.0F)
PrintResult("-5I < -11.0R", -5I < -11.0R)
PrintResult("-5I < ""12""", -5I < "12")
PrintResult("-5I < TypeCode.Double", -5I < TypeCode.Double)
PrintResult("26UI < False", 26UI < False)
PrintResult("26UI < True", 26UI < True)
PrintResult("26UI < System.SByte.MinValue", 26UI < System.SByte.MinValue)
PrintResult("26UI < System.Byte.MaxValue", 26UI < System.Byte.MaxValue)
PrintResult("26UI < -3S", 26UI < -3S)
PrintResult("26UI < 24US", 26UI < 24US)
PrintResult("26UI < -5I", 26UI < -5I)
PrintResult("26UI < 26UI", 26UI < 26UI)
PrintResult("26UI < -7L", 26UI < -7L)
PrintResult("26UI < 28UL", 26UI < 28UL)
PrintResult("26UI < -9D", 26UI < -9D)
PrintResult("26UI < 10.0F", 26UI < 10.0F)
PrintResult("26UI < -11.0R", 26UI < -11.0R)
PrintResult("26UI < ""12""", 26UI < "12")
PrintResult("26UI < TypeCode.Double", 26UI < TypeCode.Double)
PrintResult("-7L < False", -7L < False)
PrintResult("-7L < True", -7L < True)
PrintResult("-7L < System.SByte.MinValue", -7L < System.SByte.MinValue)
PrintResult("-7L < System.Byte.MaxValue", -7L < System.Byte.MaxValue)
PrintResult("-7L < -3S", -7L < -3S)
PrintResult("-7L < 24US", -7L < 24US)
PrintResult("-7L < -5I", -7L < -5I)
PrintResult("-7L < 26UI", -7L < 26UI)
PrintResult("-7L < -7L", -7L < -7L)
PrintResult("-7L < 28UL", -7L < 28UL)
PrintResult("-7L < -9D", -7L < -9D)
PrintResult("-7L < 10.0F", -7L < 10.0F)
PrintResult("-7L < -11.0R", -7L < -11.0R)
PrintResult("-7L < ""12""", -7L < "12")
PrintResult("-7L < TypeCode.Double", -7L < TypeCode.Double)
PrintResult("28UL < False", 28UL < False)
PrintResult("28UL < True", 28UL < True)
PrintResult("28UL < System.SByte.MinValue", 28UL < System.SByte.MinValue)
PrintResult("28UL < System.Byte.MaxValue", 28UL < System.Byte.MaxValue)
PrintResult("28UL < -3S", 28UL < -3S)
PrintResult("28UL < 24US", 28UL < 24US)
PrintResult("28UL < -5I", 28UL < -5I)
PrintResult("28UL < 26UI", 28UL < 26UI)
PrintResult("28UL < -7L", 28UL < -7L)
PrintResult("28UL < 28UL", 28UL < 28UL)
PrintResult("28UL < -9D", 28UL < -9D)
PrintResult("28UL < 10.0F", 28UL < 10.0F)
PrintResult("28UL < -11.0R", 28UL < -11.0R)
PrintResult("28UL < ""12""", 28UL < "12")
PrintResult("28UL < TypeCode.Double", 28UL < TypeCode.Double)
PrintResult("-9D < False", -9D < False)
PrintResult("-9D < True", -9D < True)
PrintResult("-9D < System.SByte.MinValue", -9D < System.SByte.MinValue)
PrintResult("-9D < System.Byte.MaxValue", -9D < System.Byte.MaxValue)
PrintResult("-9D < -3S", -9D < -3S)
PrintResult("-9D < 24US", -9D < 24US)
PrintResult("-9D < -5I", -9D < -5I)
PrintResult("-9D < 26UI", -9D < 26UI)
PrintResult("-9D < -7L", -9D < -7L)
PrintResult("-9D < 28UL", -9D < 28UL)
PrintResult("-9D < -9D", -9D < -9D)
PrintResult("-9D < 10.0F", -9D < 10.0F)
PrintResult("-9D < -11.0R", -9D < -11.0R)
PrintResult("-9D < ""12""", -9D < "12")
PrintResult("-9D < TypeCode.Double", -9D < TypeCode.Double)
PrintResult("10.0F < False", 10.0F < False)
PrintResult("10.0F < True", 10.0F < True)
PrintResult("10.0F < System.SByte.MinValue", 10.0F < System.SByte.MinValue)
PrintResult("10.0F < System.Byte.MaxValue", 10.0F < System.Byte.MaxValue)
PrintResult("10.0F < -3S", 10.0F < -3S)
PrintResult("10.0F < 24US", 10.0F < 24US)
PrintResult("10.0F < -5I", 10.0F < -5I)
PrintResult("10.0F < 26UI", 10.0F < 26UI)
PrintResult("10.0F < -7L", 10.0F < -7L)
PrintResult("10.0F < 28UL", 10.0F < 28UL)
PrintResult("10.0F < -9D", 10.0F < -9D)
PrintResult("10.0F < 10.0F", 10.0F < 10.0F)
PrintResult("10.0F < -11.0R", 10.0F < -11.0R)
PrintResult("10.0F < ""12""", 10.0F < "12")
PrintResult("10.0F < TypeCode.Double", 10.0F < TypeCode.Double)
PrintResult("-11.0R < False", -11.0R < False)
PrintResult("-11.0R < True", -11.0R < True)
PrintResult("-11.0R < System.SByte.MinValue", -11.0R < System.SByte.MinValue)
PrintResult("-11.0R < System.Byte.MaxValue", -11.0R < System.Byte.MaxValue)
PrintResult("-11.0R < -3S", -11.0R < -3S)
PrintResult("-11.0R < 24US", -11.0R < 24US)
PrintResult("-11.0R < -5I", -11.0R < -5I)
PrintResult("-11.0R < 26UI", -11.0R < 26UI)
PrintResult("-11.0R < -7L", -11.0R < -7L)
PrintResult("-11.0R < 28UL", -11.0R < 28UL)
PrintResult("-11.0R < -9D", -11.0R < -9D)
PrintResult("-11.0R < 10.0F", -11.0R < 10.0F)
PrintResult("-11.0R < -11.0R", -11.0R < -11.0R)
PrintResult("-11.0R < ""12""", -11.0R < "12")
PrintResult("-11.0R < TypeCode.Double", -11.0R < TypeCode.Double)
PrintResult("""12"" < False", "12" < False)
PrintResult("""12"" < True", "12" < True)
PrintResult("""12"" < System.SByte.MinValue", "12" < System.SByte.MinValue)
PrintResult("""12"" < System.Byte.MaxValue", "12" < System.Byte.MaxValue)
PrintResult("""12"" < -3S", "12" < -3S)
PrintResult("""12"" < 24US", "12" < 24US)
PrintResult("""12"" < -5I", "12" < -5I)
PrintResult("""12"" < 26UI", "12" < 26UI)
PrintResult("""12"" < -7L", "12" < -7L)
PrintResult("""12"" < 28UL", "12" < 28UL)
PrintResult("""12"" < -9D", "12" < -9D)
PrintResult("""12"" < 10.0F", "12" < 10.0F)
PrintResult("""12"" < -11.0R", "12" < -11.0R)
PrintResult("""12"" < ""12""", "12" < "12")
PrintResult("""12"" < TypeCode.Double", "12" < TypeCode.Double)
PrintResult("TypeCode.Double < False", TypeCode.Double < False)
PrintResult("TypeCode.Double < True", TypeCode.Double < True)
PrintResult("TypeCode.Double < System.SByte.MinValue", TypeCode.Double < System.SByte.MinValue)
PrintResult("TypeCode.Double < System.Byte.MaxValue", TypeCode.Double < System.Byte.MaxValue)
PrintResult("TypeCode.Double < -3S", TypeCode.Double < -3S)
PrintResult("TypeCode.Double < 24US", TypeCode.Double < 24US)
PrintResult("TypeCode.Double < -5I", TypeCode.Double < -5I)
PrintResult("TypeCode.Double < 26UI", TypeCode.Double < 26UI)
PrintResult("TypeCode.Double < -7L", TypeCode.Double < -7L)
PrintResult("TypeCode.Double < 28UL", TypeCode.Double < 28UL)
PrintResult("TypeCode.Double < -9D", TypeCode.Double < -9D)
PrintResult("TypeCode.Double < 10.0F", TypeCode.Double < 10.0F)
PrintResult("TypeCode.Double < -11.0R", TypeCode.Double < -11.0R)
PrintResult("TypeCode.Double < ""12""", TypeCode.Double < "12")
PrintResult("TypeCode.Double < TypeCode.Double", TypeCode.Double < TypeCode.Double)
PrintResult("False > False", False > False)
PrintResult("False > True", False > True)
PrintResult("False > System.SByte.MinValue", False > System.SByte.MinValue)
PrintResult("False > System.Byte.MaxValue", False > System.Byte.MaxValue)
PrintResult("False > -3S", False > -3S)
PrintResult("False > 24US", False > 24US)
PrintResult("False > -5I", False > -5I)
PrintResult("False > 26UI", False > 26UI)
PrintResult("False > -7L", False > -7L)
PrintResult("False > 28UL", False > 28UL)
PrintResult("False > -9D", False > -9D)
PrintResult("False > 10.0F", False > 10.0F)
PrintResult("False > -11.0R", False > -11.0R)
PrintResult("False > ""12""", False > "12")
PrintResult("False > TypeCode.Double", False > TypeCode.Double)
PrintResult("True > False", True > False)
PrintResult("True > True", True > True)
PrintResult("True > System.SByte.MinValue", True > System.SByte.MinValue)
PrintResult("True > System.Byte.MaxValue", True > System.Byte.MaxValue)
PrintResult("True > -3S", True > -3S)
PrintResult("True > 24US", True > 24US)
PrintResult("True > -5I", True > -5I)
PrintResult("True > 26UI", True > 26UI)
PrintResult("True > -7L", True > -7L)
PrintResult("True > 28UL", True > 28UL)
PrintResult("True > -9D", True > -9D)
PrintResult("True > 10.0F", True > 10.0F)
PrintResult("True > -11.0R", True > -11.0R)
PrintResult("True > ""12""", True > "12")
PrintResult("True > TypeCode.Double", True > TypeCode.Double)
PrintResult("System.SByte.MinValue > False", System.SByte.MinValue > False)
PrintResult("System.SByte.MinValue > True", System.SByte.MinValue > True)
PrintResult("System.SByte.MinValue > System.SByte.MinValue", System.SByte.MinValue > System.SByte.MinValue)
PrintResult("System.SByte.MinValue > System.Byte.MaxValue", System.SByte.MinValue > System.Byte.MaxValue)
PrintResult("System.SByte.MinValue > -3S", System.SByte.MinValue > -3S)
PrintResult("System.SByte.MinValue > 24US", System.SByte.MinValue > 24US)
PrintResult("System.SByte.MinValue > -5I", System.SByte.MinValue > -5I)
PrintResult("System.SByte.MinValue > 26UI", System.SByte.MinValue > 26UI)
PrintResult("System.SByte.MinValue > -7L", System.SByte.MinValue > -7L)
PrintResult("System.SByte.MinValue > 28UL", System.SByte.MinValue > 28UL)
PrintResult("System.SByte.MinValue > -9D", System.SByte.MinValue > -9D)
PrintResult("System.SByte.MinValue > 10.0F", System.SByte.MinValue > 10.0F)
PrintResult("System.SByte.MinValue > -11.0R", System.SByte.MinValue > -11.0R)
PrintResult("System.SByte.MinValue > ""12""", System.SByte.MinValue > "12")
PrintResult("System.SByte.MinValue > TypeCode.Double", System.SByte.MinValue > TypeCode.Double)
PrintResult("System.Byte.MaxValue > False", System.Byte.MaxValue > False)
PrintResult("System.Byte.MaxValue > True", System.Byte.MaxValue > True)
PrintResult("System.Byte.MaxValue > System.SByte.MinValue", System.Byte.MaxValue > System.SByte.MinValue)
PrintResult("System.Byte.MaxValue > System.Byte.MaxValue", System.Byte.MaxValue > System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue > -3S", System.Byte.MaxValue > -3S)
PrintResult("System.Byte.MaxValue > 24US", System.Byte.MaxValue > 24US)
PrintResult("System.Byte.MaxValue > -5I", System.Byte.MaxValue > -5I)
PrintResult("System.Byte.MaxValue > 26UI", System.Byte.MaxValue > 26UI)
PrintResult("System.Byte.MaxValue > -7L", System.Byte.MaxValue > -7L)
PrintResult("System.Byte.MaxValue > 28UL", System.Byte.MaxValue > 28UL)
PrintResult("System.Byte.MaxValue > -9D", System.Byte.MaxValue > -9D)
PrintResult("System.Byte.MaxValue > 10.0F", System.Byte.MaxValue > 10.0F)
PrintResult("System.Byte.MaxValue > -11.0R", System.Byte.MaxValue > -11.0R)
PrintResult("System.Byte.MaxValue > ""12""", System.Byte.MaxValue > "12")
PrintResult("System.Byte.MaxValue > TypeCode.Double", System.Byte.MaxValue > TypeCode.Double)
PrintResult("-3S > False", -3S > False)
PrintResult("-3S > True", -3S > True)
PrintResult("-3S > System.SByte.MinValue", -3S > System.SByte.MinValue)
PrintResult("-3S > System.Byte.MaxValue", -3S > System.Byte.MaxValue)
PrintResult("-3S > -3S", -3S > -3S)
PrintResult("-3S > 24US", -3S > 24US)
PrintResult("-3S > -5I", -3S > -5I)
PrintResult("-3S > 26UI", -3S > 26UI)
PrintResult("-3S > -7L", -3S > -7L)
PrintResult("-3S > 28UL", -3S > 28UL)
PrintResult("-3S > -9D", -3S > -9D)
PrintResult("-3S > 10.0F", -3S > 10.0F)
PrintResult("-3S > -11.0R", -3S > -11.0R)
PrintResult("-3S > ""12""", -3S > "12")
PrintResult("-3S > TypeCode.Double", -3S > TypeCode.Double)
PrintResult("24US > False", 24US > False)
PrintResult("24US > True", 24US > True)
PrintResult("24US > System.SByte.MinValue", 24US > System.SByte.MinValue)
PrintResult("24US > System.Byte.MaxValue", 24US > System.Byte.MaxValue)
PrintResult("24US > -3S", 24US > -3S)
PrintResult("24US > 24US", 24US > 24US)
PrintResult("24US > -5I", 24US > -5I)
PrintResult("24US > 26UI", 24US > 26UI)
PrintResult("24US > -7L", 24US > -7L)
PrintResult("24US > 28UL", 24US > 28UL)
PrintResult("24US > -9D", 24US > -9D)
PrintResult("24US > 10.0F", 24US > 10.0F)
PrintResult("24US > -11.0R", 24US > -11.0R)
PrintResult("24US > ""12""", 24US > "12")
PrintResult("24US > TypeCode.Double", 24US > TypeCode.Double)
PrintResult("-5I > False", -5I > False)
PrintResult("-5I > True", -5I > True)
PrintResult("-5I > System.SByte.MinValue", -5I > System.SByte.MinValue)
PrintResult("-5I > System.Byte.MaxValue", -5I > System.Byte.MaxValue)
PrintResult("-5I > -3S", -5I > -3S)
PrintResult("-5I > 24US", -5I > 24US)
PrintResult("-5I > -5I", -5I > -5I)
PrintResult("-5I > 26UI", -5I > 26UI)
PrintResult("-5I > -7L", -5I > -7L)
PrintResult("-5I > 28UL", -5I > 28UL)
PrintResult("-5I > -9D", -5I > -9D)
PrintResult("-5I > 10.0F", -5I > 10.0F)
PrintResult("-5I > -11.0R", -5I > -11.0R)
PrintResult("-5I > ""12""", -5I > "12")
PrintResult("-5I > TypeCode.Double", -5I > TypeCode.Double)
PrintResult("26UI > False", 26UI > False)
PrintResult("26UI > True", 26UI > True)
PrintResult("26UI > System.SByte.MinValue", 26UI > System.SByte.MinValue)
PrintResult("26UI > System.Byte.MaxValue", 26UI > System.Byte.MaxValue)
PrintResult("26UI > -3S", 26UI > -3S)
PrintResult("26UI > 24US", 26UI > 24US)
PrintResult("26UI > -5I", 26UI > -5I)
PrintResult("26UI > 26UI", 26UI > 26UI)
PrintResult("26UI > -7L", 26UI > -7L)
PrintResult("26UI > 28UL", 26UI > 28UL)
PrintResult("26UI > -9D", 26UI > -9D)
PrintResult("26UI > 10.0F", 26UI > 10.0F)
PrintResult("26UI > -11.0R", 26UI > -11.0R)
PrintResult("26UI > ""12""", 26UI > "12")
PrintResult("26UI > TypeCode.Double", 26UI > TypeCode.Double)
PrintResult("-7L > False", -7L > False)
PrintResult("-7L > True", -7L > True)
PrintResult("-7L > System.SByte.MinValue", -7L > System.SByte.MinValue)
PrintResult("-7L > System.Byte.MaxValue", -7L > System.Byte.MaxValue)
PrintResult("-7L > -3S", -7L > -3S)
PrintResult("-7L > 24US", -7L > 24US)
PrintResult("-7L > -5I", -7L > -5I)
PrintResult("-7L > 26UI", -7L > 26UI)
PrintResult("-7L > -7L", -7L > -7L)
PrintResult("-7L > 28UL", -7L > 28UL)
PrintResult("-7L > -9D", -7L > -9D)
PrintResult("-7L > 10.0F", -7L > 10.0F)
PrintResult("-7L > -11.0R", -7L > -11.0R)
PrintResult("-7L > ""12""", -7L > "12")
PrintResult("-7L > TypeCode.Double", -7L > TypeCode.Double)
PrintResult("28UL > False", 28UL > False)
PrintResult("28UL > True", 28UL > True)
PrintResult("28UL > System.SByte.MinValue", 28UL > System.SByte.MinValue)
PrintResult("28UL > System.Byte.MaxValue", 28UL > System.Byte.MaxValue)
PrintResult("28UL > -3S", 28UL > -3S)
PrintResult("28UL > 24US", 28UL > 24US)
PrintResult("28UL > -5I", 28UL > -5I)
PrintResult("28UL > 26UI", 28UL > 26UI)
PrintResult("28UL > -7L", 28UL > -7L)
PrintResult("28UL > 28UL", 28UL > 28UL)
PrintResult("28UL > -9D", 28UL > -9D)
PrintResult("28UL > 10.0F", 28UL > 10.0F)
PrintResult("28UL > -11.0R", 28UL > -11.0R)
PrintResult("28UL > ""12""", 28UL > "12")
PrintResult("28UL > TypeCode.Double", 28UL > TypeCode.Double)
PrintResult("-9D > False", -9D > False)
PrintResult("-9D > True", -9D > True)
PrintResult("-9D > System.SByte.MinValue", -9D > System.SByte.MinValue)
PrintResult("-9D > System.Byte.MaxValue", -9D > System.Byte.MaxValue)
PrintResult("-9D > -3S", -9D > -3S)
PrintResult("-9D > 24US", -9D > 24US)
PrintResult("-9D > -5I", -9D > -5I)
PrintResult("-9D > 26UI", -9D > 26UI)
PrintResult("-9D > -7L", -9D > -7L)
PrintResult("-9D > 28UL", -9D > 28UL)
PrintResult("-9D > -9D", -9D > -9D)
PrintResult("-9D > 10.0F", -9D > 10.0F)
PrintResult("-9D > -11.0R", -9D > -11.0R)
PrintResult("-9D > ""12""", -9D > "12")
PrintResult("-9D > TypeCode.Double", -9D > TypeCode.Double)
PrintResult("10.0F > False", 10.0F > False)
PrintResult("10.0F > True", 10.0F > True)
PrintResult("10.0F > System.SByte.MinValue", 10.0F > System.SByte.MinValue)
PrintResult("10.0F > System.Byte.MaxValue", 10.0F > System.Byte.MaxValue)
PrintResult("10.0F > -3S", 10.0F > -3S)
PrintResult("10.0F > 24US", 10.0F > 24US)
PrintResult("10.0F > -5I", 10.0F > -5I)
PrintResult("10.0F > 26UI", 10.0F > 26UI)
PrintResult("10.0F > -7L", 10.0F > -7L)
PrintResult("10.0F > 28UL", 10.0F > 28UL)
PrintResult("10.0F > -9D", 10.0F > -9D)
PrintResult("10.0F > 10.0F", 10.0F > 10.0F)
PrintResult("10.0F > -11.0R", 10.0F > -11.0R)
PrintResult("10.0F > ""12""", 10.0F > "12")
PrintResult("10.0F > TypeCode.Double", 10.0F > TypeCode.Double)
PrintResult("-11.0R > False", -11.0R > False)
PrintResult("-11.0R > True", -11.0R > True)
PrintResult("-11.0R > System.SByte.MinValue", -11.0R > System.SByte.MinValue)
PrintResult("-11.0R > System.Byte.MaxValue", -11.0R > System.Byte.MaxValue)
PrintResult("-11.0R > -3S", -11.0R > -3S)
PrintResult("-11.0R > 24US", -11.0R > 24US)
PrintResult("-11.0R > -5I", -11.0R > -5I)
PrintResult("-11.0R > 26UI", -11.0R > 26UI)
PrintResult("-11.0R > -7L", -11.0R > -7L)
PrintResult("-11.0R > 28UL", -11.0R > 28UL)
PrintResult("-11.0R > -9D", -11.0R > -9D)
PrintResult("-11.0R > 10.0F", -11.0R > 10.0F)
PrintResult("-11.0R > -11.0R", -11.0R > -11.0R)
PrintResult("-11.0R > ""12""", -11.0R > "12")
PrintResult("-11.0R > TypeCode.Double", -11.0R > TypeCode.Double)
PrintResult("""12"" > False", "12" > False)
PrintResult("""12"" > True", "12" > True)
PrintResult("""12"" > System.SByte.MinValue", "12" > System.SByte.MinValue)
PrintResult("""12"" > System.Byte.MaxValue", "12" > System.Byte.MaxValue)
PrintResult("""12"" > -3S", "12" > -3S)
PrintResult("""12"" > 24US", "12" > 24US)
PrintResult("""12"" > -5I", "12" > -5I)
PrintResult("""12"" > 26UI", "12" > 26UI)
PrintResult("""12"" > -7L", "12" > -7L)
PrintResult("""12"" > 28UL", "12" > 28UL)
PrintResult("""12"" > -9D", "12" > -9D)
PrintResult("""12"" > 10.0F", "12" > 10.0F)
PrintResult("""12"" > -11.0R", "12" > -11.0R)
PrintResult("""12"" > ""12""", "12" > "12")
PrintResult("""12"" > TypeCode.Double", "12" > TypeCode.Double)
PrintResult("TypeCode.Double > False", TypeCode.Double > False)
PrintResult("TypeCode.Double > True", TypeCode.Double > True)
PrintResult("TypeCode.Double > System.SByte.MinValue", TypeCode.Double > System.SByte.MinValue)
PrintResult("TypeCode.Double > System.Byte.MaxValue", TypeCode.Double > System.Byte.MaxValue)
PrintResult("TypeCode.Double > -3S", TypeCode.Double > -3S)
PrintResult("TypeCode.Double > 24US", TypeCode.Double > 24US)
PrintResult("TypeCode.Double > -5I", TypeCode.Double > -5I)
PrintResult("TypeCode.Double > 26UI", TypeCode.Double > 26UI)
PrintResult("TypeCode.Double > -7L", TypeCode.Double > -7L)
PrintResult("TypeCode.Double > 28UL", TypeCode.Double > 28UL)
PrintResult("TypeCode.Double > -9D", TypeCode.Double > -9D)
PrintResult("TypeCode.Double > 10.0F", TypeCode.Double > 10.0F)
PrintResult("TypeCode.Double > -11.0R", TypeCode.Double > -11.0R)
PrintResult("TypeCode.Double > ""12""", TypeCode.Double > "12")
PrintResult("TypeCode.Double > TypeCode.Double", TypeCode.Double > TypeCode.Double)
PrintResult("False Xor False", False Xor False)
PrintResult("False Xor True", False Xor True)
PrintResult("False Xor System.SByte.MinValue", False Xor System.SByte.MinValue)
PrintResult("False Xor System.Byte.MaxValue", False Xor System.Byte.MaxValue)
PrintResult("False Xor -3S", False Xor -3S)
PrintResult("False Xor 24US", False Xor 24US)
PrintResult("False Xor -5I", False Xor -5I)
PrintResult("False Xor 26UI", False Xor 26UI)
PrintResult("False Xor -7L", False Xor -7L)
PrintResult("False Xor 28UL", False Xor 28UL)
PrintResult("False Xor -9D", False Xor -9D)
PrintResult("False Xor 10.0F", False Xor 10.0F)
PrintResult("False Xor -11.0R", False Xor -11.0R)
PrintResult("False Xor ""12""", False Xor "12")
PrintResult("False Xor TypeCode.Double", False Xor TypeCode.Double)
PrintResult("True Xor False", True Xor False)
PrintResult("True Xor True", True Xor True)
PrintResult("True Xor System.SByte.MinValue", True Xor System.SByte.MinValue)
PrintResult("True Xor System.Byte.MaxValue", True Xor System.Byte.MaxValue)
PrintResult("True Xor -3S", True Xor -3S)
PrintResult("True Xor 24US", True Xor 24US)
PrintResult("True Xor -5I", True Xor -5I)
PrintResult("True Xor 26UI", True Xor 26UI)
PrintResult("True Xor -7L", True Xor -7L)
PrintResult("True Xor 28UL", True Xor 28UL)
PrintResult("True Xor -9D", True Xor -9D)
PrintResult("True Xor 10.0F", True Xor 10.0F)
PrintResult("True Xor -11.0R", True Xor -11.0R)
PrintResult("True Xor ""12""", True Xor "12")
PrintResult("True Xor TypeCode.Double", True Xor TypeCode.Double)
PrintResult("System.SByte.MinValue Xor False", System.SByte.MinValue Xor False)
PrintResult("System.SByte.MinValue Xor True", System.SByte.MinValue Xor True)
PrintResult("System.SByte.MinValue Xor System.SByte.MinValue", System.SByte.MinValue Xor System.SByte.MinValue)
PrintResult("System.SByte.MinValue Xor System.Byte.MaxValue", System.SByte.MinValue Xor System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Xor -3S", System.SByte.MinValue Xor -3S)
PrintResult("System.SByte.MinValue Xor 24US", System.SByte.MinValue Xor 24US)
PrintResult("System.SByte.MinValue Xor -5I", System.SByte.MinValue Xor -5I)
PrintResult("System.SByte.MinValue Xor 26UI", System.SByte.MinValue Xor 26UI)
PrintResult("System.SByte.MinValue Xor -7L", System.SByte.MinValue Xor -7L)
PrintResult("System.SByte.MinValue Xor 28UL", System.SByte.MinValue Xor 28UL)
PrintResult("System.SByte.MinValue Xor -9D", System.SByte.MinValue Xor -9D)
PrintResult("System.SByte.MinValue Xor 10.0F", System.SByte.MinValue Xor 10.0F)
PrintResult("System.SByte.MinValue Xor -11.0R", System.SByte.MinValue Xor -11.0R)
PrintResult("System.SByte.MinValue Xor ""12""", System.SByte.MinValue Xor "12")
PrintResult("System.SByte.MinValue Xor TypeCode.Double", System.SByte.MinValue Xor TypeCode.Double)
PrintResult("System.Byte.MaxValue Xor False", System.Byte.MaxValue Xor False)
PrintResult("System.Byte.MaxValue Xor True", System.Byte.MaxValue Xor True)
PrintResult("System.Byte.MaxValue Xor System.SByte.MinValue", System.Byte.MaxValue Xor System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Xor System.Byte.MaxValue", System.Byte.MaxValue Xor System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Xor -3S", System.Byte.MaxValue Xor -3S)
PrintResult("System.Byte.MaxValue Xor 24US", System.Byte.MaxValue Xor 24US)
PrintResult("System.Byte.MaxValue Xor -5I", System.Byte.MaxValue Xor -5I)
PrintResult("System.Byte.MaxValue Xor 26UI", System.Byte.MaxValue Xor 26UI)
PrintResult("System.Byte.MaxValue Xor -7L", System.Byte.MaxValue Xor -7L)
PrintResult("System.Byte.MaxValue Xor 28UL", System.Byte.MaxValue Xor 28UL)
PrintResult("System.Byte.MaxValue Xor -9D", System.Byte.MaxValue Xor -9D)
PrintResult("System.Byte.MaxValue Xor 10.0F", System.Byte.MaxValue Xor 10.0F)
PrintResult("System.Byte.MaxValue Xor -11.0R", System.Byte.MaxValue Xor -11.0R)
PrintResult("System.Byte.MaxValue Xor ""12""", System.Byte.MaxValue Xor "12")
PrintResult("System.Byte.MaxValue Xor TypeCode.Double", System.Byte.MaxValue Xor TypeCode.Double)
PrintResult("-3S Xor False", -3S Xor False)
PrintResult("-3S Xor True", -3S Xor True)
PrintResult("-3S Xor System.SByte.MinValue", -3S Xor System.SByte.MinValue)
PrintResult("-3S Xor System.Byte.MaxValue", -3S Xor System.Byte.MaxValue)
PrintResult("-3S Xor -3S", -3S Xor -3S)
PrintResult("-3S Xor 24US", -3S Xor 24US)
PrintResult("-3S Xor -5I", -3S Xor -5I)
PrintResult("-3S Xor 26UI", -3S Xor 26UI)
PrintResult("-3S Xor -7L", -3S Xor -7L)
PrintResult("-3S Xor 28UL", -3S Xor 28UL)
PrintResult("-3S Xor -9D", -3S Xor -9D)
PrintResult("-3S Xor 10.0F", -3S Xor 10.0F)
PrintResult("-3S Xor -11.0R", -3S Xor -11.0R)
PrintResult("-3S Xor ""12""", -3S Xor "12")
PrintResult("-3S Xor TypeCode.Double", -3S Xor TypeCode.Double)
PrintResult("24US Xor False", 24US Xor False)
PrintResult("24US Xor True", 24US Xor True)
PrintResult("24US Xor System.SByte.MinValue", 24US Xor System.SByte.MinValue)
PrintResult("24US Xor System.Byte.MaxValue", 24US Xor System.Byte.MaxValue)
PrintResult("24US Xor -3S", 24US Xor -3S)
PrintResult("24US Xor 24US", 24US Xor 24US)
PrintResult("24US Xor -5I", 24US Xor -5I)
PrintResult("24US Xor 26UI", 24US Xor 26UI)
PrintResult("24US Xor -7L", 24US Xor -7L)
PrintResult("24US Xor 28UL", 24US Xor 28UL)
PrintResult("24US Xor -9D", 24US Xor -9D)
PrintResult("24US Xor 10.0F", 24US Xor 10.0F)
PrintResult("24US Xor -11.0R", 24US Xor -11.0R)
PrintResult("24US Xor ""12""", 24US Xor "12")
PrintResult("24US Xor TypeCode.Double", 24US Xor TypeCode.Double)
PrintResult("-5I Xor False", -5I Xor False)
PrintResult("-5I Xor True", -5I Xor True)
PrintResult("-5I Xor System.SByte.MinValue", -5I Xor System.SByte.MinValue)
PrintResult("-5I Xor System.Byte.MaxValue", -5I Xor System.Byte.MaxValue)
PrintResult("-5I Xor -3S", -5I Xor -3S)
PrintResult("-5I Xor 24US", -5I Xor 24US)
PrintResult("-5I Xor -5I", -5I Xor -5I)
PrintResult("-5I Xor 26UI", -5I Xor 26UI)
PrintResult("-5I Xor -7L", -5I Xor -7L)
PrintResult("-5I Xor 28UL", -5I Xor 28UL)
PrintResult("-5I Xor -9D", -5I Xor -9D)
PrintResult("-5I Xor 10.0F", -5I Xor 10.0F)
PrintResult("-5I Xor -11.0R", -5I Xor -11.0R)
PrintResult("-5I Xor ""12""", -5I Xor "12")
PrintResult("-5I Xor TypeCode.Double", -5I Xor TypeCode.Double)
PrintResult("26UI Xor False", 26UI Xor False)
PrintResult("26UI Xor True", 26UI Xor True)
PrintResult("26UI Xor System.SByte.MinValue", 26UI Xor System.SByte.MinValue)
PrintResult("26UI Xor System.Byte.MaxValue", 26UI Xor System.Byte.MaxValue)
PrintResult("26UI Xor -3S", 26UI Xor -3S)
PrintResult("26UI Xor 24US", 26UI Xor 24US)
PrintResult("26UI Xor -5I", 26UI Xor -5I)
PrintResult("26UI Xor 26UI", 26UI Xor 26UI)
PrintResult("26UI Xor -7L", 26UI Xor -7L)
PrintResult("26UI Xor 28UL", 26UI Xor 28UL)
PrintResult("26UI Xor -9D", 26UI Xor -9D)
PrintResult("26UI Xor 10.0F", 26UI Xor 10.0F)
PrintResult("26UI Xor -11.0R", 26UI Xor -11.0R)
PrintResult("26UI Xor ""12""", 26UI Xor "12")
PrintResult("26UI Xor TypeCode.Double", 26UI Xor TypeCode.Double)
PrintResult("-7L Xor False", -7L Xor False)
PrintResult("-7L Xor True", -7L Xor True)
PrintResult("-7L Xor System.SByte.MinValue", -7L Xor System.SByte.MinValue)
PrintResult("-7L Xor System.Byte.MaxValue", -7L Xor System.Byte.MaxValue)
PrintResult("-7L Xor -3S", -7L Xor -3S)
PrintResult("-7L Xor 24US", -7L Xor 24US)
PrintResult("-7L Xor -5I", -7L Xor -5I)
PrintResult("-7L Xor 26UI", -7L Xor 26UI)
PrintResult("-7L Xor -7L", -7L Xor -7L)
PrintResult("-7L Xor 28UL", -7L Xor 28UL)
PrintResult("-7L Xor -9D", -7L Xor -9D)
PrintResult("-7L Xor 10.0F", -7L Xor 10.0F)
PrintResult("-7L Xor -11.0R", -7L Xor -11.0R)
PrintResult("-7L Xor ""12""", -7L Xor "12")
PrintResult("-7L Xor TypeCode.Double", -7L Xor TypeCode.Double)
PrintResult("28UL Xor False", 28UL Xor False)
PrintResult("28UL Xor True", 28UL Xor True)
PrintResult("28UL Xor System.SByte.MinValue", 28UL Xor System.SByte.MinValue)
PrintResult("28UL Xor System.Byte.MaxValue", 28UL Xor System.Byte.MaxValue)
PrintResult("28UL Xor -3S", 28UL Xor -3S)
PrintResult("28UL Xor 24US", 28UL Xor 24US)
PrintResult("28UL Xor -5I", 28UL Xor -5I)
PrintResult("28UL Xor 26UI", 28UL Xor 26UI)
PrintResult("28UL Xor -7L", 28UL Xor -7L)
PrintResult("28UL Xor 28UL", 28UL Xor 28UL)
PrintResult("28UL Xor -9D", 28UL Xor -9D)
PrintResult("28UL Xor 10.0F", 28UL Xor 10.0F)
PrintResult("28UL Xor -11.0R", 28UL Xor -11.0R)
PrintResult("28UL Xor ""12""", 28UL Xor "12")
PrintResult("28UL Xor TypeCode.Double", 28UL Xor TypeCode.Double)
PrintResult("-9D Xor False", -9D Xor False)
PrintResult("-9D Xor True", -9D Xor True)
PrintResult("-9D Xor System.SByte.MinValue", -9D Xor System.SByte.MinValue)
PrintResult("-9D Xor System.Byte.MaxValue", -9D Xor System.Byte.MaxValue)
PrintResult("-9D Xor -3S", -9D Xor -3S)
PrintResult("-9D Xor 24US", -9D Xor 24US)
PrintResult("-9D Xor -5I", -9D Xor -5I)
PrintResult("-9D Xor 26UI", -9D Xor 26UI)
PrintResult("-9D Xor -7L", -9D Xor -7L)
PrintResult("-9D Xor 28UL", -9D Xor 28UL)
PrintResult("-9D Xor -9D", -9D Xor -9D)
PrintResult("-9D Xor 10.0F", -9D Xor 10.0F)
PrintResult("-9D Xor -11.0R", -9D Xor -11.0R)
PrintResult("-9D Xor ""12""", -9D Xor "12")
PrintResult("-9D Xor TypeCode.Double", -9D Xor TypeCode.Double)
PrintResult("10.0F Xor False", 10.0F Xor False)
PrintResult("10.0F Xor True", 10.0F Xor True)
PrintResult("10.0F Xor System.SByte.MinValue", 10.0F Xor System.SByte.MinValue)
PrintResult("10.0F Xor System.Byte.MaxValue", 10.0F Xor System.Byte.MaxValue)
PrintResult("10.0F Xor -3S", 10.0F Xor -3S)
PrintResult("10.0F Xor 24US", 10.0F Xor 24US)
PrintResult("10.0F Xor -5I", 10.0F Xor -5I)
PrintResult("10.0F Xor 26UI", 10.0F Xor 26UI)
PrintResult("10.0F Xor -7L", 10.0F Xor -7L)
PrintResult("10.0F Xor 28UL", 10.0F Xor 28UL)
PrintResult("10.0F Xor -9D", 10.0F Xor -9D)
PrintResult("10.0F Xor 10.0F", 10.0F Xor 10.0F)
PrintResult("10.0F Xor -11.0R", 10.0F Xor -11.0R)
PrintResult("10.0F Xor ""12""", 10.0F Xor "12")
PrintResult("10.0F Xor TypeCode.Double", 10.0F Xor TypeCode.Double)
PrintResult("-11.0R Xor False", -11.0R Xor False)
PrintResult("-11.0R Xor True", -11.0R Xor True)
PrintResult("-11.0R Xor System.SByte.MinValue", -11.0R Xor System.SByte.MinValue)
PrintResult("-11.0R Xor System.Byte.MaxValue", -11.0R Xor System.Byte.MaxValue)
PrintResult("-11.0R Xor -3S", -11.0R Xor -3S)
PrintResult("-11.0R Xor 24US", -11.0R Xor 24US)
PrintResult("-11.0R Xor -5I", -11.0R Xor -5I)
PrintResult("-11.0R Xor 26UI", -11.0R Xor 26UI)
PrintResult("-11.0R Xor -7L", -11.0R Xor -7L)
PrintResult("-11.0R Xor 28UL", -11.0R Xor 28UL)
PrintResult("-11.0R Xor -9D", -11.0R Xor -9D)
PrintResult("-11.0R Xor 10.0F", -11.0R Xor 10.0F)
PrintResult("-11.0R Xor -11.0R", -11.0R Xor -11.0R)
PrintResult("-11.0R Xor ""12""", -11.0R Xor "12")
PrintResult("-11.0R Xor TypeCode.Double", -11.0R Xor TypeCode.Double)
PrintResult("""12"" Xor False", "12" Xor False)
PrintResult("""12"" Xor True", "12" Xor True)
PrintResult("""12"" Xor System.SByte.MinValue", "12" Xor System.SByte.MinValue)
PrintResult("""12"" Xor System.Byte.MaxValue", "12" Xor System.Byte.MaxValue)
PrintResult("""12"" Xor -3S", "12" Xor -3S)
PrintResult("""12"" Xor 24US", "12" Xor 24US)
PrintResult("""12"" Xor -5I", "12" Xor -5I)
PrintResult("""12"" Xor 26UI", "12" Xor 26UI)
PrintResult("""12"" Xor -7L", "12" Xor -7L)
PrintResult("""12"" Xor 28UL", "12" Xor 28UL)
PrintResult("""12"" Xor -9D", "12" Xor -9D)
PrintResult("""12"" Xor 10.0F", "12" Xor 10.0F)
PrintResult("""12"" Xor -11.0R", "12" Xor -11.0R)
PrintResult("""12"" Xor ""12""", "12" Xor "12")
PrintResult("""12"" Xor TypeCode.Double", "12" Xor TypeCode.Double)
PrintResult("TypeCode.Double Xor False", TypeCode.Double Xor False)
PrintResult("TypeCode.Double Xor True", TypeCode.Double Xor True)
PrintResult("TypeCode.Double Xor System.SByte.MinValue", TypeCode.Double Xor System.SByte.MinValue)
PrintResult("TypeCode.Double Xor System.Byte.MaxValue", TypeCode.Double Xor System.Byte.MaxValue)
PrintResult("TypeCode.Double Xor -3S", TypeCode.Double Xor -3S)
PrintResult("TypeCode.Double Xor 24US", TypeCode.Double Xor 24US)
PrintResult("TypeCode.Double Xor -5I", TypeCode.Double Xor -5I)
PrintResult("TypeCode.Double Xor 26UI", TypeCode.Double Xor 26UI)
PrintResult("TypeCode.Double Xor -7L", TypeCode.Double Xor -7L)
PrintResult("TypeCode.Double Xor 28UL", TypeCode.Double Xor 28UL)
PrintResult("TypeCode.Double Xor -9D", TypeCode.Double Xor -9D)
PrintResult("TypeCode.Double Xor 10.0F", TypeCode.Double Xor 10.0F)
PrintResult("TypeCode.Double Xor -11.0R", TypeCode.Double Xor -11.0R)
PrintResult("TypeCode.Double Xor ""12""", TypeCode.Double Xor "12")
PrintResult("TypeCode.Double Xor TypeCode.Double", TypeCode.Double Xor TypeCode.Double)
PrintResult("False Or False", False Or False)
PrintResult("False Or True", False Or True)
PrintResult("False Or System.SByte.MinValue", False Or System.SByte.MinValue)
PrintResult("False Or System.Byte.MaxValue", False Or System.Byte.MaxValue)
PrintResult("False Or -3S", False Or -3S)
PrintResult("False Or 24US", False Or 24US)
PrintResult("False Or -5I", False Or -5I)
PrintResult("False Or 26UI", False Or 26UI)
PrintResult("False Or -7L", False Or -7L)
PrintResult("False Or 28UL", False Or 28UL)
PrintResult("False Or -9D", False Or -9D)
PrintResult("False Or 10.0F", False Or 10.0F)
PrintResult("False Or -11.0R", False Or -11.0R)
PrintResult("False Or ""12""", False Or "12")
PrintResult("False Or TypeCode.Double", False Or TypeCode.Double)
PrintResult("True Or False", True Or False)
PrintResult("True Or True", True Or True)
PrintResult("True Or System.SByte.MinValue", True Or System.SByte.MinValue)
PrintResult("True Or System.Byte.MaxValue", True Or System.Byte.MaxValue)
PrintResult("True Or -3S", True Or -3S)
PrintResult("True Or 24US", True Or 24US)
PrintResult("True Or -5I", True Or -5I)
PrintResult("True Or 26UI", True Or 26UI)
PrintResult("True Or -7L", True Or -7L)
PrintResult("True Or 28UL", True Or 28UL)
PrintResult("True Or -9D", True Or -9D)
PrintResult("True Or 10.0F", True Or 10.0F)
PrintResult("True Or -11.0R", True Or -11.0R)
PrintResult("True Or ""12""", True Or "12")
PrintResult("True Or TypeCode.Double", True Or TypeCode.Double)
PrintResult("System.SByte.MinValue Or False", System.SByte.MinValue Or False)
PrintResult("System.SByte.MinValue Or True", System.SByte.MinValue Or True)
PrintResult("System.SByte.MinValue Or System.SByte.MinValue", System.SByte.MinValue Or System.SByte.MinValue)
PrintResult("System.SByte.MinValue Or System.Byte.MaxValue", System.SByte.MinValue Or System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Or -3S", System.SByte.MinValue Or -3S)
PrintResult("System.SByte.MinValue Or 24US", System.SByte.MinValue Or 24US)
PrintResult("System.SByte.MinValue Or -5I", System.SByte.MinValue Or -5I)
PrintResult("System.SByte.MinValue Or 26UI", System.SByte.MinValue Or 26UI)
PrintResult("System.SByte.MinValue Or -7L", System.SByte.MinValue Or -7L)
PrintResult("System.SByte.MinValue Or 28UL", System.SByte.MinValue Or 28UL)
PrintResult("System.SByte.MinValue Or -9D", System.SByte.MinValue Or -9D)
PrintResult("System.SByte.MinValue Or 10.0F", System.SByte.MinValue Or 10.0F)
PrintResult("System.SByte.MinValue Or -11.0R", System.SByte.MinValue Or -11.0R)
PrintResult("System.SByte.MinValue Or ""12""", System.SByte.MinValue Or "12")
PrintResult("System.SByte.MinValue Or TypeCode.Double", System.SByte.MinValue Or TypeCode.Double)
PrintResult("System.Byte.MaxValue Or False", System.Byte.MaxValue Or False)
PrintResult("System.Byte.MaxValue Or True", System.Byte.MaxValue Or True)
PrintResult("System.Byte.MaxValue Or System.SByte.MinValue", System.Byte.MaxValue Or System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Or System.Byte.MaxValue", System.Byte.MaxValue Or System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Or -3S", System.Byte.MaxValue Or -3S)
PrintResult("System.Byte.MaxValue Or 24US", System.Byte.MaxValue Or 24US)
PrintResult("System.Byte.MaxValue Or -5I", System.Byte.MaxValue Or -5I)
PrintResult("System.Byte.MaxValue Or 26UI", System.Byte.MaxValue Or 26UI)
PrintResult("System.Byte.MaxValue Or -7L", System.Byte.MaxValue Or -7L)
PrintResult("System.Byte.MaxValue Or 28UL", System.Byte.MaxValue Or 28UL)
PrintResult("System.Byte.MaxValue Or -9D", System.Byte.MaxValue Or -9D)
PrintResult("System.Byte.MaxValue Or 10.0F", System.Byte.MaxValue Or 10.0F)
PrintResult("System.Byte.MaxValue Or -11.0R", System.Byte.MaxValue Or -11.0R)
PrintResult("System.Byte.MaxValue Or ""12""", System.Byte.MaxValue Or "12")
PrintResult("System.Byte.MaxValue Or TypeCode.Double", System.Byte.MaxValue Or TypeCode.Double)
PrintResult("-3S Or False", -3S Or False)
PrintResult("-3S Or True", -3S Or True)
PrintResult("-3S Or System.SByte.MinValue", -3S Or System.SByte.MinValue)
PrintResult("-3S Or System.Byte.MaxValue", -3S Or System.Byte.MaxValue)
PrintResult("-3S Or -3S", -3S Or -3S)
PrintResult("-3S Or 24US", -3S Or 24US)
PrintResult("-3S Or -5I", -3S Or -5I)
PrintResult("-3S Or 26UI", -3S Or 26UI)
PrintResult("-3S Or -7L", -3S Or -7L)
PrintResult("-3S Or 28UL", -3S Or 28UL)
PrintResult("-3S Or -9D", -3S Or -9D)
PrintResult("-3S Or 10.0F", -3S Or 10.0F)
PrintResult("-3S Or -11.0R", -3S Or -11.0R)
PrintResult("-3S Or ""12""", -3S Or "12")
PrintResult("-3S Or TypeCode.Double", -3S Or TypeCode.Double)
PrintResult("24US Or False", 24US Or False)
PrintResult("24US Or True", 24US Or True)
PrintResult("24US Or System.SByte.MinValue", 24US Or System.SByte.MinValue)
PrintResult("24US Or System.Byte.MaxValue", 24US Or System.Byte.MaxValue)
PrintResult("24US Or -3S", 24US Or -3S)
PrintResult("24US Or 24US", 24US Or 24US)
PrintResult("24US Or -5I", 24US Or -5I)
PrintResult("24US Or 26UI", 24US Or 26UI)
PrintResult("24US Or -7L", 24US Or -7L)
PrintResult("24US Or 28UL", 24US Or 28UL)
PrintResult("24US Or -9D", 24US Or -9D)
PrintResult("24US Or 10.0F", 24US Or 10.0F)
PrintResult("24US Or -11.0R", 24US Or -11.0R)
PrintResult("24US Or ""12""", 24US Or "12")
PrintResult("24US Or TypeCode.Double", 24US Or TypeCode.Double)
PrintResult("-5I Or False", -5I Or False)
PrintResult("-5I Or True", -5I Or True)
PrintResult("-5I Or System.SByte.MinValue", -5I Or System.SByte.MinValue)
PrintResult("-5I Or System.Byte.MaxValue", -5I Or System.Byte.MaxValue)
PrintResult("-5I Or -3S", -5I Or -3S)
PrintResult("-5I Or 24US", -5I Or 24US)
PrintResult("-5I Or -5I", -5I Or -5I)
PrintResult("-5I Or 26UI", -5I Or 26UI)
PrintResult("-5I Or -7L", -5I Or -7L)
PrintResult("-5I Or 28UL", -5I Or 28UL)
PrintResult("-5I Or -9D", -5I Or -9D)
PrintResult("-5I Or 10.0F", -5I Or 10.0F)
PrintResult("-5I Or -11.0R", -5I Or -11.0R)
PrintResult("-5I Or ""12""", -5I Or "12")
PrintResult("-5I Or TypeCode.Double", -5I Or TypeCode.Double)
PrintResult("26UI Or False", 26UI Or False)
PrintResult("26UI Or True", 26UI Or True)
PrintResult("26UI Or System.SByte.MinValue", 26UI Or System.SByte.MinValue)
PrintResult("26UI Or System.Byte.MaxValue", 26UI Or System.Byte.MaxValue)
PrintResult("26UI Or -3S", 26UI Or -3S)
PrintResult("26UI Or 24US", 26UI Or 24US)
PrintResult("26UI Or -5I", 26UI Or -5I)
PrintResult("26UI Or 26UI", 26UI Or 26UI)
PrintResult("26UI Or -7L", 26UI Or -7L)
PrintResult("26UI Or 28UL", 26UI Or 28UL)
PrintResult("26UI Or -9D", 26UI Or -9D)
PrintResult("26UI Or 10.0F", 26UI Or 10.0F)
PrintResult("26UI Or -11.0R", 26UI Or -11.0R)
PrintResult("26UI Or ""12""", 26UI Or "12")
PrintResult("26UI Or TypeCode.Double", 26UI Or TypeCode.Double)
PrintResult("-7L Or False", -7L Or False)
PrintResult("-7L Or True", -7L Or True)
PrintResult("-7L Or System.SByte.MinValue", -7L Or System.SByte.MinValue)
PrintResult("-7L Or System.Byte.MaxValue", -7L Or System.Byte.MaxValue)
PrintResult("-7L Or -3S", -7L Or -3S)
PrintResult("-7L Or 24US", -7L Or 24US)
PrintResult("-7L Or -5I", -7L Or -5I)
PrintResult("-7L Or 26UI", -7L Or 26UI)
PrintResult("-7L Or -7L", -7L Or -7L)
PrintResult("-7L Or 28UL", -7L Or 28UL)
PrintResult("-7L Or -9D", -7L Or -9D)
PrintResult("-7L Or 10.0F", -7L Or 10.0F)
PrintResult("-7L Or -11.0R", -7L Or -11.0R)
PrintResult("-7L Or ""12""", -7L Or "12")
PrintResult("-7L Or TypeCode.Double", -7L Or TypeCode.Double)
PrintResult("28UL Or False", 28UL Or False)
PrintResult("28UL Or True", 28UL Or True)
PrintResult("28UL Or System.SByte.MinValue", 28UL Or System.SByte.MinValue)
PrintResult("28UL Or System.Byte.MaxValue", 28UL Or System.Byte.MaxValue)
PrintResult("28UL Or -3S", 28UL Or -3S)
PrintResult("28UL Or 24US", 28UL Or 24US)
PrintResult("28UL Or -5I", 28UL Or -5I)
PrintResult("28UL Or 26UI", 28UL Or 26UI)
PrintResult("28UL Or -7L", 28UL Or -7L)
PrintResult("28UL Or 28UL", 28UL Or 28UL)
PrintResult("28UL Or -9D", 28UL Or -9D)
PrintResult("28UL Or 10.0F", 28UL Or 10.0F)
PrintResult("28UL Or -11.0R", 28UL Or -11.0R)
PrintResult("28UL Or ""12""", 28UL Or "12")
PrintResult("28UL Or TypeCode.Double", 28UL Or TypeCode.Double)
PrintResult("-9D Or False", -9D Or False)
PrintResult("-9D Or True", -9D Or True)
PrintResult("-9D Or System.SByte.MinValue", -9D Or System.SByte.MinValue)
PrintResult("-9D Or System.Byte.MaxValue", -9D Or System.Byte.MaxValue)
PrintResult("-9D Or -3S", -9D Or -3S)
PrintResult("-9D Or 24US", -9D Or 24US)
PrintResult("-9D Or -5I", -9D Or -5I)
PrintResult("-9D Or 26UI", -9D Or 26UI)
PrintResult("-9D Or -7L", -9D Or -7L)
PrintResult("-9D Or 28UL", -9D Or 28UL)
PrintResult("-9D Or -9D", -9D Or -9D)
PrintResult("-9D Or 10.0F", -9D Or 10.0F)
PrintResult("-9D Or -11.0R", -9D Or -11.0R)
PrintResult("-9D Or ""12""", -9D Or "12")
PrintResult("-9D Or TypeCode.Double", -9D Or TypeCode.Double)
PrintResult("10.0F Or False", 10.0F Or False)
PrintResult("10.0F Or True", 10.0F Or True)
PrintResult("10.0F Or System.SByte.MinValue", 10.0F Or System.SByte.MinValue)
PrintResult("10.0F Or System.Byte.MaxValue", 10.0F Or System.Byte.MaxValue)
PrintResult("10.0F Or -3S", 10.0F Or -3S)
PrintResult("10.0F Or 24US", 10.0F Or 24US)
PrintResult("10.0F Or -5I", 10.0F Or -5I)
PrintResult("10.0F Or 26UI", 10.0F Or 26UI)
PrintResult("10.0F Or -7L", 10.0F Or -7L)
PrintResult("10.0F Or 28UL", 10.0F Or 28UL)
PrintResult("10.0F Or -9D", 10.0F Or -9D)
PrintResult("10.0F Or 10.0F", 10.0F Or 10.0F)
PrintResult("10.0F Or -11.0R", 10.0F Or -11.0R)
PrintResult("10.0F Or ""12""", 10.0F Or "12")
PrintResult("10.0F Or TypeCode.Double", 10.0F Or TypeCode.Double)
PrintResult("-11.0R Or False", -11.0R Or False)
PrintResult("-11.0R Or True", -11.0R Or True)
PrintResult("-11.0R Or System.SByte.MinValue", -11.0R Or System.SByte.MinValue)
PrintResult("-11.0R Or System.Byte.MaxValue", -11.0R Or System.Byte.MaxValue)
PrintResult("-11.0R Or -3S", -11.0R Or -3S)
PrintResult("-11.0R Or 24US", -11.0R Or 24US)
PrintResult("-11.0R Or -5I", -11.0R Or -5I)
PrintResult("-11.0R Or 26UI", -11.0R Or 26UI)
PrintResult("-11.0R Or -7L", -11.0R Or -7L)
PrintResult("-11.0R Or 28UL", -11.0R Or 28UL)
PrintResult("-11.0R Or -9D", -11.0R Or -9D)
PrintResult("-11.0R Or 10.0F", -11.0R Or 10.0F)
PrintResult("-11.0R Or -11.0R", -11.0R Or -11.0R)
PrintResult("-11.0R Or ""12""", -11.0R Or "12")
PrintResult("-11.0R Or TypeCode.Double", -11.0R Or TypeCode.Double)
PrintResult("""12"" Or False", "12" Or False)
PrintResult("""12"" Or True", "12" Or True)
PrintResult("""12"" Or System.SByte.MinValue", "12" Or System.SByte.MinValue)
PrintResult("""12"" Or System.Byte.MaxValue", "12" Or System.Byte.MaxValue)
PrintResult("""12"" Or -3S", "12" Or -3S)
PrintResult("""12"" Or 24US", "12" Or 24US)
PrintResult("""12"" Or -5I", "12" Or -5I)
PrintResult("""12"" Or 26UI", "12" Or 26UI)
PrintResult("""12"" Or -7L", "12" Or -7L)
PrintResult("""12"" Or 28UL", "12" Or 28UL)
PrintResult("""12"" Or -9D", "12" Or -9D)
PrintResult("""12"" Or 10.0F", "12" Or 10.0F)
PrintResult("""12"" Or -11.0R", "12" Or -11.0R)
PrintResult("""12"" Or ""12""", "12" Or "12")
PrintResult("""12"" Or TypeCode.Double", "12" Or TypeCode.Double)
PrintResult("TypeCode.Double Or False", TypeCode.Double Or False)
PrintResult("TypeCode.Double Or True", TypeCode.Double Or True)
PrintResult("TypeCode.Double Or System.SByte.MinValue", TypeCode.Double Or System.SByte.MinValue)
PrintResult("TypeCode.Double Or System.Byte.MaxValue", TypeCode.Double Or System.Byte.MaxValue)
PrintResult("TypeCode.Double Or -3S", TypeCode.Double Or -3S)
PrintResult("TypeCode.Double Or 24US", TypeCode.Double Or 24US)
PrintResult("TypeCode.Double Or -5I", TypeCode.Double Or -5I)
PrintResult("TypeCode.Double Or 26UI", TypeCode.Double Or 26UI)
PrintResult("TypeCode.Double Or -7L", TypeCode.Double Or -7L)
PrintResult("TypeCode.Double Or 28UL", TypeCode.Double Or 28UL)
PrintResult("TypeCode.Double Or -9D", TypeCode.Double Or -9D)
PrintResult("TypeCode.Double Or 10.0F", TypeCode.Double Or 10.0F)
PrintResult("TypeCode.Double Or -11.0R", TypeCode.Double Or -11.0R)
PrintResult("TypeCode.Double Or ""12""", TypeCode.Double Or "12")
PrintResult("TypeCode.Double Or TypeCode.Double", TypeCode.Double Or TypeCode.Double)
PrintResult("False And False", False And False)
PrintResult("False And True", False And True)
PrintResult("False And System.SByte.MinValue", False And System.SByte.MinValue)
PrintResult("False And System.Byte.MaxValue", False And System.Byte.MaxValue)
PrintResult("False And -3S", False And -3S)
PrintResult("False And 24US", False And 24US)
PrintResult("False And -5I", False And -5I)
PrintResult("False And 26UI", False And 26UI)
PrintResult("False And -7L", False And -7L)
PrintResult("False And 28UL", False And 28UL)
PrintResult("False And -9D", False And -9D)
PrintResult("False And 10.0F", False And 10.0F)
PrintResult("False And -11.0R", False And -11.0R)
PrintResult("False And ""12""", False And "12")
PrintResult("False And TypeCode.Double", False And TypeCode.Double)
PrintResult("True And False", True And False)
PrintResult("True And True", True And True)
PrintResult("True And System.SByte.MinValue", True And System.SByte.MinValue)
PrintResult("True And System.Byte.MaxValue", True And System.Byte.MaxValue)
PrintResult("True And -3S", True And -3S)
PrintResult("True And 24US", True And 24US)
PrintResult("True And -5I", True And -5I)
PrintResult("True And 26UI", True And 26UI)
PrintResult("True And -7L", True And -7L)
PrintResult("True And 28UL", True And 28UL)
PrintResult("True And -9D", True And -9D)
PrintResult("True And 10.0F", True And 10.0F)
PrintResult("True And -11.0R", True And -11.0R)
PrintResult("True And ""12""", True And "12")
PrintResult("True And TypeCode.Double", True And TypeCode.Double)
PrintResult("System.SByte.MinValue And False", System.SByte.MinValue And False)
PrintResult("System.SByte.MinValue And True", System.SByte.MinValue And True)
PrintResult("System.SByte.MinValue And System.SByte.MinValue", System.SByte.MinValue And System.SByte.MinValue)
PrintResult("System.SByte.MinValue And System.Byte.MaxValue", System.SByte.MinValue And System.Byte.MaxValue)
PrintResult("System.SByte.MinValue And -3S", System.SByte.MinValue And -3S)
PrintResult("System.SByte.MinValue And 24US", System.SByte.MinValue And 24US)
PrintResult("System.SByte.MinValue And -5I", System.SByte.MinValue And -5I)
PrintResult("System.SByte.MinValue And 26UI", System.SByte.MinValue And 26UI)
PrintResult("System.SByte.MinValue And -7L", System.SByte.MinValue And -7L)
PrintResult("System.SByte.MinValue And 28UL", System.SByte.MinValue And 28UL)
PrintResult("System.SByte.MinValue And -9D", System.SByte.MinValue And -9D)
PrintResult("System.SByte.MinValue And 10.0F", System.SByte.MinValue And 10.0F)
PrintResult("System.SByte.MinValue And -11.0R", System.SByte.MinValue And -11.0R)
PrintResult("System.SByte.MinValue And ""12""", System.SByte.MinValue And "12")
PrintResult("System.SByte.MinValue And TypeCode.Double", System.SByte.MinValue And TypeCode.Double)
PrintResult("System.Byte.MaxValue And False", System.Byte.MaxValue And False)
PrintResult("System.Byte.MaxValue And True", System.Byte.MaxValue And True)
PrintResult("System.Byte.MaxValue And System.SByte.MinValue", System.Byte.MaxValue And System.SByte.MinValue)
PrintResult("System.Byte.MaxValue And System.Byte.MaxValue", System.Byte.MaxValue And System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue And -3S", System.Byte.MaxValue And -3S)
PrintResult("System.Byte.MaxValue And 24US", System.Byte.MaxValue And 24US)
PrintResult("System.Byte.MaxValue And -5I", System.Byte.MaxValue And -5I)
PrintResult("System.Byte.MaxValue And 26UI", System.Byte.MaxValue And 26UI)
PrintResult("System.Byte.MaxValue And -7L", System.Byte.MaxValue And -7L)
PrintResult("System.Byte.MaxValue And 28UL", System.Byte.MaxValue And 28UL)
PrintResult("System.Byte.MaxValue And -9D", System.Byte.MaxValue And -9D)
PrintResult("System.Byte.MaxValue And 10.0F", System.Byte.MaxValue And 10.0F)
PrintResult("System.Byte.MaxValue And -11.0R", System.Byte.MaxValue And -11.0R)
PrintResult("System.Byte.MaxValue And ""12""", System.Byte.MaxValue And "12")
PrintResult("System.Byte.MaxValue And TypeCode.Double", System.Byte.MaxValue And TypeCode.Double)
PrintResult("-3S And False", -3S And False)
PrintResult("-3S And True", -3S And True)
PrintResult("-3S And System.SByte.MinValue", -3S And System.SByte.MinValue)
PrintResult("-3S And System.Byte.MaxValue", -3S And System.Byte.MaxValue)
PrintResult("-3S And -3S", -3S And -3S)
PrintResult("-3S And 24US", -3S And 24US)
PrintResult("-3S And -5I", -3S And -5I)
PrintResult("-3S And 26UI", -3S And 26UI)
PrintResult("-3S And -7L", -3S And -7L)
PrintResult("-3S And 28UL", -3S And 28UL)
PrintResult("-3S And -9D", -3S And -9D)
PrintResult("-3S And 10.0F", -3S And 10.0F)
PrintResult("-3S And -11.0R", -3S And -11.0R)
PrintResult("-3S And ""12""", -3S And "12")
PrintResult("-3S And TypeCode.Double", -3S And TypeCode.Double)
PrintResult("24US And False", 24US And False)
PrintResult("24US And True", 24US And True)
PrintResult("24US And System.SByte.MinValue", 24US And System.SByte.MinValue)
PrintResult("24US And System.Byte.MaxValue", 24US And System.Byte.MaxValue)
PrintResult("24US And -3S", 24US And -3S)
PrintResult("24US And 24US", 24US And 24US)
PrintResult("24US And -5I", 24US And -5I)
PrintResult("24US And 26UI", 24US And 26UI)
PrintResult("24US And -7L", 24US And -7L)
PrintResult("24US And 28UL", 24US And 28UL)
PrintResult("24US And -9D", 24US And -9D)
PrintResult("24US And 10.0F", 24US And 10.0F)
PrintResult("24US And -11.0R", 24US And -11.0R)
PrintResult("24US And ""12""", 24US And "12")
PrintResult("24US And TypeCode.Double", 24US And TypeCode.Double)
PrintResult("-5I And False", -5I And False)
PrintResult("-5I And True", -5I And True)
PrintResult("-5I And System.SByte.MinValue", -5I And System.SByte.MinValue)
PrintResult("-5I And System.Byte.MaxValue", -5I And System.Byte.MaxValue)
PrintResult("-5I And -3S", -5I And -3S)
PrintResult("-5I And 24US", -5I And 24US)
PrintResult("-5I And -5I", -5I And -5I)
PrintResult("-5I And 26UI", -5I And 26UI)
PrintResult("-5I And -7L", -5I And -7L)
PrintResult("-5I And 28UL", -5I And 28UL)
PrintResult("-5I And -9D", -5I And -9D)
PrintResult("-5I And 10.0F", -5I And 10.0F)
PrintResult("-5I And -11.0R", -5I And -11.0R)
PrintResult("-5I And ""12""", -5I And "12")
PrintResult("-5I And TypeCode.Double", -5I And TypeCode.Double)
PrintResult("26UI And False", 26UI And False)
PrintResult("26UI And True", 26UI And True)
PrintResult("26UI And System.SByte.MinValue", 26UI And System.SByte.MinValue)
PrintResult("26UI And System.Byte.MaxValue", 26UI And System.Byte.MaxValue)
PrintResult("26UI And -3S", 26UI And -3S)
PrintResult("26UI And 24US", 26UI And 24US)
PrintResult("26UI And -5I", 26UI And -5I)
PrintResult("26UI And 26UI", 26UI And 26UI)
PrintResult("26UI And -7L", 26UI And -7L)
PrintResult("26UI And 28UL", 26UI And 28UL)
PrintResult("26UI And -9D", 26UI And -9D)
PrintResult("26UI And 10.0F", 26UI And 10.0F)
PrintResult("26UI And -11.0R", 26UI And -11.0R)
PrintResult("26UI And ""12""", 26UI And "12")
PrintResult("26UI And TypeCode.Double", 26UI And TypeCode.Double)
PrintResult("-7L And False", -7L And False)
PrintResult("-7L And True", -7L And True)
PrintResult("-7L And System.SByte.MinValue", -7L And System.SByte.MinValue)
PrintResult("-7L And System.Byte.MaxValue", -7L And System.Byte.MaxValue)
PrintResult("-7L And -3S", -7L And -3S)
PrintResult("-7L And 24US", -7L And 24US)
PrintResult("-7L And -5I", -7L And -5I)
PrintResult("-7L And 26UI", -7L And 26UI)
PrintResult("-7L And -7L", -7L And -7L)
PrintResult("-7L And 28UL", -7L And 28UL)
PrintResult("-7L And -9D", -7L And -9D)
PrintResult("-7L And 10.0F", -7L And 10.0F)
PrintResult("-7L And -11.0R", -7L And -11.0R)
PrintResult("-7L And ""12""", -7L And "12")
PrintResult("-7L And TypeCode.Double", -7L And TypeCode.Double)
PrintResult("28UL And False", 28UL And False)
PrintResult("28UL And True", 28UL And True)
PrintResult("28UL And System.SByte.MinValue", 28UL And System.SByte.MinValue)
PrintResult("28UL And System.Byte.MaxValue", 28UL And System.Byte.MaxValue)
PrintResult("28UL And -3S", 28UL And -3S)
PrintResult("28UL And 24US", 28UL And 24US)
PrintResult("28UL And -5I", 28UL And -5I)
PrintResult("28UL And 26UI", 28UL And 26UI)
PrintResult("28UL And -7L", 28UL And -7L)
PrintResult("28UL And 28UL", 28UL And 28UL)
PrintResult("28UL And -9D", 28UL And -9D)
PrintResult("28UL And 10.0F", 28UL And 10.0F)
PrintResult("28UL And -11.0R", 28UL And -11.0R)
PrintResult("28UL And ""12""", 28UL And "12")
PrintResult("28UL And TypeCode.Double", 28UL And TypeCode.Double)
PrintResult("-9D And False", -9D And False)
PrintResult("-9D And True", -9D And True)
PrintResult("-9D And System.SByte.MinValue", -9D And System.SByte.MinValue)
PrintResult("-9D And System.Byte.MaxValue", -9D And System.Byte.MaxValue)
PrintResult("-9D And -3S", -9D And -3S)
PrintResult("-9D And 24US", -9D And 24US)
PrintResult("-9D And -5I", -9D And -5I)
PrintResult("-9D And 26UI", -9D And 26UI)
PrintResult("-9D And -7L", -9D And -7L)
PrintResult("-9D And 28UL", -9D And 28UL)
PrintResult("-9D And -9D", -9D And -9D)
PrintResult("-9D And 10.0F", -9D And 10.0F)
PrintResult("-9D And -11.0R", -9D And -11.0R)
PrintResult("-9D And ""12""", -9D And "12")
PrintResult("-9D And TypeCode.Double", -9D And TypeCode.Double)
PrintResult("10.0F And False", 10.0F And False)
PrintResult("10.0F And True", 10.0F And True)
PrintResult("10.0F And System.SByte.MinValue", 10.0F And System.SByte.MinValue)
PrintResult("10.0F And System.Byte.MaxValue", 10.0F And System.Byte.MaxValue)
PrintResult("10.0F And -3S", 10.0F And -3S)
PrintResult("10.0F And 24US", 10.0F And 24US)
PrintResult("10.0F And -5I", 10.0F And -5I)
PrintResult("10.0F And 26UI", 10.0F And 26UI)
PrintResult("10.0F And -7L", 10.0F And -7L)
PrintResult("10.0F And 28UL", 10.0F And 28UL)
PrintResult("10.0F And -9D", 10.0F And -9D)
PrintResult("10.0F And 10.0F", 10.0F And 10.0F)
PrintResult("10.0F And -11.0R", 10.0F And -11.0R)
PrintResult("10.0F And ""12""", 10.0F And "12")
PrintResult("10.0F And TypeCode.Double", 10.0F And TypeCode.Double)
PrintResult("-11.0R And False", -11.0R And False)
PrintResult("-11.0R And True", -11.0R And True)
PrintResult("-11.0R And System.SByte.MinValue", -11.0R And System.SByte.MinValue)
PrintResult("-11.0R And System.Byte.MaxValue", -11.0R And System.Byte.MaxValue)
PrintResult("-11.0R And -3S", -11.0R And -3S)
PrintResult("-11.0R And 24US", -11.0R And 24US)
PrintResult("-11.0R And -5I", -11.0R And -5I)
PrintResult("-11.0R And 26UI", -11.0R And 26UI)
PrintResult("-11.0R And -7L", -11.0R And -7L)
PrintResult("-11.0R And 28UL", -11.0R And 28UL)
PrintResult("-11.0R And -9D", -11.0R And -9D)
PrintResult("-11.0R And 10.0F", -11.0R And 10.0F)
PrintResult("-11.0R And -11.0R", -11.0R And -11.0R)
PrintResult("-11.0R And ""12""", -11.0R And "12")
PrintResult("-11.0R And TypeCode.Double", -11.0R And TypeCode.Double)
PrintResult("""12"" And False", "12" And False)
PrintResult("""12"" And True", "12" And True)
PrintResult("""12"" And System.SByte.MinValue", "12" And System.SByte.MinValue)
PrintResult("""12"" And System.Byte.MaxValue", "12" And System.Byte.MaxValue)
PrintResult("""12"" And -3S", "12" And -3S)
PrintResult("""12"" And 24US", "12" And 24US)
PrintResult("""12"" And -5I", "12" And -5I)
PrintResult("""12"" And 26UI", "12" And 26UI)
PrintResult("""12"" And -7L", "12" And -7L)
PrintResult("""12"" And 28UL", "12" And 28UL)
PrintResult("""12"" And -9D", "12" And -9D)
PrintResult("""12"" And 10.0F", "12" And 10.0F)
PrintResult("""12"" And -11.0R", "12" And -11.0R)
PrintResult("""12"" And ""12""", "12" And "12")
PrintResult("""12"" And TypeCode.Double", "12" And TypeCode.Double)
PrintResult("TypeCode.Double And False", TypeCode.Double And False)
PrintResult("TypeCode.Double And True", TypeCode.Double And True)
PrintResult("TypeCode.Double And System.SByte.MinValue", TypeCode.Double And System.SByte.MinValue)
PrintResult("TypeCode.Double And System.Byte.MaxValue", TypeCode.Double And System.Byte.MaxValue)
PrintResult("TypeCode.Double And -3S", TypeCode.Double And -3S)
PrintResult("TypeCode.Double And 24US", TypeCode.Double And 24US)
PrintResult("TypeCode.Double And -5I", TypeCode.Double And -5I)
PrintResult("TypeCode.Double And 26UI", TypeCode.Double And 26UI)
PrintResult("TypeCode.Double And -7L", TypeCode.Double And -7L)
PrintResult("TypeCode.Double And 28UL", TypeCode.Double And 28UL)
PrintResult("TypeCode.Double And -9D", TypeCode.Double And -9D)
PrintResult("TypeCode.Double And 10.0F", TypeCode.Double And 10.0F)
PrintResult("TypeCode.Double And -11.0R", TypeCode.Double And -11.0R)
PrintResult("TypeCode.Double And ""12""", TypeCode.Double And "12")
PrintResult("TypeCode.Double And TypeCode.Double", TypeCode.Double And TypeCode.Double)
'PrintResult("#8:30:00 AM# + ""12""", #8:30:00 AM# + "12")
'PrintResult("#8:30:00 AM# + #8:30:00 AM#", #8:30:00 AM# + #8:30:00 AM#)
PrintResult("""c""c + ""12""", "c"c + "12")
PrintResult("""c""c + ""c""c", "c"c + "c"c)
'PrintResult("""12"" + #8:30:00 AM#", "12" + #8:30:00 AM#)
PrintResult("""12"" + ""c""c", "12" + "c"c)
'PrintResult("#8:30:00 AM# & False", #8:30:00 AM# & False)
'PrintResult("#8:30:00 AM# & True", #8:30:00 AM# & True)
'PrintResult("#8:30:00 AM# & System.SByte.MinValue", #8:30:00 AM# & System.SByte.MinValue)
'PrintResult("#8:30:00 AM# & System.Byte.MaxValue", #8:30:00 AM# & System.Byte.MaxValue)
'PrintResult("#8:30:00 AM# & -3S", #8:30:00 AM# & -3S)
'PrintResult("#8:30:00 AM# & 24US", #8:30:00 AM# & 24US)
'PrintResult("#8:30:00 AM# & -5I", #8:30:00 AM# & -5I)
'PrintResult("#8:30:00 AM# & 26UI", #8:30:00 AM# & 26UI)
'PrintResult("#8:30:00 AM# & -7L", #8:30:00 AM# & -7L)
'PrintResult("#8:30:00 AM# & 28UL", #8:30:00 AM# & 28UL)
'PrintResult("#8:30:00 AM# & -9D", #8:30:00 AM# & -9D)
'PrintResult("#8:30:00 AM# & 10.0F", #8:30:00 AM# & 10.0F)
'PrintResult("#8:30:00 AM# & -11.0R", #8:30:00 AM# & -11.0R)
'PrintResult("#8:30:00 AM# & ""12""", #8:30:00 AM# & "12")
'PrintResult("#8:30:00 AM# & TypeCode.Double", #8:30:00 AM# & TypeCode.Double)
'PrintResult("#8:30:00 AM# & #8:30:00 AM#", #8:30:00 AM# & #8:30:00 AM#)
'PrintResult("#8:30:00 AM# & ""c""c", #8:30:00 AM# & "c"c)
PrintResult("""c""c & False", "c"c & False)
PrintResult("""c""c & True", "c"c & True)
PrintResult("""c""c & System.SByte.MinValue", "c"c & System.SByte.MinValue)
PrintResult("""c""c & System.Byte.MaxValue", "c"c & System.Byte.MaxValue)
PrintResult("""c""c & -3S", "c"c & -3S)
PrintResult("""c""c & 24US", "c"c & 24US)
PrintResult("""c""c & -5I", "c"c & -5I)
PrintResult("""c""c & 26UI", "c"c & 26UI)
PrintResult("""c""c & -7L", "c"c & -7L)
PrintResult("""c""c & 28UL", "c"c & 28UL)
PrintResult("""c""c & -9D", "c"c & -9D)
PrintResult("""c""c & 10.0F", "c"c & 10.0F)
PrintResult("""c""c & -11.0R", "c"c & -11.0R)
PrintResult("""c""c & ""12""", "c"c & "12")
PrintResult("""c""c & TypeCode.Double", "c"c & TypeCode.Double)
'PrintResult("""c""c & #8:30:00 AM#", "c"c & #8:30:00 AM#)
PrintResult("""c""c & ""c""c", "c"c & "c"c)
'PrintResult("False & #8:30:00 AM#", False & #8:30:00 AM#)
PrintResult("False & ""c""c", False & "c"c)
'PrintResult("True & #8:30:00 AM#", True & #8:30:00 AM#)
PrintResult("True & ""c""c", True & "c"c)
'PrintResult("System.SByte.MinValue & #8:30:00 AM#", System.SByte.MinValue & #8:30:00 AM#)
PrintResult("System.SByte.MinValue & ""c""c", System.SByte.MinValue & "c"c)
'PrintResult("System.Byte.MaxValue & #8:30:00 AM#", System.Byte.MaxValue & #8:30:00 AM#)
PrintResult("System.Byte.MaxValue & ""c""c", System.Byte.MaxValue & "c"c)
'PrintResult("-3S & #8:30:00 AM#", -3S & #8:30:00 AM#)
PrintResult("-3S & ""c""c", -3S & "c"c)
'PrintResult("24US & #8:30:00 AM#", 24US & #8:30:00 AM#)
PrintResult("24US & ""c""c", 24US & "c"c)
'PrintResult("-5I & #8:30:00 AM#", -5I & #8:30:00 AM#)
PrintResult("-5I & ""c""c", -5I & "c"c)
'PrintResult("26UI & #8:30:00 AM#", 26UI & #8:30:00 AM#)
PrintResult("26UI & ""c""c", 26UI & "c"c)
'PrintResult("-7L & #8:30:00 AM#", -7L & #8:30:00 AM#)
PrintResult("-7L & ""c""c", -7L & "c"c)
'PrintResult("28UL & #8:30:00 AM#", 28UL & #8:30:00 AM#)
PrintResult("28UL & ""c""c", 28UL & "c"c)
'PrintResult("-9D & #8:30:00 AM#", -9D & #8:30:00 AM#)
PrintResult("-9D & ""c""c", -9D & "c"c)
'PrintResult("10.0F & #8:30:00 AM#", 10.0F & #8:30:00 AM#)
PrintResult("10.0F & ""c""c", 10.0F & "c"c)
'PrintResult("-11.0R & #8:30:00 AM#", -11.0R & #8:30:00 AM#)
PrintResult("-11.0R & ""c""c", -11.0R & "c"c)
'PrintResult("""12"" & #8:30:00 AM#", "12" & #8:30:00 AM#)
PrintResult("""12"" & ""c""c", "12" & "c"c)
'PrintResult("TypeCode.Double & #8:30:00 AM#", TypeCode.Double & #8:30:00 AM#)
PrintResult("TypeCode.Double & ""c""c", TypeCode.Double & "c"c)
PrintResult("#8:30:00 AM# Like False", #8:30:00 AM# Like False)
PrintResult("#8:30:00 AM# Like True", #8:30:00 AM# Like True)
PrintResult("#8:30:00 AM# Like System.SByte.MinValue", #8:30:00 AM# Like System.SByte.MinValue)
PrintResult("#8:30:00 AM# Like System.Byte.MaxValue", #8:30:00 AM# Like System.Byte.MaxValue)
PrintResult("#8:30:00 AM# Like -3S", #8:30:00 AM# Like -3S)
PrintResult("#8:30:00 AM# Like 24US", #8:30:00 AM# Like 24US)
PrintResult("#8:30:00 AM# Like -5I", #8:30:00 AM# Like -5I)
PrintResult("#8:30:00 AM# Like 26UI", #8:30:00 AM# Like 26UI)
PrintResult("#8:30:00 AM# Like -7L", #8:30:00 AM# Like -7L)
PrintResult("#8:30:00 AM# Like 28UL", #8:30:00 AM# Like 28UL)
PrintResult("#8:30:00 AM# Like -9D", #8:30:00 AM# Like -9D)
PrintResult("#8:30:00 AM# Like 10.0F", #8:30:00 AM# Like 10.0F)
PrintResult("#8:30:00 AM# Like -11.0R", #8:30:00 AM# Like -11.0R)
PrintResult("#8:30:00 AM# Like ""12""", #8:30:00 AM# Like "12")
PrintResult("#8:30:00 AM# Like TypeCode.Double", #8:30:00 AM# Like TypeCode.Double)
PrintResult("#8:30:00 AM# Like #8:30:00 AM#", #8:30:00 AM# Like #8:30:00 AM#)
PrintResult("#8:30:00 AM# Like ""c""c", #8:30:00 AM# Like "c"c)
PrintResult("""c""c Like False", "c"c Like False)
PrintResult("""c""c Like True", "c"c Like True)
PrintResult("""c""c Like System.SByte.MinValue", "c"c Like System.SByte.MinValue)
PrintResult("""c""c Like System.Byte.MaxValue", "c"c Like System.Byte.MaxValue)
PrintResult("""c""c Like -3S", "c"c Like -3S)
PrintResult("""c""c Like 24US", "c"c Like 24US)
PrintResult("""c""c Like -5I", "c"c Like -5I)
PrintResult("""c""c Like 26UI", "c"c Like 26UI)
PrintResult("""c""c Like -7L", "c"c Like -7L)
PrintResult("""c""c Like 28UL", "c"c Like 28UL)
PrintResult("""c""c Like -9D", "c"c Like -9D)
PrintResult("""c""c Like 10.0F", "c"c Like 10.0F)
PrintResult("""c""c Like -11.0R", "c"c Like -11.0R)
PrintResult("""c""c Like ""12""", "c"c Like "12")
PrintResult("""c""c Like TypeCode.Double", "c"c Like TypeCode.Double)
PrintResult("""c""c Like #8:30:00 AM#", "c"c Like #8:30:00 AM#)
PrintResult("""c""c Like ""c""c", "c"c Like "c"c)
PrintResult("False Like #8:30:00 AM#", False Like #8:30:00 AM#)
PrintResult("False Like ""c""c", False Like "c"c)
PrintResult("True Like #8:30:00 AM#", True Like #8:30:00 AM#)
PrintResult("True Like ""c""c", True Like "c"c)
PrintResult("System.SByte.MinValue Like #8:30:00 AM#", System.SByte.MinValue Like #8:30:00 AM#)
PrintResult("System.SByte.MinValue Like ""c""c", System.SByte.MinValue Like "c"c)
PrintResult("System.Byte.MaxValue Like #8:30:00 AM#", System.Byte.MaxValue Like #8:30:00 AM#)
PrintResult("System.Byte.MaxValue Like ""c""c", System.Byte.MaxValue Like "c"c)
PrintResult("-3S Like #8:30:00 AM#", -3S Like #8:30:00 AM#)
PrintResult("-3S Like ""c""c", -3S Like "c"c)
PrintResult("24US Like #8:30:00 AM#", 24US Like #8:30:00 AM#)
PrintResult("24US Like ""c""c", 24US Like "c"c)
PrintResult("-5I Like #8:30:00 AM#", -5I Like #8:30:00 AM#)
PrintResult("-5I Like ""c""c", -5I Like "c"c)
PrintResult("26UI Like #8:30:00 AM#", 26UI Like #8:30:00 AM#)
PrintResult("26UI Like ""c""c", 26UI Like "c"c)
PrintResult("-7L Like #8:30:00 AM#", -7L Like #8:30:00 AM#)
PrintResult("-7L Like ""c""c", -7L Like "c"c)
PrintResult("28UL Like #8:30:00 AM#", 28UL Like #8:30:00 AM#)
PrintResult("28UL Like ""c""c", 28UL Like "c"c)
PrintResult("-9D Like #8:30:00 AM#", -9D Like #8:30:00 AM#)
PrintResult("-9D Like ""c""c", -9D Like "c"c)
PrintResult("10.0F Like #8:30:00 AM#", 10.0F Like #8:30:00 AM#)
PrintResult("10.0F Like ""c""c", 10.0F Like "c"c)
PrintResult("-11.0R Like #8:30:00 AM#", -11.0R Like #8:30:00 AM#)
PrintResult("-11.0R Like ""c""c", -11.0R Like "c"c)
PrintResult("""12"" Like #8:30:00 AM#", "12" Like #8:30:00 AM#)
PrintResult("""12"" Like ""c""c", "12" Like "c"c)
PrintResult("TypeCode.Double Like #8:30:00 AM#", TypeCode.Double Like #8:30:00 AM#)
PrintResult("TypeCode.Double Like ""c""c", TypeCode.Double Like "c"c)
PrintResult("#8:30:00 AM# = #8:30:00 AM#", #8:30:00 AM# = #8:30:00 AM#)
PrintResult("""c""c = ""12""", "c"c = "12")
PrintResult("""c""c = ""c""c", "c"c = "c"c)
PrintResult("""12"" = ""c""c", "12" = "c"c)
PrintResult("#8:30:00 AM# <> #8:30:00 AM#", #8:30:00 AM# <> #8:30:00 AM#)
PrintResult("""c""c <> ""12""", "c"c <> "12")
PrintResult("""c""c <> ""c""c", "c"c <> "c"c)
PrintResult("""12"" <> ""c""c", "12" <> "c"c)
PrintResult("#8:30:00 AM# <= #8:30:00 AM#", #8:30:00 AM# <= #8:30:00 AM#)
PrintResult("""c""c <= ""12""", "c"c <= "12")
PrintResult("""c""c <= ""c""c", "c"c <= "c"c)
PrintResult("""12"" <= ""c""c", "12" <= "c"c)
PrintResult("#8:30:00 AM# >= #8:30:00 AM#", #8:30:00 AM# >= #8:30:00 AM#)
PrintResult("""c""c >= ""12""", "c"c >= "12")
PrintResult("""c""c >= ""c""c", "c"c >= "c"c)
PrintResult("""12"" >= ""c""c", "12" >= "c"c)
PrintResult("#8:30:00 AM# < #8:30:00 AM#", #8:30:00 AM# < #8:30:00 AM#)
PrintResult("""c""c < ""12""", "c"c < "12")
PrintResult("""c""c < ""c""c", "c"c < "c"c)
PrintResult("""12"" < ""c""c", "12" < "c"c)
PrintResult("#8:30:00 AM# > #8:30:00 AM#", #8:30:00 AM# > #8:30:00 AM#)
PrintResult("""c""c > ""12""", "c"c > "12")
PrintResult("""c""c > ""c""c", "c"c > "c"c)
PrintResult("""12"" > ""c""c", "12" > "c"c)
PrintResult("System.Byte.MaxValue - 24US", System.Byte.MaxValue - 24US)
PrintResult("System.Byte.MaxValue - 26UI", System.Byte.MaxValue - 26UI)
PrintResult("System.Byte.MaxValue - 28UL", System.Byte.MaxValue - 28UL)
PrintResult("44US - 26UI", 44US - 26UI)
PrintResult("44US - 28UL", 44US - 28UL)
PrintResult("46UI - 28UL", 46UI - 28UL)
PrintResult("System.Byte.MaxValue * (System.Byte.MaxValue \ System.Byte.MaxValue)", System.Byte.MaxValue * (System.Byte.MaxValue \ System.Byte.MaxValue))
PrintResult("#8:31:00 AM# = ""8:30:00 AM""", #8:31:00 AM# = "8:30:00 AM")
PrintResult("""8:30:00 AM"" = #8:31:00 AM#", "8:30:00 AM" = #8:31:00 AM#)
PrintResult("#8:31:00 AM# <> ""8:30:00 AM""", #8:31:00 AM# <> "8:30:00 AM")
PrintResult("""8:30:00 AM"" <> #8:31:00 AM#", "8:30:00 AM" <> #8:31:00 AM#)
PrintResult("#8:31:00 AM# <= ""8:30:00 AM""", #8:31:00 AM# <= "8:30:00 AM")
PrintResult("""8:30:00 AM"" <= #8:31:00 AM#", "8:30:00 AM" <= #8:31:00 AM#)
PrintResult("#8:31:00 AM# >= ""8:30:00 AM""", #8:31:00 AM# >= "8:30:00 AM")
PrintResult("""8:30:00 AM"" >= #8:31:00 AM#", "8:30:00 AM" >= #8:31:00 AM#)
PrintResult("#8:31:00 AM# < ""8:30:00 AM""", #8:31:00 AM# < "8:30:00 AM")
PrintResult("""8:30:00 AM"" < #8:31:00 AM#", "8:30:00 AM" < #8:31:00 AM#)
PrintResult("#8:31:00 AM# > ""8:30:00 AM""", #8:31:00 AM# > "8:30:00 AM")
PrintResult("""8:30:00 AM"" > #8:31:00 AM#", "8:30:00 AM" > #8:31:00 AM#)
PrintResult("-5I + Nothing", -5I + Nothing)
PrintResult("""12"" + Nothing", "12" + Nothing)
PrintResult("""12"" + DBNull.Value", "12" + DBNull.Value)
PrintResult("Nothing + Nothing", Nothing + Nothing)
PrintResult("Nothing + -5I", Nothing + -5I)
PrintResult("Nothing + ""12""", Nothing + "12")
PrintResult("DBNull.Value + ""12""", DBNull.Value + "12")
PrintResult("-5I - Nothing", -5I - Nothing)
PrintResult("""12"" - Nothing", "12" - Nothing)
PrintResult("Nothing - Nothing", Nothing - Nothing)
PrintResult("Nothing - -5I", Nothing - -5I)
PrintResult("Nothing - ""12""", Nothing - "12")
PrintResult("-5I * Nothing", -5I * Nothing)
PrintResult("""12"" * Nothing", "12" * Nothing)
PrintResult("Nothing * Nothing", Nothing * Nothing)
PrintResult("Nothing * -5I", Nothing * -5I)
PrintResult("Nothing * ""12""", Nothing * "12")
PrintResult("-5I / Nothing", -5I / Nothing)
PrintResult("""12"" / Nothing", "12" / Nothing)
PrintResult("Nothing / Nothing", Nothing / Nothing)
PrintResult("Nothing / -5I", Nothing / -5I)
PrintResult("Nothing / ""12""", Nothing / "12")
PrintResult("Nothing \ -5I", Nothing \ -5I)
PrintResult("Nothing \ ""12""", Nothing \ "12")
PrintResult("""12"" Mod Nothing", "12" Mod Nothing)
PrintResult("Nothing Mod -5I", Nothing Mod -5I)
PrintResult("Nothing Mod ""12""", Nothing Mod "12")
PrintResult("-5I ^ Nothing", -5I ^ Nothing)
PrintResult("""12"" ^ Nothing", "12" ^ Nothing)
PrintResult("Nothing ^ Nothing", Nothing ^ Nothing)
PrintResult("Nothing ^ -5I", Nothing ^ -5I)
PrintResult("Nothing ^ ""12""", Nothing ^ "12")
PrintResult("-5I << Nothing", -5I << Nothing)
PrintResult("""12"" << Nothing", "12" << Nothing)
PrintResult("Nothing << Nothing", Nothing << Nothing)
PrintResult("Nothing << -5I", Nothing << -5I)
PrintResult("Nothing << ""12""", Nothing << "12")
PrintResult("-5I >> Nothing", -5I >> Nothing)
PrintResult("""12"" >> Nothing", "12" >> Nothing)
PrintResult("Nothing >> Nothing", Nothing >> Nothing)
PrintResult("Nothing >> -5I", Nothing >> -5I)
PrintResult("Nothing >> ""12""", Nothing >> "12")
PrintResult("-5I OrElse Nothing", -5I OrElse Nothing)
PrintResult("""12"" OrElse Nothing", "12" OrElse Nothing)
PrintResult("Nothing OrElse Nothing", Nothing OrElse Nothing)
PrintResult("Nothing OrElse -5I", Nothing OrElse -5I)
PrintResult("-5I AndAlso Nothing", -5I AndAlso Nothing)
PrintResult("Nothing AndAlso Nothing", Nothing AndAlso Nothing)
PrintResult("Nothing AndAlso -5I", Nothing AndAlso -5I)
PrintResult("-5I & Nothing", -5I & Nothing)
PrintResult("-5I & DBNull.Value", -5I & DBNull.Value)
PrintResult("""12"" & Nothing", "12" & Nothing)
PrintResult("""12"" & DBNull.Value", "12" & DBNull.Value)
PrintResult("Nothing & Nothing", Nothing & Nothing)
PrintResult("Nothing & DBNull.Value", Nothing & DBNull.Value)
PrintResult("DBNull.Value & Nothing", DBNull.Value & Nothing)
PrintResult("Nothing & -5I", Nothing & -5I)
PrintResult("Nothing & ""12""", Nothing & "12")
PrintResult("DBNull.Value & -5I", DBNull.Value & -5I)
PrintResult("DBNull.Value & ""12""", DBNull.Value & "12")
PrintResult("-5I Like Nothing", -5I Like Nothing)
PrintResult("""12"" Like Nothing", "12" Like Nothing)
PrintResult("Nothing Like Nothing", Nothing Like Nothing)
PrintResult("Nothing Like -5I", Nothing Like -5I)
PrintResult("Nothing Like ""12""", Nothing Like "12")
PrintResult("-5I = Nothing", -5I = Nothing)
PrintResult("""12"" = Nothing", "12" = Nothing)
PrintResult("Nothing = Nothing", Nothing = Nothing)
PrintResult("Nothing = -5I", Nothing = -5I)
PrintResult("Nothing = ""12""", Nothing = "12")
PrintResult("-5I <> Nothing", -5I <> Nothing)
PrintResult("""12"" <> Nothing", "12" <> Nothing)
PrintResult("Nothing <> Nothing", Nothing <> Nothing)
PrintResult("Nothing <> -5I", Nothing <> -5I)
PrintResult("Nothing <> ""12""", Nothing <> "12")
PrintResult("-5I <= Nothing", -5I <= Nothing)
PrintResult("""12"" <= Nothing", "12" <= Nothing)
PrintResult("Nothing <= Nothing", Nothing <= Nothing)
PrintResult("Nothing <= -5I", Nothing <= -5I)
PrintResult("Nothing <= ""12""", Nothing <= "12")
PrintResult("-5I >= Nothing", -5I >= Nothing)
PrintResult("""12"" >= Nothing", "12" >= Nothing)
PrintResult("Nothing >= Nothing", Nothing >= Nothing)
PrintResult("Nothing >= -5I", Nothing >= -5I)
PrintResult("Nothing >= ""12""", Nothing >= "12")
PrintResult("-5I < Nothing", -5I < Nothing)
PrintResult("""12"" < Nothing", "12" < Nothing)
PrintResult("Nothing < Nothing", Nothing < Nothing)
PrintResult("Nothing < -5I", Nothing < -5I)
PrintResult("Nothing < ""12""", Nothing < "12")
PrintResult("-5I > Nothing", -5I > Nothing)
PrintResult("""12"" > Nothing", "12" > Nothing)
PrintResult("Nothing > Nothing", Nothing > Nothing)
PrintResult("Nothing > -5I", Nothing > -5I)
PrintResult("Nothing > ""12""", Nothing > "12")
PrintResult("-5I Xor Nothing", -5I Xor Nothing)
PrintResult("""12"" Xor Nothing", "12" Xor Nothing)
PrintResult("Nothing Xor Nothing", Nothing Xor Nothing)
PrintResult("Nothing Xor -5I", Nothing Xor -5I)
PrintResult("Nothing Xor ""12""", Nothing Xor "12")
PrintResult("-5I Or Nothing", -5I Or Nothing)
PrintResult("""12"" Or Nothing", "12" Or Nothing)
PrintResult("Nothing Or Nothing", Nothing Or Nothing)
PrintResult("Nothing Or -5I", Nothing Or -5I)
PrintResult("Nothing Or ""12""", Nothing Or "12")
PrintResult("-5I And Nothing", -5I And Nothing)
PrintResult("""12"" And Nothing", "12" And Nothing)
PrintResult("Nothing And Nothing", Nothing And Nothing)
PrintResult("Nothing And -5I", Nothing And -5I)
PrintResult("Nothing And ""12""", Nothing And "12")
PrintResult("2I / 0", 2I / 0)
PrintResult("1.5F / 0", 1.5F / 0)
PrintResult("2.5R / 0", 2.5R / 0)
PrintResult("1.5F Mod 0", 1.5F Mod 0)
PrintResult("2.5R Mod 0", 2.5R Mod 0)
PrintResult("2I / 0", 2I / Nothing)
PrintResult("1.5F / 0", 1.5F / Nothing)
PrintResult("2.5R / 0", 2.5R / Nothing)
PrintResult("1.5F Mod 0", 1.5F Mod Nothing)
PrintResult("2.5R Mod 0", 2.5R Mod Nothing)
PrintResult("System.Single.MinValue - 1.0F", System.Single.MinValue - 1.0F)
PrintResult("System.Double.MinValue - 1.0R", System.Double.MinValue - 1.0R)
PrintResult("System.Single.MaxValue + 1.0F", System.Single.MaxValue + 1.0F)
PrintResult("System.Double.MaxValue + 1.0R", System.Double.MaxValue + 1.0R)
PrintResult("1.0F ^ System.Single.NegativeInfinity", 1.0F ^ System.Single.NegativeInfinity)
PrintResult("1.0F ^ System.Single.PositiveInfinity", 1.0F ^ System.Single.PositiveInfinity)
PrintResult("1.0R ^ System.Double.NegativeInfinity", 1.0R ^ System.Double.NegativeInfinity)
PrintResult("1.0R ^ System.Double.PositiveInfinity", 1.0R ^ System.Double.PositiveInfinity)
PrintResult("-1.0F ^ System.Single.NegativeInfinity", -1.0F ^ System.Single.NegativeInfinity)
PrintResult("-1.0F ^ System.Single.PositiveInfinity", -1.0F ^ System.Single.PositiveInfinity)
PrintResult("-1.0R ^ System.Double.NegativeInfinity", -1.0R ^ System.Double.NegativeInfinity)
PrintResult("-1.0R ^ System.Double.PositiveInfinity", -1.0R ^ System.Double.PositiveInfinity)
PrintResult("2.0F ^ System.Single.NaN", 2.0F ^ System.Single.NaN)
PrintResult("2.0R ^ System.Double.NaN", 2.0R ^ System.Double.NaN)
PrintResult("(-1.0F) ^ System.Single.NegativeInfinity", (-1.0F) ^ System.Single.NegativeInfinity)
PrintResult("(-1.0F) ^ System.Single.PositiveInfinity", (-1.0F) ^ System.Single.PositiveInfinity)
PrintResult("(-1.0F) ^ System.Double.NegativeInfinity", (-1.0F) ^ System.Double.NegativeInfinity)
PrintResult("(-1.0F) ^ System.Double.PositiveInfinity", (-1.0F) ^ System.Double.PositiveInfinity)
End Sub
End Module
|
ManishJayaswal/roslyn
|
src/Compilers/VisualBasic/Test/Semantic/Semantics/BinaryOperatorsTestSource5.vb
|
Visual Basic
|
apache-2.0
| 327,251
|
Public Class Form1
Dim intGuess, intRight, intScore As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
intScore = 100
'Get Random
intRight = Int(Rnd() * (100 - 1 + 1)) + 1
End Sub
Private Sub btnRightOrWrong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRightOrWrong.Click
'Get Input
intGuess = CInt(txtGuessedNum.Text)
If intGuess < intRight Then
intScore -= 10
MessageBox.Show("Guess Higher" & ControlChars.NewLine & "Your score: " & CStr(intScore), "Guess Check", MessageBoxButtons.OK)
ElseIf intGuess > intRight Then
intScore -= 10
MessageBox.Show("Guess Lower" & ControlChars.NewLine & "Your score: " & CStr(intScore), "Guess Check", MessageBoxButtons.OK)
Else
MessageBox.Show("You Won!" & ControlChars.NewLine & "Your score: " & CStr(intScore), "Guess Check", MessageBoxButtons.OK)
My.Computer.Audio.Play("chimes.wav")
Me.Close() 'Close form
End If
End Sub
End Class
'Kaleb Haslam
'Guessing Game
|
hhaslam11/Visual-Basic-Projects
|
Guessing Game/Guessing Game/Form1.vb
|
Visual Basic
|
mit
| 1,193
|
Public Class KPoly : Implements IHasRect
Public points As List(Of Point)
Public center As Point
Public AABB As Rectangle
Public id As Short
Public ReadOnly Property Rect As Rectangle Implements IHasRect.Rect
Get
Return AABB
End Get
End Property
Public Sub New()
points = New List(Of Point)
center = New Point
End Sub
Public Sub New(p As KPoly)
Init(p.points, True)
End Sub
Public Sub New(ByVal list As List(Of Point), ByVal copy As Boolean)
Init(list, copy)
End Sub
Public Sub New(ByVal r As Rectangle)
AABB = New Rectangle(r.X, r.Y, r.Width, r.Height)
points = New List(Of Point)(5)
points.Add(New Point(r.Location))
points.Add(New Point(r.X, r.Y + r.Height))
points.Add(New Point(r.X + r.Width, r.Y + r.Height))
points.Add(New Point(r.X + r.Width, r.Y))
points.Add(New Point(r.Location))
center = New Point(r.X + r.Width / 2, r.Y + r.Height / 2)
End Sub
Private Sub Init(ByVal list As List(Of Point), ByVal copy As Boolean)
Dim minx As Integer = list(0).X, miny As Integer = list(0).Y, maxx As Integer = minx, maxy As Integer = miny
points = New List(Of Point)(list.Count)
For Each pt As Point In list
If copy Then
points.Add(New Point(pt.X, pt.Y))
Else
points.Add(pt)
End If
If pt.X < minx Then minx = pt.X
If pt.X > maxx Then maxx = pt.X
If pt.Y < miny Then miny = pt.Y
If pt.Y > maxy Then maxy = pt.Y
Next
maxx -= minx : maxy -= miny
AABB = New Rectangle(minx, miny, maxx, maxy)
center = New Point(minx + maxx / 2, miny + maxy / 2)
End Sub
Private Function isLeft(ByVal p0 As Point, ByVal p1 As Point, ByVal p2 As Point) As Double
Return (p1.X - p0.X) * (p2.Y - p0.Y) - (p2.X - p0.X) * (p1.Y - p0.Y)
End Function
Private Function above(ByVal p0 As Point, ByVal p1 As Point, ByVal p2 As Point) As Boolean
Return (isLeft(p0, p1, p2) > 0)
End Function
Private Function below(ByVal p0 As Point, ByVal p1 As Point, ByVal p2 As Point) As Boolean
Return (isLeft(p0, p1, p2) < 0)
End Function
Public Sub getTangent(ByVal p As Point, ByRef l As Point, ByRef r As Point)
Dim eprev As Double, enext As Double ' aa(i) previous and next edge turn direction
Dim Rtan As Short = 0, Ltan As Short = 0 ' initially assume aa(0) = both tangents
eprev = isLeft(points(0), points(1), p)
For i As Short = 1 To points.Count - 2
enext = isLeft(points(i), points(i + 1), p)
If eprev <= 0 And enext > 0 Then
If Not below(p, points(i), points(Rtan)) Then
Rtan = i
End If
ElseIf eprev > 0 And enext <= 0 Then
If Not above(p, points(i), points(Ltan)) Then Ltan = i
End If
eprev = enext
Next
l = points(Ltan) : r = points(Rtan)
End Sub
Public Sub Fill(ByVal g As Graphics, ByVal b As Brush, Optional ByVal d As Boolean = True)
If d Then g.DrawPolygon(Pens.Black, points.ToArray)
g.FillPolygon(b, points.ToArray)
End Sub
Public Sub Draw(ByVal g As Graphics, ByVal p As Pen, Optional ByVal nodes As Boolean = False)
If points.Count = 2 Then
g.DrawLine(p, points(0), points(1))
ElseIf points.Count > 2 Then
g.DrawPolygon(p, points.ToArray)
End If
If nodes Then
For Each pt As Point In points
g.DrawEllipse(Pens.Green, pt.X - 5, pt.Y - 5, 10, 10)
Next
End If
End Sub
Private Sub calc()
Dim minx As Integer = points(0).X, miny As Integer = points(0).Y, maxx As Integer = minx, maxy As Integer = miny
For Each pt As Point In points
If pt.X < minx Then minx = pt.X
If pt.X > maxx Then maxx = pt.X
If pt.Y < miny Then miny = pt.Y
If pt.Y > maxy Then maxy = pt.Y
Next
maxx -= minx : maxy -= miny
AABB = New Rectangle(minx, miny, maxx, maxy)
center = New Point(minx + maxx / 2, miny + maxy / 2)
End Sub
Public Sub Expand(ByVal v As Integer, ByRef lst As List(Of MeshPoint))
For i As Integer = 0 To points.Count - 2
'Dim l As Double = LineDist(center, points(i)) + v
'Dim a As Double = Angle(points(i), center)
Dim px As Integer = points(i).X - center.X, py As Integer = points(i).Y - center.Y
If px < 0 Then px -= v Else px += v
If py < 0 Then py -= v Else py += v
Dim p As Point = New Point(px + center.X, py + center.Y) 'ldir(center, a, l)
If InPolys(p) < 0 Then lst.Add(New MeshPoint(p, id, v))
Next
End Sub
Public Function FindClosestNodeAndDistance(ByVal x As Integer, ByVal y As Integer, ByRef inode As Integer) As Double
Dim closestDistanceSq As Double = LineDistSq(points(0).X, points(0).Y, x, y)
Dim closestIndex As Integer = 0
For i As Integer = 1 To points.Count - 2
Dim ptSegDistSq As Double = LineDistSq(points(i).X, points(i).Y, x, y)
If ptSegDistSq < closestDistanceSq Then
closestDistanceSq = ptSegDistSq
closestIndex = i
End If
Next
inode = closestIndex
Return Math.Sqrt(closestDistanceSq)
End Function
Public Function FindNodeClosest(ByVal x As Integer, ByVal y As Integer, Optional ByVal delta As Integer = 0, Optional ByVal fInd As Boolean = False) As Integer
Dim closestDistanceSq As Double = Double.MaxValue
Dim closestIndex As Integer = -1
Dim lInd As Integer
If fInd Then lInd = points.Count - 1 Else lInd = points.Count - 2
For i As Integer = 0 To lInd
Dim ptSegDistSq As Double = LineDistSq(points(i).X, points(i).Y, x, y)
If ptSegDistSq < closestDistanceSq Then
closestDistanceSq = ptSegDistSq
closestIndex = i
End If
Next
If closestDistanceSq > (delta * delta) Then closestIndex = -1
Return closestIndex
End Function
Public ReadOnly Property Count As Integer
Get
Return points.Count
End Get
End Property
Public Sub Save(ByVal file As Integer)
FilePut(file, CShort(points.Count))
For Each p As Point In points
FilePut(file, CInt(p.X))
FilePut(file, CInt(p.Y))
Next
End Sub
Public Function Contains(ByVal p As Point) As Boolean
Return Contains(p.X, p.Y)
End Function
Public Function Contains(ByVal x As Integer, ByVal y As Integer) As Boolean
Dim pointIBefore As New Point
If points.Count > 2 Then pointIBefore = points(points.Count - 2)
Dim crossings As Integer = 0
For i As Integer = 0 To points.Count - 2
Dim pointI As Point = points(i)
If (((pointIBefore.Y <= y And y < pointI.Y) Or (pointI.Y <= y And y < pointIBefore.Y)) And x < ((pointI.X - pointIBefore.X) / (pointI.Y - pointIBefore.Y) * (y - pointIBefore.Y) + pointIBefore.X)) Then
crossings += 1
End If
pointIBefore = pointI
Next
Return (crossings Mod 2 <> 0)
End Function
Public Sub Finish()
points.Add(New Point(points(0)))
calc()
End Sub
Public Sub AddPt(ByVal p As Point)
points.Add(New Point(p)) : calc()
End Sub
Public Sub AddPt(ByVal x As Integer, ByVal y As Integer)
points.Add(New Point(x, y)) : calc()
End Sub
Public Sub MovePt(ByVal i As Integer, ByVal x As Integer, ByVal y As Integer, Optional ByVal dif As Boolean = False)
If (i = 0 Or i = points.Count - 1) And dif = False Then
Dim l As Integer = points.Count - 1
points(0) = New Point(points(0).X + x, points(0).Y + y)
points(l) = New Point(points(l).X + x, points(l).Y + y)
Else
points(i) = New Point(points(i).X + x, points(i).Y + y)
End If
calc()
End Sub
Public Sub MoveRel(ByVal x As Integer, ByVal y As Integer)
For i As Integer = 0 To points.Count - 1
points(i) = New Point(points(i).X + x, points(i).Y + y)
Next
calc()
End Sub
Public Function GetBoundaryPtClosest(ByVal x As Integer, ByVal y As Integer) As Point
Dim closestDistanceSq As Double = Double.MaxValue
Dim closestIndex As Integer = -1
Dim closestNextIndex As Integer = -1
Dim pNext As Point, p As Point
Dim nextI As Integer
For i As Integer = 0 To points.Count - 1
nextI = (i + 1) Mod points.Count
p = points(i)
pNext = points(nextI)
Dim ptSegDistSq As Double = ptLineDistSq(p.X, p.Y, pNext.X, pNext.Y, x, y)
If ptSegDistSq < closestDistanceSq Then
closestDistanceSq = ptSegDistSq
closestIndex = i
closestNextIndex = nextI
End If
Next
p = points(closestIndex)
pNext = points(closestNextIndex)
Return getClosestPtOnLine(p.X, p.Y, pNext.X, pNext.Y, x, y)
End Function
Public Function LineIntersects(ByVal p1 As Point, ByVal p2 As Point) As Boolean
Return LineIntersects(p1.X, p1.Y, p2.X, p2.Y)
End Function
Public Function LineIntersects(ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer) As Boolean
If x1 = x2 AndAlso y1 = y2 Then Return False
Dim ax As Double = x2 - x1, ay As Double = y2 - y1
Dim pointIBefore As Point = points(points.Count - 1)
For Each pointI As Point In points
Dim x3 As Integer = pointIBefore.X, y3 As Integer = pointIBefore.Y, x4 As Integer = pointI.X
Dim y4 As Integer = pointI.Y, bx As Integer = x3 - x4, by As Integer = y3 - y4, cx As Integer = x1 - x3
Dim cy As Integer = y1 - y3
Dim alphaNumerator As Double = by * cx - bx * cy, commonDenominator As Double = ay * bx - ax * by
If commonDenominator > 0 Then
If alphaNumerator < 0 OrElse alphaNumerator > commonDenominator Then
pointIBefore = pointI
Continue For
End If
ElseIf commonDenominator < 0 Then
If alphaNumerator > 0 OrElse alphaNumerator < commonDenominator Then
pointIBefore = pointI
Continue For
End If
End If
Dim betaNumerator As Double = ax * cy - ay * cx
If commonDenominator > 0 Then
If betaNumerator < 0 OrElse betaNumerator > commonDenominator Then
pointIBefore = pointI
Continue For
End If
ElseIf commonDenominator < 0 Then
If betaNumerator > 0 OrElse betaNumerator < commonDenominator Then
pointIBefore = pointI
Continue For
End If
End If
If commonDenominator = 0 Then
' This code wasn't in Franklin Antonio's method. It was added by Keith Woodward.
' The lines are parallel.
' Check if they're collinear.
Dim collinearityTestForP3 As Double = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2) ' see http://mathworld.wolfram.com/Collinear.html
' If p3 is collinear with p1 and p2 then p4 will also be collinear, since p1-p2 is parallel with p3-p4
If collinearityTestForP3 = 0 Then
' The lines are collinear. Now check if they overlap.
If x1 >= x3 AndAlso x1 <= x4 OrElse x1 <= x3 AndAlso x1 >= x4 OrElse _
x2 >= x3 AndAlso x2 <= x4 OrElse x2 <= x3 AndAlso x2 >= x4 OrElse _
x3 >= x1 AndAlso x3 <= x2 OrElse x3 <= x1 AndAlso x3 >= x2 Then
If y1 >= y3 AndAlso y1 <= y4 OrElse y1 <= y3 AndAlso y1 >= y4 OrElse _
y2 >= y3 AndAlso y2 <= y4 OrElse y2 <= y3 AndAlso y2 >= y4 OrElse _
y3 >= y1 AndAlso y3 <= y2 OrElse y3 <= y1 AndAlso y3 >= y2 Then _
Return True
End If
End If
pointIBefore = pointI
Continue For
End If
Return True
Next
Return False
End Function
Public Function IntersectPerimeter(foreign As KPoly) As Boolean
Dim pointIBefore As Point = points(points.Count - 1) '(points.size() != 0 ? points.get(points.size()-1) : null);
Dim pointJBefore As Point = foreign.points(foreign.points.Count - 1) '(foreign.points.size() != 0 ? foreign.points.get(foreign.points.size()-1) : null);
For Each pointI As Point In points
For Each pointJ As Point In foreign.points
' The below linesIntersect could be sped up slightly since many things are recalc'ed over and over again.
If linesIntersect(pointI, pointIBefore, pointJ, pointJBefore) Then Return True
pointJBefore = pointJ
Next
pointIBefore = pointI
Next
Return False
End Function
Public Function Intersects(foreign As KPoly) As Boolean
If IntersectPerimeter(foreign) Then Return True
If Contains(foreign.points(0)) OrElse foreign.Contains(points(0)) Then Return True
Return False
End Function
Public Function Intersects(ByVal r As Rectangle) As Boolean
Dim pointIBefore As Point = points(points.Count - 1) '(points.size() != 0 ? points.get(points.size()-1) : null);
Dim foreign As Point() = {New Point(r.X, r.Y), New Point(r.X, r.Y + r.Height), New Point(r.X + r.Width, r.Y + r.Height), New Point(r.X + r.Width, r.Y)}
Dim pointJBefore As Point = foreign(3) '(foreign.points.size() != 0 ? foreign.points.get(foreign.points.size()-1) : null);
For Each pointI As Point In points
For i As Integer = 0 To 3
' The below linesIntersect could be sped up slightly since many things are recalc'ed over and over again.
If linesIntersect(pointI, pointIBefore, foreign(i), pointJBefore) Then Return True
pointJBefore = foreign(i)
Next
pointIBefore = pointI
Next
Return False
End Function
End Class
|
thekoushik/Darker-Unknown
|
WindowsApplication3/WindowsApplication3/WindowsApplication3/KPoly.vb
|
Visual Basic
|
mit
| 14,685
|
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI
Imports SistFoncreagro.BussinessEntities
Imports SistFoncreagro.BussinesLogic
Public Class FrmProyectoInformes
Inherits System.Web.UI.Page
Function Ruta(ByVal NomArch As String) As String
Return "~\Archivos\Monitoreo\InformesProyecto\" + NomArch
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim miId As String
miId = Request.QueryString("IdProyecto")
HIdProyecto.Value = miId
End If
End Sub
Protected Sub RGInforme_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RGInforme.InsertCommand
RGInforme.DataBind()
End Sub
Protected Sub RGInforme_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RGInforme.ItemCommand
If e.CommandName = "Ver" Then
Dim _Archivo As String
Dim editeditem As GridEditableItem = CType(e.Item, GridEditableItem)
_Archivo = RGInforme.Items(editeditem.ItemIndex)("Archivo").Text
System.Diagnostics.Process.Start("~\Archivos\Monitoreo\InformesProyecto\" + _Archivo)
''Dim assembly As System.Reflection.Assembly = _
'' System.Reflection.Assembly.GetExecutingAssembly()
''Dim root As String = assembly.GetName().Name
''Dim stream As System.IO.Stream = assembly.GetManifestResourceStream(root + "." + _Archivo)
''Dim buffer(Convert.ToInt32(stream.Length) - 1) As Byte
''stream.Read(buffer, 0, buffer.Length)
''stream.Close()
''Dim f As New IO.FileStream(_Archivo, IO.FileMode.Create, IO.FileAccess.Write)
''f.Write(buffer, 0, buffer.Length)
''f.Close()
''Process.Start(_Archivo)
'Dim myFile As ProcessStartInfo
'If (System.IO.File.Exists("\\servfoncreagro\c$\Inetpub\wwwroot\Archivos\Monitoreo\InformesProyecto\" + _Archivo)) Then
Try
'myFile = New ProcessStartInfo(Server.MapPath("~\Archivos\Monitoreo\InformesProyecto\" + _Archivo))
'myFile = New ProcessStartInfo("\\servfoncreagro\c$\Inetpub\wwwroot\Archivos\Monitoreo\InformesProyecto\" + _Archivo)
''myFile.UseShellExecute = False
''myFile.RedirectStandardOutput = True
'Process.Start(myFile)
Catch ex As Exception
RWM1.RadAlert(ex.Message.ToString, 300, 100, "Error", "")
End Try
ElseIf e.CommandName = "Borrar" Then
Dim _Archivo As String
Dim editeditem As GridEditableItem = CType(e.Item, GridEditableItem)
_Archivo = Trim(RGInforme.Items(editeditem.ItemIndex)("Archivo").Text)
Dim mIdInfProy As Int32
mIdInfProy = Integer.Parse(editeditem.OwnerTableView.DataKeyValues(editeditem.ItemIndex)("IdInfProy"))
Dim _Informe As New InformeProyecto
Dim _InformeBL As New InformeProyectoBL
Try
If _Archivo <> "" And _Archivo <> " " Then
'Dim archivo As String = ("\\servfoncreagro\c$\Inetpub\wwwroot\Archivos\Monitoreo\InformesProyecto\" + _Archivo)
Dim archivo As String = (Server.MapPath("~\Archivos\Monitoreo\InformesProyecto\" + _Archivo))
My.Computer.FileSystem.DeleteFile(archivo)
Dim _ArchivoBL As New AdjMonitBL
_Informe = _InformeBL.GetAllFromInformeProyectoById(mIdInfProy)
_ArchivoBL.DeleteAdjMonit(_Informe.IdAdjMonit)
End If
_InformeBL.DeleteInformeProyecto(mIdInfProy)
Catch ex As Exception
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical)
End Try
RGInforme.DataBind()
End If
End Sub
Public Function ValidarFecha(ByVal Valor As Date) As String
Dim MisFunciones As New Funciones
Dim miFecha As String = MisFunciones.CampoFecha(Valor)
Return miFecha
End Function
Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
If HIdProyecto.Value = "" Then RWMensajes.RadAlert("No hay un proyecto seleccionado", 230, 100, "Error", "") : Exit Sub
Select Case e.Item.Value
Case "Datos"
Response.Redirect("~\Monitoreo\Formularios\FrmDatosProyecto.aspx?IdProyecto=" + HIdProyecto.Value)
Case "Convenio"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoConvenio.aspx?IdProyecto=" + HIdProyecto.Value)
Case "Componentes"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoComponentes.aspx?IdProyecto=" + HIdProyecto.Value)
Case "Actividades"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoActividad.aspx?IdProyecto=" + HIdProyecto.Value)
Case "CCostos"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoCCosto.aspx?IdProyecto=" + HIdProyecto.Value)
Case "Ambito"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoAmbito.aspx?IdProyecto=" + HIdProyecto.Value)
Case "Informes"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoInformes.aspx?IdProyecto=" + HIdProyecto.Value)
Case "ForFin"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoPresupuesto.aspx?IdProyecto=" + HIdProyecto.Value)
Case "ForAnual"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoPresupuestoAnual.aspx?IdProyecto=" + HIdProyecto.Value)
Case "AvanFis"
Response.Redirect("~\Monitoreo\Formularios\FrmProyectoAvanceFisico.aspx?IdProyecto=" + HIdProyecto.Value)
End Select
End Sub
End Class
|
crackper/SistFoncreagro
|
SistFoncreagro.WebSite/Monitoreo/Formularios/FrmProyectoInformes.aspx.vb
|
Visual Basic
|
mit
| 6,094
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die mit einer Assembly verknüpft sind.
' Die Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("Outlook01AddinVB4")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("https://github.com/NetOfficeFw")>
<Assembly: AssemblyCopyright("Copyright © 2013 Sebastian Lange")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(True)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
<Assembly: Guid("40b87708-040f-4dcc-b0f2-6958edc35bdc")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
NetOfficeFw/NetOffice
|
Examples/Outlook/VB/NetOffice COMAddin Examples/01 Simple/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 1,235
|
Option Infer On
Imports System
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim partDocument As SolidEdgePart.PartDocument = Nothing
Dim models As SolidEdgePart.Models = Nothing
Dim model As SolidEdgePart.Model = Nothing
Dim drafts As SolidEdgePart.Drafts = Nothing
Dim draft As SolidEdgePart.Draft = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
partDocument = TryCast(application.ActiveDocument, SolidEdgePart.PartDocument)
If partDocument IsNot Nothing Then
models = partDocument.Models
model = models.Item(1)
drafts = model.Drafts
For i As Integer = 1 To drafts.Count
draft = drafts.Item(i)
Dim FaceType = SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll
Dim faces = CType(draft.Faces(FaceType), SolidEdgeGeometry.Edges)
Next i
End If
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgePart.Draft.Faces.vb
|
Visual Basic
|
mit
| 1,786
|
Imports System.Xml
Public Class Welcome
Private _FunctionDoc As New XmlDocument
Private _nodeSubset
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
_FunctionDoc.Load("FunctionData.xml")
Dim selection = ListBox1.SelectedItem.ToString
_nodeSubset = _FunctionDoc.SelectNodes("/help/Category[@name='" + selection + "']/Command/*")
Dim SectionForm = New Section
SectionForm.TitleLabel.Text = SectionForm.TitleLabel.Text + " " + selection
SectionForm.PrePopulateTreeViewControl(_nodeSubset)
SectionForm._selection = selection
SectionForm.Show()
Me.Hide()
End Sub
End Class
|
zparnold/vs
|
HCIProject4XMLReader/HCIProject4XMLReader/Welcome.vb
|
Visual Basic
|
mit
| 705
|
Imports System.Windows.Forms
Public Class ValueUI
' Form Load
Private Sub ChangeProfitMarginUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = CDbl(getValue("ProfitMargin"))
TextBoxCC.Text = toPercent(getCreditCardDiscount())
TextBoxNormal.Text = toPercent(CDbl(getValue("NormalMember")))
TextBoxGold.Text = toPercent(CDbl(getValue("GoldMember")))
TextBoxTwo.Text = toPercent(CDbl(getValue("TwoMonth")))
TextBoxThree.Text = toPercent(CDbl(getValue("ThreeMonth")))
TextBoxFrd.Text = toPercent(CDbl(getValue("Friend")))
End Sub
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
If TextBox1.Text = "" Or TextBoxCC.Text = "" Or TextBoxNormal.Text = "" Or TextBoxGold.Text = "" Or TextBoxTwo.Text = "" Or TextBoxThree.Text = "" Or TextBoxFrd.Text = "" Then
MsgBox("Please fill in all fields!")
Return
End If
setValue("ProfitMargin", TextBox1.Text)
setValue("CreditCardPayment", toDouble(TextBoxCC.Text))
setValue("NormalMember", toDouble(TextBoxNormal.Text))
setValue("GoldMember", toDouble(TextBoxGold.Text))
setValue("TwoMonth", toDouble(TextBoxTwo.Text))
setValue("ThreeMonth", toDouble(TextBoxThree.Text))
setValue("Friend", toDouble(TextBoxFrd.Text))
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
' Update
Private Sub setValue(ByVal attr As String, ByVal value As String)
db.query("UPDATE Options SET OValue = '" & value & "' WHERE OName = '" & attr & "'")
End Sub
' Get Value
Shared Function getValue(ByVal attr As String)
Dim result = db.query("SELECT * FROM Options WHERE OName = '" & esc(attr) & "'")
result.nextRow()
Return result.readAttr("OValue")
End Function
Shared Function getCreditCardDiscount() As Double
Return CDbl(getValue("CreditCardPayment"))
End Function
Shared Function getNormalMemberDiscount() As Double
Return CDbl(getValue("NormalMember"))
End Function
Shared Function getGoldMemberDiscount() As Double
Return CDbl(getValue("GoldMember"))
End Function
' To Discount Precentage
Shared Function toPercent(ByVal value As Double) As Double
Return (1 - value) * 100
End Function
Shared Function toDouble(ByVal value As Double) As Double
Return (100 - value) / 100
End Function
' Member toString
Shared Function memberToString(ByVal i) As String
Select Case i
Case 0
Return "Non-member"
Case 1
Return "Normal Member"
Case 2
Return "Gold member"
Case Else
Return "<Unkown Membership>"
End Select
End Function
End Class
|
louislam/summer-course-system
|
Summer Course System/UI/ValueUI.vb
|
Visual Basic
|
mit
| 2,816
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18213
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Login_Server.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
LargoWinch/LegacyEmu
|
LoginServer/Login_Server/My Project/Resources.Designer.vb
|
Visual Basic
|
apache-2.0
| 2,721
|
' ╔═══════════════════════════════════════════════════════════════════════════╗
' ║ Copyright © 2013-2016 nicoco007 ║
' ║ ║
' ║ Licensed under the Apache License, Version 2.0 (the "License"); ║
' ║ you may not use this file except in compliance with the License. ║
' ║ You may obtain a copy of the License at ║
' ║ ║
' ║ http://www.apache.org/licenses/LICENSE-2.0 ║
' ║ ║
' ║ Unless required by applicable law or agreed to in writing, software ║
' ║ distributed under the License is distributed on an "AS IS" BASIS, ║
' ║ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ║
' ║ See the License for the specific language governing permissions and ║
' ║ limitations under the License. ║
' ╚═══════════════════════════════════════════════════════════════════════════╝
Public Class UpdateDialog
Private MainWindow As MainWindow = DirectCast(Application.Current.MainWindow, MainWindow)
Private Sub YesButton_Click(sender As Object, e As RoutedEventArgs) Handles YesButton.Click
Process.Start("http://go.nicoco007.com/fwlink/?LinkID=1006")
Me.Close()
End Sub
Private Sub NoButton_Click(sender As Object, e As RoutedEventArgs) Handles NoButton.Click
Me.Close()
End Sub
Private Sub UpdateDialog_Loaded(sender As Object, e As RoutedEventArgs)
Me.Title = Application.Language.GetString("New Version Available!")
Label1.Content = Application.Language.GetString("A new version of MCBackup is available!")
CurrentVersionLabel.Content = String.Format(Application.Language.GetString("Installed Version: {0}"), MainWindow.ApplicationVersion)
LatestVersionLabel.Content = String.Format(Application.Language.GetString("Latest Version: {0}"), MainWindow.LatestVersion)
Label2.Content = Application.Language.GetString("Would you like to update?")
YesButton.Content = Application.Language.GetString("Yes")
NoButton.Content = Application.Language.GetString("No")
ShowChangelogButton.Content = Application.Language.GetString("Show Changelog")
End Sub
Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
Process.Start("http://go.nicoco007.com/fwlink/?LinkID=1001&utm_source=mcbackup&utm_medium=mcbackup")
End Sub
End Class
|
nicoco007/MCBackup-3
|
MCBackup 3/Dialogs/UpdateDialog.xaml.vb
|
Visual Basic
|
apache-2.0
| 3,078
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Imports System.CodeDom.Compiler
Imports System.ComponentModel
Imports System.Globalization
Imports System.Resources
Imports System.Runtime.CompilerServices
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
DebuggerNonUserCode(), _
CompilerGenerated(), _
HideModuleName()> _
Friend Module Resources
Private resourceMan As ResourceManager
Private resourceCulture As CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<EditorBrowsable(EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As ResourceManager
Get
If ReferenceEquals(resourceMan, Nothing) Then
Dim temp As ResourceManager = New ResourceManager("PeanutButter.DatabaseHelpers.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<EditorBrowsable(EditorBrowsableState.Advanced)> _
Friend Property Culture() As CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
fluffynuts/PeanutButter
|
source/DatabaseHelpers/PeanutButter.DatabaseHelpers/My Project/Resources.Designer.vb
|
Visual Basic
|
bsd-3-clause
| 2,436
|
' ReSharper disable UnusedMember.Global
' ReSharper disable UnusedMemberInSuper.Global
Namespace StatementBuilders
Public Interface IDeleteStatementBuilder
Inherits IStatementBuilder
Function WithDatabaseProvider(provider As DatabaseProviders) As IDeleteStatementBuilder
Function Build() As String
Function WithTable(table As String) As IDeleteStatementBuilder
Function WithCondition(condition As String) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As String) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Int64) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Int32) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Int16) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Decimal) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Double) As IDeleteStatementBuilder
Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As DateTime) As IDeleteStatementBuilder
Function WithCondition(fieldName as String, op as Condition.EqualityOperators, fieldValue as Boolean) as IDeleteStatementBuilder
Function WithCondition(condition As ICondition) As IDeleteStatementBuilder
Function WithAllConditions(ParamArray conditions As ICondition()) As IDeleteStatementBuilder
Function WithAllRows() As IDeleteStatementBuilder
End Interface
Public Class DeleteStatementBuilder
Inherits StatementBuilderBase
Implements IDeleteStatementBuilder
Public Shared Function Create() As DeleteStatementBuilder
Return New DeleteStatementBuilder()
End Function
Private _table As String
Private _allRows As Boolean
Private ReadOnly _conditions as List(Of String) = New List(Of String)
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Date) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Decimal) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Double) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Integer) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Long) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Short) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As String) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition As Condition = CreateCondition(fieldName, op, fieldValue)
Return WithCondition(condition.ToString())
End Function
Public Function WithDatabaseProvider(ByVal provider As DatabaseProviders) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithDatabaseProvider
SetDatabaseProvider(provider)
return Me
End Function
Public Function Build() As String Implements IDeleteStatementBuilder.Build
CheckParameters()
Dim parts = New List(Of String)
parts.Add("delete from ")
parts.Add(_openObjectQuote)
parts.Add(_table)
parts.Add(_closeObjectQuote)
AddConditionsTo(parts)
Return String.Join("", parts)
End Function
Private Sub AddConditionsTo(parts as List(Of String))
if _allRows Then Return
parts.Add(" where ")
Dim firstCondition = True
For Each cond As String In _conditions
If Not firstCondition Then
parts.Add(" and ")
End If
firstCondition = False
parts.Add(cond)
Next
End Sub
Private Sub CheckParameters()
If _table Is Nothing Then
Throw New ArgumentException([GetType]().Name + ": no table specified")
End If
If Not _allRows And _conditions.Count = 0 Then
Throw New ArgumentException([GetType]().Name + ": no condition(s) specified")
End If
End Sub
Public Function WithCondition(condition As String) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
_conditions.Add(condition)
Return Me
End Function
Public Function WithCondition(condition As ICondition) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
condition.UseDatabaseProvider(_databaseProvider)
_conditions.Add(condition.ToString())
Return Me
End Function
Public Function WithAllConditions(ParamArray conditions As ICondition()) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithAllConditions
Dim conditionChain = New ConditionChain(CompoundCondition.BooleanOperators.OperatorAnd, conditions)
conditionChain.UseDatabaseProvider(_databaseProvider)
Return WithCondition(conditionChain)
End Function
Public Function WithTable(table As String) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithTable
_table = table
Return Me
End Function
Public Function WithAllRows() As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithAllRows
_allRows = True
Return Me
End Function
Public Function WithCondition(fieldName As String, op As Condition.EqualityOperators, fieldValue As Boolean) As IDeleteStatementBuilder Implements IDeleteStatementBuilder.WithCondition
Dim condition = new Condition(fieldName, op, fieldValue)
condition.UseDatabaseProvider(_databaseProvider)
_conditions.Add(condition.ToString())
Return Me
End Function
End Class
End NameSpace
|
fluffynuts/PeanutButter
|
source/DatabaseHelpers/PeanutButter.DatabaseHelpers/StatementBuilders/DeleteStatementBuilder.vb
|
Visual Basic
|
bsd-3-clause
| 7,311
|
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Runtime.InteropServices
Imports System.Text
Imports OpenCvSharp
' Namespace OpenCvSharpSamplesVB
''' <summary>
''' CvSeqのテスト
''' </summary>
Friend Module SeqTest
'INSTANT VB TODO TASK: There is no equivalent to the 'unsafe' modifier in VB:
'ORIGINAL LINE: public unsafe SeqTest()
Public Sub Start()
Using storage As New CvMemStorage(0)
Dim rand As New Random()
Dim seq As New CvSeq(Of Integer)(SeqType.EltypeS32C1, storage)
' push
For i As Integer = 0 To 9
Dim push As Integer = seq.Push(rand.Next(100)) 'seq.Push(i);
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("{0} is pushed", push))
Next i
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("----------"))
' enumerate
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("contents of seq"))
For Each item As Integer In seq
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("{0} ", item))
Next item
Form1.TextBox1.AppendText(Environment.NewLine & " ")
' sort
Dim func As CvCmpFunc(Of Integer) = Function(a As Integer, b As Integer) a.CompareTo(b)
seq.Sort(func)
' convert to array
Dim array() As Integer = seq.ToArray()
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("contents of sorted seq"))
For Each item As Integer In array
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("{0} ", item))
Next item
Form1.TextBox1.AppendText(Environment.NewLine & " ")
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("----------"))
' pop
For i As Integer = 0 To 9
Dim pop As Integer = seq.Pop()
Form1.TextBox1.AppendText(Environment.NewLine & String.Format("{0} is popped", pop))
Next i
'Console.ReadKey()
End Using
End Sub
End Module
' End Namespace
|
shimat/opencvsharp_2410
|
sample/CStyleSamplesVB/Samples/SeqTest.vb
|
Visual Basic
|
bsd-3-clause
| 2,378
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Editor.UnitTests.SignatureHelp
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.SignatureHelp
Public Class GetXmlNamespaceExpressionSignatureHelpProviderTests
Inherits AbstractVisualBasicSignatureHelpProviderTests
Public Sub New(workspaceFixture As VisualBasicTestWorkspaceFixture)
MyBase.New(workspaceFixture)
End Sub
Friend Overrides Function GetSignatureHelpProviderType() As Type
Return GetType(GetXmlNamespaceExpressionSignatureHelpProvider)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)>
Public Async Function TestInvocationForGetType() As Task
Dim markup = <a><![CDATA[
Class C
Sub Goo()
Dim x = GetXmlNamespace($$
End Sub
End Class
]]></a>.Value
Dim expectedOrderedItems = New List(Of SignatureHelpTestItem)()
expectedOrderedItems.Add(New SignatureHelpTestItem(
$"GetXmlNamespace([{VBWorkspaceResources.xmlNamespacePrefix}]) As System.Xml.Linq.XNamespace",
VBWorkspaceResources.Returns_the_System_Xml_Linq_XNamespace_object_corresponding_to_the_specified_XML_namespace_prefix,
VBWorkspaceResources.The_XML_namespace_prefix_to_return_a_System_Xml_Linq_XNamespace_object_for_If_this_is_omitted_the_object_for_the_default_XML_namespace_is_returned,
currentParameterIndex:=0))
Await TestAsync(markup, expectedOrderedItems)
End Function
End Class
End Namespace
|
jmarolf/roslyn
|
src/EditorFeatures/VisualBasicTest/SignatureHelp/GetXmlNamespaceExpressionSignatureHelpProviderTests.vb
|
Visual Basic
|
mit
| 1,968
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Runtime.CompilerServices
Imports System.Threading
Imports System.Threading.Tasks
Imports System.Windows.Threading
Imports Microsoft.CodeAnalysis.Editor.Commands
Imports Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense
Imports Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Shared.TestHooks
Imports Microsoft.CodeAnalysis.SignatureHelp
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.VisualStudio.Language.Intellisense
Imports Microsoft.VisualStudio.Text
Imports Microsoft.VisualStudio.Text.Editor
Imports Moq
#Disable Warning RS0007 ' Avoid zero-length array allocations. This is non-shipping test code.
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
Public Class SignatureHelpControllerTests
Public Sub New()
' The controller expects to be on a UI thread
TestWorkspace.ResetThreadAffinity()
End Sub
<WpfFact>
Public Sub InvokeSignatureHelpWithoutDocumentShouldNotStartNewSession()
Dim emptyProvider = New Mock(Of IDocumentProvider)
emptyProvider.Setup(Function(p) p.GetDocumentAsync(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken))).Returns(Task.FromResult(DirectCast(Nothing, Document)))
Dim controller As Controller = CreateController(documentProvider:=emptyProvider)
controller.WaitForController()
Assert.Equal(0, GetMocks(controller).Provider.GetItemsCount)
End Sub
<WpfFact>
Public Sub InvokeSignatureHelpWithDocumentShouldStartNewSession()
Dim controller = CreateController()
GetMocks(controller).Presenter.Verify(Function(p) p.CreateSession(It.IsAny(Of ITextView), It.IsAny(Of ITextBuffer), It.IsAny(Of ISignatureHelpSession)), Times.Once)
End Sub
<WpfFact>
Public Sub EmptyModelShouldStopSession()
Dim controller = CreateController(items:={}, waitForPresentation:=True)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.Dismiss(), Times.Once)
End Sub
<WpfFact>
Public Sub UpKeyShouldDismissWhenThereIsOnlyOneItem()
Dim controller = CreateController(items:=CreateItems(1), waitForPresentation:=True)
Dim handled = controller.TryHandleUpKey()
Assert.False(handled)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.Dismiss(), Times.Once)
End Sub
<WpfFact>
Public Sub UpKeyShouldNavigateWhenThereAreMultipleItems()
Dim controller = CreateController(items:=CreateItems(2), waitForPresentation:=True)
Dim handled = controller.TryHandleUpKey()
Assert.True(handled)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.SelectPreviousItem(), Times.Once)
End Sub
<WpfFact>
<WorkItem(985007, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/985007")>
Public Sub UpKeyShouldNotCrashWhenSessionIsDismissed()
' Create a provider that will return an empty state when queried the second time
Dim slowProvider = New Mock(Of ISignatureHelpProvider)
slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), It.IsAny(Of CancellationToken))) _
.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing)))
Dim controller = CreateController(provider:=slowProvider.Object, waitForPresentation:=True)
' Now force an update to the model that will result in stopping the session
slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), It.IsAny(Of CancellationToken))) _
.Returns(Task.FromResult(Of SignatureHelpItems)(Nothing))
DirectCast(controller, ICommandHandler(Of TypeCharCommandArgs)).ExecuteCommand(
New TypeCharCommandArgs(CreateMock(Of ITextView), CreateMock(Of ITextBuffer), " "c),
Sub() GetMocks(controller).Buffer.Insert(0, " "))
Dim handled = controller.TryHandleUpKey() ' this will block on the model being updated which should dismiss the session
Assert.False(handled)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.Dismiss(), Times.Once)
End Sub
<WpfFact>
<WorkItem(179726, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workItems?id=179726&_a=edit")>
Public Sub DownKeyShouldNotBlockOnModelComputation()
Dim mre = New ManualResetEvent(False)
Dim controller = CreateController(items:=CreateItems(2), waitForPresentation:=False)
Dim slowProvider = New Mock(Of ISignatureHelpProvider)
slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), It.IsAny(Of CancellationToken))) _
.Returns(Function()
mre.WaitOne()
Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing))
End Function)
Dim handled = controller.TryHandleDownKey()
Assert.False(handled)
End Sub
<WpfFact>
<WorkItem(179726, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workItems?id=179726&_a=edit")>
Public Sub UpKeyShouldNotBlockOnModelComputation()
Dim mre = New ManualResetEvent(False)
Dim controller = CreateController(items:=CreateItems(2), waitForPresentation:=False)
Dim slowProvider = New Mock(Of ISignatureHelpProvider)
slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), It.IsAny(Of CancellationToken))) _
.Returns(Function()
mre.WaitOne()
Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing))
End Function)
Dim handled = controller.TryHandleUpKey()
Assert.False(handled)
End Sub
<WpfFact>
<WorkItem(179726, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workItems?id=179726&_a=edit")>
Public Async Function UpKeyShouldBlockOnRecomputationAfterPresentation() As Task
Dim dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher
Dim worker = Async Function()
Dim slowProvider = New Mock(Of ISignatureHelpProvider)
slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), It.IsAny(Of CancellationToken))) _
.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing)))
Dim controller = dispatcher.Invoke(Function() CreateController(provider:=slowProvider.Object, waitForPresentation:=True))
' Update session so that providers are requeried.
' SlowProvider now blocks on the checkpoint's task.
Dim checkpoint = New Checkpoint()
slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), It.IsAny(Of CancellationToken))) _
.Returns(Function()
checkpoint.Task.Wait()
Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 2), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing))
End Function)
dispatcher.Invoke(Sub() DirectCast(controller, ICommandHandler(Of TypeCharCommandArgs)).ExecuteCommand(
New TypeCharCommandArgs(CreateMock(Of ITextView), CreateMock(Of ITextBuffer), " "c),
Sub() GetMocks(controller).Buffer.Insert(0, " ")))
Dim handled = dispatcher.InvokeAsync(Function() controller.TryHandleUpKey()) ' Send the controller an up key, which should block on the computation
checkpoint.Release() ' Allow slowprovider to finish
Await handled.Task.ConfigureAwait(False)
' We expect 2 calls to the presenter (because we had an existing presentation session when we started the second computation).
Assert.True(handled.Result)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.PresentItems(It.IsAny(Of ITrackingSpan), It.IsAny(Of IList(Of SignatureHelpItem)),
It.IsAny(Of SignatureHelpItem), It.IsAny(Of Integer?)), Times.Exactly(2))
End Function
Await worker().ConfigureAwait(False)
End Function
<WpfFact>
Public Sub DownKeyShouldNavigateWhenThereAreMultipleItems()
Dim controller = CreateController(items:=CreateItems(2), waitForPresentation:=True)
Dim handled = controller.TryHandleDownKey()
Assert.True(handled)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.SelectNextItem(), Times.Once)
End Sub
<WorkItem(1181, "https://github.com/dotnet/roslyn/issues/1181")>
<WpfFact>
Public Sub UpAndDownKeysShouldStillNavigateWhenDuplicateItemsAreFiltered()
Dim item = CreateItems(1).Single()
Dim controller = CreateController(items:={item, item}, waitForPresentation:=True)
Dim handled = controller.TryHandleUpKey()
Assert.False(handled)
GetMocks(controller).PresenterSession.Verify(Sub(p) p.Dismiss(), Times.Once)
End Sub
<WpfFact>
Public Sub CaretMoveWithActiveSessionShouldRecomputeModel()
Dim controller = CreateController(waitForPresentation:=True)
Mock.Get(GetMocks(controller).View.Object.Caret).Raise(Sub(c) AddHandler c.PositionChanged, Nothing, New CaretPositionChangedEventArgs(Nothing, Nothing, Nothing))
controller.WaitForController()
' GetItemsAsync is called once initially, and then once as a result of handling the PositionChanged event
Assert.Equal(2, GetMocks(controller).Provider.GetItemsCount)
End Sub
<WpfFact>
Public Sub RetriggerActiveSessionOnClosingBrace()
Dim controller = CreateController(waitForPresentation:=True)
DirectCast(controller, ICommandHandler(Of TypeCharCommandArgs)).ExecuteCommand(
New TypeCharCommandArgs(CreateMock(Of ITextView), CreateMock(Of ITextBuffer), ")"c),
Sub() GetMocks(controller).Buffer.Insert(0, ")"))
controller.WaitForController()
' GetItemsAsync is called once initially, and then once as a result of handling the typechar command
Assert.Equal(2, GetMocks(controller).Provider.GetItemsCount)
End Sub
<WpfFact>
<WorkItem(959116, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/959116")>
Public Sub TypingNonTriggerCharacterShouldNotRequestDocument()
Dim controller = CreateController(triggerSession:=False)
DirectCast(controller, ICommandHandler(Of TypeCharCommandArgs)).ExecuteCommand(
New TypeCharCommandArgs(CreateMock(Of ITextView), CreateMock(Of ITextBuffer), "a"c),
Sub() GetMocks(controller).Buffer.Insert(0, "a"))
GetMocks(controller).DocumentProvider.Verify(Function(p) p.GetDocumentAsync(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken)), Times.Never)
End Sub
' Create an empty document to use as a non-null parameter when needed
Private Shared ReadOnly s_document As Document =
(Function()
Dim workspace = TestWorkspace.CreateWorkspace(
<Workspace>
<Project Language="C#">
<Document>
</Document>
</Project>
</Workspace>)
Return workspace.CurrentSolution.GetDocument(workspace.Documents.Single().Id)
End Function)()
Private Shared ReadOnly s_bufferFactory As ITextBufferFactoryService = DirectCast(s_document.Project.Solution.Workspace, TestWorkspace).GetService(Of ITextBufferFactoryService)
Private Shared ReadOnly s_controllerMocksMap As New ConditionalWeakTable(Of Controller, ControllerMocks)
Private Shared Function GetMocks(controller As Controller) As ControllerMocks
Dim result As ControllerMocks = Nothing
Roslyn.Utilities.Contract.ThrowIfFalse(s_controllerMocksMap.TryGetValue(controller, result))
Return result
End Function
Private Shared Function CreateController(Optional documentProvider As Mock(Of IDocumentProvider) = Nothing,
Optional presenterSession As Mock(Of ISignatureHelpPresenterSession) = Nothing,
Optional items As IList(Of SignatureHelpItem) = Nothing,
Optional provider As ISignatureHelpProvider = Nothing,
Optional waitForPresentation As Boolean = False,
Optional triggerSession As Boolean = True) As Controller
Dim buffer = s_bufferFactory.CreateTextBuffer()
Dim view = CreateMockTextView(buffer)
Dim asyncListener = New Mock(Of IAsynchronousOperationListener)
If documentProvider Is Nothing Then
documentProvider = New Mock(Of IDocumentProvider)
documentProvider.Setup(Function(p) p.GetDocumentAsync(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken))).Returns(Task.FromResult(s_document))
documentProvider.Setup(Function(p) p.GetOpenDocumentInCurrentContextWithChanges(It.IsAny(Of ITextSnapshot))).Returns(s_document)
End If
If provider Is Nothing Then
items = If(items, CreateItems(1))
provider = New MockSignatureHelpProvider(items)
End If
Dim presenter = New Mock(Of IIntelliSensePresenter(Of ISignatureHelpPresenterSession, ISignatureHelpSession)) With {.DefaultValue = DefaultValue.Mock}
presenterSession = If(presenterSession, New Mock(Of ISignatureHelpPresenterSession) With {.DefaultValue = DefaultValue.Mock})
presenter.Setup(Function(p) p.CreateSession(It.IsAny(Of ITextView), It.IsAny(Of ITextBuffer), It.IsAny(Of ISignatureHelpSession))).Returns(presenterSession.Object)
presenterSession.Setup(Sub(p) p.PresentItems(It.IsAny(Of ITrackingSpan), It.IsAny(Of IList(Of SignatureHelpItem)), It.IsAny(Of SignatureHelpItem), It.IsAny(Of Integer?))) _
.Callback(Sub() presenterSession.SetupGet(Function(p) p.EditorSessionIsActive).Returns(True))
Dim controller = New Controller(
view.Object,
buffer,
presenter.Object,
asyncListener.Object,
documentProvider.Object,
{provider})
s_controllerMocksMap.Add(controller, New ControllerMocks(
view,
buffer,
presenter,
presenterSession,
asyncListener,
documentProvider,
TryCast(provider, MockSignatureHelpProvider)))
If triggerSession Then
DirectCast(controller, ICommandHandler(Of InvokeSignatureHelpCommandArgs)).ExecuteCommand(New InvokeSignatureHelpCommandArgs(view.Object, buffer), Nothing)
If waitForPresentation Then
controller.WaitForController()
End If
End If
Return controller
End Function
Private Shared Function CreateItems(count As Integer) As IList(Of SignatureHelpItem)
Return Enumerable.Range(0, count).Select(Function(i) New SignatureHelpItem(isVariadic:=False, documentationFactory:=Nothing, prefixParts:={}, separatorParts:={}, suffixParts:={}, parameters:={}, descriptionParts:={})).ToList()
End Function
Friend Class MockSignatureHelpProvider
Implements ISignatureHelpProvider
Private ReadOnly _items As IList(Of SignatureHelpItem)
Public Sub New(items As IList(Of SignatureHelpItem))
Me._items = items
End Sub
Public Property GetItemsCount As Integer
Public Function GetItemsAsync(document As Document, position As Integer, triggerInfo As SignatureHelpTriggerInfo, cancellationToken As CancellationToken) As Task(Of SignatureHelpItems) Implements ISignatureHelpProvider.GetItemsAsync
GetItemsCount += 1
Return Task.FromResult(If(_items.Any(),
New SignatureHelpItems(_items, TextSpan.FromBounds(position, position), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing),
Nothing))
End Function
Public Function IsTriggerCharacter(ch As Char) As Boolean Implements ISignatureHelpProvider.IsTriggerCharacter
Return ch = "("c
End Function
Public Function IsRetriggerCharacter(ch As Char) As Boolean Implements ISignatureHelpProvider.IsRetriggerCharacter
Return ch = ")"c
End Function
End Class
Private Shared Function CreateMockTextView(buffer As ITextBuffer) As Mock(Of ITextView)
Dim caret = New Mock(Of ITextCaret)
caret.Setup(Function(c) c.Position).Returns(Function() New CaretPosition(New VirtualSnapshotPoint(buffer.CurrentSnapshot, buffer.CurrentSnapshot.Length), CreateMock(Of IMappingPoint), PositionAffinity.Predecessor))
Dim view = New Mock(Of ITextView) With {.DefaultValue = DefaultValue.Mock}
view.Setup(Function(v) v.Caret).Returns(caret.Object)
view.Setup(Function(v) v.TextBuffer).Returns(buffer)
view.Setup(Function(v) v.TextSnapshot).Returns(buffer.CurrentSnapshot)
Return view
End Function
Private Shared Function CreateMock(Of T As Class)() As T
Dim mock = New Mock(Of T)
Return mock.Object
End Function
Private Class ControllerMocks
Public ReadOnly View As Mock(Of ITextView)
Public ReadOnly Buffer As ITextBuffer
Public ReadOnly Presenter As Mock(Of IIntelliSensePresenter(Of ISignatureHelpPresenterSession, ISignatureHelpSession))
Public ReadOnly PresenterSession As Mock(Of ISignatureHelpPresenterSession)
Public ReadOnly AsyncListener As Mock(Of IAsynchronousOperationListener)
Public ReadOnly DocumentProvider As Mock(Of IDocumentProvider)
Public ReadOnly Provider As MockSignatureHelpProvider
Public Sub New(view As Mock(Of ITextView), buffer As ITextBuffer, presenter As Mock(Of IIntelliSensePresenter(Of ISignatureHelpPresenterSession, ISignatureHelpSession)), presenterSession As Mock(Of ISignatureHelpPresenterSession), asyncListener As Mock(Of IAsynchronousOperationListener), documentProvider As Mock(Of IDocumentProvider), provider As MockSignatureHelpProvider)
Me.View = view
Me.Buffer = buffer
Me.Presenter = presenter
Me.PresenterSession = presenterSession
Me.AsyncListener = asyncListener
Me.DocumentProvider = documentProvider
Me.Provider = provider
End Sub
End Class
End Class
End Namespace
|
rgani/roslyn
|
src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb
|
Visual Basic
|
apache-2.0
| 21,016
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Diagnostics
Imports System.Linq
Imports System.Text
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Imports System.Runtime.InteropServices
' NOTE: VB does not support constant expressions in flow analysis during command-line compilation, but supports them when
' analysis is being called via public API. This distinction is governed by 'suppressConstantExpressions' flag
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend MustInherit Class AbstractFlowPass(Of LocalState As AbstractLocalState)
Inherits BoundTreeVisitor
''' <summary>
''' The compilation in which the analysis is taking place. This is needed to determine which
''' conditional methods will be compiled and which will be omitted.
''' </summary>
Protected ReadOnly compilation As VisualBasicCompilation
''' <summary>
''' The symbol of method whose body is being analyzed or field or property whose
''' initializer is being analyzed
''' </summary>
Public symbol As Symbol
''' <summary>
''' The bound code of the method or initializer being analyzed
''' </summary>
Private ReadOnly _methodOrInitializerMainNode As BoundNode
''' <summary>
''' The flow analysis state at each label, computed by merging the state from branches to
''' that label with the state when we fall into the label. Entries are created when the
''' label is encountered. One case deserves special attention: when the destination of the
''' branch is a label earlier in the code, it is possible (though rarely occurs in practice)
''' that we are changing the state at a label that we've already analyzed. In that case we
''' run another pass of the analysis to allow those changes to propagate. This repeats until
''' no further changes to the state of these labels occurs. This can result in quadratic
''' performance in unlikely but possible code such as this: "int x; if (cond) goto l1; x =
''' 3; l5: print x; l4: goto l5; l3: goto l4; l2: goto l3; l1: goto l2;"
''' </summary>
Private ReadOnly _labels As New Dictionary(Of LabelSymbol, LabelStateAndNesting)
''' <summary> All of the labels seen so far in this forward scan of the body </summary>
Private _labelsSeen As New HashSet(Of LabelSymbol)
Private _placeholderReplacementMap As Dictionary(Of BoundValuePlaceholderBase, BoundExpression)
''' <summary>
''' Set to true after an analysis scan if the analysis was incomplete due to a backward
''' "goto" branch changing some analysis result. In this case the caller scans again (until
''' this is false). Since the analysis proceeds by monotonically changing the state computed
''' at each label, this must terminate.
''' </summary>
Friend backwardBranchChanged As Boolean = False
''' <summary> Actual storage for PendingBranches </summary>
Private _pendingBranches As ArrayBuilder(Of PendingBranch) = ArrayBuilder(Of PendingBranch).GetInstance()
''' <summary> The definite assignment and/or reachability state at the point currently being analyzed. </summary>
Protected State As LocalState
Protected StateWhenTrue As LocalState
Protected StateWhenFalse As LocalState
Protected IsConditionalState As Boolean
''' <summary>
''' 'Me' parameter, relevant for methods, fields, properties, otherwise Nothing
''' </summary>
Protected ReadOnly MeParameter As ParameterSymbol
''' <summary>
''' Used only in the data flows out walker, we track unassignments as well as assignments
''' </summary>
Protected ReadOnly TrackUnassignments As Boolean
''' <summary>
''' The current lexical nesting in the BoundTree.
''' </summary>
''' <remarks></remarks>
Private _nesting As ArrayBuilder(Of Integer)
''' <summary>
''' Where all diagnostics are deposited.
''' </summary>
Protected ReadOnly diagnostics As DiagnosticBag = DiagnosticBag.GetInstance()
''' <summary> Indicates whether or not support of constant expressions (boolean and nothing)
''' is enabled in this analyzer. In general, constant expressions support is enabled in analysis
''' exposed to public API consumer and disabled when used from command-line compiler. </summary>
Private ReadOnly _suppressConstantExpressions As Boolean
Protected _recursionDepth As Integer
''' <summary>
''' Construct an object for outside-region analysis
''' </summary>
Protected Sub New(_info As FlowAnalysisInfo, suppressConstExpressionsSupport As Boolean)
MyClass.New(_info, Nothing, suppressConstExpressionsSupport, False)
End Sub
''' <summary>
''' Construct an object for region-aware analysis
''' </summary>
Protected Sub New(_info As FlowAnalysisInfo, _region As FlowAnalysisRegionInfo, suppressConstExpressionsSupport As Boolean, trackUnassignments As Boolean)
Debug.Assert(_info.Symbol.Kind = SymbolKind.Field OrElse
_info.Symbol.Kind = SymbolKind.Property OrElse
_info.Symbol.Kind = SymbolKind.Method OrElse
_info.Symbol.Kind = SymbolKind.Parameter)
Me.compilation = _info.Compilation
Me.symbol = _info.Symbol
Me.MeParameter = Me.symbol.GetMeParameter()
Me._methodOrInitializerMainNode = _info.Node
Me._firstInRegion = _region.FirstInRegion
Me._lastInRegion = _region.LastInRegion
Me._region = _region.Region
Me.TrackUnassignments = trackUnassignments
Me._loopHeadState = If(trackUnassignments, New Dictionary(Of BoundLoopStatement, LocalState)(), Nothing)
Me._suppressConstantExpressions = suppressConstExpressionsSupport
End Sub
Protected Overridable Sub InitForScan()
End Sub
Protected MustOverride Function ReachableState() As LocalState
Protected MustOverride Function UnreachableState() As LocalState
''' <summary> Set conditional state </summary>
Private Sub SetConditionalState(_whenTrue As LocalState, _whenFalse As LocalState)
Me.State = Nothing
Me.StateWhenTrue = _whenTrue
Me.StateWhenFalse = _whenFalse
Me.IsConditionalState = True
End Sub
''' <summary> Set unconditional state </summary>
Protected Sub SetState(_state As LocalState)
Me.State = _state
If Me.IsConditionalState Then
Me.StateWhenTrue = Nothing
Me.StateWhenFalse = Nothing
Me.IsConditionalState = False
End If
End Sub
''' <summary> Split state </summary>
Protected Sub Split()
If Not Me.IsConditionalState Then
SetConditionalState(Me.State, Me.State.Clone())
End If
End Sub
''' <summary> Intersect and unsplit state </summary>
Protected Sub Unsplit()
If Me.IsConditionalState Then
Me.IntersectWith(Me.StateWhenTrue, Me.StateWhenFalse)
Me.SetState(Me.StateWhenTrue)
End If
End Sub
''' <summary>
''' Pending escapes generated in the current scope (or more deeply nested scopes). When jump
''' statements (goto, break, continue, return) are processed, they are placed in the
''' Me._pendingBranches buffer to be processed later by the code handling the destination
''' statement. As a special case, the processing of try-finally statements might modify the
''' contents of the Me._pendingBranches buffer to take into account the behavior of
''' "intervening" finally clauses.
''' </summary>
Protected ReadOnly Property PendingBranches As ImmutableArray(Of PendingBranch)
Get
Return _pendingBranches.ToImmutable
End Get
End Property
''' <summary>
''' Perform a single pass of flow analysis. Note that after this pass,
''' this.backwardBranchChanged indicates if a further pass is required.
''' </summary>
''' <returns>False if the region is invalid</returns>
Protected Overridable Function Scan() As Boolean
' Clear diagnostics reported in the previous iteration
Me.diagnostics.Clear()
' initialize
Me._regionPlace = RegionPlace.Before
Me.SetState(ReachableState())
Me.backwardBranchChanged = False
If Me._nesting IsNot Nothing Then
Me._nesting.Free()
End If
Me._nesting = ArrayBuilder(Of Integer).GetInstance()
InitForScan()
' pending branches should be restored after each iteration
Dim oldPending As SavedPending = Me.SavePending()
Visit(Me._methodOrInitializerMainNode)
Me.RestorePending(oldPending)
Me._labelsSeen.Clear()
' if we are tracking regions, we must have left the region by now;
' otherwise the region was erroneous which must have been detected earlier
Return Me._firstInRegion Is Nothing OrElse Me._regionPlace = RegionPlace.After
End Function
''' <returns>False if the region is invalid</returns>
Protected Overridable Function Analyze() As Boolean
Do
If Not Me.Scan() Then
Return False
End If
Loop While Me.backwardBranchChanged
Return True
End Function
Protected Overridable Sub Free()
If Me._nesting IsNot Nothing Then
Me._nesting.Free()
End If
Me.diagnostics.Free()
Me._pendingBranches.Free()
End Sub
''' <summary>
''' If analysis is being performed in a context of a method returns method's parameters,
''' otherwise returns an empty array
''' </summary>
Protected ReadOnly Property MethodParameters As ImmutableArray(Of ParameterSymbol)
Get
Return If(Me.symbol.Kind = SymbolKind.Method, DirectCast(Me.symbol, MethodSymbol).Parameters, ImmutableArray(Of ParameterSymbol).Empty)
End Get
End Property
''' <summary>
''' Specifies whether or not method's ByRef parameters should be analyzed. If there's more than one location in
''' the method being analyzed, then the method is partial and we prefer to report an out parameter in partial
''' method error.
''' Note: VB doesn't support "out" so it doesn't warn for unassigned parameters. However, check variables passed
''' byref are assigned so that data flow analysis detects parameters flowing out.
''' </summary>
''' <returns>true if the out parameters of the method should be analyzed</returns>
Protected ReadOnly Property ShouldAnalyzeByRefParameters As Boolean
Get
Return Me.symbol.Kind = SymbolKind.Method AndAlso DirectCast(Me.symbol, MethodSymbol).Locations.Length = 1
End Get
End Property
''' <summary>
''' Method symbol or nothing
''' TODO: Need to try and get rid of this property
''' </summary>
Protected ReadOnly Property MethodSymbol As MethodSymbol
Get
Return If(Me.symbol.Kind = SymbolKind.Method, DirectCast(Me.symbol, MethodSymbol), Nothing)
End Get
End Property
''' <summary>
''' If analysis is being performed in a context of a method returns method's return type,
''' otherwise returns Nothing
''' </summary>
Protected ReadOnly Property MethodReturnType As TypeSymbol
Get
Return If(Me.symbol.Kind = SymbolKind.Method, DirectCast(Me.symbol, MethodSymbol).ReturnType, Nothing)
End Get
End Property
''' <summary>
''' Return the flow analysis state associated with a label.
''' </summary>
''' <param name="label"></param>
''' <returns></returns>
''' <remarks></remarks>
Private Function LabelState(label As LabelSymbol) As LocalState
Dim result As LabelStateAndNesting = Nothing
If _labels.TryGetValue(label, result) Then
Return result.State
End If
Return UnreachableState()
End Function
''' <summary>
''' Set the current state to one that indicates that it is unreachable.
''' </summary>
Protected Sub SetUnreachable()
Me.SetState(UnreachableState())
End Sub
Private Function IsConstantTrue(node As BoundExpression) As Boolean
If Me._suppressConstantExpressions Then
Return False
End If
If Not node.IsConstant Then
Return False
End If
Dim constantValue = node.ConstantValueOpt
If constantValue.Discriminator <> ConstantValueTypeDiscriminator.Boolean Then
Return False
End If
Return constantValue.BooleanValue
End Function
Private Function IsConstantFalse(node As BoundExpression) As Boolean
If Me._suppressConstantExpressions Then
Return False
End If
If Not node.IsConstant Then
Return False
End If
Dim constantValue = node.ConstantValueOpt
If constantValue.Discriminator <> ConstantValueTypeDiscriminator.Boolean Then
Return False
End If
Return Not constantValue.BooleanValue
End Function
Private Function IsConstantNull(node As BoundExpression) As Boolean
If Me._suppressConstantExpressions Then
Return False
End If
If Not node.IsConstant Then
Return False
End If
Return node.ConstantValueOpt.IsNull
End Function
Protected Shared Function IsNonPrimitiveValueType(type As TypeSymbol) As Boolean
Debug.Assert(type IsNot Nothing)
If Not type.IsValueType Then
Return False
End If
Select Case type.SpecialType
Case SpecialType.None,
SpecialType.System_Nullable_T,
SpecialType.System_IntPtr,
SpecialType.System_UIntPtr
Return True
Case Else
Return False
End Select
End Function
''' <summary>
''' Called at the point in a loop where the backwards branch would go to.
''' </summary>
''' <param name="node"></param>
''' <remarks></remarks>
Private Sub LoopHead(node As BoundLoopStatement)
If Me.TrackUnassignments Then
Dim previousState As LocalState
If Me._loopHeadState.TryGetValue(node, previousState) Then
IntersectWith(Me.State, previousState)
End If
Me._loopHeadState(node) = Me.State.Clone()
End If
End Sub
''' <summary>
''' Called at the point in a loop where the backward branch is placed.
''' </summary>
''' <param name="node"></param>
''' <remarks></remarks>
Private Sub LoopTail(node As BoundLoopStatement)
If Me.TrackUnassignments Then
Dim oldState = Me._loopHeadState(node)
If IntersectWith(oldState, Me.State) Then
Me._loopHeadState(node) = oldState
Me.backwardBranchChanged = True
End If
End If
End Sub
''' <summary>
''' Used to resolve exit statements in each statement form that has an Exit statement
''' (loops, switch).
''' </summary>
Private Sub ResolveBreaks(breakState As LocalState, breakLabel As LabelSymbol)
Dim newPendingBranches = ArrayBuilder(Of PendingBranch).GetInstance()
For Each pending In Me.PendingBranches
Select Case pending.Branch.Kind
Case BoundKind.ExitStatement
Dim exitStmt = TryCast(pending.Branch, BoundExitStatement)
If exitStmt.Label = breakLabel Then
IntersectWith(breakState, pending.State)
Else
' If it doesn't match then it is for an outer block
newPendingBranches.Add(pending)
End If
Case Else
newPendingBranches.Add(pending)
End Select
Next
ResetPendingBranches(newPendingBranches)
Me.SetState(breakState)
End Sub
''' <summary>
''' Used to resolve continue statements in each statement form that supports it.
''' </summary>
''' <param name = "continueLabel"></param>
Private Sub ResolveContinues(continueLabel As LabelSymbol)
Dim newPendingBranches = ArrayBuilder(Of PendingBranch).GetInstance()
For Each pending In Me.PendingBranches
Select Case pending.Branch.Kind
Case BoundKind.ContinueStatement
' When the continue XXX does not match an enclosing XXX block then no label exists
Dim continueStmt = TryCast(pending.Branch, BoundContinueStatement)
' Technically, nothing in the language specification depends on the state
' at the continue label, so we could just discard them instead of merging
' the states. In fact, we need not have added continue statements to the
' pending jump queue in the first place if we were interested solely in the
' flow analysis. However, region analysis (in support of extract method)
' depends on continue statements appearing in the pending branch queue, so
' we process them from the queue here.
If continueStmt.Label = continueLabel Then
IntersectWith(Me.State, pending.State)
Else
' If it doesn't match then it is for an outer block
newPendingBranches.Add(pending)
End If
Case Else
newPendingBranches.Add(pending)
End Select
Next
ResetPendingBranches(newPendingBranches)
End Sub
''' <summary>
''' Subclasses override this if they want to take special actions on processing a goto
''' statement, when both the jump and the label have been located.
''' </summary>
Protected Overridable Sub NoteBranch(pending As PendingBranch, stmt As BoundStatement, labelStmt As BoundLabelStatement)
End Sub
Private Shared Function GetBranchTargetLabel(branch As BoundStatement, gotoOnly As Boolean) As LabelSymbol
Select Case branch.Kind
Case BoundKind.GotoStatement
Return DirectCast(branch, BoundGotoStatement).Label
Case BoundKind.ConditionalGoto
Return DirectCast(branch, BoundConditionalGoto).Label
Case BoundKind.ExitStatement
Return If(gotoOnly, Nothing, DirectCast(branch, BoundExitStatement).Label)
Case BoundKind.ReturnStatement
Return If(gotoOnly, Nothing, DirectCast(branch, BoundReturnStatement).ExitLabelOpt)
Case BoundKind.ContinueStatement
Return Nothing
Case BoundKind.YieldStatement
Return Nothing
Case Else
Throw ExceptionUtilities.UnexpectedValue(branch.Kind)
End Select
Return Nothing
End Function
Protected Overridable Sub ResolveBranch(pending As PendingBranch, label As LabelSymbol, target As BoundLabelStatement, ByRef labelStateChanged As Boolean)
Dim _state = LabelState(target.Label)
NoteBranch(pending, pending.Branch, target)
Dim changed = IntersectWith(_state, pending.State)
If changed Then
labelStateChanged = True
Me._labels(target.Label) = New LabelStateAndNesting(target, _state, Me._nesting)
End If
End Sub
''' <summary>
''' To handle a label, we resolve all pending forward references to branches to that label. Returns true if the state of
''' the label changes as a result.
''' </summary>
''' <param name = "target"></param>
''' <returns></returns>
Private Function ResolveBranches(target As BoundLabelStatement) As Boolean
Dim labelStateChanged As Boolean = False
If Me.PendingBranches.Length > 0 Then
Dim newPendingBranches = ArrayBuilder(Of PendingBranch).GetInstance()
For Each pending In Me.PendingBranches
Dim label As LabelSymbol = GetBranchTargetLabel(pending.Branch, False)
If label IsNot Nothing AndAlso label = target.Label Then
ResolveBranch(pending, label, target, labelStateChanged)
Else
newPendingBranches.Add(pending)
End If
Next
ResetPendingBranches(newPendingBranches)
End If
Return labelStateChanged
End Function
Protected Class SavedPending
Public ReadOnly PendingBranches As ArrayBuilder(Of PendingBranch)
Public ReadOnly LabelsSeen As HashSet(Of LabelSymbol)
Public Sub New(ByRef _pendingBranches As ArrayBuilder(Of PendingBranch), ByRef _labelsSeen As HashSet(Of LabelSymbol))
Me.PendingBranches = _pendingBranches
Me.LabelsSeen = _labelsSeen
_pendingBranches = ArrayBuilder(Of PendingBranch).GetInstance()
_labelsSeen = New HashSet(Of LabelSymbol)
End Sub
End Class
''' <summary>
''' When branching into constructs that don't support jumps into/out of (i.e. lambdas),
''' we save the pending branches when visiting more nested constructs.
''' </summary>
Protected Function SavePending() As SavedPending
Return New SavedPending(Me._pendingBranches, Me._labelsSeen)
End Function
Private Sub ResetPendingBranches(newPendingBranches As ArrayBuilder(Of PendingBranch))
Debug.Assert(newPendingBranches IsNot Nothing)
Debug.Assert(newPendingBranches IsNot Me._pendingBranches)
Me._pendingBranches.Free()
Me._pendingBranches = newPendingBranches
End Sub
''' <summary>
''' We use this to restore the old set of pending branches and labels after visiting a construct that contains nested statements.
''' </summary>
''' <param name="oldPending">The old pending branches/labels, which are to be merged with the current ones</param>
Protected Sub RestorePending(oldPending As SavedPending, Optional mergeLabelsSeen As Boolean = False)
If ResolveBranches(Me._labelsSeen) Then
Me.backwardBranchChanged = True
End If
oldPending.PendingBranches.AddRange(Me.PendingBranches)
ResetPendingBranches(oldPending.PendingBranches)
' We only use SavePending/RestorePending when there could be no branch into the region between them.
' So there is no need to save the labels seen between the calls. If there were such a need, we would
' do "this.labelsSeen.UnionWith(oldPending.LabelsSeen);" instead of the following assignment
If mergeLabelsSeen Then
Me._labelsSeen.AddAll(oldPending.LabelsSeen)
Else
Me._labelsSeen = oldPending.LabelsSeen
End If
End Sub
''' <summary>
''' We look at all pending branches and attempt to resolve the branches with labels if the nesting of the
''' block is the nearest common parent to the branch and the label. Because the code is evaluated recursively
''' outward we only need to check if the current nesting is a prefix of both the branch and the label nesting.
''' </summary>
Private Function ResolveBranches(labelsFilter As HashSet(Of LabelSymbol)) As Boolean
Dim labelStateChanged As Boolean = False
If Me.PendingBranches.Length > 0 Then
Dim newPendingBranches = ArrayBuilder(Of PendingBranch).GetInstance()
For Each pending In Me.PendingBranches
Dim labelSymbol As LabelSymbol = Nothing
Dim labelAndNesting As LabelStateAndNesting = Nothing
If BothBranchAndLabelArePrefixedByNesting(pending, labelsFilter, labelSymbol:=labelSymbol, labelAndNesting:=labelAndNesting) Then
Dim changed As Boolean
ResolveBranch(pending, labelSymbol, labelAndNesting.Target, changed)
If changed Then
labelStateChanged = True
End If
Continue For
End If
newPendingBranches.Add(pending)
Next
ResetPendingBranches(newPendingBranches)
End If
Return labelStateChanged
End Function
Private Function BothBranchAndLabelArePrefixedByNesting(branch As PendingBranch,
Optional labelsFilter As HashSet(Of LabelSymbol) = Nothing,
Optional ignoreLast As Boolean = False,
<Out()> Optional ByRef labelSymbol As LabelSymbol = Nothing,
<Out()> Optional ByRef labelAndNesting As LabelStateAndNesting = Nothing) As Boolean
Dim branchStatement As BoundStatement = branch.Branch
If branchStatement IsNot Nothing AndAlso branch.Nesting.IsPrefixedBy(Me._nesting, ignoreLast) Then
labelSymbol = GetBranchTargetLabel(branchStatement, gotoOnly:=True)
If labelSymbol IsNot Nothing AndAlso (labelsFilter Is Nothing OrElse labelsFilter.Contains(labelSymbol)) Then
Return Me._labels.TryGetValue(labelSymbol, labelAndNesting) AndAlso
labelAndNesting.Nesting.IsPrefixedBy(Me._nesting, ignoreLast)
End If
End If
Return False
End Function
''' <summary>
''' Report an unimplemented language construct.
''' </summary>
''' <param name = "node"></param>
''' <param name = "feature"></param>
''' <returns></returns>
Protected Overridable Function Unimplemented(node As BoundNode, feature As [String]) As BoundNode
Return Nothing
End Function
Protected Overridable Function AllBitsSet() As LocalState
Return Nothing
End Function
Protected Sub SetPlaceholderSubstitute(placeholder As BoundValuePlaceholderBase, newSubstitute As BoundExpression)
Debug.Assert(placeholder IsNot Nothing)
If _placeholderReplacementMap Is Nothing Then
_placeholderReplacementMap = New Dictionary(Of BoundValuePlaceholderBase, BoundExpression)()
End If
Debug.Assert(Not _placeholderReplacementMap.ContainsKey(placeholder))
_placeholderReplacementMap(placeholder) = newSubstitute
End Sub
Protected Sub RemovePlaceholderSubstitute(placeholder As BoundValuePlaceholderBase)
Debug.Assert(placeholder IsNot Nothing)
Debug.Assert(_placeholderReplacementMap.ContainsKey(placeholder))
Me._placeholderReplacementMap.Remove(placeholder)
End Sub
Protected ReadOnly Property GetPlaceholderSubstitute(placeholder As BoundValuePlaceholderBase) As BoundExpression
Get
Dim value As BoundExpression = Nothing
If Me._placeholderReplacementMap IsNot Nothing AndAlso Me._placeholderReplacementMap.TryGetValue(placeholder, value) Then
Return value
End If
Return Nothing
End Get
End Property
Protected MustOverride Function Dump(state As LocalState) As String
#Region "Visitors"
Public NotOverridable Overrides Function Visit(node As BoundNode) As BoundNode
Visit(node, dontLeaveRegion:=False)
Return Nothing
End Function
''' <summary>
''' Visit a node.
''' </summary>
Protected Overridable Overloads Sub Visit(node As BoundNode, dontLeaveRegion As Boolean)
VisitAlways(node, dontLeaveRegion:=dontLeaveRegion)
End Sub
''' <summary>
''' Visit a node, process
''' </summary>
Protected Sub VisitAlways(node As BoundNode, Optional dontLeaveRegion As Boolean = False)
If Me._firstInRegion Is Nothing Then
VisitWithStackGuard(node)
Else
If node Is Me._firstInRegion AndAlso Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
VisitWithStackGuard(node)
If Not dontLeaveRegion AndAlso node Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
End If
End Sub
Private Shadows Function VisitWithStackGuard(node As BoundNode) As BoundNode
Dim expression = TryCast(node, BoundExpression)
If expression IsNot Nothing Then
Return VisitExpressionWithStackGuard(_recursionDepth, expression)
End If
Return MyBase.Visit(node)
End Function
Protected Overrides Function VisitExpressionWithoutStackGuard(node As BoundExpression) As BoundExpression
Return DirectCast(MyBase.Visit(node), BoundExpression)
End Function
Protected Overrides Function ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException() As Boolean
Return False ' just let the original exception to bubble up.
End Function
Protected Overridable Sub VisitLvalue(node As BoundExpression, Optional dontLeaveRegion As Boolean = False)
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If node Is Me._firstInRegion AndAlso Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
Select Case node.Kind
Case BoundKind.Local
Dim local = DirectCast(node, BoundLocal)
If local.LocalSymbol.IsByRef Then
VisitRvalue(local)
End If
Case BoundKind.Parameter, BoundKind.MeReference, BoundKind.MyClassReference, BoundKind.MyBaseReference
' no need for it to be previously assigned: it is on the left.
Case BoundKind.FieldAccess
VisitFieldAccessInternal(DirectCast(node, BoundFieldAccess))
Case BoundKind.WithLValueExpressionPlaceholder,
BoundKind.WithRValueExpressionPlaceholder,
BoundKind.LValuePlaceholder,
BoundKind.RValuePlaceholder
' TODO: Other placeholder kinds?
Dim substitute As BoundExpression = GetPlaceholderSubstitute(DirectCast(node, BoundValuePlaceholderBase))
If substitute IsNot Nothing Then
VisitLvalue(substitute)
Else
VisitRvalue(node, dontLeaveRegion:=True)
End If
Case Else
VisitRvalue(node, dontLeaveRegion:=True)
End Select
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If Not dontLeaveRegion AndAlso node Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
End Sub
''' <summary>
''' Visit a boolean condition expression.
''' </summary>
Protected Sub VisitCondition(node As BoundExpression)
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If node Is Me._firstInRegion AndAlso Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
Visit(node, dontLeaveRegion:=True)
AdjustConditionalState(node)
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If node Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
End Sub
Private Sub AdjustConditionalState(node As BoundExpression)
If IsConstantTrue(node) Then
Me.Unsplit()
Me.SetConditionalState(Me.State, UnreachableState())
ElseIf IsConstantFalse(node) Then
Me.Unsplit()
Me.SetConditionalState(UnreachableState(), Me.State)
Else
Me.Split()
End If
End Sub
''' <summary>
''' Visit a general expression, where we will only need to determine if variables are
''' assigned (or not). That is, we will not be needing AssignedWhenTrue and
''' AssignedWhenFalse.
''' </summary>
Protected Sub VisitRvalue(node As BoundExpression, Optional rwContext As ReadWriteContext = ReadWriteContext.None, Optional dontLeaveRegion As Boolean = False)
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If node Is Me._firstInRegion AndAlso Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
If rwContext <> ReadWriteContext.None Then
Select Case node.Kind
Case BoundKind.Local
VisitLocalInReadWriteContext(DirectCast(node, BoundLocal), rwContext)
GoTo lUnsplitAndFinish
Case BoundKind.FieldAccess
VisitFieldAccessInReadWriteContext(DirectCast(node, BoundFieldAccess), rwContext)
GoTo lUnsplitAndFinish
End Select
End If
Visit(node, dontLeaveRegion:=True)
lUnsplitAndFinish:
Me.Unsplit()
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If Not dontLeaveRegion AndAlso node Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
End Sub
Public Overrides Function VisitSequence(node As BoundSequence) As BoundNode
Dim sideEffects = node.SideEffects
If Not sideEffects.IsEmpty Then
For Each sideEffect In node.SideEffects
VisitExpressionAsStatement(sideEffect)
Next
End If
Debug.Assert(node.ValueOpt IsNot Nothing OrElse node.HasErrors OrElse node.Type.SpecialType = SpecialType.System_Void)
If node.ValueOpt IsNot Nothing Then
VisitRvalue(node.ValueOpt)
End If
Return Nothing
End Function
Public Overrides Function VisitByRefArgumentPlaceholder(node As BoundByRefArgumentPlaceholder) As BoundNode
Dim replacement As BoundExpression = GetPlaceholderSubstitute(node)
If replacement IsNot Nothing Then
VisitRvalue(replacement, ReadWriteContext.ByRefArgument)
End If
Return Nothing
End Function
Public Overrides Function VisitByRefArgumentWithCopyBack(node As BoundByRefArgumentWithCopyBack) As BoundNode
Me.SetPlaceholderSubstitute(node.InPlaceholder, node.OriginalArgument)
VisitRvalue(node.InConversion)
Me.RemovePlaceholderSubstitute(node.InPlaceholder)
Return Nothing
End Function
Protected Overridable Sub VisitStatement(statement As BoundStatement)
Visit(statement)
End Sub
Public Overrides Function VisitLValueToRValueWrapper(node As BoundLValueToRValueWrapper) As BoundNode
Visit(node.UnderlyingLValue)
Return Nothing
End Function
Public Overrides Function VisitWithLValueExpressionPlaceholder(node As BoundWithLValueExpressionPlaceholder) As BoundNode
Visit(GetPlaceholderSubstitute(node))
Return Nothing
End Function
Public Overrides Function VisitWithStatement(node As BoundWithStatement) As BoundNode
' In case we perform _region_ flow analysis processing of the region inside With
' statement expression is a little subtle. The original expression may be
' rewritten into a placeholder substitution expression and a set of initializers.
' The placeholder will be processed when we visit left-omitted part of member or
' dictionary access in the statements inside the With statement body, but the
' initializers are to be processed with BoundWithStatement itself.
' True if it is a _region_ flow analysis and the region is defined inside the original expression
Dim origExpressionContainsRegion As Boolean = False
' True if origExpressionContainsRegion is True and region encloses all the initializers
Dim regionEnclosesInitializers As Boolean = False
If Me._firstInRegion IsNot Nothing AndAlso Me._regionPlace = RegionPlace.Before Then
Debug.Assert(Me._lastInRegion IsNot Nothing)
' Check if the region defining node is somewhere inside OriginalExpression
If BoundNodeFinder.ContainsNode(node.OriginalExpression, Me._firstInRegion, _recursionDepth, ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()) Then
Debug.Assert(BoundNodeFinder.ContainsNode(node.OriginalExpression, Me._lastInRegion, _recursionDepth, ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()))
origExpressionContainsRegion = True
' Does any of initializers contain the node or the node contains initializers?
For Each initializer In node.DraftInitializers
Debug.Assert(initializer.Kind = BoundKind.AssignmentOperator)
Dim initializerExpr As BoundExpression = DirectCast(initializer, BoundAssignmentOperator).Right
If initializerExpr.Kind = BoundKind.LValueToRValueWrapper Then
initializerExpr = DirectCast(initializerExpr, BoundLValueToRValueWrapper).UnderlyingLValue
End If
regionEnclosesInitializers = True
If Me._firstInRegion Is initializerExpr OrElse Not BoundNodeFinder.ContainsNode(Me._firstInRegion, initializerExpr, _recursionDepth, ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()) Then
regionEnclosesInitializers = False
Exit For
End If
Next
End If
End If
' NOTE: If origExpressionContainsRegion is True and regionEnclosesInitializers is *False*,
' we should expect that the region is to be properly entered/left while appropriate
' initializer is visited *OR* the node is a literal/local which was not captured,
' but simply reused when needed in With statement body
'
' The assumption above is guarded by the following assert
#If DEBUG Then
If origExpressionContainsRegion AndAlso Not regionEnclosesInitializers Then
Dim containedByInitializer As Boolean = False
For Each initializer In node.DraftInitializers
Debug.Assert(initializer.Kind = BoundKind.AssignmentOperator)
Dim initializerExpr As BoundExpression = DirectCast(initializer, BoundAssignmentOperator).Right
If initializerExpr.Kind = BoundKind.LValueToRValueWrapper Then
initializerExpr = DirectCast(initializerExpr, BoundLValueToRValueWrapper).UnderlyingLValue
End If
containedByInitializer = False
Debug.Assert(initializerExpr IsNot Nothing)
If BoundNodeFinder.ContainsNode(initializerExpr, Me._firstInRegion, _recursionDepth, ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()) Then
Debug.Assert(Not containedByInitializer)
containedByInitializer = True
Exit For
End If
Next
Debug.Assert(containedByInitializer OrElse IsNotCapturedExpression(Me._firstInRegion))
End If
#End If
If origExpressionContainsRegion AndAlso regionEnclosesInitializers Then
Me.EnterRegion()
End If
' Visit initializers
For Each initializer In node.DraftInitializers
VisitRvalue(initializer)
Next
If origExpressionContainsRegion Then
If regionEnclosesInitializers Then
Me.LeaveRegion() ' This call also asserts that we are inside the region
Else
' If any of the initializers contained region, we must have exited the region by now or the node is a literal
' which was not captured in initializers, but just reused across when/if needed in With statement body
#If DEBUG Then
Debug.Assert(Me._regionPlace = RegionPlace.After OrElse IsNotCapturedExpression(Me._firstInRegion))
#End If
End If
End If
' Visit body
VisitBlock(node.Body)
If origExpressionContainsRegion AndAlso Me._regionPlace <> RegionPlace.After Then
' The region was a part of the expression, but was not property processed/visited during
' analysis of expression and body; this *may* indicate a bug in flow analysis, otherwise
' it is the case when a struct-typed lvalue expression was never used inside the body AND
' the region was defined by nodes which were not part of initializers; thus, we never
' emitted/visited the node
Debug.Assert(Me._regionPlace = AbstractFlowPass(Of LocalState).RegionPlace.Before)
Me.SetInvalidRegion()
End If
Return Nothing
End Function
#If DEBUG Then
Private Shared Function IsNotCapturedExpression(node As BoundNode) As Boolean
If node Is Nothing Then
Return True
End If
Select Case node.Kind
Case BoundKind.Local
Return DirectCast(node, BoundLocal).Type.IsValueType
Case BoundKind.Parameter
Return DirectCast(node, BoundParameter).Type.IsValueType
Case BoundKind.Literal
Return True
Case BoundKind.MeReference
Return True
Case BoundKind.FieldAccess
Return IsNotCapturedExpression(DirectCast(node, BoundFieldAccess).ReceiverOpt)
Case Else
Return False
End Select
End Function
#End If
Public Overrides Function VisitAnonymousTypeCreationExpression(node As BoundAnonymousTypeCreationExpression) As BoundNode
For Each argument In node.Arguments
VisitRvalue(argument)
Next
Return Nothing
End Function
Public Overrides Function VisitAnonymousTypeFieldInitializer(node As BoundAnonymousTypeFieldInitializer) As BoundNode
VisitRvalue(node.Value)
Return Nothing
End Function
''' <summary>
''' Since each language construct must be handled according to the rules of the language specification,
''' the default visitor reports that the construct for the node is not implemented in the compiler.
''' </summary>
Public Overrides Function DefaultVisit(node As BoundNode) As BoundNode
Return Unimplemented(node, "flow analysis")
End Function
Protected Enum ReadWriteContext
None
CompoundAssignmentTarget
ByRefArgument
End Enum
Protected Overridable Sub VisitLocalInReadWriteContext(node As BoundLocal, rwContext As ReadWriteContext)
End Sub
Protected Overridable Sub VisitFieldAccessInReadWriteContext(node As BoundFieldAccess, rwContext As ReadWriteContext)
VisitFieldAccessInternal(node)
End Sub
Public Overrides Function VisitLambda(node As BoundLambda) As BoundNode
' Control-flow analysis does NOT dive into a lambda, while data-flow analysis does.
Return Nothing
End Function
Public Overrides Function VisitQueryExpression(node As BoundQueryExpression) As BoundNode
' Control-flow analysis does NOT dive into a query expression, while data-flow analysis does.
Return Nothing
End Function
Public Overrides Function VisitLocal(node As BoundLocal) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitRangeVariable(node As BoundRangeVariable) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitLocalDeclaration(node As BoundLocalDeclaration) As BoundNode
If node.InitializerOpt IsNot Nothing Then
VisitRvalue(node.InitializerOpt) ' analyze the expression
End If
Return Nothing
End Function
Private Function IntroduceBlock() As Integer
Dim level = Me._nesting.Count
Me._nesting.Add(0)
Return level
End Function
Private Sub FinalizeBlock(level As Integer)
Me._nesting.RemoveAt(level)
End Sub
Private Sub InitializeBlockStatement(level As Integer, ByRef index As Integer)
Me._nesting(level) = index
index += 1
End Sub
Public Overrides Function VisitBlock(node As BoundBlock) As BoundNode
Dim level = IntroduceBlock()
Dim i As Integer = 0
For Each statement In node.Statements
InitializeBlockStatement(level, i)
VisitStatement(statement)
Next
FinalizeBlock(level)
Return Nothing
End Function
Public Overrides Function VisitExpressionStatement(node As BoundExpressionStatement) As BoundNode
VisitExpressionAsStatement(node.Expression)
Return Nothing
End Function
Private Sub VisitExpressionAsStatement(node As BoundExpression)
VisitRvalue(node)
End Sub
Public Overrides Function VisitLateMemberAccess(node As BoundLateMemberAccess) As BoundNode
' receiver of a latebound access is never modified
VisitRvalue(node.ReceiverOpt)
Return Nothing
End Function
Public Overrides Function VisitLateInvocation(node As BoundLateInvocation) As BoundNode
Dim member = node.Member
Me.Visit(node.Member)
Dim arguments = node.ArgumentsOpt
If Not arguments.IsEmpty Then
Dim isByRef As Boolean
If member.Kind <> BoundKind.LateMemberAccess Then
' this is a Set, Get or Indexing.
isByRef = False
Else
' otherwise assume it is ByRef
isByRef = True
End If
VisitLateBoundArguments(arguments, isByRef)
End If
Return Nothing
End Function
Private Sub VisitLateBoundArguments(arguments As ImmutableArray(Of BoundExpression), isByRef As Boolean)
For Each argument In arguments
VisitLateBoundArgument(argument, isByRef)
Next
If isByRef Then
For Each argument In arguments
WriteArgument(argument, False)
Next
End If
End Sub
Protected Overridable Sub VisitLateBoundArgument(arg As BoundExpression, isByRef As Boolean)
If isByRef Then
VisitLvalue(arg)
Else
VisitRvalue(arg)
End If
End Sub
Public Overrides Function VisitCall(node As BoundCall) As BoundNode
' If the method being called is a partial method without a definition, or is a conditional method
' whose condition is not true at the given syntax location, then the call has no effect and it is ignored for the purposes of
' definite assignment analysis.
Dim callsAreOmitted As Boolean = node.Method.CallsAreOmitted(node.Syntax, node.SyntaxTree)
Dim savedState As LocalState = Nothing
If callsAreOmitted Then
Debug.Assert(Not Me.IsConditionalState)
savedState = Me.State.Clone()
Me.SetUnreachable()
End If
Dim methodGroup As BoundMethodGroup = node.MethodGroupOpt
Dim receiverOpt As BoundExpression = node.ReceiverOpt
Dim method As MethodSymbol = node.Method
' if method group is present, check if we need to enter region
If methodGroup IsNot Nothing AndAlso Me._firstInRegion Is methodGroup AndAlso
Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
If receiverOpt IsNot Nothing Then
VisitCallReceiver(receiverOpt, method)
Else
' If receiver is nothing it means that the method being
' accessed is shared; we still want to visit the original receiver
' to handle shared methods called on instance receiver.
Dim originalReceiver As BoundExpression = If(methodGroup IsNot Nothing, methodGroup.ReceiverOpt, Nothing)
If originalReceiver IsNot Nothing AndAlso Not originalReceiver.WasCompilerGenerated Then
Debug.Assert(method.IsShared)
' Do not visit originalReceiver if it is Type/Namespace/TypeOrValueExpression and the method
' is shared, we want region flow analysis to return Succeeded = False in this case
Dim kind As BoundKind = originalReceiver.Kind
If (kind <> BoundKind.TypeExpression) AndAlso
(kind <> BoundKind.NamespaceExpression) AndAlso
(kind <> BoundKind.TypeOrValueExpression) Then
VisitUnreachableReceiver(originalReceiver)
End If
End If
End If
' if method group is present, check if we need to leave region
If methodGroup IsNot Nothing AndAlso Me._lastInRegion Is methodGroup AndAlso IsInside Then
Me.LeaveRegion()
End If
VisitArguments(node.Arguments, method.Parameters)
If receiverOpt IsNot Nothing AndAlso receiverOpt.IsLValue Then
WriteLValueCallReceiver(receiverOpt, method)
End If
If callsAreOmitted Then
Me.SetState(savedState)
End If
Return Nothing
End Function
Private Sub VisitCallReceiver(receiver As BoundExpression, method As MethodSymbol)
Debug.Assert(receiver IsNot Nothing)
Debug.Assert(method IsNot Nothing)
If Not method.IsReducedExtensionMethod OrElse Not receiver.IsValue() Then
Debug.Assert(method.Kind <> MethodKind.Constructor)
VisitRvalue(receiver)
Else
VisitArgument(receiver, method.CallsiteReducedFromMethod.Parameters(0))
End If
End Sub
Private Sub WriteLValueCallReceiver(receiver As BoundExpression, method As MethodSymbol)
Debug.Assert(receiver IsNot Nothing)
Debug.Assert(receiver.IsLValue)
Debug.Assert(method IsNot Nothing)
If receiver.Type.IsReferenceType Then
' If a receiver is of reference type, it will not be modified if the
' method is not an extension method, note that extension method may
' write to ByRef parameter
Dim reducedFrom As MethodSymbol = method.CallsiteReducedFromMethod
If reducedFrom Is Nothing OrElse reducedFrom.ParameterCount = 0 OrElse Not reducedFrom.Parameters(0).IsByRef Then
Return
End If
End If
WriteArgument(receiver, False)
End Sub
Private Sub VisitArguments(arguments As ImmutableArray(Of BoundExpression), parameters As ImmutableArray(Of ParameterSymbol))
If parameters.IsDefault Then
For Each arg In arguments
VisitRvalue(arg)
Next
Else
Dim n As Integer = Math.Min(parameters.Length, arguments.Length)
' The first loop reflects passing arguments to the method/property
For i = 0 To n - 1
VisitArgument(arguments(i), parameters(i))
Next
' The second loop reflects writing to ByRef arguments after the method returned
For i = 0 To n - 1
If parameters(i).IsByRef Then
WriteArgument(arguments(i), parameters(i).IsOut)
End If
Next
End If
End Sub
Protected Overridable Sub WriteArgument(arg As BoundExpression, isOut As Boolean)
End Sub
Protected Overridable Sub VisitArgument(arg As BoundExpression, p As ParameterSymbol)
If p.IsByRef Then
VisitLvalue(arg)
Else
VisitRvalue(arg)
End If
End Sub
Public Overrides Function VisitDelegateCreationExpression(node As BoundDelegateCreationExpression) As BoundNode
Dim methodGroup As BoundMethodGroup = node.MethodGroupOpt
' if method group is present, check if we need to enter region
If methodGroup IsNot Nothing AndAlso Me._firstInRegion Is methodGroup AndAlso
Me._regionPlace = AbstractFlowPass(Of LocalState).RegionPlace.Before Then
Me.EnterRegion()
End If
Dim receiverOpt As BoundExpression = node.ReceiverOpt
Dim method As MethodSymbol = node.Method
If receiverOpt IsNot Nothing Then
If Not method.IsReducedExtensionMethod OrElse Not receiverOpt.IsValue() Then
Debug.Assert(method.Kind <> MethodKind.Constructor)
VisitRvalue(receiverOpt)
Else
VisitArgument(receiverOpt, method.CallsiteReducedFromMethod.Parameters(0))
End If
Else
' If receiver is nothing it means that the method being
' accessed is shared; we still want to visit the original receiver
' to handle shared methods called on instance receiver.
Dim originalReceiver As BoundExpression = If(methodGroup IsNot Nothing, methodGroup.ReceiverOpt, Nothing)
If originalReceiver IsNot Nothing AndAlso Not originalReceiver.WasCompilerGenerated Then
Debug.Assert(method.IsShared)
' Do not visit originalReceiver if it is Type/Namespace/TypeOrValueExpression and the method
' is shared, we want region flow analysis to return Succeeded = False in this case
Dim kind As BoundKind = originalReceiver.Kind
If (kind <> BoundKind.TypeExpression) AndAlso
(kind <> BoundKind.NamespaceExpression) AndAlso
(kind <> BoundKind.TypeOrValueExpression) Then
VisitUnreachableReceiver(originalReceiver)
End If
End If
End If
' if method group is present, check if we need to leave region
If methodGroup IsNot Nothing AndAlso Me._lastInRegion Is methodGroup AndAlso IsInside Then
Me.LeaveRegion()
End If
Return Nothing
End Function
Public Overrides Function VisitBadExpression(node As BoundBadExpression) As BoundNode
' Visit the child nodes in bad expressions so that uses of locals in bad expressions are recorded. This
' suppresses warnings about unused locals.
For Each child In node.ChildBoundNodes
VisitRvalue(TryCast(child, BoundExpression))
Next
Return Nothing
End Function
Public Overrides Function VisitBadStatement(node As BoundBadStatement) As BoundNode
' Visit the child nodes of the bad statement
For Each child In node.ChildBoundNodes
Dim statement = TryCast(child, BoundStatement)
If statement IsNot Nothing Then
VisitStatement(TryCast(child, BoundStatement))
Else
Dim expression = TryCast(child, BoundExpression)
If expression IsNot Nothing Then
VisitExpressionAsStatement(expression)
Else
Visit(child)
End If
End If
Next
Return Nothing
End Function
Public Overrides Function VisitBadVariable(node As BoundBadVariable) As BoundNode
If node.IsLValue Then
VisitLvalue(node.Expression)
Else
VisitRvalue(node.Expression)
End If
Return Nothing
End Function
Public Overrides Function VisitTypeExpression(node As BoundTypeExpression) As BoundNode
' Visit the receiver even though the expression value
' is ignored since the region may be within the receiver.
VisitUnreachableReceiver(node.UnevaluatedReceiverOpt)
Return Nothing
End Function
Public Overrides Function VisitLiteral(node As BoundLiteral) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitConversion(node As BoundConversion) As BoundNode
VisitRvalue(node.Operand)
Return Nothing
End Function
Public Overrides Function VisitUserDefinedConversion(node As BoundUserDefinedConversion) As BoundNode
VisitRvalue(node.UnderlyingExpression)
Return Nothing
End Function
Public Overrides Function VisitIfStatement(node As BoundIfStatement) As BoundNode
VisitCondition(node.Condition)
Dim trueState As LocalState = Me.StateWhenTrue
Dim falseState As LocalState = Me.StateWhenFalse
Me.SetState(trueState)
VisitStatement(node.Consequence)
trueState = Me.State
Me.SetState(falseState)
If node.AlternativeOpt IsNot Nothing Then
VisitStatement(node.AlternativeOpt)
End If
Me.IntersectWith(Me.State, trueState)
Return Nothing
End Function
Public Overrides Function VisitTernaryConditionalExpression(node As BoundTernaryConditionalExpression) As BoundNode
VisitCondition(node.Condition)
Dim trueState As LocalState = Me.StateWhenTrue
Dim falseState As LocalState = Me.StateWhenFalse
If IsConstantTrue(node.Condition) Then
Me.SetState(falseState)
VisitRvalue(node.WhenFalse)
Me.SetState(trueState)
VisitRvalue(node.WhenTrue)
ElseIf IsConstantFalse(node.Condition) Then
Me.SetState(trueState)
VisitRvalue(node.WhenTrue)
Me.SetState(falseState)
VisitRvalue(node.WhenFalse)
Else
Me.SetState(trueState)
VisitRvalue(node.WhenTrue)
Me.Unsplit()
trueState = Me.State
Me.SetState(falseState)
VisitRvalue(node.WhenFalse)
Me.Unsplit()
Me.IntersectWith(Me.State, trueState)
End If
Return Nothing
End Function
Public Overrides Function VisitBinaryConditionalExpression(node As BoundBinaryConditionalExpression) As BoundNode
VisitRvalue(node.TestExpression)
If node.TestExpression.IsConstant AndAlso node.TestExpression.ConstantValueOpt.IsNothing Then
' this may be something like 'If(CType(Nothing, String), AnyExpression)'
VisitRvalue(node.ElseExpression)
Else
' all other cases including 'If("const", AnyExpression)'
Dim savedState As LocalState = Me.State.Clone()
VisitRvalue(node.ElseExpression)
Me.SetState(savedState)
End If
Return Nothing
End Function
Public Overrides Function VisitConditionalAccess(node As BoundConditionalAccess) As BoundNode
VisitRvalue(node.Receiver)
If node.Receiver.IsConstant Then
If node.Receiver.ConstantValueOpt.IsNothing Then
Dim savedState As LocalState = Me.State.Clone()
SetUnreachable()
VisitRvalue(node.AccessExpression)
Me.SetState(savedState)
Else
VisitRvalue(node.AccessExpression)
End If
Else
Dim savedState As LocalState = Me.State.Clone()
VisitRvalue(node.AccessExpression)
IntersectWith(Me.State, savedState)
End If
Return Nothing
End Function
Public Overrides Function VisitLoweredConditionalAccess(node As BoundLoweredConditionalAccess) As BoundNode
VisitRvalue(node.ReceiverOrCondition)
Dim savedState As LocalState = Me.State.Clone()
VisitRvalue(node.WhenNotNull)
IntersectWith(Me.State, savedState)
If node.WhenNullOpt IsNot Nothing Then
savedState = Me.State.Clone()
VisitRvalue(node.WhenNullOpt)
IntersectWith(Me.State, savedState)
End If
Return Nothing
End Function
Public Overrides Function VisitComplexConditionalAccessReceiver(node As BoundComplexConditionalAccessReceiver) As BoundNode
Dim savedState As LocalState = Me.State.Clone()
VisitLvalue(node.ValueTypeReceiver)
IntersectWith(Me.State, savedState)
savedState = Me.State.Clone()
VisitRvalue(node.ReferenceTypeReceiver)
IntersectWith(Me.State, savedState)
Return Nothing
End Function
Public Overrides Function VisitConditionalAccessReceiverPlaceholder(node As BoundConditionalAccessReceiverPlaceholder) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitReturnStatement(node As BoundReturnStatement) As BoundNode
' Set unreachable and pending branch for all returns except for the final return that is auto generated
If Not node.IsEndOfMethodReturn Then
VisitRvalue(node.ExpressionOpt)
Me._pendingBranches.Add(New PendingBranch(node, Me.State, Me._nesting))
SetUnreachable()
End If
Return Nothing
End Function
Public Overrides Function VisitYieldStatement(node As BoundYieldStatement) As BoundNode
VisitRvalue(node.Expression)
Me._pendingBranches.Add(New PendingBranch(node, Me.State, Me._nesting))
Return Nothing
End Function
Public Overrides Function VisitStopStatement(node As BoundStopStatement) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitEndStatement(node As BoundEndStatement) As BoundNode
SetUnreachable()
Return Nothing
End Function
Public Overrides Function VisitMeReference(node As BoundMeReference) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitParameter(node As BoundParameter) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitObjectCreationExpression(node As BoundObjectCreationExpression) As BoundNode
For Each e In node.Arguments
VisitRvalue(e)
Next
VisitObjectCreationExpressionInitializer(node.InitializerOpt)
Return Nothing
End Function
Public Overrides Function VisitNoPiaObjectCreationExpression(node As BoundNoPiaObjectCreationExpression) As BoundNode
VisitObjectCreationExpressionInitializer(node.InitializerOpt)
Return Nothing
End Function
Protected Overridable Sub VisitObjectCreationExpressionInitializer(node As BoundObjectInitializerExpressionBase)
Visit(node)
End Sub
Private Function VisitObjectInitializerExpressionBase(node As BoundObjectInitializerExpressionBase) As BoundNode
For Each initializer In node.Initializers
VisitExpressionAsStatement(initializer)
Next
Return Nothing
End Function
Public Overrides Function VisitCollectionInitializerExpression(node As BoundCollectionInitializerExpression) As BoundNode
Return Me.VisitObjectInitializerExpressionBase(node)
End Function
Public Overrides Function VisitObjectInitializerExpression(node As BoundObjectInitializerExpression) As BoundNode
Return Me.VisitObjectInitializerExpressionBase(node)
End Function
Public Overrides Function VisitNewT(node As BoundNewT) As BoundNode
Visit(node.InitializerOpt)
Return Nothing
End Function
Public Overrides Function VisitRedimStatement(node As BoundRedimStatement) As BoundNode
For Each clause In node.Clauses
Visit(clause)
Next
Return Nothing
End Function
Public Overrides Function VisitEraseStatement(node As BoundEraseStatement) As BoundNode
For Each clause In node.Clauses
Visit(clause)
Next
Return Nothing
End Function
Protected Overridable ReadOnly Property SuppressRedimOperandRvalueOnPreserve As Boolean
Get
Return False
End Get
End Property
Public Overrides Function VisitRedimClause(node As BoundRedimClause) As BoundNode
If node.Preserve AndAlso Not SuppressRedimOperandRvalueOnPreserve Then
VisitRvalue(node.Operand)
End If
VisitLvalue(node.Operand)
For Each index In node.Indices
VisitRvalue(index)
Next
Return Nothing
End Function
Public Overrides Function VisitAssignmentOperator(node As BoundAssignmentOperator) As BoundNode
If node.LeftOnTheRightOpt Is Nothing Then
VisitLvalue(node.Left)
Else
SetPlaceholderSubstitute(node.LeftOnTheRightOpt, node.Left)
End If
VisitRvalue(node.Right)
If node.LeftOnTheRightOpt IsNot Nothing Then
RemovePlaceholderSubstitute(node.LeftOnTheRightOpt)
End If
Return Nothing
End Function
Public Overrides Function VisitMidResult(node As BoundMidResult) As BoundNode
VisitRvalue(node.Original)
VisitRvalue(node.Start)
If node.LengthOpt IsNot Nothing Then
VisitRvalue(node.LengthOpt)
End If
VisitRvalue(node.Source)
Return Nothing
End Function
Public Overrides Function VisitReferenceAssignment(node As BoundReferenceAssignment) As BoundNode
VisitRvalue(node.ByRefLocal)
VisitRvalue(node.LValue)
Return Nothing
End Function
Public Overrides Function VisitCompoundAssignmentTargetPlaceholder(node As BoundCompoundAssignmentTargetPlaceholder) As BoundNode
Dim replacement As BoundExpression = GetPlaceholderSubstitute(node)
If replacement IsNot Nothing Then
VisitRvalue(replacement, ReadWriteContext.CompoundAssignmentTarget)
End If
Return Nothing
End Function
Public Overrides Function VisitFieldAccess(node As BoundFieldAccess) As BoundNode
VisitFieldAccessInternal(node)
Return Nothing
End Function
Private Function VisitFieldAccessInternal(node As BoundFieldAccess) As BoundNode
Dim receiverOpt = node.ReceiverOpt
If FieldAccessMayRequireTracking(node) Then
VisitLvalue(receiverOpt)
ElseIf node.FieldSymbol.IsShared Then
VisitUnreachableReceiver(receiverOpt)
Else
VisitRvalue(receiverOpt)
End If
Return Nothing
End Function
''' <summary> Bound field access passed may require tracking if it is an access to a non-shared structure field </summary>
Protected Shared Function FieldAccessMayRequireTracking(fieldAccess As BoundFieldAccess) As Boolean
If fieldAccess.FieldSymbol.IsShared Then
Return False
End If
Dim receiver = fieldAccess.ReceiverOpt
' Receiver must exist
If receiver Is Nothing Then
Return False
End If
' Receiver is of non-primitive structure type
Dim receiverType = receiver.Type
Return IsNonPrimitiveValueType(receiverType)
End Function
Public Overrides Function VisitPropertyAccess(node As BoundPropertyAccess) As BoundNode
Dim propertyGroup As BoundPropertyGroup = node.PropertyGroupOpt
' if property group is present, check if we need to enter region
If propertyGroup IsNot Nothing AndAlso Me._firstInRegion Is propertyGroup AndAlso
Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
If node.ReceiverOpt IsNot Nothing Then
VisitRvalue(node.ReceiverOpt)
Else
' If receiver is nothing it means that the property being
' accessed is shared; we still want to visit the original receiver
' to handle shared properties accessed on instance receiver.
Dim originalReceiver As BoundExpression = If(propertyGroup IsNot Nothing, propertyGroup.ReceiverOpt, Nothing)
If originalReceiver IsNot Nothing AndAlso Not originalReceiver.WasCompilerGenerated Then
Debug.Assert(node.PropertySymbol.IsShared)
' Do not visit originalReceiver if it is Type/Namespace/TypeOrValueExpression and the property
' is shared, we want region flow analysis to return Succeeded = False in this case
Dim kind As BoundKind = originalReceiver.Kind
If (kind <> BoundKind.TypeExpression) AndAlso
(kind <> BoundKind.NamespaceExpression) AndAlso
(kind <> BoundKind.TypeOrValueExpression) Then
VisitUnreachableReceiver(originalReceiver)
End If
End If
End If
' if property group is present, check if we need to leave region
If propertyGroup IsNot Nothing AndAlso Me._lastInRegion Is propertyGroup AndAlso IsInside Then
Me.LeaveRegion()
End If
For Each argument In node.Arguments
VisitRvalue(argument)
Next
Return Nothing
End Function
''' <summary>
''' If a receiver is included in cases where the receiver will not be
''' evaluated (an instance for a shared method for instance), we
''' still want to visit the receiver but treat it as unreachable code.
''' </summary>
Private Sub VisitUnreachableReceiver(receiver As BoundExpression)
Debug.Assert(Not Me.IsConditionalState)
If receiver IsNot Nothing Then
Dim saved As LocalState = Me.State.Clone()
Me.SetUnreachable()
Me.VisitRvalue(receiver)
Me.SetState(saved)
End If
End Sub
Public Overrides Function VisitAsNewLocalDeclarations(node As BoundAsNewLocalDeclarations) As BoundNode
VisitRvalue(node.Initializer)
For Each v In node.LocalDeclarations
Visit(v)
Next
Return Nothing
End Function
Public Overrides Function VisitDimStatement(node As BoundDimStatement) As BoundNode
For Each v In node.LocalDeclarations
VisitStatement(v)
Next
Return Nothing
End Function
Public Overrides Function VisitWhileStatement(node As BoundWhileStatement) As BoundNode
' while node.Condition node.Body node.ContinueLabel: node.BreakLabel:
LoopHead(node)
VisitCondition(node.Condition)
Dim bodyState As LocalState = Me.StateWhenTrue
Dim breakState As LocalState = Me.StateWhenFalse
Me.SetState(bodyState)
VisitStatement(node.Body)
ResolveContinues(node.ContinueLabel)
LoopTail(node)
ResolveBreaks(breakState, node.ExitLabel)
Return Nothing
End Function
Public Overrides Function VisitSelectStatement(node As BoundSelectStatement) As BoundNode
VisitStatement(node.ExpressionStatement)
Dim caseBlocks = node.CaseBlocks
If caseBlocks.Any() Then
VisitCaseBlocks(caseBlocks)
ResolveBreaks(Me.State, node.ExitLabel)
End If
Return Nothing
End Function
Private Sub VisitCaseBlocks(caseBlocks As ImmutableArray(Of BoundCaseBlock))
Debug.Assert(caseBlocks.Any())
Dim caseBlockStateBuilder = ArrayBuilder(Of LocalState).GetInstance(caseBlocks.Length)
Dim hasCaseElse = False
Dim curIndex As Integer = 0
Dim lastIndex As Integer = caseBlocks.Length - 1
For Each caseBlock In caseBlocks
' Visit case statement
VisitStatement(caseBlock.CaseStatement)
' Case statement might have a non-null conditionOpt for the condition expression.
' However, conditionOpt cannot be a compile time constant expression.
' VisitCaseStatement must have unsplit the states into a non-conditional state for this scenario.
Debug.Assert(Not Me.IsConditionalState)
' save the current state for next case block.
Dim savedState As LocalState = Me.State.Clone()
' Visit case block body
VisitStatement(caseBlock.Body)
hasCaseElse = hasCaseElse OrElse caseBlock.Syntax.Kind = SyntaxKind.CaseElseBlock
' If the select statement had a case else block, then the state at the end
' of select statement is the merge of states at the end of all case blocks.
' Otherwise, the end state is merge of states at the end of all case blocks
' and saved state prior to visiting the last case block body (i.e. no matching case state)
If curIndex <> lastIndex OrElse Not hasCaseElse Then
caseBlockStateBuilder.Add(Me.State.Clone())
Me.SetState(savedState)
End If
curIndex = curIndex + 1
Next
For Each localState In caseBlockStateBuilder
Me.IntersectWith(Me.State, localState)
Next
caseBlockStateBuilder.Free()
End Sub
Public Overrides Function VisitCaseBlock(node As BoundCaseBlock) As BoundNode
Throw ExceptionUtilities.Unreachable
End Function
Public Overrides Function VisitCaseStatement(node As BoundCaseStatement) As BoundNode
If node.ConditionOpt IsNot Nothing Then
' Case clause expressions cannot be constant expression.
Debug.Assert(node.ConditionOpt.ConstantValueOpt Is Nothing)
VisitRvalue(node.ConditionOpt)
Else
For Each clause In node.CaseClauses
Select Case clause.Kind
Case BoundKind.RelationalCaseClause
VisitRelationalCaseClause(DirectCast(clause, BoundRelationalCaseClause))
Case BoundKind.SimpleCaseClause
VisitSimpleCaseClause(DirectCast(clause, BoundSimpleCaseClause))
Case BoundKind.RangeCaseClause
VisitRangeCaseClause(DirectCast(clause, BoundRangeCaseClause))
Case Else
Throw ExceptionUtilities.UnexpectedValue(clause.Kind)
End Select
Next
End If
Return Nothing
End Function
Public Overrides Function VisitRelationalCaseClause(node As BoundRelationalCaseClause) As BoundNode
' Exactly one of the operand or condition must be non-null
Debug.Assert(node.OperandOpt IsNot Nothing Xor node.ConditionOpt IsNot Nothing)
If node.OperandOpt IsNot Nothing Then
VisitRvalue(node.OperandOpt)
Else
VisitRvalue(node.ConditionOpt)
End If
Return Nothing
End Function
Public Overrides Function VisitSimpleCaseClause(node As BoundSimpleCaseClause) As BoundNode
' Exactly one of the value or condition must be non-null
Debug.Assert(node.ValueOpt IsNot Nothing Xor node.ConditionOpt IsNot Nothing)
If node.ValueOpt IsNot Nothing Then
VisitRvalue(node.ValueOpt)
Else
VisitRvalue(node.ConditionOpt)
End If
Return Nothing
End Function
Public Overrides Function VisitRangeCaseClause(node As BoundRangeCaseClause) As BoundNode
' Exactly one of the LowerBoundOpt or LowerBoundConditionOpt must be non-null
Debug.Assert(node.LowerBoundOpt IsNot Nothing Xor node.LowerBoundConditionOpt IsNot Nothing)
If node.LowerBoundOpt IsNot Nothing Then
VisitRvalue(node.LowerBoundOpt)
Else
VisitRvalue(node.LowerBoundConditionOpt)
End If
' Exactly one of the UpperBoundOpt or UpperBoundConditionOpt must be non-null
Debug.Assert(node.UpperBoundOpt IsNot Nothing Xor node.UpperBoundConditionOpt IsNot Nothing)
If node.UpperBoundOpt IsNot Nothing Then
VisitRvalue(node.UpperBoundOpt)
Else
VisitRvalue(node.UpperBoundConditionOpt)
End If
Return Nothing
End Function
Protected Overridable Sub VisitForControlInitialization(node As BoundForToStatement)
VisitLvalue(node.ControlVariable)
End Sub
Protected Overridable Sub VisitForControlInitialization(node As BoundForEachStatement)
VisitLvalue(node.ControlVariable)
End Sub
Protected Overridable Sub VisitForInitValues(node As BoundForToStatement)
VisitRvalue(node.InitialValue)
VisitRvalue(node.LimitValue)
VisitRvalue(node.StepValue)
End Sub
Protected Overridable Sub VisitForStatementVariableDeclaration(node As BoundForStatement)
End Sub
Public Overrides Function VisitForEachStatement(node As BoundForEachStatement) As BoundNode
' This is a bit subtle.
' initialization of For each control variable happens after the collection is evaluated.
' For example the following statement should give a warning:
' For each i As Object in Me.GetSomeCollection(i) ' <- use of uninitialized i
VisitForStatementVariableDeclaration(node)
VisitRvalue(node.Collection)
LoopHead(node)
Me.Split()
Dim bodyState As LocalState = Me.StateWhenTrue
Dim breakState As LocalState = Me.StateWhenFalse
Me.SetState(bodyState)
' The control Variable is only considered initialized if the body was entered.
VisitForControlInitialization(node)
VisitStatement(node.Body)
ResolveContinues(node.ContinueLabel)
LoopTail(node)
ResolveBreaks(breakState, node.ExitLabel)
Return Nothing
End Function
Public Overrides Function VisitUsingStatement(node As BoundUsingStatement) As BoundNode
Debug.Assert(Not node.ResourceList.IsDefault OrElse node.ResourceExpressionOpt IsNot Nothing)
' A using statement can come in two flavors: using <expression> and using <variable declarations>
' visit possible resource expression
If node.ResourceExpressionOpt IsNot Nothing Then
VisitRvalue(node.ResourceExpressionOpt)
Else
' visit all declarations
For Each variableDeclaration In node.ResourceList
Visit(variableDeclaration)
Next
End If
VisitStatement(node.Body)
Return Nothing
End Function
Public Overrides Function VisitForToStatement(node As BoundForToStatement) As BoundNode
' This is a bit subtle.
' initialization of For control variable happens after initial value, limit and step are evaluated.
' For example the following statement should give a warning:
' For i As Object = 0 To i ' <- use of uninitialized i
VisitForStatementVariableDeclaration(node)
VisitForInitValues(node)
VisitForControlInitialization(node)
LoopHead(node)
Me.Split()
Dim bodyState As LocalState = Me.StateWhenTrue
Dim breakState As LocalState = Me.StateWhenFalse
Me.SetState(bodyState)
VisitStatement(node.Body)
ResolveContinues(node.ContinueLabel)
LoopTail(node)
ResolveBreaks(breakState, node.ExitLabel)
Return Nothing
End Function
Public Overrides Function VisitTryStatement(node As BoundTryStatement) As BoundNode
Dim oldPending = SavePending()
Dim level = IntroduceBlock()
Dim i As Integer = 0
Dim initialState = Me.State.Clone()
InitializeBlockStatement(level, i)
VisitTryBlock(node.TryBlock, node, initialState)
Dim finallyState = initialState.Clone()
Dim endState = Me.State
For Each catchBlock In node.CatchBlocks
Me.SetState(initialState.Clone())
InitializeBlockStatement(level, i)
VisitCatchBlock(catchBlock, finallyState)
IntersectWith(endState, Me.State)
Next
If node.FinallyBlockOpt IsNot Nothing Then
Dim tryAndCatchPending As SavedPending = SavePending()
Me.SetState(finallyState)
Dim unsetInFinally = AllBitsSet()
InitializeBlockStatement(level, i)
VisitFinallyBlock(node.FinallyBlockOpt, unsetInFinally)
For Each pend In tryAndCatchPending.PendingBranches
' Do not union if branch is a Yield statement
Dim unionBranchWithFinallyState As Boolean = pend.Branch.Kind <> BoundKind.YieldStatement
' or if the branch goes from Catch to Try block
If unionBranchWithFinallyState Then
If BothBranchAndLabelArePrefixedByNesting(pend, ignoreLast:=True) Then
unionBranchWithFinallyState = False
End If
End If
If unionBranchWithFinallyState Then
Me.UnionWith(pend.State, Me.State)
If Me.TrackUnassignments Then
Me.IntersectWith(pend.State, unsetInFinally)
End If
End If
Next
RestorePending(tryAndCatchPending)
Me.UnionWith(endState, Me.State)
If Me.TrackUnassignments Then
Me.IntersectWith(endState, unsetInFinally)
End If
End If
Me.SetState(endState)
FinalizeBlock(level)
If node.ExitLabelOpt IsNot Nothing Then
ResolveBreaks(endState, node.ExitLabelOpt)
End If
RestorePending(oldPending)
Return Nothing
End Function
Protected Overridable Sub VisitTryBlock(tryBlock As BoundStatement, node As BoundTryStatement, ByRef tryState As LocalState)
VisitStatement(tryBlock)
End Sub
Protected Overridable Overloads Sub VisitCatchBlock(catchBlock As BoundCatchBlock, ByRef finallyState As LocalState)
If catchBlock.ExceptionSourceOpt IsNot Nothing Then
VisitLvalue(catchBlock.ExceptionSourceOpt)
End If
If catchBlock.ErrorLineNumberOpt IsNot Nothing Then
VisitRvalue(catchBlock.ErrorLineNumberOpt)
End If
If catchBlock.ExceptionFilterOpt IsNot Nothing Then
VisitRvalue(catchBlock.ExceptionFilterOpt)
End If
VisitBlock(catchBlock.Body)
End Sub
Protected Overridable Sub VisitFinallyBlock(finallyBlock As BoundStatement, ByRef unsetInFinally As LocalState)
VisitStatement(finallyBlock)
End Sub
Public Overrides Function VisitArrayAccess(node As BoundArrayAccess) As BoundNode
VisitRvalue(node.Expression)
For Each i In node.Indices
VisitRvalue(i)
Next
Return Nothing
End Function
Public NotOverridable Overrides Function VisitBinaryOperator(node As BoundBinaryOperator) As BoundNode
' Do not blow the stack due to a deep recursion on the left.
Dim stack = ArrayBuilder(Of BoundBinaryOperator).GetInstance()
Dim binary As BoundBinaryOperator = node
Dim child As BoundExpression = node.Left
Do
If child.Kind <> BoundKind.BinaryOperator Then
Exit Do
End If
stack.Push(binary)
binary = DirectCast(child, BoundBinaryOperator)
child = binary.Left
Loop
' As we emulate visiting, enter the region if needed.
' We shouldn't do this for the top most node,
' VisitBinaryOperator caller such as VisitRvalue(...) does this.
If Me._regionPlace = RegionPlace.Before Then
If stack.Count > 0 Then
' Skipping the first node
Debug.Assert(stack(0) Is node)
For i As Integer = 1 To stack.Count - 1
If stack(i) Is Me._firstInRegion Then
Me.EnterRegion()
GoTo EnteredRegion
End If
Next
' Note, the last binary operator is not pushed to the stack, it is stored in [binary].
Debug.Assert(binary IsNot node)
If binary Is Me._firstInRegion Then
Me.EnterRegion()
End If
EnteredRegion:
Else
Debug.Assert(binary Is node)
End If
End If
Select Case binary.OperatorKind And BinaryOperatorKind.OpMask
Case BinaryOperatorKind.AndAlso,
BinaryOperatorKind.OrElse
VisitCondition(child)
Case Else
VisitRvalue(child)
End Select
Do
Select Case binary.OperatorKind And BinaryOperatorKind.OpMask
Case BinaryOperatorKind.AndAlso
Dim leftTrue As LocalState = Me.StateWhenTrue
Dim leftFalse As LocalState = Me.StateWhenFalse
Me.SetState(leftTrue)
VisitCondition(binary.Right)
Dim resultTrue As LocalState = Me.StateWhenTrue
Dim resultFalse As LocalState = leftFalse
IntersectWith(resultFalse, Me.StateWhenFalse)
Me.SetConditionalState(resultTrue, resultFalse)
Exit Select
Case BinaryOperatorKind.OrElse
Dim leftTrue As LocalState = Me.StateWhenTrue
Dim leftFalse As LocalState = Me.StateWhenFalse
Me.SetState(leftFalse)
VisitCondition(binary.Right)
Dim resultTrue As LocalState = Me.StateWhenTrue
IntersectWith(resultTrue, leftTrue)
Dim resultFalse As LocalState = Me.StateWhenFalse
Me.SetConditionalState(resultTrue, resultFalse)
Exit Select
Case Else
VisitRvalue(binary.Right)
End Select
If stack.Count > 0 Then
child = binary
binary = stack.Pop()
' Do things that VisitCondition/VisitRvalue would have done for us if we were to call them
' for the child
Select Case binary.OperatorKind And BinaryOperatorKind.OpMask
Case BinaryOperatorKind.AndAlso,
BinaryOperatorKind.OrElse
' Do things that VisitCondition would have done for us if we were to call it
' for the child
AdjustConditionalState(child) ' VisitCondition does this
Case Else
Me.Unsplit() ' VisitRvalue does this
End Select
' VisitCondition/VisitRvalue do this
If child Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
Else
Exit Do
End If
Loop
Debug.Assert(binary Is node)
stack.Free()
Return Nothing
End Function
Public Overrides Function VisitUserDefinedBinaryOperator(node As BoundUserDefinedBinaryOperator) As BoundNode
VisitRvalue(node.UnderlyingExpression)
Return Nothing
End Function
Public Overrides Function VisitUserDefinedShortCircuitingOperator(node As BoundUserDefinedShortCircuitingOperator) As BoundNode
If node.LeftOperand IsNot Nothing Then
VisitRvalue(node.LeftOperand)
End If
VisitRvalue(node.BitwiseOperator)
Return Nothing
End Function
Public Overrides Function VisitAddHandlerStatement(node As BoundAddHandlerStatement) As BoundNode
Return VisitAddRemoveHandlerStatement(node)
End Function
Public Overrides Function VisitRemoveHandlerStatement(node As BoundRemoveHandlerStatement) As BoundNode
Return VisitAddRemoveHandlerStatement(node)
End Function
Public Overrides Function VisitAddressOfOperator(node As BoundAddressOfOperator) As BoundNode
Visit(node.MethodGroup)
Return Nothing
End Function
Public Overrides Function VisitLateAddressOfOperator(node As BoundLateAddressOfOperator) As BoundNode
Visit(node.MemberAccess)
Return Nothing
End Function
Private Function VisitAddRemoveHandlerStatement(node As BoundAddRemoveHandlerStatement) As BoundNode
' from the data/control flow prospective AddRemoveHandler
' statement is just a trivial binary operator.
VisitRvalue(node.EventAccess)
VisitRvalue(node.Handler)
Return Nothing
End Function
Public Overrides Function VisitEventAccess(node As BoundEventAccess) As BoundNode
Dim receiver = node.ReceiverOpt
If receiver IsNot Nothing Then
VisitRvalue(node.ReceiverOpt)
End If
Return Nothing
End Function
Public Overrides Function VisitRaiseEventStatement(node As BoundRaiseEventStatement) As BoundNode
Me.VisitExpressionAsStatement(node.EventInvocation)
Return Nothing
End Function
Public Overrides Function VisitParenthesized(node As BoundParenthesized) As BoundNode
VisitRvalue(node.Expression)
Return Nothing
End Function
Public Overrides Function VisitUnaryOperator(node As BoundUnaryOperator) As BoundNode
If node.OperatorKind = UnaryOperatorKind.Not Then
VisitCondition(node.Operand)
Me.SetConditionalState(Me.StateWhenFalse, Me.StateWhenTrue)
Else
VisitRvalue(node.Operand)
End If
Return Nothing
End Function
Public Overrides Function VisitUserDefinedUnaryOperator(node As BoundUserDefinedUnaryOperator) As BoundNode
VisitRvalue(node.UnderlyingExpression)
Return Nothing
End Function
Public Overrides Function VisitNullableIsTrueOperator(node As BoundNullableIsTrueOperator) As BoundNode
VisitRvalue(node.Operand)
Return Nothing
End Function
Public Overrides Function VisitArrayCreation(node As BoundArrayCreation) As BoundNode
For Each e1 In node.Bounds
VisitRvalue(e1)
Next
If node.InitializerOpt IsNot Nothing AndAlso Not node.InitializerOpt.Initializers.IsDefault Then
For Each element In node.InitializerOpt.Initializers
VisitRvalue(element)
Next
End If
Return Nothing
End Function
Public Overrides Function VisitArrayInitialization(node As BoundArrayInitialization) As BoundNode
For Each initializer In node.Initializers
VisitRvalue(initializer)
Next
Return Nothing
End Function
Public Overrides Function VisitArrayLiteral(node As BoundArrayLiteral) As BoundNode
For Each arrayBound In node.Bounds
VisitRvalue(arrayBound)
Next
VisitRvalue(node.Initializer)
Return Nothing
End Function
Public Overrides Function VisitDirectCast(node As BoundDirectCast) As BoundNode
VisitRvalue(node.Operand)
Return Nothing
End Function
Public Overrides Function VisitTryCast(node As BoundTryCast) As BoundNode
VisitRvalue(node.Operand)
Return Nothing
End Function
Public Overrides Function VisitTypeOf(node As BoundTypeOf) As BoundNode
VisitRvalue(node.Operand)
Return Nothing
End Function
Public Overrides Function VisitMethodGroup(node As BoundMethodGroup) As BoundNode
VisitRvalue(node.ReceiverOpt)
Return Nothing
End Function
Public Overrides Function VisitPropertyGroup(node As BoundPropertyGroup) As BoundNode
VisitRvalue(node.ReceiverOpt)
Return Nothing
End Function
Public Overrides Function VisitGetType(node As BoundGetType) As BoundNode
VisitTypeExpression(node.SourceType)
Return Nothing
End Function
Public Overrides Function VisitSequencePoint(node As BoundSequencePoint) As BoundNode
VisitStatement(node.StatementOpt)
Return Nothing
End Function
Public Overrides Function VisitSequencePointWithSpan(node As BoundSequencePointWithSpan) As BoundNode
VisitStatement(node.StatementOpt)
Return Nothing
End Function
Public Overrides Function VisitStatementList(node As BoundStatementList) As BoundNode
For Each statement In node.Statements
Visit(statement)
Next
Return Nothing
End Function
Public Overrides Function VisitSyncLockStatement(node As BoundSyncLockStatement) As BoundNode
' visit SyncLock expression
VisitRvalue(node.LockExpression)
' visit body
VisitStatement(node.Body)
Return Nothing
End Function
Public Overrides Function VisitUnboundLambda(node As UnboundLambda) As BoundNode
Dim boundLambda As BoundLambda = node.BindForErrorRecovery()
Debug.Assert(boundLambda IsNot Nothing)
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'boundLambda' is not nothing
If boundLambda Is Me._firstInRegion AndAlso Me._regionPlace = RegionPlace.Before Then
Me.EnterRegion()
End If
VisitLambda(node.BindForErrorRecovery())
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'boundLambda' is not nothing
If boundLambda Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
Return Nothing
End Function
Public Overrides Function VisitExitStatement(node As BoundExitStatement) As BoundNode
Me._pendingBranches.Add(New PendingBranch(node, Me.State, Me._nesting))
SetUnreachable()
Return Nothing
End Function
Public Overrides Function VisitContinueStatement(node As BoundContinueStatement) As BoundNode
Me._pendingBranches.Add(New PendingBranch(node, Me.State, Me._nesting))
SetUnreachable()
Return Nothing
End Function
Public Overrides Function VisitMyBaseReference(node As BoundMyBaseReference) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitDoLoopStatement(node As BoundDoLoopStatement) As BoundNode
If node.ConditionOpt IsNot Nothing Then
If node.ConditionIsTop Then
VisitDoLoopTopConditionStatement(node)
Else
VisitDoLoopBottomConditionStatement(node)
End If
Else
VisitUnconditionalDoLoopStatement(node)
End If
Return Nothing
End Function
Public Sub VisitDoLoopTopConditionStatement(node As BoundDoLoopStatement)
Debug.Assert(node.ConditionIsTop AndAlso node.ConditionOpt IsNot Nothing)
' do while | until node.Condition statements node.ContinueLabel: loop node.BreakLabel:
LoopHead(node)
VisitCondition(node.ConditionOpt)
Dim exitState As LocalState
If node.ConditionIsUntil Then
exitState = Me.StateWhenTrue
Me.SetState(Me.StateWhenFalse)
Else
exitState = Me.StateWhenFalse
Me.SetState(Me.StateWhenTrue)
End If
VisitStatement(node.Body)
ResolveContinues(node.ContinueLabel)
LoopTail(node)
ResolveBreaks(exitState, node.ExitLabel)
End Sub
Public Sub VisitDoLoopBottomConditionStatement(node As BoundDoLoopStatement)
Debug.Assert(Not node.ConditionIsTop AndAlso node.ConditionOpt IsNot Nothing)
' do statements node.ContinueLabel: loop while|until node.Condition node.ExitLabel:
LoopHead(node)
VisitStatement(node.Body)
ResolveContinues(node.ContinueLabel)
VisitCondition(node.ConditionOpt)
Dim exitState As LocalState
If node.ConditionIsUntil Then
exitState = Me.StateWhenTrue
Me.SetState(Me.StateWhenFalse)
Else
exitState = Me.StateWhenFalse
Me.SetState(Me.StateWhenTrue)
End If
LoopTail(node)
ResolveBreaks(exitState, node.ExitLabel)
End Sub
Private Overloads Sub VisitUnconditionalDoLoopStatement(node As BoundDoLoopStatement)
Debug.Assert(node.ConditionOpt Is Nothing)
' do statements; node.ContinueLabel: loop node.BreakLabel:
LoopHead(node)
VisitStatement(node.Body)
ResolveContinues(node.ContinueLabel)
Dim exitState = UnreachableState()
LoopTail(node)
ResolveBreaks(exitState, node.ExitLabel)
End Sub
Public Overrides Function VisitGotoStatement(node As BoundGotoStatement) As BoundNode
Me._pendingBranches.Add(New PendingBranch(node, Me.State, Me._nesting))
SetUnreachable()
Return Nothing
End Function
Public Overrides Function VisitLabelStatement(node As BoundLabelStatement) As BoundNode
If ResolveBranches(node) Then
Me.backwardBranchChanged = True
End If
Dim label As LabelSymbol = node.Label
Dim _state As LocalState = LabelState(label)
Me.IntersectWith(Me.State, _state)
Me._labels(label) = New LabelStateAndNesting(node, Me.State.Clone(), Me._nesting)
Me._labelsSeen.Add(label)
Return Nothing
End Function
Public Overrides Function VisitThrowStatement(node As BoundThrowStatement) As BoundNode
Dim expr As BoundExpression = node.ExpressionOpt
If expr IsNot Nothing Then
VisitRvalue(expr)
End If
SetUnreachable()
Return Nothing
End Function
Public Overrides Function VisitNoOpStatement(node As BoundNoOpStatement) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitNamespaceExpression(node As BoundNamespaceExpression) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitFieldInitializer(node As BoundFieldInitializer) As BoundNode
VisitRvalue(node.InitialValue)
Return Nothing
End Function
Public Overrides Function VisitPropertyInitializer(node As BoundPropertyInitializer) As BoundNode
VisitRvalue(node.InitialValue)
Return Nothing
End Function
Public Overrides Function VisitArrayLength(node As BoundArrayLength) As BoundNode
VisitRvalue(node.Expression)
Return Nothing
End Function
Public Overrides Function VisitConditionalGoto(node As BoundConditionalGoto) As BoundNode
VisitRvalue(node.Condition)
Me._pendingBranches.Add(New PendingBranch(node, Me.State, Me._nesting))
Return Nothing
End Function
Public Overrides Function VisitXmlDocument(node As BoundXmlDocument) As BoundNode
VisitRvalue(node.Declaration)
For Each child In node.ChildNodes
VisitRvalue(child)
Next
Return Nothing
End Function
Public Overrides Function VisitXmlElement(node As BoundXmlElement) As BoundNode
VisitRvalue(node.Argument)
For Each child In node.ChildNodes
VisitRvalue(child)
Next
Return Nothing
End Function
Public Overrides Function VisitXmlAttribute(node As BoundXmlAttribute) As BoundNode
VisitRvalue(node.Name)
VisitRvalue(node.Value)
Return Nothing
End Function
Public Overrides Function VisitXmlName(node As BoundXmlName) As BoundNode
Return Nothing
End Function
Public Overrides Function VisitXmlNamespace(node As BoundXmlNamespace) As BoundNode
' VisitRvalue(node.XmlNamespace) is supposed to be included in node.ObjectCreation
VisitRvalue(node.ObjectCreation)
Return Nothing
End Function
Public Overrides Function VisitXmlEmbeddedExpression(node As BoundXmlEmbeddedExpression) As BoundNode
VisitRvalue(node.Expression)
Return Nothing
End Function
Public Overrides Function VisitXmlMemberAccess(node As BoundXmlMemberAccess) As BoundNode
VisitRvalue(node.MemberAccess)
Return Nothing
End Function
Public Overrides Function VisitUnstructuredExceptionHandlingStatement(node As BoundUnstructuredExceptionHandlingStatement) As BoundNode
Visit(node.Body)
Return Nothing
End Function
Public Overrides Function VisitAwaitOperator(node As BoundAwaitOperator) As BoundNode
VisitRvalue(node.Operand)
Return Nothing
End Function
Public Overrides Function VisitNameOfOperator(node As BoundNameOfOperator) As BoundNode
Dim savedState As LocalState = Me.State.Clone()
SetUnreachable()
VisitRvalue(node.Argument)
Me.SetState(savedState)
Return Nothing
End Function
Public Overrides Function VisitTypeAsValueExpression(node As BoundTypeAsValueExpression) As BoundNode
Visit(node.Expression)
Return Nothing
End Function
Public Overrides Function VisitInterpolatedStringExpression(node As BoundInterpolatedStringExpression) As BoundNode
For Each item In node.Contents
Debug.Assert(item.Kind = BoundKind.Literal OrElse item.Kind = BoundKind.Interpolation)
Visit(item)
Next
Return Nothing
End Function
Public Overrides Function VisitInterpolation(node As BoundInterpolation) As BoundNode
VisitRvalue(node.Expression)
VisitRvalue(node.AlignmentOpt)
VisitRvalue(node.FormatStringOpt)
Return Nothing
End Function
Public Overrides Function VisitParameterEqualsValue(node As BoundParameterEqualsValue) As BoundNode
VisitRvalue(node.Value)
Return Nothing
End Function
#End Region
End Class
End Namespace
|
jaredpar/roslyn
|
src/Compilers/VisualBasic/Portable/Analysis/FlowAnalysis/AbstractFlowPass.vb
|
Visual Basic
|
apache-2.0
| 110,111
|
Imports System.Windows.Controls
Partial Public Class DynamicLayerXAML
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
End Class
|
MrChen2015/arcgis-samples-silverlight
|
src/VBNet/ArcGISSilverlightSDK/DynamicLayers/DynamicLayerXAML.xaml.vb
|
Visual Basic
|
apache-2.0
| 163
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.ArrayStatements
Public Class PreserveKeywordRecommenderTests
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub PreserveNotInMethodBodyTest()
VerifyRecommendationsMissing(<MethodBody>|</MethodBody>, "Preserve")
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub PreserveAfterReDimStatementTest()
VerifyRecommendationsContain(<MethodBody>ReDim | </MethodBody>, "Preserve")
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub PreserveNotAfterReDimPreserveTest()
VerifyRecommendationsMissing(<ClassDeclaration>ReDim Preserve |</ClassDeclaration>, "Preserve")
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub PreserveNotAfterWeirdBrokenReDimTest()
VerifyRecommendationsMissing(<MethodBody>ReDim x, ReDim |</MethodBody>, "Preserve")
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub PreserveInSingleLineLambdaTest()
VerifyRecommendationsContain(<MethodBody>Dim x = Sub() ReDim |</MethodBody>, "Preserve")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub NotAfterEolTest()
VerifyRecommendationsMissing(
<MethodBody>ReDim
| </MethodBody>, "Preserve")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AfterExplicitLineContinuationTest()
VerifyRecommendationsContain(
<MethodBody>ReDim _
| </MethodBody>, "Preserve")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AfterExplicitLineContinuationTestCommentsAfterLineContinuation()
VerifyRecommendationsContain(
<MethodBody>ReDim _ ' Test
| </MethodBody>, "Preserve")
End Sub
End Class
End Namespace
|
physhi/roslyn
|
src/EditorFeatures/VisualBasicTest/Recommendations/ArrayStatements/PreserveKeywordRecommenderTests.vb
|
Visual Basic
|
apache-2.0
| 2,624
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Partial Public MustInherit Class AbstractCodeModelObjectTests(Of TCodeModelObject As Class)
Protected Class InterfaceData
Public Property Name As String
Public Property Position As Object = 0
Public Property Bases As Object
Public Property Access As EnvDTE.vsCMAccess = EnvDTE.vsCMAccess.vsCMAccessDefault
End Class
End Class
End Namespace
|
mmitche/roslyn
|
src/VisualStudio/Core/Test/CodeModel/AbstractCodeModelObjectTests.InterfaceData.vb
|
Visual Basic
|
apache-2.0
| 648
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
Public Class XmlDocumentPrologueHighlighterTests
Inherits AbstractVisualBasicKeywordHighlighterTests
Friend Overrides Function CreateHighlighter() As IHighlighter
Return New XmlDeclarationHighlighter()
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Sub TestXmlLiteralSample1_1()
Test(<Text><![CDATA[
Class C
Sub M()
Dim q = {|Cursor:[|<?|]|}xml version="1.0"[|?>|]
<contact>
<!-- who is this guy? -->
<name>Bill Chiles</name>
<phone type="home">555-555-5555</phone>
<birthyear><%= DateTime.Today.Year - 100 %></birthyear>
<![CDATA[Be wary of this guy!]]>]]<![CDATA[>
</contact>
End Sub
End Class]]></Text>)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Sub TestXmlLiteralSample1_2()
Test(<Text><![CDATA[
Class C
Sub M()
Dim q = [|<?|]xml version="1.0"{|Cursor:[|?>|]|}
<contact>
<!-- who is this guy? -->
<name>Bill Chiles</name>
<phone type="home">555-555-5555</phone>
<birthyear><%= DateTime.Today.Year - 100 %></birthyear>
<![CDATA[Be wary of this guy!]]>]]<![CDATA[>
</contact>
End Sub
End Class]]></Text>)
End Sub
End Class
End Namespace
|
v-codeel/roslyn
|
src/EditorFeatures/VisualBasicTest/KeywordHighlighting/XmlDocumentPrologueHighligherTests.vb
|
Visual Basic
|
apache-2.0
| 1,592
|
Imports System
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim documents As SolidEdgeFramework.Documents = Nothing
Dim partDocument As SolidEdgePart.PartDocument = Nothing
Dim refPlanes As SolidEdgePart.RefPlanes = Nothing
Dim profileSets As SolidEdgePart.ProfileSets = Nothing
Dim profileSet As SolidEdgePart.ProfileSet = Nothing
Dim profiles As SolidEdgePart.Profiles = Nothing
Dim profile As SolidEdgePart.Profile = Nothing
Dim ellipses2d As SolidEdgeFrameworkSupport.Ellipses2d = Nothing
Dim ellipse2d As SolidEdgeFrameworkSupport.Ellipse2d = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
documents = application.Documents
partDocument = CType(documents.Add("SolidEdge.PartDocument"), SolidEdgePart.PartDocument)
refPlanes = partDocument.RefPlanes
profileSets = partDocument.ProfileSets
profileSet = profileSets.Add()
profiles = profileSet.Profiles
profile = profiles.Add(refPlanes.Item(1))
ellipses2d = profile.Ellipses2d
Dim Orientation = SolidEdgeFrameworkSupport.Geom2dOrientationConstants.igGeom2dOrientClockwise
ellipse2d = ellipses2d.AddByCenter(0, 0, 0.01, 0, 0.5, Orientation)
ellipse2d.Scale(2)
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgeFrameworkSupport.Ellipse2d.Scale.vb
|
Visual Basic
|
mit
| 2,146
|
Sub Clin_Docum_Sheet_Setup()
Dim tbl As ListObject
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Application.ScreenUpdating = False
Sheets("Clinical Documentation").Select
Set sht = Worksheets("Clinical Documentation")
Set StartCell = Range("A2")
'Refresh UsedRange
Worksheets("Clinical Documentation").UsedRange
'Find Last Row and Column
LastRow = StartCell.SpecialCells(xlCellTypeLastCell).Row
LastColumn = StartCell.SpecialCells(xlCellTypeLastCell).Column
'Select Range
sht.Range(StartCell, sht.Cells(LastRow, LastColumn)).Select
'Turn selected Range Into Table
Set tbl = ActiveSheet.ListObjects.Add(xlSrcRange, Selection, , xlYes)
tbl.Name = "Clinical_Table"
tbl.TableStyle = "TableStyleLight9"
'changes font color of header row to white
Rows("1:1").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("A2").Select
End Sub
|
Jonnokc/Excel_VBA
|
Validation_Form/Clinical Documentation Sheet/Clinical_Docum_Sheet_Setup.vb
|
Visual Basic
|
mit
| 1,077
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "fCotizaciones_SalesT"
'-------------------------------------------------------------------------------------------'
Partial Class fCotizaciones_SalesT
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine(" SELECT Cotizaciones.Cod_Cli, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN Clientes.Nom_Cli ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Cotizaciones.Nom_Cli = '') THEN Clientes.Nom_Cli ELSE Cotizaciones.Nom_Cli END) END) AS Nom_Cli, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN Clientes.Rif ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Cotizaciones.Rif = '') THEN Clientes.Rif ELSE Cotizaciones.Rif END) END) AS Rif, ")
loComandoSeleccionar.AppendLine(" Clientes.Nit, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN SUBSTRING(Clientes.Dir_Fis,1, 200) ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (SUBSTRING(Cotizaciones.Dir_Fis,1, 200) = '') THEN SUBSTRING(Clientes.Dir_Fis,1, 200) ELSE SUBSTRING(Cotizaciones.Dir_Fis,1, 200) END) END) AS Dir_Fis, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN Clientes.Telefonos ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Cotizaciones.Telefonos = '') THEN Clientes.Telefonos ELSE Cotizaciones.Telefonos END) END) AS Telefonos, ")
loComandoSeleccionar.AppendLine(" Clientes.Fax, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Nom_Cli As Nom_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Rif As Rif_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Nit As Nit_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Dir_Fis As Dir_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Telefonos As Tel_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Documento, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Fec_Fin, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Bru, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Por_Des1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Por_Rec1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Des1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Rec1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Net, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_For, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Dis_Imp, ")
loComandoSeleccionar.AppendLine(" SUBSTRING(Formas_Pagos.Nom_For,1,20) AS Nom_For, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_Ven, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Comentario, ")
loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Cod_Art, ")
loComandoSeleccionar.AppendLine(" Articulos.Nom_Art, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Renglon, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Comentario AS Comentario_renglon, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Can_Art1, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Cod_Uni, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Precio1, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Por_Des, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Mon_Net As Neto, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Por_Imp1 As Por_Imp, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Cod_Imp, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Mon_Imp1 As Impuesto ")
loComandoSeleccionar.AppendLine(" FROM Cotizaciones ")
loComandoSeleccionar.AppendLine(" JOIN Renglones_Cotizaciones ON (Cotizaciones.Documento = Renglones_Cotizaciones.Documento) ")
loComandoSeleccionar.AppendLine(" JOIN Clientes ON (Cotizaciones.Cod_Cli = Clientes.Cod_Cli)")
loComandoSeleccionar.AppendLine(" JOIN Formas_Pagos ON (Cotizaciones.Cod_For = Formas_Pagos.Cod_For)")
loComandoSeleccionar.AppendLine(" JOIN Vendedores ON (Cotizaciones.Cod_Ven = Vendedores.Cod_Ven)")
loComandoSeleccionar.AppendLine(" JOIN Articulos ON (Articulos.Cod_Art = Renglones_Cotizaciones.Cod_Art)")
loComandoSeleccionar.AppendLine(" WHERE " & cusAplicacion.goFormatos.pcCondicionPrincipal)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodos(loComandoSeleccionar.ToString, "curReportes")
Dim lcXml As String = "<impuesto></impuesto>"
Dim lcPorcentajesImpueto As String
Dim loImpuestos As New System.Xml.XmlDocument()
lcPorcentajesImpueto = "("
'Recorre cada renglon de la tabla
For lnNumeroFila As Integer = 0 To laDatosReporte.Tables(0).Rows.Count - 1
lcXml = laDatosReporte.Tables(0).Rows(lnNumeroFila).Item("dis_imp")
If String.IsNullOrEmpty(lcXml.Trim()) Then
Continue For
End If
loImpuestos.LoadXml(lcXml)
'En cada renglón lee el contenido de la distribució de impuestos
For Each loImpuesto As System.Xml.XmlNode In loImpuestos.SelectNodes("impuestos/impuesto")
If lnNumeroFila = laDatosReporte.Tables(0).Rows.Count - 1 Then
If CDec(loImpuesto.SelectSingleNode("porcentaje").InnerText)<> 0 Then
lcPorcentajesImpueto = lcPorcentajesImpueto & ", " & CDec(loImpuesto.SelectSingleNode("porcentaje").InnerText) & "%"
End If
End If
Next loImpuesto
Next lnNumeroFila
lcPorcentajesImpueto = lcPorcentajesImpueto & ")"
lcPorcentajesImpueto = lcPorcentajesImpueto.Replace("(,", "(")
lcPorcentajesImpueto = lcPorcentajesImpueto.Replace(".", ",")
'--------------------------------------------------'
' Carga la imagen del logo en cusReportes '
'--------------------------------------------------'
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
'-------------------------------------------------------------------------------------------------------
' Verificando si el select (tabla nº0) trae registros
'-------------------------------------------------------------------------------------------------------
If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
"No se Encontraron Registros para los Parámetros Especificados. ", _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
"350px", _
"200px")
End If
loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fCotizaciones_SalesT", laDatosReporte)
CType(loObjetoReporte.ReportDefinition.ReportObjects("Text38"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = lcPorcentajesImpueto.ToString
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfCotizaciones_SalesT.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' MAT: 17/08/11: Codigo inicial
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
fCotizaciones_SalesT.aspx.vb
|
Visual Basic
|
mit
| 10,433
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FormProduct
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.Button2 = New System.Windows.Forms.Button()
Me.txKategori = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.cmbstatus = New System.Windows.Forms.ComboBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.txNama = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.txKode = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.SplitContainer3 = New System.Windows.Forms.SplitContainer()
Me.SplitContainer5 = New System.Windows.Forms.SplitContainer()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.SplitContainer4 = New System.Windows.Forms.SplitContainer()
Me.dtgridproduk = New System.Windows.Forms.DataGridView()
Me.dtgridsub = New System.Windows.Forms.DataGridView()
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
Me.ProductsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.SubProductsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
CType(Me.SplitContainer2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer2.Panel1.SuspendLayout()
Me.SplitContainer2.Panel2.SuspendLayout()
Me.SplitContainer2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
CType(Me.SplitContainer3, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer3.Panel1.SuspendLayout()
Me.SplitContainer3.Panel2.SuspendLayout()
Me.SplitContainer3.SuspendLayout()
CType(Me.SplitContainer5, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer5.Panel1.SuspendLayout()
Me.SplitContainer5.Panel2.SuspendLayout()
Me.SplitContainer5.SuspendLayout()
CType(Me.SplitContainer4, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer4.Panel1.SuspendLayout()
Me.SplitContainer4.Panel2.SuspendLayout()
Me.SplitContainer4.SuspendLayout()
CType(Me.dtgridproduk, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.dtgridsub, System.ComponentModel.ISupportInitialize).BeginInit()
Me.MenuStrip1.SuspendLayout()
Me.SuspendLayout()
'
'SplitContainer2
'
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1
Me.SplitContainer2.IsSplitterFixed = True
Me.SplitContainer2.Location = New System.Drawing.Point(0, 24)
Me.SplitContainer2.Name = "SplitContainer2"
Me.SplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer2.Panel1
'
Me.SplitContainer2.Panel1.Controls.Add(Me.GroupBox1)
'
'SplitContainer2.Panel2
'
Me.SplitContainer2.Panel2.Controls.Add(Me.SplitContainer3)
Me.SplitContainer2.Size = New System.Drawing.Size(1063, 504)
Me.SplitContainer2.SplitterDistance = 105
Me.SplitContainer2.TabIndex = 1
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Controls.Add(Me.Button2)
Me.GroupBox1.Controls.Add(Me.txKategori)
Me.GroupBox1.Controls.Add(Me.Label6)
Me.GroupBox1.Controls.Add(Me.cmbstatus)
Me.GroupBox1.Controls.Add(Me.Label5)
Me.GroupBox1.Controls.Add(Me.txNama)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.txKode)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Top
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(1063, 102)
Me.GroupBox1.TabIndex = 36
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Search"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 48.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(651, 20)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(286, 73)
Me.Label3.TabIndex = 1
Me.Label3.Text = "Products"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(247, 65)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(153, 23)
Me.Button2.TabIndex = 11
Me.Button2.Text = "Load All"
Me.Button2.UseVisualStyleBackColor = True
'
'txKategori
'
Me.txKategori.Location = New System.Drawing.Point(296, 22)
Me.txKategori.Name = "txKategori"
Me.txKategori.Size = New System.Drawing.Size(133, 20)
Me.txKategori.TabIndex = 2
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(244, 25)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(49, 13)
Me.Label6.TabIndex = 41
Me.Label6.Text = "Category"
'
'cmbstatus
'
Me.cmbstatus.FormattingEnabled = True
Me.cmbstatus.Items.AddRange(New Object() {"Active", "Inactive"})
Me.cmbstatus.Location = New System.Drawing.Point(81, 65)
Me.cmbstatus.Name = "cmbstatus"
Me.cmbstatus.Size = New System.Drawing.Size(133, 21)
Me.cmbstatus.TabIndex = 3
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(6, 68)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(37, 13)
Me.Label5.TabIndex = 39
Me.Label5.Text = "Status"
'
'txNama
'
Me.txNama.Location = New System.Drawing.Point(81, 43)
Me.txNama.Name = "txNama"
Me.txNama.Size = New System.Drawing.Size(133, 20)
Me.txNama.TabIndex = 1
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(6, 46)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(75, 13)
Me.Label2.TabIndex = 36
Me.Label2.Text = "Product Name"
'
'txKode
'
Me.txKode.Location = New System.Drawing.Point(81, 22)
Me.txKode.Name = "txKode"
Me.txKode.Size = New System.Drawing.Size(133, 20)
Me.txKode.TabIndex = 0
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(6, 25)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 13)
Me.Label1.TabIndex = 34
Me.Label1.Text = "Product Code"
'
'SplitContainer3
'
Me.SplitContainer3.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1
Me.SplitContainer3.IsSplitterFixed = True
Me.SplitContainer3.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer3.Name = "SplitContainer3"
Me.SplitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer3.Panel1
'
Me.SplitContainer3.Panel1.Controls.Add(Me.SplitContainer5)
'
'SplitContainer3.Panel2
'
Me.SplitContainer3.Panel2.Controls.Add(Me.SplitContainer4)
Me.SplitContainer3.Size = New System.Drawing.Size(1063, 395)
Me.SplitContainer3.SplitterDistance = 25
Me.SplitContainer3.TabIndex = 0
'
'SplitContainer5
'
Me.SplitContainer5.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer5.FixedPanel = System.Windows.Forms.FixedPanel.Panel1
Me.SplitContainer5.IsSplitterFixed = True
Me.SplitContainer5.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer5.Name = "SplitContainer5"
'
'SplitContainer5.Panel1
'
Me.SplitContainer5.Panel1.Controls.Add(Me.TextBox1)
'
'SplitContainer5.Panel2
'
Me.SplitContainer5.Panel2.Controls.Add(Me.TextBox2)
Me.SplitContainer5.Size = New System.Drawing.Size(1063, 25)
Me.SplitContainer5.SplitterDistance = 791
Me.SplitContainer5.TabIndex = 0
'
'TextBox1
'
Me.TextBox1.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.TextBox1.Enabled = False
Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox1.Location = New System.Drawing.Point(0, 0)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(791, 22)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "Product"
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox2
'
Me.TextBox2.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox2.Dock = System.Windows.Forms.DockStyle.Fill
Me.TextBox2.Enabled = False
Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox2.Location = New System.Drawing.Point(0, 0)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(268, 22)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = "Product Sub"
Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'SplitContainer4
'
Me.SplitContainer4.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel1
Me.SplitContainer4.IsSplitterFixed = True
Me.SplitContainer4.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer4.Name = "SplitContainer4"
'
'SplitContainer4.Panel1
'
Me.SplitContainer4.Panel1.Controls.Add(Me.dtgridproduk)
'
'SplitContainer4.Panel2
'
Me.SplitContainer4.Panel2.Controls.Add(Me.dtgridsub)
Me.SplitContainer4.Size = New System.Drawing.Size(1063, 366)
Me.SplitContainer4.SplitterDistance = 791
Me.SplitContainer4.TabIndex = 1
'
'dtgridproduk
'
Me.dtgridproduk.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader
Me.dtgridproduk.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dtgridproduk.Dock = System.Windows.Forms.DockStyle.Fill
Me.dtgridproduk.Location = New System.Drawing.Point(0, 0)
Me.dtgridproduk.Name = "dtgridproduk"
Me.dtgridproduk.Size = New System.Drawing.Size(791, 366)
Me.dtgridproduk.TabIndex = 37
'
'dtgridsub
'
Me.dtgridsub.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader
Me.dtgridsub.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dtgridsub.Dock = System.Windows.Forms.DockStyle.Fill
Me.dtgridsub.Location = New System.Drawing.Point(0, 0)
Me.dtgridsub.Name = "dtgridsub"
Me.dtgridsub.Size = New System.Drawing.Size(268, 366)
Me.dtgridsub.TabIndex = 38
'
'MenuStrip1
'
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ProductsToolStripMenuItem, Me.SubProductsToolStripMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(1063, 24)
Me.MenuStrip1.TabIndex = 2
Me.MenuStrip1.Text = "MenuStrip1"
'
'ProductsToolStripMenuItem
'
Me.ProductsToolStripMenuItem.Name = "ProductsToolStripMenuItem"
Me.ProductsToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Alt Or System.Windows.Forms.Keys.A), System.Windows.Forms.Keys)
Me.ProductsToolStripMenuItem.Size = New System.Drawing.Size(91, 20)
Me.ProductsToolStripMenuItem.Text = "&Add Products"
'
'SubProductsToolStripMenuItem
'
Me.SubProductsToolStripMenuItem.Name = "SubProductsToolStripMenuItem"
Me.SubProductsToolStripMenuItem.ShortcutKeys = CType((System.Windows.Forms.Keys.Alt Or System.Windows.Forms.Keys.D), System.Windows.Forms.Keys)
Me.SubProductsToolStripMenuItem.Size = New System.Drawing.Size(114, 20)
Me.SubProductsToolStripMenuItem.Text = "A&dd Sub Products"
'
'FormProduct
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1063, 528)
Me.Controls.Add(Me.SplitContainer2)
Me.Controls.Add(Me.MenuStrip1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.KeyPreview = True
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "FormProduct"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Products"
Me.SplitContainer2.Panel1.ResumeLayout(False)
Me.SplitContainer2.Panel2.ResumeLayout(False)
CType(Me.SplitContainer2, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.SplitContainer3.Panel1.ResumeLayout(False)
Me.SplitContainer3.Panel2.ResumeLayout(False)
CType(Me.SplitContainer3, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer3.ResumeLayout(False)
Me.SplitContainer5.Panel1.ResumeLayout(False)
Me.SplitContainer5.Panel1.PerformLayout()
Me.SplitContainer5.Panel2.ResumeLayout(False)
Me.SplitContainer5.Panel2.PerformLayout()
CType(Me.SplitContainer5, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer5.ResumeLayout(False)
Me.SplitContainer4.Panel1.ResumeLayout(False)
Me.SplitContainer4.Panel2.ResumeLayout(False)
CType(Me.SplitContainer4, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer4.ResumeLayout(False)
CType(Me.dtgridproduk, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dtgridsub, System.ComponentModel.ISupportInitialize).EndInit()
Me.MenuStrip1.ResumeLayout(False)
Me.MenuStrip1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents SplitContainer2 As System.Windows.Forms.SplitContainer
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents txKategori As System.Windows.Forms.TextBox
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents cmbstatus As System.Windows.Forms.ComboBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents txNama As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txKode As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents SplitContainer3 As System.Windows.Forms.SplitContainer
Friend WithEvents SplitContainer5 As System.Windows.Forms.SplitContainer
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents SplitContainer4 As System.Windows.Forms.SplitContainer
Friend WithEvents dtgridproduk As System.Windows.Forms.DataGridView
Friend WithEvents dtgridsub As System.Windows.Forms.DataGridView
Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip
Friend WithEvents ProductsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents SubProductsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
End Class
|
doters/electrohell
|
stockingElectrohell 02-04-16/stockingElectrohell/stockingElectrohell/forms/FormProduct.Designer.vb
|
Visual Basic
|
mit
| 18,035
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
'-------------------------------------------------------------------------------------------'
' Inicio de clase "rReporte_General_Pago_SID"
'-------------------------------------------------------------------------------------------'
Partial Class rReporte_General_Pago_SID
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0))
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0))
Dim lcParametro1Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro1Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(1), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2))
Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2))
Dim lcParametro3Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(3))
'Dim lcParametro3Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(3))
Dim lcParametro4Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(4))
Dim lcParametro4Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(4))
Dim lcParametro5Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(5))
Dim lcParametro5Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(5))
Dim lcParametro6Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(6))
Dim lcParametro6Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(6))
Dim lcParametro7Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(7))
Dim lcParametro7Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(7))
Dim lcParametro8Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(8))
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim loConsulta As New StringBuilder()
loConsulta.AppendLine("")
'loConsulta.AppendLine("CREATE TABLE #tmpDetalles( Cod_Tra CHAR(10) COLLATE DATABASE_DEFAULT, ")
'loConsulta.AppendLine(" Empleado VARCHAR(100) COLLATE DATABASE_DEFAULT,")
'loConsulta.AppendLine(" Cod_Con CHAR(10) COLLATE DATABASE_DEFAULT, ")
'loConsulta.AppendLine(" Nom_Con VARCHAR(100) COLLATE DATABASE_DEFAULT, ")
'loConsulta.AppendLine(" Asignacion DECIMAL(28, 10), ")
'loConsulta.AppendLine(" Deduccion DECIMAL(28, 10), ")
'loConsulta.AppendLine(" Otro DECIMAL(28, 10), ")
'loConsulta.AppendLine(" Bono_Alimentacion DECIMAL(28, 10), ")
'loConsulta.AppendLine(" Saldo DECIMAL(28, 10), ")
'loConsulta.AppendLine(" Desde DATETIME, ")
'loConsulta.AppendLine(" Hasta DATETIME)")
'loConsulta.AppendLine("")
'loConsulta.AppendLine("INSERT INTO #tmpDetalles(Cod_Tra, Empleado, Cod_Con, Nom_Con, Asignacion, Deduccion, ")
'loConsulta.AppendLine(" Otro, Bono_Alimentacion, Saldo, Desde, Hasta)")
loConsulta.AppendLine("SELECT Trabajadores.Cod_Tra AS Cod_Tra,")
loConsulta.AppendLine(" Trabajadores.Nom_Tra AS Empleado,")
loConsulta.AppendLine(" Conceptos_Nomina.Cod_Con AS Cod_Con,")
loConsulta.AppendLine(" Conceptos_Nomina.Nom_Con AS Nom_Con,")
loConsulta.AppendLine(" SUM(CASE WHEN Conceptos_Nomina.tipo='Asignacion'")
loConsulta.AppendLine(" AND Renglones_Recibos.cod_con <> 'A011'")
loConsulta.AppendLine(" AND Renglones_Recibos.cod_con <> 'A013'")
loConsulta.AppendLine(" THEN Renglones_Recibos.mon_net ")
loConsulta.AppendLine(" ELSE 0 END) AS Asignacion,")
loConsulta.AppendLine(" SUM(CASE Conceptos_Nomina.tipo")
loConsulta.AppendLine(" WHEN 'Deduccion' THEN Renglones_Recibos.mon_net")
loConsulta.AppendLine(" WHEN 'Retencion' THEN Renglones_Recibos.mon_net")
loConsulta.AppendLine(" ELSE 0 END) AS Deduccion,")
loConsulta.AppendLine(" SUM(CASE Conceptos_Nomina.tipo ")
loConsulta.AppendLine(" WHEN 'Otro' THEN Renglones_Recibos.mon_net ")
loConsulta.AppendLine(" ELSE 0 END) AS Otro,")
loConsulta.AppendLine(" SUM(CASE WHEN Renglones_Recibos.cod_con = 'A011'")
loConsulta.AppendLine(" OR Renglones_Recibos.cod_con = 'A013'")
loConsulta.AppendLine(" THEN Renglones_Recibos.mon_net ")
loConsulta.AppendLine(" ELSE 0 END) AS Bono_Alimentacion,")
loConsulta.AppendLine(" COALESCE(Prestamos.mon_Sal, 0) AS Saldo,")
loConsulta.AppendLine(" CAST(" & lcParametro1Desde & " AS DATETIME) AS Desde, ")
loConsulta.AppendLine(" CAST(" & lcParametro1Hasta & " AS DATETIME) AS Hasta ")
loConsulta.AppendLine("FROM Renglones_Recibos")
loConsulta.AppendLine(" JOIN Recibos ")
loConsulta.AppendLine(" ON Recibos.Documento = Renglones_Recibos.Documento")
loConsulta.AppendLine(" AND Recibos.Fecha BETWEEN " & lcParametro1Desde & " AND " & lcParametro1Hasta)
loConsulta.AppendLine(" AND Recibos.Cod_Con BETWEEN " & lcParametro4Desde & " AND " & lcParametro4Hasta)
loConsulta.AppendLine(" AND Recibos.Status IN (" & lcParametro8Desde & ")")
loConsulta.AppendLine(" JOIN Conceptos_Nomina ")
loConsulta.AppendLine(" ON Conceptos_Nomina.Cod_Con = Renglones_Recibos.cod_con ")
loConsulta.AppendLine(" AND Conceptos_Nomina.Cod_Con BETWEEN " & lcParametro0Desde & " AND " & lcParametro0Hasta)
loConsulta.AppendLine(" AND Conceptos_Nomina.Cod_Cla BETWEEN " & lcParametro7Desde & " AND " & lcParametro7Hasta)
loConsulta.AppendLine(" JOIN Trabajadores ")
loConsulta.AppendLine(" ON Trabajadores.Cod_Tra = Recibos.cod_tra ")
loConsulta.AppendLine(" LEFT JOIN Detalles_Prestamos ")
loConsulta.AppendLine(" ON Detalles_Prestamos.documento = Renglones_Recibos.doc_ori")
loConsulta.AppendLine(" AND Detalles_Prestamos.renglon = Renglones_Recibos.ren_ori")
loConsulta.AppendLine(" AND Renglones_Recibos.Tip_Ori = 'Prestamos'")
loConsulta.AppendLine(" LEFT JOIN Prestamos ")
loConsulta.AppendLine(" ON Detalles_Prestamos.documento = Prestamos.documento")
loConsulta.AppendLine(" AND Prestamos.status = 'Confirmado'")
loConsulta.AppendLine(" AND Prestamos.Mon_Sal > 0")
loConsulta.AppendLine("WHERE Trabajadores.Tip_tra = 'Trabajador'")
loConsulta.AppendLine(" AND Conceptos_Nomina.tipo <> 'Otro'")
loConsulta.AppendLine(" AND Trabajadores.Cod_Tra BETWEEN " & lcParametro2Desde & " AND " & lcParametro2Hasta)
loConsulta.AppendLine(" AND Trabajadores.Status IN (" & lcParametro3Desde & ")")
loConsulta.AppendLine(" AND Trabajadores.Cod_Dep BETWEEN " & lcParametro5Desde & " AND " & lcParametro5Hasta)
loConsulta.AppendLine(" AND Trabajadores.Cod_Suc BETWEEN " & lcParametro6Desde & " AND " & lcParametro6Hasta)
loConsulta.AppendLine("GROUP BY Trabajadores.Cod_Tra,")
loConsulta.AppendLine(" Trabajadores.Nom_Tra,")
loConsulta.AppendLine(" Conceptos_Nomina.Cod_Con,")
loConsulta.AppendLine(" Conceptos_Nomina.Nom_Con,")
loConsulta.AppendLine(" Conceptos_Nomina.tipo,")
loConsulta.AppendLine(" COALESCE(Prestamos.Documento, ''),")
loConsulta.AppendLine(" COALESCE(Prestamos.mon_Sal, 0)")
loConsulta.AppendLine("ORDER BY " & lcOrdenamiento & ",")
loConsulta.AppendLine(" (CASE Conceptos_Nomina.tipo")
loConsulta.AppendLine(" WHEN 'Asignacion' THEN 0")
loConsulta.AppendLine(" WHEN 'Otro' THEN 2")
loConsulta.AppendLine(" ELSE 1")
loConsulta.AppendLine(" END) ASC,")
loConsulta.AppendLine(" Conceptos_Nomina.Cod_Con")
loConsulta.AppendLine("")
loConsulta.AppendLine("")
Dim loServicios As New cusDatos.goDatos
'Me.mEscribirConsulta(loConsulta.ToString())
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loConsulta.ToString(), "curReportes")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rReporte_General_Pago_SID", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrReporte_General_Pago_SID.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo '
'-------------------------------------------------------------------------------------------'
' RJG: 14/06/13: Codigo inicial '
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
Reportes - Nomina/rReporte_General_Pago_SID.aspx.vb
|
Visual Basic
|
mit
| 12,070
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.VehicleLoan.My.MySettings
Get
Return Global.VehicleLoan.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
Shadorunce/MiniProjects
|
Vehicle Loan/VehicleLoanFiles/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 3,001
|
#Region "License"
' The MIT License (MIT)
'
' Copyright (c) 2017 Richard L King (TradeWright Software Systems)
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all
' copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.
#End Region
Public Interface IApiLoadTestController
ReadOnly Property EnableUseV100ProtocolCheckbox As Boolean
ReadOnly Property EnableUseQueueingCallbackHandlerCheckbox As Boolean
Sub Connect(server As String, clientId As Integer, port As Integer)
Sub Disconnect()
Function StartTicker(symbol As String, secType As String, expiry As String, exchange As String, currencyCode As String, primaryExchange As String, multiplier As Integer, marketDepth As Boolean) As Integer
Sub StopTickers()
End Interface
|
tradewright/tradewright-twsapi
|
SampleApplications/ApiLoadTester/APILoadTestUI/IApiLoadTestController.vb
|
Visual Basic
|
mit
| 1,710
|
Imports System.Data
Partial Class fCuentas_Cobrar2
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine(" SELECT Cuentas_Cobrar.Cod_Cli, ")
loComandoSeleccionar.AppendLine(" Clientes.Nom_Cli, ")
loComandoSeleccionar.AppendLine(" Clientes.Rif, ")
loComandoSeleccionar.AppendLine(" Clientes.Nit, ")
loComandoSeleccionar.AppendLine(" Clientes.Dir_Fis, ")
loComandoSeleccionar.AppendLine(" Clientes.Telefonos, ")
loComandoSeleccionar.AppendLine(" Clientes.Fax, ")
loComandoSeleccionar.AppendLine(" Clientes.Contacto, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Tip_Doc, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Cod_Tip, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Nom_Cli As Nom_Gen, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Rif As Rif_Gen, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Nit As Nit_Gen, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Dir_Fis As Dir_Gen, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Telefonos As Tel_Gen, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Documento, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Fec_Fin, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Bru, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Por_Imp1, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Net, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Cod_For, ")
loComandoSeleccionar.AppendLine(" SUBSTRING(Formas_Pagos.Nom_For,1,30) AS Nom_For, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Cod_Ven, ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Comentario, ")
loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven ")
loComandoSeleccionar.AppendLine(" FROM Cuentas_Cobrar, ")
loComandoSeleccionar.AppendLine(" Clientes, ")
loComandoSeleccionar.AppendLine(" Formas_Pagos, ")
loComandoSeleccionar.AppendLine(" Vendedores ")
loComandoSeleccionar.AppendLine(" WHERE Cuentas_Cobrar.Cod_Cli = Clientes.Cod_Cli AND ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Cod_For = Formas_Pagos.Cod_For AND ")
loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Cod_Ven = Vendedores.Cod_Ven AND " & cusAplicacion.goFormatos.pcCondicionPrincipal)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodos(loComandoSeleccionar.ToString, "curReportes")
loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fCuentas_Cobrar2", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfCuentas_Cobrar2.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' JFP: 26/01/09: Codigo inicial
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
fCuentas_Cobrar2.aspx.vb
|
Visual Basic
|
mit
| 4,813
|
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} select_customers
Caption = "list customer connections"
ClientHeight = 4725
ClientLeft = 45
ClientTop = 360
ClientWidth = 8040
OleObjectBlob = "select_customers.frx":0000
StartUpPosition = 1 'Fenstermitte
End
Attribute VB_Name = "select_customers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub UserForm_Activate()
Rem fill list field
Call fill_data
Rem fill list field eof
Rem north/south
cb_n_s.Clear
cb_n_s.AddItem "north"
cb_n_s.AddItem "south"
Rem nordth/south eof
End Sub
Private Sub cb_show_Click()
select_customers.Hide
ControlPanel.Hide
Sheets("Overview").Activate
Cells.Select
Selection.sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
Selection.AutoFilter Field:=1, Criteria1:=list_customers.Value
If cb_n_s.Value <> "" Then
Selection.AutoFilter Field:=24, Criteria1:=cb_n_s.Value
End If
Cells(2, 1).Select
End Sub
Private Sub fill_data()
Dim i As Integer
list_customers.Clear
Rem kundenliste sortieren
Call sort_customer
Rem kundenliste sortieren
Rem kunden einlesem
x = 1
For i = 1 To 70
If Sheets("Values").Cells(x, 1).Value = "" Then
If Sheets("Values").Cells(x + 1, 1).Value = "" Then
Exit Sub
Else
x = x + 1
End If
Else
list_customers.AddItem Sheets("Values").Cells(x, 1).Value
x = x + 1
End If
Next
Rem kunden einlesen eof
End Sub
Sub sort_customer()
With Worksheets("Values")
.Range("A1:A70").sort Key1:=.Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Rem Name define for Validation
ActiveWorkbook.names.Add Name:="Customers", RefersToR1C1:= _
"=OFFSET(Values!R1C1,0,0,COUNTA(Values!C1),1)"
Rem Name define for Validation eof
End With
End Sub
|
freemindhv/campusfibres
|
select_customers.vb
|
Visual Basic
|
mit
| 2,278
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports System.Threading
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Represents a named type symbol whose members are declared in source.
''' </summary>
Friend MustInherit Class SourceMemberContainerTypeSymbol
Inherits InstanceTypeSymbol
''' <summary>
''' Holds information about a SourceType in a compact form.
''' </summary>
<Flags>
Friend Enum SourceTypeFlags As UShort
[Private] = CUShort(Accessibility.Private)
[Protected] = CUShort(Accessibility.Protected)
[Friend] = CUShort(Accessibility.Friend)
ProtectedFriend = CUShort(Accessibility.ProtectedOrFriend)
PrivateProtected = CUShort(Accessibility.ProtectedAndFriend)
[Public] = CUShort(Accessibility.Public)
AccessibilityMask = &H7
[Class] = CUShort(TypeKind.Class) << TypeKindShift
[Structure] = CUShort(TypeKind.Structure) << TypeKindShift
[Interface] = CUShort(TypeKind.Interface) << TypeKindShift
[Enum] = CUShort(TypeKind.Enum) << TypeKindShift
[Delegate] = CUShort(TypeKind.Delegate) << TypeKindShift
[Module] = CUShort(TypeKind.Module) << TypeKindShift
Submission = CUShort(TypeKind.Submission) << TypeKindShift
TypeKindMask = &HF0
TypeKindShift = 4
[MustInherit] = 1 << 8
[NotInheritable] = 1 << 9
[Shadows] = 1 << 10
[Partial] = 1 << 11
End Enum
' Flags about the type
Private ReadOnly _flags As SourceTypeFlags
' Misc flags defining the state of this symbol (StateFlags)
Protected m_lazyState As Integer
<Flags>
Protected Enum StateFlags As Integer
FlattenedMembersIsSortedMask = &H1 ' Set if "m_lazyMembersFlattened" is sorted.
ReportedVarianceDiagnostics = &H2 ' Set if variance diagnostics have been reported.
ReportedBaseClassConstraintsDiagnostics = &H4 ' Set if base class constraints diagnostics have been reported.
ReportedInterfacesConstraintsDiagnostics = &H8 ' Set if constraints diagnostics for base/implemented interfaces have been reported.
End Enum
' Containing symbol
Private ReadOnly _containingSymbol As NamespaceOrTypeSymbol
' Containing source module
Protected ReadOnly m_containingModule As SourceModuleSymbol
' The declaration for this type.
Private ReadOnly _declaration As MergedTypeDeclaration
' The name of the type, might be different than m_decl.Name depending on lexical sort order.
Private ReadOnly _name As String
' The name of the default property if any.
' GetMembersAndInitializers must be called before accessing field.
Private _defaultPropertyName As String
' The different kinds of members of this type
Private _lazyMembersAndInitializers As MembersAndInitializers
' Maps names to nested type symbols.
Private Shared ReadOnly s_emptyTypeMembers As New Dictionary(Of String, ImmutableArray(Of NamedTypeSymbol))(IdentifierComparison.Comparer)
Private _lazyTypeMembers As Dictionary(Of String, ImmutableArray(Of NamedTypeSymbol))
' An array of members in declaration order.
Private _lazyMembersFlattened As ImmutableArray(Of Symbol)
' Type parameters (Nothing if not created yet)
Private _lazyTypeParameters As ImmutableArray(Of TypeParameterSymbol)
Private _lazyEmitExtensionAttribute As ThreeState = ThreeState.Unknown
Private _lazyContainsExtensionMethods As ThreeState = ThreeState.Unknown
Private _lazyAnyMemberHasAttributes As ThreeState = ThreeState.Unknown
Private _lazyStructureCycle As Integer = ThreeState.Unknown ' Interlocked
Private _lazyLexicalSortKey As LexicalSortKey = LexicalSortKey.NotInitialized
#Region "Construction"
' Create the type symbol and associated type parameter symbols. Most information
' is deferred until later.
Protected Sub New(declaration As MergedTypeDeclaration,
containingSymbol As NamespaceOrTypeSymbol,
containingModule As SourceModuleSymbol)
m_containingModule = containingModule
_containingSymbol = containingSymbol
_declaration = declaration
_name = GetBestName(declaration, containingModule.ContainingSourceAssembly.DeclaringCompilation)
_flags = ComputeTypeFlags(declaration, containingSymbol.IsNamespace)
End Sub
' Figure out the "right" name spelling, it should come from lexically first declaration.
Private Shared Function GetBestName(declaration As MergedTypeDeclaration, compilation As VisualBasicCompilation) As String
Dim declarations As ImmutableArray(Of SingleTypeDeclaration) = declaration.Declarations
Dim best As SingleTypeDeclaration = declarations(0)
For i As Integer = 1 To declarations.Length - 1
Dim bestLocation As Location = best.Location
If compilation.FirstSourceLocation(bestLocation, declarations(i).Location) IsNot bestLocation Then
best = declarations(i)
End If
Next
Return best.Name
End Function
''' <summary>
''' Compute the type flags from the declaration.
''' This function DOES NOT diagnose errors in the modifiers. Given the set of modifiers,
''' it produces the flags, even in the case of potentially conflicting modifiers. We have to
''' return some answer even in the case of errors.
''' </summary>
Private Function ComputeTypeFlags(declaration As MergedTypeDeclaration, isTopLevel As Boolean) As SourceTypeFlags
Dim mergedModifiers As DeclarationModifiers = DeclarationModifiers.None
For i = 0 To declaration.Declarations.Length - 1
mergedModifiers = mergedModifiers Or declaration.Declarations(i).Modifiers
Next
Dim modifiers = mergedModifiers
Dim flags As SourceTypeFlags = 0
' compute type kind, inheritability
Select Case declaration.Kind
Case DeclarationKind.Class
flags = SourceTypeFlags.Class
If (modifiers And DeclarationModifiers.NotInheritable) <> 0 Then
flags = flags Or SourceTypeFlags.NotInheritable
ElseIf (modifiers And DeclarationModifiers.MustInherit) <> 0 Then
flags = flags Or SourceTypeFlags.MustInherit
End If
Case DeclarationKind.Script, DeclarationKind.ImplicitClass
flags = SourceTypeFlags.Class Or SourceTypeFlags.NotInheritable
Case DeclarationKind.Submission
flags = SourceTypeFlags.Submission Or SourceTypeFlags.NotInheritable
Case DeclarationKind.Structure
flags = SourceTypeFlags.Structure Or SourceTypeFlags.NotInheritable
Case DeclarationKind.Interface
flags = SourceTypeFlags.Interface Or SourceTypeFlags.MustInherit
Case DeclarationKind.Enum
flags = SourceTypeFlags.Enum Or SourceTypeFlags.NotInheritable
Case DeclarationKind.Delegate,
DeclarationKind.EventSyntheticDelegate
flags = SourceTypeFlags.Delegate Or SourceTypeFlags.NotInheritable
Case DeclarationKind.Module
flags = SourceTypeFlags.Module Or SourceTypeFlags.NotInheritable
Case Else
Throw ExceptionUtilities.UnexpectedValue(declaration.Kind)
End Select
' compute accessibility
If isTopLevel Then
' top-level types (types in namespaces) can only be Friend or Public, and the default is friend
If (modifiers And DeclarationModifiers.Friend) <> 0 Then
flags = flags Or SourceTypeFlags.Friend
ElseIf (modifiers And DeclarationModifiers.Public) <> 0 Then
flags = flags Or SourceTypeFlags.Public
Else
flags = flags Or SourceTypeFlags.Friend
End If
Else
' Nested types (including types in modules) can be any accessibility, and the default is public
If (modifiers And (DeclarationModifiers.Private Or DeclarationModifiers.Protected)) =
(DeclarationModifiers.Private Or DeclarationModifiers.Protected) Then
flags = flags Or SourceTypeFlags.PrivateProtected
ElseIf (modifiers And DeclarationModifiers.Private) <> 0 Then
flags = flags Or SourceTypeFlags.Private
ElseIf (modifiers And (DeclarationModifiers.Protected Or DeclarationModifiers.Friend)) =
(DeclarationModifiers.Protected Or DeclarationModifiers.Friend) Then
flags = flags Or SourceTypeFlags.ProtectedFriend
ElseIf (modifiers And DeclarationModifiers.Protected) <> 0 Then
flags = flags Or SourceTypeFlags.Protected
ElseIf (modifiers And DeclarationModifiers.Friend) <> 0 Then
flags = flags Or SourceTypeFlags.Friend
Else
flags = flags Or SourceTypeFlags.Public
End If
End If
' Compute partial
If (modifiers And DeclarationModifiers.Partial) <> 0 Then
flags = flags Or SourceTypeFlags.Partial
End If
' Compute Shadows
If (modifiers And DeclarationModifiers.Shadows) <> 0 Then
flags = flags Or SourceTypeFlags.Shadows
End If
Return flags
End Function
Public Shared Function Create(declaration As MergedTypeDeclaration,
containingSymbol As NamespaceOrTypeSymbol,
containingModule As SourceModuleSymbol) As SourceMemberContainerTypeSymbol
Dim kind = declaration.SyntaxReferences.First.SyntaxTree.GetEmbeddedKind()
If kind <> EmbeddedSymbolKind.None Then
Return New EmbeddedSymbolManager.EmbeddedNamedTypeSymbol(declaration, containingSymbol, containingModule, kind)
End If
Select Case declaration.Kind
Case DeclarationKind.ImplicitClass,
DeclarationKind.Script,
DeclarationKind.Submission
Return New ImplicitNamedTypeSymbol(declaration, containingSymbol, containingModule)
Case Else
Dim type = New SourceNamedTypeSymbol(declaration, containingSymbol, containingModule)
' In case Vb Core Runtime is being embedded, we should mark attribute
' 'Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute'
' as being referenced if the named type just created is a module
If type.TypeKind = TypeKind.Module Then
type.DeclaringCompilation.EmbeddedSymbolManager.RegisterModuleDeclaration()
End If
Return type
End Select
End Function
' Create a nested type with the given declaration.
Private Function CreateNestedType(declaration As MergedTypeDeclaration) As NamedTypeSymbol
#If DEBUG Then
' Ensure that the type declaration is either from user code or embedded
' code, but not merged across embedded code/user code boundary.
Dim embedded = EmbeddedSymbolKind.Unset
For Each ref In declaration.SyntaxReferences
Dim refKind = ref.SyntaxTree.GetEmbeddedKind()
If embedded <> EmbeddedSymbolKind.Unset Then
Debug.Assert(embedded = refKind)
Else
embedded = refKind
End If
Next
Debug.Assert(embedded <> EmbeddedSymbolKind.Unset)
#End If
If declaration.Kind = DeclarationKind.Delegate Then
Debug.Assert(Not declaration.SyntaxReferences.First.SyntaxTree.IsEmbeddedSyntaxTree)
Return New SourceNamedTypeSymbol(declaration, Me, m_containingModule)
ElseIf declaration.Kind = DeclarationKind.EventSyntheticDelegate Then
Debug.Assert(Not declaration.SyntaxReferences.First.SyntaxTree.IsEmbeddedSyntaxTree)
Return New SynthesizedEventDelegateSymbol(declaration.SyntaxReferences(0), Me)
Else
Return Create(declaration, Me, m_containingModule)
End If
End Function
#End Region
#Region "Completion"
''' <summary>
''' Force all declaration errors to be generated.
''' </summary>
Friend NotOverridable Overrides Sub GenerateDeclarationErrors(cancellationToken As CancellationToken)
GenerateAllDeclarationErrorsImpl(cancellationToken)
End Sub
Protected Overridable Sub GenerateAllDeclarationErrorsImpl(cancellationToken As CancellationToken)
cancellationToken.ThrowIfCancellationRequested()
Dim membersAndInitializers = GetMembersAndInitializers()
cancellationToken.ThrowIfCancellationRequested()
For Each member In Me.GetMembers()
' we already visited types
If member.Kind <> SymbolKind.NamedType Then
member.GenerateDeclarationErrors(cancellationToken)
End If
Next
cancellationToken.ThrowIfCancellationRequested()
Dim unused1 = BaseTypeNoUseSiteDiagnostics
cancellationToken.ThrowIfCancellationRequested()
Dim unused2 = InterfacesNoUseSiteDiagnostics
cancellationToken.ThrowIfCancellationRequested()
Dim unused3 = ExplicitInterfaceImplementationMap
cancellationToken.ThrowIfCancellationRequested()
Dim typeParams = TypeParameters
If Not typeParams.IsEmpty Then
TypeParameterSymbol.EnsureAllConstraintsAreResolved(typeParams)
End If
cancellationToken.ThrowIfCancellationRequested()
Dim unused4 = GetAttributes()
cancellationToken.ThrowIfCancellationRequested()
BindAllMemberAttributes(cancellationToken)
cancellationToken.ThrowIfCancellationRequested()
GenerateVarianceDiagnostics()
End Sub
Private Sub GenerateVarianceDiagnostics()
If (m_lazyState And StateFlags.ReportedVarianceDiagnostics) <> 0 Then
Return
End If
Dim diagnostics As DiagnosticBag = Nothing
Dim infosBuffer As ArrayBuilder(Of DiagnosticInfo) = Nothing
Select Case Me.TypeKind
Case TypeKind.Interface
GenerateVarianceDiagnosticsForInterface(diagnostics, infosBuffer)
Case TypeKind.Delegate
GenerateVarianceDiagnosticsForDelegate(diagnostics, infosBuffer)
Case TypeKind.Class, TypeKind.Enum, TypeKind.Structure
ReportNestingIntoVariantInterface(diagnostics)
Case TypeKind.Module, TypeKind.Submission
Case Else
Throw ExceptionUtilities.UnexpectedValue(Me.TypeKind)
End Select
m_containingModule.AtomicSetFlagAndStoreDiagnostics(m_lazyState,
StateFlags.ReportedVarianceDiagnostics,
0,
diagnostics,
CompilationStage.Declare)
If diagnostics IsNot Nothing Then
diagnostics.Free()
End If
If infosBuffer IsNot Nothing Then
' all diagnostics were reported to diagnostic bag:
Debug.Assert(infosBuffer.Count = 0)
infosBuffer.Free()
End If
End Sub
Private Sub ReportNestingIntoVariantInterface(<[In], Out> ByRef diagnostics As DiagnosticBag)
If Not _containingSymbol.IsType Then
Return
End If
' Check for illegal nesting into variant interface.
Dim container = DirectCast(_containingSymbol, NamedTypeSymbol)
Do
If Not container.IsInterfaceType() Then
Debug.Assert(Not container.IsDelegateType())
' The same validation will be performed for the container and
' there is no reason to duplicate the same errors, if any, on this type.
container = Nothing
Exit Do
End If
If container.TypeParameters.HaveVariance() Then
' We are inside of a variant interface
Exit Do
End If
' This interface isn't variant, but its containing interface might be.
container = container.ContainingType
Loop While container IsNot Nothing
If container IsNot Nothing Then
Debug.Assert(container.IsInterfaceType() AndAlso container.HasVariance())
If diagnostics Is Nothing Then
diagnostics = DiagnosticBag.GetInstance()
End If
diagnostics.Add(New VBDiagnostic(ErrorFactory.ErrorInfo(ERRID.ERR_VarianceInterfaceNesting), Locations(0)))
End If
End Sub
Private Sub GenerateVarianceDiagnosticsForInterface(
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
' Dev10 didn't do this shortcut, but I and Lucian believe that the checks below
' can be safely skipped for an invariant interface.
If Not Me.HasVariance() Then
Return
End If
' Variance spec $2:
' An interface I is valid if and only if
' * every method signature in I is valid and has no variant generic parameters (no variant generic
' parameters part is handled by SourceMethodSymbol.BindTypeParameterConstraints), and
' * every property in I is valid, and
' * every event in I is valid, and
' * every immediate base interface type of I is valid covariantly, and
' * the interface is either invariant or it lacks nested classes and structs, and
' * every nested type is valid.
'
' A property "Property Goo as T" is valid if and only if either
' * The property is read-only and T is valid covariantly, or
' * The property is write-only and T is valid invariantly, or
' * The property is readable and writable and T is invariant.
'
' An event "Event e as D" is valid if and only if
' * the delegate type D is valid contravariantly
'
' An event "Event e(Signature)" is valid if and only if
' * it is not contained (not even nested) in a variant interface,
' this is handled by SynthesizedEventDelegateSymbol.
'
' The test that nested types are valid isn't needed, since GenerateVarianceDiagnostics
' will anyways be called on them all. (and for any invalid nested type, we report the
' error on it, rather than on this container.)
'
' The check that an interface lacks nested classes and structs is done inside
' ReportNestingIntoVariantInterface. Why? Because we have to look for indirectly
' nested classes/structs, not just immediate ones. And it seemed nicer for classes/structs
' to look UP for variant containers, rather than for interfaces to look DOWN for class/struct contents.
For Each batch As ImmutableArray(Of Symbol) In GetMembersAndInitializers().Members.Values
For Each member As Symbol In batch
If Not member.IsImplicitlyDeclared Then
Select Case member.Kind
Case SymbolKind.Method
GenerateVarianceDiagnosticsForMethod(DirectCast(member, MethodSymbol), diagnostics, infosBuffer)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
Case SymbolKind.Property
GenerateVarianceDiagnosticsForProperty(DirectCast(member, PropertySymbol), diagnostics, infosBuffer)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
Case SymbolKind.Event
GenerateVarianceDiagnosticsForEvent(DirectCast(member, EventSymbol), diagnostics, infosBuffer)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
End Select
End If
Next
Next
' 3. every immediate base interface is valid covariantly.
' Actually, the only type that's invalid covariantly and allowable as a base interface,
' is a generic instantiation X(T1,...) where we've instantiated it wrongly (e.g. given it "Out Ti"
' for a generic parameter that was declared as an "In"). Look what happens:
' Interface IZoo(Of In T) | Dim x as IZoo(Of Animal)
' Inherits IReadOnly(Of T) | Dim y as IZoo(Of Mammal) = x ' through contravariance of IZoo
' End Interface | Dim z as IReadOnly(Of Mammal) = y ' through inheritance from IZoo
' Now we might give "z" to someone who's expecting to read only Mammals, even though we know the zoo
' contains all kinds of animals.
For Each implemented As NamedTypeSymbol In Me.InterfacesNoUseSiteDiagnostics
If Not implemented.IsErrorType() Then
Debug.Assert(Not HaveDiagnostics(infosBuffer))
GenerateVarianceDiagnosticsForType(implemented, VarianceKind.Out, VarianceContext.Complex, infosBuffer)
If HaveDiagnostics(infosBuffer) Then
ReportDiagnostics(diagnostics, GetInheritsOrImplementsLocation(implemented, getInherits:=True), infosBuffer)
End If
End If
Next
End Sub
' Gets the implements location for a particular interface, which must be implemented but might be indirectly implemented.
' Also gets the direct interface it was inherited through
Private Function GetImplementsLocation(implementedInterface As NamedTypeSymbol, ByRef directInterface As NamedTypeSymbol) As Location
Debug.Assert(Me.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics(implementedInterface).Contains(implementedInterface))
' Find the directly implemented interface that "implementedIface" was inherited through.
directInterface = Nothing
For Each iface In Me.InterfacesNoUseSiteDiagnostics
If TypeSymbol.Equals(iface, implementedInterface, TypeCompareKind.ConsiderEverything) Then
directInterface = iface
Exit For
ElseIf directInterface Is Nothing AndAlso iface.ImplementsInterface(implementedInterface, comparer:=Nothing, useSiteDiagnostics:=Nothing) Then
directInterface = iface
End If
Next
Debug.Assert(directInterface IsNot Nothing)
Return GetInheritsOrImplementsLocation(directInterface, Me.IsInterfaceType())
End Function
Private Function GetImplementsLocation(implementedInterface As NamedTypeSymbol) As Location
Dim dummy As NamedTypeSymbol = Nothing
Return GetImplementsLocation(implementedInterface, dummy)
End Function
Protected MustOverride Function GetInheritsOrImplementsLocation(base As NamedTypeSymbol, getInherits As Boolean) As Location
Private Sub GenerateVarianceDiagnosticsForDelegate(
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
' Dev10 didn't do this shortcut, but I and Lucian believe that the checks below
' can be safely skipped for an invariant interface.
If Not Me.HasVariance() Then
Return
End If
' Variance spec $2
' A delegate "Delegate Function/Sub Goo(Of T1, ... Tn)Signature" is valid if and only if
' * the signature is valid.
'
' That delegate becomes "Class Goo(Of T1, ... Tn) : Function Invoke(...) As ... : End Class
' So we just need to pick up the "Invoke" method and check that it's valid.
' NB. that delegates can have variance in their generic params, and hence so can e.g. "Class Goo(Of Out T1)"
' This is the only place in the CLI where a class can have variant generic params.
'
' Note: delegates that are synthesized from events are already dealt with in
' SynthesizedEventDelegateSymbol.GenerateAllDeclarationErrors, so we won't run into them here.
Dim invoke As MethodSymbol = Me.DelegateInvokeMethod
If invoke IsNot Nothing Then
GenerateVarianceDiagnosticsForMethod(invoke, diagnostics, infosBuffer)
End If
End Sub
Private Shared Sub ReportDiagnostics(
<[In], Out> ByRef diagnostics As DiagnosticBag,
location As Location,
infos As ArrayBuilder(Of DiagnosticInfo)
)
If diagnostics Is Nothing Then
diagnostics = DiagnosticBag.GetInstance()
End If
For Each info In infos
diagnostics.Add(info, location)
Next
infos.Clear()
End Sub
Private Shared Function HaveDiagnostics(diagnostics As ArrayBuilder(Of DiagnosticInfo)) As Boolean
Return diagnostics IsNot Nothing AndAlso diagnostics.Count > 0
End Function
''' <summary>
''' Following enum is used just to help give more specific error messages.
''' </summary>
Private Enum VarianceContext
' We'll give specific error messages in these simple contexts:
[ByVal]
[ByRef]
[Return]
[Constraint]
Nullable
ReadOnlyProperty
WriteOnlyProperty
[Property]
' Otherwise (e.g. nested inside a generic) we use the following as a catch-all:
Complex
End Enum
Private Sub GenerateVarianceDiagnosticsForType(
type As TypeSymbol,
requiredVariance As VarianceKind,
context As VarianceContext,
<[In], Out> ByRef diagnostics As ArrayBuilder(Of DiagnosticInfo)
)
GenerateVarianceDiagnosticsForTypeRecursively(type, requiredVariance, context, Nothing, 0, diagnostics)
End Sub
Private Shared Sub AppendVarianceDiagnosticInfo(
<[In], Out> ByRef diagnostics As ArrayBuilder(Of DiagnosticInfo),
info As DiagnosticInfo
)
If diagnostics Is Nothing Then
diagnostics = ArrayBuilder(Of DiagnosticInfo).GetInstance()
End If
diagnostics.Add(info)
End Sub
Private Structure VarianceDiagnosticsTargetTypeParameter
Public ReadOnly ConstructedType As NamedTypeSymbol
Private ReadOnly _typeParameterIndex As Integer
Public ReadOnly Property TypeParameter As TypeParameterSymbol
Get
Return ConstructedType.TypeParameters(_typeParameterIndex)
End Get
End Property
Public Sub New(constructedType As NamedTypeSymbol, typeParameterIndex As Integer)
Debug.Assert(typeParameterIndex >= 0 AndAlso typeParameterIndex < constructedType.Arity)
Me.ConstructedType = constructedType
_typeParameterIndex = typeParameterIndex
End Sub
End Structure
Private Sub GenerateVarianceDiagnosticsForTypeRecursively(
type As TypeSymbol,
requiredVariance As VarianceKind,
context As VarianceContext,
typeParameterInfo As VarianceDiagnosticsTargetTypeParameter,
constructionDepth As Integer,
<[In], Out> ByRef diagnostics As ArrayBuilder(Of DiagnosticInfo)
)
' Variance spec $2:
'
' A type T is valid invariantly if and only if:
' * it is valid covariantly, and
' * it is valid contravariantly.
'
' A type T is valid covariantly if and only if one of the following hold: either
' * T is a generic parameter which was not declared contravariant, or
' * T is an array type U() where U is valid covariantly, or
' * T is a construction X1(Of T11...)...Xn(Of Tn1...) of some generic struct/class/interface/delegate Xn
' declared as X1(Of X11...)...Xn(Of Xn1...) such that for each i and j,
' - if Xij was declared covariant then Tij is valid covariantly
' - if Xij was declared contravariant then Tij is valid contravariantly
' - if Xij was declared invariant then Tij is valid invariantly
' * or T is a non-generic struct/class/interface/delegate/enum.
'
' A type T is valid contravariantly if and only if one of the following hold: either
' * T is a generic parameter which was not declared covariant, or
' * T is an array type U() where U is valid contravariantly, or
' * T is a construction X1(Of T11...)...Xn(Of Tn1...) of some generic struct/class/interface/delegate Xn
' declared as X1(Of X11...)...Xn(Of Xn1...) such that for each i and j,
' - if Xij was declared covariant then Tij is valid contravariantly
' - if Xij was declared contravariant then Tij is valid covariantly
' - if Xij was declared invariant then Tij is valid invariantly
' * or T is a non-generic struct/class/interface/delegate/enum.
'
'
' In all cases, if a type fails a variance validity check, then it ultimately failed
' because somewhere there were one or more generic parameters "T" which were declared with
' the wrong kind of variance. In particular, they were either declared In when they'd have
' to be Out or InOut, or they were declared Out when they'd have to be In or InOut.
' We mark all these as errors.
'
' BUT... CLS restrictions say that in any generic type, all nested types first copy their
' containers's generic parameters. This restriction is embodied in the BCSYM structure.
' SOURCE: BCSYM: IL:
' Interface I(Of Out T1) Interface"I"/genericparams=T1 .interface I(Of Out T1)
' Interface J : End Interface Interface"J"/no genericparams .interface J(Of Out T1)
' Sub f(ByVal x as J) ... GenericTypeBinding(J,args=[], .proc f(x As J(Of T1))
' End Interface parentargs=I[T1])
' Observe that, by construction, any time we use a nested type like J in a contravariant position
' then it's bound to be invalid. If we simply applied the previous paragraph then we'd emit a
' confusing error to the user like "J is invalid because T1 is an Out parameter". So we want
' to do a better job of reporting errors. In particular,
' * If we are checking a GenericTypeBinding (e.g. x as J(Of T1)) for contravariant validity, look up
' to find the outermost ancestor binding (e.g. parentargs=I[T1]) which is of a variant interface.
' If this is also the outermost variant container of the current context, then it's an error.
Select Case type.Kind
Case SymbolKind.TypeParameter
' 1. if T is a generic parameter which was declared wrongly
Dim typeParam = DirectCast(type, TypeParameterSymbol)
If (typeParam.Variance = VarianceKind.Out AndAlso requiredVariance <> VarianceKind.Out) OrElse
(typeParam.Variance = VarianceKind.In AndAlso requiredVariance <> VarianceKind.In) Then
' The error is either because we have an "Out" param and Out is inappropriate here,
' or we used an "In" param and In is inappropriate here. This flag says which:
Dim inappropriateOut As Boolean = (typeParam.Variance = VarianceKind.Out)
' OKAY, so now we need to report an error. Simple enough, but we've tried to give helpful
' context-specific error messages to the user, and so the code has to work through a lot
' of special cases.
Select Case context
Case VarianceContext.ByVal
' "Type '|1' cannot be used as a ByVal parameter type because '|1' is an 'Out' type parameter."
Debug.Assert(inappropriateOut, "unexpected: a variance error in ByVal must be due to an inappropriate out")
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceOutByValDisallowed1, type.Name))
Case VarianceContext.ByRef
' "Type '|1' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '|1' is an 'Out/In' type parameter."
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutByRefDisallowed1,
ERRID.ERR_VarianceInByRefDisallowed1),
type.Name))
Case VarianceContext.Return
' "Type '|1' cannot be used as a return type because '|1' is an 'In' type parameter."
Debug.Assert(Not inappropriateOut, "unexpected: a variance error in Return Type must be due to an inappropriate in")
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceInReturnDisallowed1, type.Name))
Case VarianceContext.Constraint
' "Type '|1' cannot be used as a generic type constraint because '|1' is an 'Out' type parameter."
Debug.Assert(inappropriateOut, "unexpected: a variance error in Constraint must be due to an inappropriate out")
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceOutConstraintDisallowed1, type.Name))
Case VarianceContext.Nullable
' "Type '|1' cannot be used in '|2' because 'In' and 'Out' type parameters cannot be made nullable, and '|1' is an 'In/Out' type parameter."
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutNullableDisallowed2,
ERRID.ERR_VarianceInNullableDisallowed2),
type.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType)))
Case VarianceContext.ReadOnlyProperty
' "Type '|1' cannot be used as a ReadOnly property type because '|1' is an 'In' type parameter."
Debug.Assert(Not inappropriateOut, "unexpected: a variance error in ReadOnlyProperty must be due to an inappropriate in")
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceInReadOnlyPropertyDisallowed1, type.Name))
Case VarianceContext.WriteOnlyProperty
' "Type '|1' cannot be used as a WriteOnly property type because '|1' is an 'Out' type parameter."
Debug.Assert(inappropriateOut, "unexpected: a variance error in WriteOnlyProperty must be due to an inappropriate out")
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceOutWriteOnlyPropertyDisallowed1, type.Name))
Case VarianceContext.Property
' "Type '|1' cannot be used as a property type in this context because '|1' is an 'Out/In' type parameter and the property is not marked ReadOnly/WriteOnly.")
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutPropertyDisallowed1,
ERRID.ERR_VarianceInPropertyDisallowed1),
type.Name))
Case VarianceContext.Complex
' Otherwise, we're in "VarianceContextComplex" property. And so the error message needs
' to spell out precisely where in the context we are:
' "Type '|1' cannot be used in this context because '|1' is an 'Out|In' type parameter."
' "Type '|1' cannot be used for the '|2' in '|3' in this context because '|1' is an 'Out|In' type parameter."
' "Type '|1' cannot be used in '|2' in this context because '|1' is an 'Out|In' type parameter."
' "Type '|1' cannot be used in '|2' for the '|3' in '|4' in this context because '|1' is an 'Out' type parameter."
' We need the "in '|2' here" clause when ErrorBindingIsNested, to show which instantiation we're talking about.
' We need the "for the '|3' in '|4'" when ErrorBinding->GetGenericParamCount()>1
If typeParameterInfo.ConstructedType Is Nothing Then
' "Type '|1' cannot be used in this context because '|1' is an 'Out|In' type parameter."
' Used for simple errors where the erroneous generic-param is NOT inside a generic binding:
' e.g. "Sub f(ByVal a as O)" for some parameter declared as "Out O"
' gives the error "An 'Out' parameter like 'O' cannot be user here".
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutParamDisallowed1,
ERRID.ERR_VarianceInParamDisallowed1),
type.Name))
ElseIf constructionDepth <= 1 Then
If typeParameterInfo.ConstructedType.Arity <= 1 Then
' "Type '|1' cannot be used in this context because '|1' is an 'Out|In' type parameter."
' e.g. "Sub f(ByVal a As IEnumerable(Of O))" yields
' "An 'Out' parameter like 'O' cannot be used here."
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutParamDisallowed1,
ERRID.ERR_VarianceInParamDisallowed1),
type.Name))
Else
Debug.Assert(typeParameterInfo.ConstructedType.Arity > 1)
' "Type '|1' cannot be used for the '|2' in '|3' in this context because '|1' is an 'Out|In' type parameter."
' e.g. "Sub f(ByVal a As IDoubleEnumerable(Of O,I)) yields
' "An 'Out' parameter like 'O' cannot be used for type parameter 'T1' of 'IDoubleEnumerable(Of T1,T2)'."
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutParamDisallowedForGeneric3,
ERRID.ERR_VarianceInParamDisallowedForGeneric3),
type.Name,
typeParameterInfo.TypeParameter.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType.OriginalDefinition)))
End If
Else
Debug.Assert(constructionDepth > 1)
If typeParameterInfo.ConstructedType.Arity <= 1 Then
' "Type '|1' cannot be used in '|2' in this context because '|1' is an 'Out|In' type parameter."
' e.g. "Sub f(ByVal a as Func(Of IEnumerable(Of O), IEnumerable(Of O))" yields
' "In 'IEnumerable(Of O)' here, an 'Out' parameter like 'O' cannot be used."
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutParamDisallowedHere2,
ERRID.ERR_VarianceInParamDisallowedHere2),
type.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType)))
Else
Debug.Assert(typeParameterInfo.ConstructedType.Arity > 1)
' "Type '|1' cannot be used in '|2' for the '|3' in '|4' in this context because '|1' is an 'Out' type parameter."
' e.g. "Sub f(ByVal a as IEnumerable(Of Func(Of O,O))" yields
' "In 'Func(Of O,O)' here, an 'Out' parameter like 'O' cannot be used for type parameter 'Tresult' of 'Func(Of Tresult,T)'."
AppendVarianceDiagnosticInfo(diagnostics,
ErrorFactory.ErrorInfo(If(inappropriateOut,
ERRID.ERR_VarianceOutParamDisallowedHereForGeneric4,
ERRID.ERR_VarianceInParamDisallowedHereForGeneric4),
type.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType),
typeParameterInfo.TypeParameter.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType.OriginalDefinition)))
End If
End If
Case Else
Throw ExceptionUtilities.UnexpectedValue(context)
End Select
End If
Case SymbolKind.ArrayType
' 2. if T is an array U():
GenerateVarianceDiagnosticsForTypeRecursively(DirectCast(type, ArrayTypeSymbol).ElementType,
requiredVariance,
context,
typeParameterInfo,
constructionDepth,
diagnostics)
Case SymbolKind.NamedType
Dim namedType = DirectCast(type.GetTupleUnderlyingTypeOrSelf(), NamedTypeSymbol)
If Not namedType.IsGenericType Then
Return
End If
' 3. T is a construction X1(Of T11...)...Xn(Of Tn1...) of some generic struct/class/interface/delegate X1(Of X11...)...Xn(Of Xn1...)
' Special check, discussed above, for better error-reporting when we find a generic binding in an
' illegal contravariant position
If requiredVariance <> VarianceKind.Out Then
Dim outermostVarianceContainerOfType As NamedTypeSymbol = Nothing
Dim container As NamedTypeSymbol = type.ContainingType
While container IsNot Nothing
If container.TypeParameters.HaveVariance() Then
outermostVarianceContainerOfType = container.OriginalDefinition
End If
container = container.ContainingType
End While
Dim outermostVarianceContainerOfContext As NamedTypeSymbol = Nothing
container = Me
Do
If container.TypeParameters.HaveVariance() Then
outermostVarianceContainerOfContext = container
End If
container = container.ContainingType
Loop While container IsNot Nothing
If outermostVarianceContainerOfType IsNot Nothing AndAlso outermostVarianceContainerOfType Is outermostVarianceContainerOfContext Then
' ERRID_VarianceTypeDisallowed2. "Type '|1' cannot be used in this context because both the context and the definition of '|1' are nested within type '|2', and '|2' has 'In' or 'Out' type parameters. Consider moving '|1' outside of '|2'."
' ERRID_VarianceTypeDisallowedForGeneric4. "Type '|1' cannot be used for the '|3' in '|4' in this context because both the context and the definition of '|1' are nested within type '|2', and '|2' has 'In' or 'Out' type parameters. Consider moving '|1' outside of '|2'."
' ERRID_VarianceTypeDisallowedHere3. "Type '|1' cannot be used in '|3' in this context because both the context and the definition of '|1' are nested within type '|2', and '|2' has 'In' or 'Out' type parameters. Consider moving '|1' outside of '|2'."
' ERRID_VarianceTypeDisallowedHereForGeneric5. "Type '|1' cannot be used for the '|4' of '|5' in '|3' in this context because both the context and the definition of '|1' are nested within type '|2', and '|2' has 'In' or 'Out' type parameters. Consider moving '|1' outside of '|2'."
If typeParameterInfo.ConstructedType Is Nothing Then
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceTypeDisallowed2,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(type.OriginalDefinition),
CustomSymbolDisplayFormatter.QualifiedName(outermostVarianceContainerOfType)))
ElseIf constructionDepth <= 1 Then
If typeParameterInfo.ConstructedType.Arity <= 1 Then
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceTypeDisallowed2,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(type.OriginalDefinition),
CustomSymbolDisplayFormatter.QualifiedName(outermostVarianceContainerOfType)))
Else
Debug.Assert(typeParameterInfo.ConstructedType.Arity > 1)
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceTypeDisallowedForGeneric4,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(type.OriginalDefinition),
CustomSymbolDisplayFormatter.QualifiedName(outermostVarianceContainerOfType),
typeParameterInfo.TypeParameter.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType.OriginalDefinition)))
End If
Else
Debug.Assert(constructionDepth > 1)
If typeParameterInfo.ConstructedType.Arity <= 1 Then
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceTypeDisallowedHere3,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(type.OriginalDefinition),
CustomSymbolDisplayFormatter.QualifiedName(outermostVarianceContainerOfType),
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType)))
Else
Debug.Assert(typeParameterInfo.ConstructedType.Arity > 1)
AppendVarianceDiagnosticInfo(diagnostics, ErrorFactory.ErrorInfo(ERRID.ERR_VarianceTypeDisallowedHereForGeneric5,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(type.OriginalDefinition),
CustomSymbolDisplayFormatter.QualifiedName(outermostVarianceContainerOfType),
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType),
typeParameterInfo.TypeParameter.Name,
CustomSymbolDisplayFormatter.QualifiedName(typeParameterInfo.ConstructedType.OriginalDefinition)))
End If
End If
Return
End If
End If
' The general code below will catch the case of nullables "T?" or "Nullable(Of T)", which require T to
' be invariant. But we want more specific error reporting for this case, so we check for it first.
If namedType.IsNullableType() Then
Debug.Assert(namedType.TypeParameters(0).Variance = VarianceKind.None, "unexpected: a nullable type should have one generic parameter with no variance")
If namedType.TypeArgumentsNoUseSiteDiagnostics(0).IsValueType Then
GenerateVarianceDiagnosticsForTypeRecursively(namedType.TypeArgumentsNoUseSiteDiagnostics(0),
VarianceKind.None,
VarianceContext.Nullable,
New VarianceDiagnosticsTargetTypeParameter(namedType, 0),
constructionDepth,
diagnostics)
End If
Return
End If
' "Type" will refer to the last generic binding, Xn(Of Tn1...). So we have to check all the way up to X1.
Do
For argumentIndex As Integer = 0 To namedType.Arity - 1
' nb. the InvertVariance() here is the only difference between covariantly-valid and contravariantly-valid
' for generic constructions.
Dim argumentRequiredVariance As VarianceKind
Select Case requiredVariance
Case VarianceKind.In
Select Case namedType.TypeParameters(argumentIndex).Variance
Case VarianceKind.In
argumentRequiredVariance = VarianceKind.Out
Case VarianceKind.Out
argumentRequiredVariance = VarianceKind.In
Case Else
argumentRequiredVariance = VarianceKind.None
End Select
Case VarianceKind.Out
argumentRequiredVariance = namedType.TypeParameters(argumentIndex).Variance
Case Else
argumentRequiredVariance = VarianceKind.None
End Select
GenerateVarianceDiagnosticsForTypeRecursively(namedType.TypeArgumentsNoUseSiteDiagnostics(argumentIndex),
argumentRequiredVariance,
VarianceContext.Complex,
New VarianceDiagnosticsTargetTypeParameter(namedType, argumentIndex),
constructionDepth + 1,
diagnostics)
Next
namedType = namedType.ContainingType
Loop While namedType IsNot Nothing
Case SymbolKind.ErrorType
Case Else
Throw ExceptionUtilities.UnexpectedValue(type.Kind)
End Select
End Sub
Private Sub GenerateVarianceDiagnosticsForMethod(
method As MethodSymbol,
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
Select Case method.MethodKind
Case MethodKind.EventAdd, MethodKind.EventRemove, MethodKind.PropertyGet, MethodKind.PropertySet
Return
End Select
GenerateVarianceDiagnosticsForParameters(method.Parameters, diagnostics, infosBuffer)
' Return type is valid covariantly
Debug.Assert(Not HaveDiagnostics(infosBuffer))
GenerateVarianceDiagnosticsForType(method.ReturnType, VarianceKind.Out, VarianceContext.Return, infosBuffer)
If HaveDiagnostics(infosBuffer) Then
Dim location As Location
Dim syntax As MethodBaseSyntax = method.GetDeclaringSyntaxNode(Of MethodBaseSyntax)()
If syntax Is Nothing AndAlso method.MethodKind = MethodKind.DelegateInvoke Then
syntax = method.ContainingType.GetDeclaringSyntaxNode(Of MethodBaseSyntax)()
End If
Dim asClause As AsClauseSyntax = If(syntax IsNot Nothing, syntax.AsClauseInternal, Nothing)
If asClause IsNot Nothing Then
location = asClause.Type.GetLocation()
Else
location = method.Locations(0)
End If
ReportDiagnostics(diagnostics, location, infosBuffer)
End If
GenerateVarianceDiagnosticsForConstraints(method.TypeParameters, diagnostics, infosBuffer)
End Sub
Private Sub GenerateVarianceDiagnosticsForParameters(
parameters As ImmutableArray(Of ParameterSymbol),
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
' Each ByVal Pi is valid contravariantly, and each ByRef Pi is valid invariantly
For Each param As ParameterSymbol In parameters
Dim requiredVariance As VarianceKind
Dim context As VarianceContext
If param.IsByRef Then
requiredVariance = VarianceKind.None
context = VarianceContext.ByRef
Else
requiredVariance = VarianceKind.In
context = VarianceContext.ByVal
End If
GenerateVarianceDiagnosticsForType(param.Type, requiredVariance, context, infosBuffer)
If HaveDiagnostics(infosBuffer) Then
Dim location As Location
Dim syntax As ParameterSyntax = param.GetDeclaringSyntaxNode(Of ParameterSyntax)()
If syntax IsNot Nothing AndAlso syntax.AsClause IsNot Nothing Then
location = syntax.AsClause.Type.GetLocation()
Else
location = param.Locations(0)
End If
ReportDiagnostics(diagnostics, location, infosBuffer)
End If
Next
End Sub
Private Sub GenerateVarianceDiagnosticsForConstraints(
parameters As ImmutableArray(Of TypeParameterSymbol),
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
' Each constraint on U1...Un is valid contravariantly
' "It is character-building to consider why this is required" [Eric Lippert, 2008]
' Interface IReadOnly(Of Out T) | Class Zoo(Of T) | Dim m As IReadOnly(Of Mammal) = new Zoo(Of Mammal) ' OK through inheritance
' Sub Fun(Of U As T)() | Implements IReadOnly(Of T) | Dim a as IReadOnly(Of Animal) = m ' OK through covariance
' End Interface | End Class | a.Fun(Of Fish)() ' BAD: Fish is an Animal (satisfies "U as T"), but fun is expecting a mammal!
For Each param As TypeParameterSymbol In parameters
For Each constraint As TypeSymbol In param.ConstraintTypesNoUseSiteDiagnostics
GenerateVarianceDiagnosticsForType(constraint, VarianceKind.In, VarianceContext.Constraint, infosBuffer)
If HaveDiagnostics(infosBuffer) Then
Dim location As Location = param.Locations(0)
For Each constraintInfo As TypeParameterConstraint In param.GetConstraints()
If constraintInfo.TypeConstraint IsNot Nothing AndAlso
constraintInfo.TypeConstraint.IsSameTypeIgnoringAll(constraint) Then
location = constraintInfo.LocationOpt
Exit For
End If
Next
ReportDiagnostics(diagnostics, location, infosBuffer)
End If
Next
Next
End Sub
Private Sub GenerateVarianceDiagnosticsForProperty(
[property] As PropertySymbol,
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
' Gettable: requires covariance. Settable: requires contravariance. Gettable and settable: requires invariance.
Dim requiredVariance As VarianceKind
Dim context As VarianceContext
If [property].IsReadOnly Then
requiredVariance = VarianceKind.Out
context = VarianceContext.ReadOnlyProperty
ElseIf [property].IsWriteOnly Then
requiredVariance = VarianceKind.In
context = VarianceContext.WriteOnlyProperty
Else
requiredVariance = VarianceKind.None
context = VarianceContext.Property
End If
GenerateVarianceDiagnosticsForType([property].Type, requiredVariance, context, infosBuffer)
If HaveDiagnostics(infosBuffer) Then
Dim location As Location
Dim syntax As PropertyStatementSyntax = [property].GetDeclaringSyntaxNode(Of PropertyStatementSyntax)()
If syntax IsNot Nothing AndAlso syntax.AsClause IsNot Nothing Then
location = syntax.AsClause.Type.GetLocation()
Else
location = [property].Locations(0)
End If
ReportDiagnostics(diagnostics, location, infosBuffer)
End If
' A property might be declared with extra parameters, so we have to check that these are variance-valid.
GenerateVarianceDiagnosticsForParameters([property].Parameters, diagnostics, infosBuffer)
End Sub
Private Sub GenerateVarianceDiagnosticsForEvent(
[event] As EventSymbol,
<[In], Out> ByRef diagnostics As DiagnosticBag,
<[In], Out> ByRef infosBuffer As ArrayBuilder(Of DiagnosticInfo)
)
Debug.Assert(Not HaveDiagnostics(infosBuffer))
Dim type As TypeSymbol = [event].Type
If Not type.IsDelegateType() Then
Return
End If
If type.ImplicitlyDefinedBy() Is [event] Then
Return
End If
GenerateVarianceDiagnosticsForType(type, VarianceKind.In, VarianceContext.Complex, infosBuffer)
If HaveDiagnostics(infosBuffer) Then
Dim location As Location
Dim syntax As EventStatementSyntax = [event].GetDeclaringSyntaxNode(Of EventStatementSyntax)()
If syntax IsNot Nothing AndAlso syntax.AsClause IsNot Nothing Then
location = syntax.AsClause.Type.GetLocation()
Else
location = [event].Locations(0)
End If
ReportDiagnostics(diagnostics, location, infosBuffer)
End If
End Sub
''' <summary>
''' Ensure all attributes on all members in the named type are bound.
''' </summary>
Private Sub BindAllMemberAttributes(cancellationToken As CancellationToken)
' Ensure all members are declared
Dim lookup = Me.MemberAndInitializerLookup
Dim haveExtensionMethods As Boolean = False
' Now bind all attributes on all members. This must be done after the members are declared to avoid
' infinite recursion.
For Each syms In lookup.Members.Values
For Each sym In syms
sym.GetAttributes()
' Make a note of extension methods
If Not haveExtensionMethods Then
haveExtensionMethods = (sym.Kind = SymbolKind.Method AndAlso DirectCast(sym, MethodSymbol).IsExtensionMethod)
End If
cancellationToken.ThrowIfCancellationRequested()
Next
Next
If haveExtensionMethods Then
Debug.Assert(Me.MightContainExtensionMethods)
m_containingModule.RecordPresenceOfExtensionMethods()
Debug.Assert(_lazyContainsExtensionMethods <> ThreeState.False)
_lazyContainsExtensionMethods = ThreeState.True
' At this point we already processed all the attributes on the type.
' and should know whether there is an explicit Extension attribute on it.
' If there is an explicit attribute, or we passed through this code before,
' m_lazyEmitExtensionAttribute should have known value.
If _lazyEmitExtensionAttribute = ThreeState.Unknown Then
' We need to emit an Extension attribute on the type.
' Can we locate it?
Dim useSiteError As DiagnosticInfo = Nothing
m_containingModule.ContainingSourceAssembly.DeclaringCompilation.GetExtensionAttributeConstructor(useSiteError:=useSiteError)
If useSiteError IsNot Nothing Then
' Note, we are storing false because, even though we should emit the attribute,
' we can't do that due to the use site error.
_lazyEmitExtensionAttribute = ThreeState.False
' also notify the containing assembly to not use the extension attribute
m_containingModule.ContainingSourceAssembly.AnErrorHasBeenReportedAboutExtensionAttribute()
Else
' We have extension methods, we don't have explicit Extension attribute
' on the type, which we were able to locate. Should emit it.
Debug.Assert(_lazyEmitExtensionAttribute <> ThreeState.False)
_lazyEmitExtensionAttribute = ThreeState.True
End If
End If
Else
Debug.Assert(_lazyContainsExtensionMethods <> ThreeState.True)
_lazyContainsExtensionMethods = ThreeState.False
Debug.Assert(_lazyEmitExtensionAttribute <> ThreeState.True)
_lazyEmitExtensionAttribute = ThreeState.False
End If
Debug.Assert(_lazyEmitExtensionAttribute <> ThreeState.Unknown)
Debug.Assert(_lazyContainsExtensionMethods <> ThreeState.Unknown)
Debug.Assert(_lazyEmitExtensionAttribute = ThreeState.False OrElse _lazyContainsExtensionMethods = ThreeState.True)
End Sub
#End Region
#Region "Containers"
Public Overrides ReadOnly Property ContainingSymbol As Symbol
Get
Return _containingSymbol
End Get
End Property
Public Overrides ReadOnly Property ContainingType As NamedTypeSymbol
Get
Return TryCast(_containingSymbol, NamedTypeSymbol)
End Get
End Property
Public Overrides ReadOnly Property ContainingModule As ModuleSymbol
Get
Return m_containingModule
End Get
End Property
Public ReadOnly Property ContainingSourceModule As SourceModuleSymbol
Get
Return m_containingModule
End Get
End Property
#End Region
#Region "Flags Encoded Properties"
Public Overrides ReadOnly Property DeclaredAccessibility As Accessibility
Get
Return CType((_flags And SourceTypeFlags.AccessibilityMask), Accessibility)
End Get
End Property
Public Overrides ReadOnly Property IsMustInherit As Boolean
Get
Return (_flags And SourceTypeFlags.MustInherit) <> 0
End Get
End Property
Public Overrides ReadOnly Property IsNotInheritable As Boolean
Get
Return (_flags And SourceTypeFlags.NotInheritable) <> 0
End Get
End Property
Friend Overrides ReadOnly Property ShadowsExplicitly As Boolean
Get
Return (_flags And SourceTypeFlags.Shadows) <> 0
End Get
End Property
Public Overrides ReadOnly Property TypeKind As TypeKind
Get
Return CType((_flags And SourceTypeFlags.TypeKindMask) >> CUInt(SourceTypeFlags.TypeKindShift), TypeKind)
End Get
End Property
Friend Overrides ReadOnly Property IsInterface As Boolean
Get
Return Me.TypeKind = TypeKind.Interface
End Get
End Property
Friend ReadOnly Property IsPartial As Boolean
Get
Return (_flags And SourceTypeFlags.Partial) <> 0
End Get
End Property
#End Region
#Region "Syntax"
Friend ReadOnly Property TypeDeclaration As MergedTypeDeclaration
Get
Return _declaration
End Get
End Property
Public Overrides ReadOnly Property IsImplicitlyDeclared As Boolean
Get
Return False
End Get
End Property
Public NotOverridable Overrides ReadOnly Property IsScriptClass As Boolean
Get
Dim kind = _declaration.Declarations(0).Kind
Return kind = DeclarationKind.Script OrElse kind = DeclarationKind.Submission
End Get
End Property
Public NotOverridable Overrides ReadOnly Property IsImplicitClass As Boolean
Get
Return _declaration.Declarations(0).Kind = DeclarationKind.ImplicitClass
End Get
End Property
Public NotOverridable Overrides ReadOnly Property Arity As Integer
Get
Return _declaration.Arity
End Get
End Property
' Get the declaration kind. Used to match up symbols with declarations in the BinderCache.
' Name, Arity, and DeclarationKind must match to exactly one source symbol, even in the presence
' of errors.
Friend ReadOnly Property DeclarationKind As DeclarationKind
Get
Return _declaration.Kind
End Get
End Property
Public NotOverridable Overrides ReadOnly Property Name As String
Get
Return _name
End Get
End Property
Friend NotOverridable Overrides ReadOnly Property MangleName As Boolean
Get
Return Arity > 0
End Get
End Property
''' <summary>
''' Should return full emitted namespace name for a top level type if the name
''' might be different in case from containing namespace symbol full name, Nothing otherwise.
'''
''' Although namespaces unify based on case-insensitive name, VB uses the casing the namespace
''' declaration surround the class definition for the name emitted to metadata.
'''
''' Namespace GOO
''' Class X
''' End Class
''' ENd Namespace
''' Namespace goo
''' Class Y
''' End Class
''' ENd Namespace
'''
''' In metadata, these are classes "GOO.X" and "goo.Y" (and thus appear in different namespaces
''' when imported into C#.) This function determines the casing of the namespace part of a class, if needed
''' to override the namespace name.
''' </summary>
Friend Overrides Function GetEmittedNamespaceName() As String
Dim containingSourceNamespace = TryCast(_containingSymbol, SourceNamespaceSymbol)
If containingSourceNamespace IsNot Nothing AndAlso containingSourceNamespace.HasMultipleSpellings Then
' Find the namespace spelling surrounding the first declaration.
Debug.Assert(Locations.Length > 0)
Dim firstLocation = Me.DeclaringCompilation.FirstSourceLocation(Locations)
Debug.Assert(firstLocation.IsInSource)
Return containingSourceNamespace.GetDeclarationSpelling(firstLocation.SourceTree, firstLocation.SourceSpan.Start)
End If
Return Nothing
End Function
Friend NotOverridable Overrides Function GetLexicalSortKey() As LexicalSortKey
' WARNING: this should not allocate memory!
If Not _lazyLexicalSortKey.IsInitialized Then
_lazyLexicalSortKey.SetFrom(_declaration.GetLexicalSortKey(DeclaringCompilation))
End If
Return _lazyLexicalSortKey
End Function
Public NotOverridable Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Dim result = _declaration.NameLocations
Return result
End Get
End Property
''' <summary>
''' Syntax references of all parts of the type declaration.
''' Submission and script classes are represented by their containing <see cref="CompilationUnitSyntax"/>,
''' implicit class can be represented by <see cref="CompilationUnitSyntax"/> or <see cref="NamespaceBlockSyntax"/>.
''' </summary>
Public ReadOnly Property SyntaxReferences As ImmutableArray(Of SyntaxReference)
Get
Return _declaration.SyntaxReferences
End Get
End Property
Public NotOverridable Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference)
Get
Return GetDeclaringSyntaxReferenceHelper(SyntaxReferences)
End Get
End Property
#End Region
#Region "Member from Syntax"
' Types defined in source code go through the following states, described here.
' The data that is computed by each state is stored in a contained immutable object, for storage efficiency
' and ease of lock-free implementation.
' 1) Created. Only the name, accessibility, arity, typekind, type parameters (but not their names),
' and references to the source code declarations are known.
' No access to the syntax tree is needed for this state, only the declaration.
' 2) Nested types created. No errors are diagnosed yet. Still no access to the syntax tree is
' needed for this state.
' 3) Type parameters names, variance, and constraints are known. Errors relating to type parameters
' are diagnosed. This needs to be done before resolving inheritance, because the base type can
' involve the type parameters.
' 4) Inheritance resolved. The base type, interfaces, type parameter names, variance, and
' constraints are known. Errors relating to partial types are reported.
' 5) Members declared. All members of the type are created, and errors with them reported.
' Errors relating to nested type are reported here also.
'
' Which phases have been completed is tracked by whether the state data for that
' that phase has been initialized. This allows us to update phases in a lock-free
' manner, which avoids many deadlock possibilities. It also makes sure that diagnostics are
' reported once and only once.
'
' The states are not visible outside the class, the class moves to the given
' state on demand. Care must be given in implementing the transitions to avoid
' deadlock or infinite recursion.
' Given the syntax declaration, and a container, get the symbol relating to that syntax.
' This is done by looking up the name from the declaration in the container, handling duplicates, arity, and
' so forth correctly.
Friend Shared Function FindSymbolFromSyntax(declarationSyntax As TypeStatementSyntax,
container As NamespaceOrTypeSymbol,
sourceModule As ModuleSymbol) As SourceNamedTypeSymbol
Dim childName As String = declarationSyntax.Identifier.ValueText
Dim childArity As Integer = DeclarationTreeBuilder.GetArity(declarationSyntax.TypeParameterList)
Dim childDeclKind As DeclarationKind = DeclarationTreeBuilder.GetKind(declarationSyntax.Kind)
Return FindSymbolInContainer(childName, childArity, childDeclKind, container, sourceModule)
End Function
' Given the syntax declaration, and a container, get the symbol relating to that syntax.
' This is done by lookup up the name from the declaration in the container, handling duplicates, arity, and
' so forth correctly.
Friend Shared Function FindSymbolFromSyntax(declarationSyntax As EnumStatementSyntax,
container As NamespaceOrTypeSymbol,
sourceModule As ModuleSymbol) As SourceNamedTypeSymbol
Dim childName As String = declarationSyntax.Identifier.ValueText
Dim childArity As Integer = 0
Dim childDeclKind As DeclarationKind = DeclarationTreeBuilder.GetKind(declarationSyntax.Kind)
Return FindSymbolInContainer(childName, childArity, childDeclKind, container, sourceModule)
End Function
' Given the syntax declaration, and a container, get the symbol relating to that syntax.
' This is done by lookup up the name from the declaration in the container, handling duplicates, arity, and
' so forth correctly.
Friend Shared Function FindSymbolFromSyntax(declarationSyntax As DelegateStatementSyntax,
container As NamespaceOrTypeSymbol,
sourceModule As ModuleSymbol) As SourceNamedTypeSymbol
Dim childName As String = declarationSyntax.Identifier.ValueText
Dim childArity As Integer = DeclarationTreeBuilder.GetArity(declarationSyntax.TypeParameterList)
Dim childDeclKind As DeclarationKind = VisualBasic.Symbols.DeclarationKind.Delegate
Return FindSymbolInContainer(childName, childArity, childDeclKind, container, sourceModule)
End Function
' Helper for FindSymbolFromSyntax. Finds a child source type based on name, arity, DeclarationKind.
Private Shared Function FindSymbolInContainer(childName As String,
childArity As Integer,
childDeclKind As DeclarationKind,
container As NamespaceOrTypeSymbol,
sourceModule As ModuleSymbol) As SourceNamedTypeSymbol
' We need to find the correct symbol, even in error cases. There must be only one
' symbol that is a source symbol, defined in our module, with the given name, arity,
' and declaration kind. The declaration table merges together symbols with the same
' arity, name, and declaration kind (regardless of the Partial modifier).
For Each child In container.GetTypeMembers(childName, childArity)
Dim sourceType = TryCast(child, SourceNamedTypeSymbol)
If sourceType IsNot Nothing Then
If (sourceType.ContainingModule Is sourceModule AndAlso
sourceType.DeclarationKind = childDeclKind) Then
Return sourceType
End If
End If
Next
Return Nothing
End Function
#End Region
#Region "Members (phase 5)"
''' <summary>
''' Structure to wrap the different arrays of members.
''' </summary>
Friend Class MembersAndInitializers
Friend ReadOnly Members As Dictionary(Of String, ImmutableArray(Of Symbol))
Friend ReadOnly StaticInitializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer))
Friend ReadOnly InstanceInitializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer))
Friend ReadOnly StaticInitializersSyntaxLength As Integer
Friend ReadOnly InstanceInitializersSyntaxLength As Integer
''' <summary>
''' Initializes a new instance of the <see cref="MembersAndInitializers" /> class.
''' </summary>
''' <param name="members">The members.</param>
''' <param name="staticInitializers">The static initializers.</param>
''' <param name="instanceInitializers">The instance initializers.</param>
Friend Sub New(
members As Dictionary(Of String, ImmutableArray(Of Symbol)),
staticInitializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer)),
instanceInitializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer)),
staticInitializersSyntaxLength As Integer,
instanceInitializersSyntaxLength As Integer)
Me.Members = members
Me.StaticInitializers = staticInitializers
Me.InstanceInitializers = instanceInitializers
Debug.Assert(staticInitializersSyntaxLength = If(staticInitializers.IsDefaultOrEmpty, 0, staticInitializers.Sum(Function(s) s.Sum(Function(i) If(Not i.IsMetadataConstant, i.Syntax.Span.Length, 0)))))
Debug.Assert(instanceInitializersSyntaxLength = If(instanceInitializers.IsDefaultOrEmpty, 0, instanceInitializers.Sum(Function(s) s.Sum(Function(i) i.Syntax.Span.Length))))
Me.StaticInitializersSyntaxLength = staticInitializersSyntaxLength
Me.InstanceInitializersSyntaxLength = instanceInitializersSyntaxLength
End Sub
End Class
''' <summary>
''' Accumulates different members kinds used while building the members.
''' </summary>
Friend NotInheritable Class MembersAndInitializersBuilder
Friend ReadOnly Members As Dictionary(Of String, ArrayBuilder(Of Symbol)) = New Dictionary(Of String, ArrayBuilder(Of Symbol))(IdentifierComparison.Comparer)
Friend Property StaticInitializers As ArrayBuilder(Of ImmutableArray(Of FieldOrPropertyInitializer))
Friend Property InstanceInitializers As ArrayBuilder(Of ImmutableArray(Of FieldOrPropertyInitializer))
Friend ReadOnly DeferredMemberDiagnostic As ArrayBuilder(Of Symbol) = ArrayBuilder(Of Symbol).GetInstance()
Friend StaticSyntaxLength As Integer = 0
Friend InstanceSyntaxLength As Integer = 0
Friend Function ToReadOnlyAndFree() As MembersAndInitializers
DeferredMemberDiagnostic.Free()
Dim readonlyMembers = New Dictionary(Of String, ImmutableArray(Of Symbol))(IdentifierComparison.Comparer)
For Each memberList In Members.Values
readonlyMembers.Add(memberList(0).Name, memberList.ToImmutableAndFree())
Next
Return New MembersAndInitializers(
readonlyMembers,
If(StaticInitializers IsNot Nothing, StaticInitializers.ToImmutableAndFree(), Nothing),
If(InstanceInitializers IsNot Nothing, InstanceInitializers.ToImmutableAndFree(), Nothing),
StaticSyntaxLength,
InstanceSyntaxLength)
End Function
End Class
''' <summary>
''' Adds a field initializer for the field to list of field initializers
''' </summary>
''' <param name="initializers">All initializers.</param>
''' <param name="computeInitializer">Compute the field initializer to add to the list of initializers.</param>
Friend Shared Sub AddInitializer(ByRef initializers As ArrayBuilder(Of FieldOrPropertyInitializer), computeInitializer As Func(Of Integer, FieldOrPropertyInitializer), ByRef aggregateSyntaxLength As Integer)
Dim initializer = computeInitializer(aggregateSyntaxLength)
If initializers Is Nothing Then
initializers = ArrayBuilder(Of FieldOrPropertyInitializer).GetInstance()
Else
' initializers should be added in syntax order
Debug.Assert(initializer.Syntax.SyntaxTree Is initializers.Last().Syntax.SyntaxTree)
Debug.Assert(initializer.Syntax.Span.Start > initializers.Last().Syntax.Span.Start)
End If
initializers.Add(initializer)
' A constant field of type decimal needs a field initializer, so
' check if it is a metadata constant, not just a constant to exclude
' decimals. Other constants do not need field initializers.
If Not initializer.IsMetadataConstant Then
' ignore leading and trailing trivia of the node
aggregateSyntaxLength += initializer.Syntax.Span.Length
End If
End Sub
''' <summary>
''' Adds an array of initializers to the member collections structure
''' </summary>
''' <param name="allInitializers">All initializers.</param>
''' <param name="siblings">The siblings.</param>
Friend Shared Sub AddInitializers(ByRef allInitializers As ArrayBuilder(Of ImmutableArray(Of FieldOrPropertyInitializer)), siblings As ArrayBuilder(Of FieldOrPropertyInitializer))
If siblings IsNot Nothing Then
If allInitializers Is Nothing Then
allInitializers = New ArrayBuilder(Of ImmutableArray(Of FieldOrPropertyInitializer))()
End If
allInitializers.Add(siblings.ToImmutableAndFree())
End If
End Sub
Protected Function GetTypeMembersDictionary() As Dictionary(Of String, ImmutableArray(Of NamedTypeSymbol))
If _lazyTypeMembers Is Nothing Then
Interlocked.CompareExchange(_lazyTypeMembers, MakeTypeMembers(), Nothing)
Debug.Assert(_lazyTypeMembers IsNot Nothing)
End If
Return _lazyTypeMembers
End Function
' Create symbols for all the nested types, and put them in a lookup indexed by (case-insensitive) name.
Private Function MakeTypeMembers() As Dictionary(Of String, ImmutableArray(Of NamedTypeSymbol))
Dim children As ImmutableArray(Of MergedTypeDeclaration) = _declaration.Children
Debug.Assert(s_emptyTypeMembers.Count = 0)
If children.IsEmpty Then
Return s_emptyTypeMembers
End If
Return children.Select(Function(decl) CreateNestedType(decl)).ToDictionary(
Function(decl) decl.Name,
IdentifierComparison.Comparer)
End Function
Friend Overrides Function GetTypeMembersUnordered() As ImmutableArray(Of NamedTypeSymbol)
Return GetTypeMembersDictionary().Flatten()
End Function
Public Overloads Overrides Function GetTypeMembers() As ImmutableArray(Of NamedTypeSymbol)
Return GetTypeMembersDictionary().Flatten(LexicalOrderSymbolComparer.Instance)
End Function
Public Overloads Overrides Function GetTypeMembers(name As String) As ImmutableArray(Of NamedTypeSymbol)
Dim members As ImmutableArray(Of NamedTypeSymbol) = Nothing
If GetTypeMembersDictionary().TryGetValue(name, members) Then
Return members
End If
Return ImmutableArray(Of NamedTypeSymbol).Empty
End Function
Public Overrides Function GetTypeMembers(name As String, arity As Integer) As ImmutableArray(Of NamedTypeSymbol)
Return GetTypeMembers(name).WhereAsArray(Function(t, arity_) t.Arity = arity_, arity)
End Function
Friend Overrides ReadOnly Property DefaultPropertyName As String
Get
If TypeKind <> TypeKind.Delegate Then
GetMembersAndInitializers() ' Ensure m_defaultPropertyName is set.
Else
Debug.Assert(_defaultPropertyName Is Nothing)
End If
Return _defaultPropertyName
End Get
End Property
Private ReadOnly Property MemberAndInitializerLookup As MembersAndInitializers
Get
Return GetMembersAndInitializers()
End Get
End Property
Private Function GetMembersAndInitializers() As MembersAndInitializers
If _lazyMembersAndInitializers Is Nothing Then
Dim diagBag = DiagnosticBag.GetInstance()
Dim membersAndInitializers = BuildMembersAndInitializers(diagBag)
m_containingModule.AtomicStoreReferenceAndDiagnostics(_lazyMembersAndInitializers, membersAndInitializers, diagBag, CompilationStage.Declare)
Debug.Assert(_lazyMembersAndInitializers IsNot Nothing)
diagBag.Free()
Dim unused = Me.KnownCircularStruct
#If DEBUG Then
VerifyMembers()
#End If
End If
Return _lazyMembersAndInitializers
End Function
#If DEBUG Then
Protected Overridable Sub VerifyMembers()
End Sub
#End If
Friend ReadOnly Property MembersHaveBeenCreated As Boolean
Get
Return _lazyMembersAndInitializers IsNot Nothing
End Get
End Property
#If DEBUG Then
' A thread local hash table to catch cases when BuildMembersAndInitializers
' is called recursively for the same symbol.
<ThreadStatic>
Private Shared s_SymbolsBuildingMembersAndInitializers As HashSet(Of SourceMemberContainerTypeSymbol)
#End If
Private Function BuildMembersAndInitializers(diagBag As DiagnosticBag) As MembersAndInitializers
Dim membersAndInitializers As MembersAndInitializers
#If DEBUG Then
If s_SymbolsBuildingMembersAndInitializers Is Nothing Then
s_SymbolsBuildingMembersAndInitializers = New HashSet(Of SourceMemberContainerTypeSymbol)(ReferenceEqualityComparer.Instance)
End If
Dim added As Boolean = s_SymbolsBuildingMembersAndInitializers.Add(Me)
Debug.Assert(added)
#End If
Try
' Get type members
Dim typeMembers = GetTypeMembersDictionary()
' Get non-type members
membersAndInitializers = BuildNonTypeMembers(diagBag)
_defaultPropertyName = DetermineDefaultPropertyName(membersAndInitializers.Members, diagBag)
' Find/process partial methods
ProcessPartialMethodsIfAny(membersAndInitializers.Members, diagBag)
' Merge types with non-types
For Each typeSymbols In typeMembers.Values
Dim nontypeSymbols As ImmutableArray(Of Symbol) = Nothing
Dim name = typeSymbols(0).Name
If Not membersAndInitializers.Members.TryGetValue(name, nontypeSymbols) Then
membersAndInitializers.Members.Add(name, StaticCast(Of Symbol).From(typeSymbols))
Else
membersAndInitializers.Members(name) = nontypeSymbols.Concat(StaticCast(Of Symbol).From(typeSymbols))
End If
Next
Finally
#If DEBUG Then
If added Then
s_SymbolsBuildingMembersAndInitializers.Remove(Me)
End If
#End If
End Try
Return membersAndInitializers
End Function
''' <summary> Examines the members collection and builds a set of partial methods if any, otherwise returns nothing </summary>
Private Function FindPartialMethodDeclarations(diagnostics As DiagnosticBag, members As Dictionary(Of String, ImmutableArray(Of Symbol))) As HashSet(Of SourceMemberMethodSymbol)
Dim partialMethods As HashSet(Of SourceMemberMethodSymbol) = Nothing
For Each memberGroup In members
For Each member In memberGroup.Value
Dim method = TryCast(member, SourceMemberMethodSymbol)
If method IsNot Nothing AndAlso method.IsPartial AndAlso method.MethodKind = MethodKind.Ordinary Then
If Not method.IsSub Then
Debug.Assert(method.Locations.Length = 1)
diagnostics.Add(ERRID.ERR_PartialMethodsMustBeSub1, method.NonMergedLocation, method.Name)
Else
If partialMethods Is Nothing Then
partialMethods = New HashSet(Of SourceMemberMethodSymbol)(ReferenceEqualityComparer.Instance)
End If
partialMethods.Add(method)
End If
End If
Next
Next
Return partialMethods
End Function
Private Sub ProcessPartialMethodsIfAny(members As Dictionary(Of String, ImmutableArray(Of Symbol)), diagnostics As DiagnosticBag)
' Detect all partial method declarations
Dim partialMethods As HashSet(Of SourceMemberMethodSymbol) = FindPartialMethodDeclarations(diagnostics, members)
If partialMethods Is Nothing Then
Return
End If
' we have at least one partial method, note that the methods we
' found may have the same names and/or signatures
' NOTE: we process partial methods one-by-one which is not optimal for the
' case where we have a bunch of partial methods with the same name.
' TODO: revise
While partialMethods.Count > 0
Dim originalPartialMethod As SourceMemberMethodSymbol = partialMethods.First()
partialMethods.Remove(originalPartialMethod)
' The best partial method
Dim bestPartialMethod As SourceMemberMethodSymbol = originalPartialMethod
Dim bestPartialMethodLocation As Location = bestPartialMethod.NonMergedLocation
Debug.Assert(bestPartialMethodLocation IsNot Nothing)
' The best partial method implementation
Dim bestImplMethod As SourceMemberMethodSymbol = Nothing
Dim bestImplLocation As Location = Nothing
' Process the members group by name
Dim memberGroup As ImmutableArray(Of Symbol) = members(originalPartialMethod.Name)
For Each member In memberGroup
Dim candidate As SourceMemberMethodSymbol = TryCast(member, SourceMemberMethodSymbol)
If candidate IsNot Nothing AndAlso candidate IsNot originalPartialMethod AndAlso candidate.MethodKind = MethodKind.Ordinary Then
If ComparePartialMethodSignatures(originalPartialMethod, candidate) Then
' candidate location
Dim candidateLocation As Location = candidate.NonMergedLocation
Debug.Assert(candidateLocation IsNot Nothing)
If partialMethods.Contains(candidate) Then
' partial-partial conflict
partialMethods.Remove(candidate)
' the 'best' partial method is the one with the 'smallest'
' location, we should report errors on the other
Dim candidateIsBigger As Boolean = Me.DeclaringCompilation.CompareSourceLocations(bestPartialMethodLocation, candidateLocation) < 0
Dim reportOnMethod As SourceMemberMethodSymbol = If(candidateIsBigger, candidate, bestPartialMethod)
Dim nameToReport As String = reportOnMethod.Name
diagnostics.Add(ERRID.ERR_OnlyOnePartialMethodAllowed2,
If(candidateIsBigger, candidateLocation, bestPartialMethodLocation),
nameToReport, nameToReport)
reportOnMethod.SuppressDuplicateProcDefDiagnostics = True
' change the best partial method if needed
If Not candidateIsBigger Then
bestPartialMethod = candidate
bestPartialMethodLocation = candidateLocation
End If
ElseIf Not candidate.IsPartial Then
' if there are more than one method
If bestImplMethod Is Nothing Then
bestImplMethod = candidate
bestImplLocation = candidateLocation
Else
' the 'best' implementation method is the one with the 'smallest'
' location, we should report errors on the others
Dim candidateIsBigger = Me.DeclaringCompilation.CompareSourceLocations(bestImplLocation, candidateLocation) < 0
Dim reportOnMethod As SourceMemberMethodSymbol = If(candidateIsBigger, candidate, bestImplMethod)
Dim reportedName As String = reportOnMethod.Name
diagnostics.Add(ERRID.ERR_OnlyOneImplementingMethodAllowed3,
If(candidateIsBigger, candidateLocation, bestImplLocation),
reportedName, reportedName, reportedName)
reportOnMethod.SuppressDuplicateProcDefDiagnostics = True
' change the best implementation if needed
If Not candidateIsBigger Then
bestImplMethod = candidate
bestImplLocation = candidateLocation
End If
End If
End If
' NOTE: the rest of partial methods are already processed, those can be safely ignored
End If
End If
Next
' Report ERR_PartialMethodMustBeEmpty
If bestPartialMethod.BlockSyntax IsNot Nothing AndAlso bestPartialMethod.BlockSyntax.Statements.Count > 0 Then
diagnostics.Add(ERRID.ERR_PartialMethodMustBeEmpty, bestPartialMethodLocation)
End If
If bestImplMethod IsNot Nothing Then
' We found the partial method implementation
' Remove the best implementation from members
' NOTE: conflicting partial method declarations and implementations are NOT removed
Dim newMembers = ArrayBuilder(Of Symbol).GetInstance()
For i = 0 To memberGroup.Length - 1
Dim member As Symbol = memberGroup(i)
If bestImplMethod IsNot member Then
newMembers.Add(member)
End If
Next
members(originalPartialMethod.Name) = newMembers.ToImmutableAndFree()
' Assign implementation to best partial method
SourceMemberMethodSymbol.InitializePartialMethodParts(bestPartialMethod, bestImplMethod)
' Report errors on partial method implementation
ReportErrorsOnPartialMethodImplementation(bestPartialMethod, bestImplMethod, bestImplLocation, diagnostics)
Else
' There is no implementation
SourceMemberMethodSymbol.InitializePartialMethodParts(bestPartialMethod, Nothing)
End If
End While
End Sub
Private Sub ReportErrorsOnPartialMethodImplementation(partialMethod As SourceMethodSymbol,
implMethod As SourceMethodSymbol,
implMethodLocation As Location,
diagnostics As DiagnosticBag)
' Report 'Method '...' must be declared 'Private' in order to implement partial method '...'
If implMethod.DeclaredAccessibility <> Accessibility.Private Then
diagnostics.Add(ERRID.ERR_ImplementationMustBePrivate2,
implMethodLocation,
implMethod.Name, partialMethod.Name)
End If
' Check method parameters' names
If partialMethod.ParameterCount > 0 Then
Debug.Assert(partialMethod.ParameterCount = implMethod.ParameterCount)
Dim declMethodParams As ImmutableArray(Of ParameterSymbol) = partialMethod.Parameters
Dim implMethodParams As ImmutableArray(Of ParameterSymbol) = implMethod.Parameters
For index = 0 To declMethodParams.Length - 1
Dim declParameter As ParameterSymbol = declMethodParams(index)
Dim implParameter As ParameterSymbol = implMethodParams(index)
' Check type parameter name
If Not CaseInsensitiveComparison.Equals(declParameter.Name, implParameter.Name) Then
Debug.Assert(implParameter.Locations.Length = 1)
diagnostics.Add(ERRID.ERR_PartialMethodParamNamesMustMatch3,
implParameter.Locations(0),
implParameter.Name, declParameter.Name, implMethod.Name)
End If
Next
End If
' Generic type names/constraints
If implMethod.Arity > 0 Then
Dim declTypeParams As ImmutableArray(Of TypeParameterSymbol) = partialMethod.TypeParameters
Dim implTypeParams As ImmutableArray(Of TypeParameterSymbol) = implMethod.TypeParameters
Debug.Assert(declTypeParams.Length = implTypeParams.Length)
For index = 0 To declTypeParams.Length - 1
Dim declParameter As TypeParameterSymbol = declTypeParams(index)
Dim implParameter As TypeParameterSymbol = implTypeParams(index)
' Check parameter name
If Not CaseInsensitiveComparison.Equals(declParameter.Name, implParameter.Name) Then
Debug.Assert(implParameter.Locations.Length = 1)
diagnostics.Add(ERRID.ERR_PartialMethodTypeParamNameMismatch3,
implParameter.Locations(0),
implParameter.Name, declParameter.Name, implMethod.Name)
End If
Next
' If type parameters constraints don't match at least on one of type
' parameters, report an error on the implementation method
Dim options = SymbolComparisonResults.ArityMismatch Or SymbolComparisonResults.ConstraintMismatch
If MethodSignatureComparer.DetailedCompare(partialMethod, implMethod, options) <> Nothing Then
diagnostics.Add(ERRID.ERR_PartialMethodGenericConstraints2,
implMethodLocation,
implMethod.Name, partialMethod.Name)
End If
End If
End Sub
''' <summary>
''' Compares two methods to check if the 'candidate' can be an implementation of the 'partialDeclaration'.
''' </summary>
Private Function ComparePartialMethodSignatures(partialDeclaration As SourceMethodSymbol, candidate As SourceMethodSymbol) As Boolean
' Don't check values of optional parameters yet, this might cause an infinite cycle.
' Don't check ParamArray mismatch either, might cause us to bind attributes too early.
Dim comparisons = SymbolComparisonResults.AllMismatches And
Not (SymbolComparisonResults.CallingConventionMismatch Or
SymbolComparisonResults.ConstraintMismatch Or
SymbolComparisonResults.OptionalParameterValueMismatch Or
SymbolComparisonResults.ParamArrayMismatch)
Dim result As SymbolComparisonResults = MethodSignatureComparer.DetailedCompare(partialDeclaration, candidate, comparisons)
If result <> Nothing Then
Return False
End If
' Dev10 also compares EQ_Flags { Shared|Overrides|MustOverride|Overloads }, but ignores 'Overloads'
Return partialDeclaration.IsShared = candidate.IsShared AndAlso
partialDeclaration.IsOverrides = candidate.IsOverrides AndAlso
partialDeclaration.IsMustOverride = candidate.IsMustOverride
End Function
Friend Overrides ReadOnly Property KnownCircularStruct As Boolean
Get
If _lazyStructureCycle = ThreeState.Unknown Then
If Not Me.IsStructureType Then
_lazyStructureCycle = ThreeState.False
Else
Dim diagnostics = DiagnosticBag.GetInstance()
Dim hasCycle = Me.CheckStructureCircularity(diagnostics)
' In either case we use AtomicStoreIntegerAndDiagnostics.
m_containingModule.AtomicStoreIntegerAndDiagnostics(_lazyStructureCycle,
If(hasCycle, ThreeState.True, ThreeState.False),
ThreeState.Unknown,
diagnostics,
CompilationStage.Declare)
diagnostics.Free()
End If
End If
Return _lazyStructureCycle = ThreeState.True
End Get
End Property
''' <summary>
''' Poolable data set to be used in structure circularity detection.
''' </summary>
Private Class StructureCircularityDetectionDataSet
''' <summary>
''' Following C# implementation we keep up to 32 data sets so that we do not need to allocate
''' them over and over. In this implementation though, circularity detection in one type can trigger
''' circularity detection in other types while it traverses the types tree. The traversal is being
''' performed breadth-first, so the number of data sets used by one thread is not longer than the
''' length of the longest structure-in-structure nesting chain.
''' </summary>
Private Shared ReadOnly s_pool As New ObjectPool(Of StructureCircularityDetectionDataSet)(
Function() New StructureCircularityDetectionDataSet(), 32)
''' <summary> Set of processed structure types </summary>
Public ReadOnly ProcessedTypes As HashSet(Of NamedTypeSymbol)
''' <summary> Queue element structure </summary>
Public Structure QueueElement
Public ReadOnly Type As NamedTypeSymbol
Public ReadOnly Path As ConsList(Of FieldSymbol)
Public Sub New(type As NamedTypeSymbol, path As ConsList(Of FieldSymbol))
Debug.Assert(type IsNot Nothing)
Debug.Assert(path IsNot Nothing)
Me.Type = type
Me.Path = path
End Sub
End Structure
''' <summary> Queue of the types to be processed </summary>
Public ReadOnly Queue As Queue(Of QueueElement)
Private Sub New()
ProcessedTypes = New HashSet(Of NamedTypeSymbol)()
Queue = New Queue(Of QueueElement)
End Sub
Public Shared Function GetInstance() As StructureCircularityDetectionDataSet
Return s_pool.Allocate()
End Function
Public Sub Free()
Me.Queue.Clear()
Me.ProcessedTypes.Clear()
s_pool.Free(Me)
End Sub
End Class
''' <summary>
''' Analyzes structure type for circularities. Reports only errors relevant for 'structBeingAnalyzed' type.
''' </summary>
''' <remarks>
''' When VB Dev10 detects circularity it reports the error only once for each cycle. Thus, if the cycle
''' is {S1 --> S2 --> S3 --> S1}, only one error will be reported, which one of S1/S2/S3 will have error
''' is non-deterministic (depends on the order of symbols in a hash table).
'''
''' Moreover, Dev10 analyzes the type graph and reports only one error in case S1 --> S2 --> S1 even if
''' there are two fields referencing S2 from S1.
'''
''' Example:
''' Structure S2
''' Dim s1 As S1
''' End Structure
'''
''' Structure S3
''' Dim s1 As S1
''' End Structure
'''
''' Structure S1
''' Dim s2 As S2 ' ERROR
''' Dim s2_ As S2 ' NO ERROR
''' Dim s3 As S3 ' ERROR
''' End Structure
'''
''' Dev10 also reports only one error for all the cycles starting with the same field, which one is reported
''' depends on the declaration order. Current implementation reports all of the cycles for consistency.
''' See testcases MultiplyCyclesInStructure03 and MultiplyCyclesInStructure04 (report different errors in Dev10).
''' </remarks>
Private Function CheckStructureCircularity(diagnostics As DiagnosticBag) As Boolean
' Must be a structure
Debug.Assert(Me.IsValueType AndAlso Not Me.IsTypeParameter)
' Allocate data set
Dim data = StructureCircularityDetectionDataSet.GetInstance()
data.Queue.Enqueue(New StructureCircularityDetectionDataSet.QueueElement(Me, ConsList(Of FieldSymbol).Empty))
Dim hasCycle = False
Try
While data.Queue.Count > 0
Dim current = data.Queue.Dequeue()
If Not data.ProcessedTypes.Add(current.Type) Then
' In some cases the queue may contain two same types which are not processed yet
Continue While
End If
Dim cycleReportedForCurrentType As Boolean = False
' iterate over non-static fields of structure data type
For Each member In current.Type.GetMembers()
Dim field = TryCast(member, FieldSymbol)
If field IsNot Nothing AndAlso Not field.IsShared Then
Dim fieldType = TryCast(field.Type, NamedTypeSymbol)
If fieldType IsNot Nothing AndAlso fieldType.IsValueType Then
' if the type is constructed from a generic structure, we should
' process ONLY fields which types are instantiated from type arguments
If Not field.IsDefinition AndAlso field.Type.Equals(field.OriginalDefinition.Type) Then
Continue For
End If
If fieldType.OriginalDefinition.Equals(Me) Then
' a cycle detected
If Not cycleReportedForCurrentType Then
' the cycle includes 'current.Path' and ends with 'field'; the order is reversed in the list
Dim cycleFields = New ConsList(Of FieldSymbol)(field, current.Path)
' generate a message info
Dim diagnosticInfos = ArrayBuilder(Of DiagnosticInfo).GetInstance()
Dim firstField As FieldSymbol = Nothing ' after the cycle is processed this will hold the last element in the list
While Not cycleFields.IsEmpty
firstField = cycleFields.Head
' generate next field description
diagnosticInfos.Add(ErrorFactory.ErrorInfo(ERRID.ERR_RecordEmbeds2,
firstField.ContainingType,
firstField.Type,
firstField.Name))
cycleFields = cycleFields.Tail
End While
diagnosticInfos.ReverseContents()
Debug.Assert(firstField IsNot Nothing)
' Report an error
Dim symbolToReportErrorOn As Symbol = If(firstField.AssociatedSymbol, DirectCast(firstField, Symbol))
Debug.Assert(symbolToReportErrorOn.Locations.Length > 0)
diagnostics.Add(ERRID.ERR_RecordCycle2,
symbolToReportErrorOn.Locations(0),
firstField.ContainingType.Name,
New CompoundDiagnosticInfo(diagnosticInfos.ToArrayAndFree()))
' Don't report errors for other fields of this type referencing 'structBeingAnalyzed'
cycleReportedForCurrentType = True
hasCycle = True
End If
ElseIf Not data.ProcessedTypes.Contains(fieldType) Then
' Add to the queue if we don't know yet if it was processed
If Not fieldType.IsDefinition Then
' Types constructed from generic types are considered to be a separate types. We never report
' errors on such types. We also process only fields actually changed compared to original generic type.
data.Queue.Enqueue(New StructureCircularityDetectionDataSet.QueueElement(
fieldType, New ConsList(Of FieldSymbol)(field, current.Path)))
' The original Generic type is added using regular rules (see next note).
fieldType = fieldType.OriginalDefinition
End If
' NOTE: we want to make sure we report the same error for the same types
' consistently and don't depend on the call order; this solution uses
' the following approach:
' (a) for each cycle we report the error only on the type which is
' 'smaller' than the other types in this cycle; the criteria
' used for detection of the 'smallest' type does not matter;
' (b) thus, this analysis only considers the cycles consisting of the
' types which are 'bigger' than 'structBeingAnalyzed' because we will not
' report the error regarding this cycle for this type anyway
Dim stepIntoType As Boolean = DetectTypeCircularity_ShouldStepIntoType(fieldType)
If stepIntoType Then
' enqueue to be processed
data.Queue.Enqueue(New StructureCircularityDetectionDataSet.QueueElement(
fieldType, New ConsList(Of FieldSymbol)(field, current.Path)))
Else
' should not process
data.ProcessedTypes.Add(fieldType)
End If
End If
End If
End If
Next
End While
Finally
data.Free()
End Try
Return hasCycle
End Function
''' <summary>
''' Simple check of whether or not we should step into the type 'typeToTest' during
''' type graph traversal inside 'DetectStructureCircularity' or 'GetDependenceChain'.
'''
''' The following rules are in place:
''' (a) we order all symbols according their first source location
''' comparison rules: first, source file names are compared,
''' then SourceSpan.Start is used for symbols inside the same file;
''' (b) given this order we enter the loop if only 'typeToTest' is 'less' than
''' 'structBeingAnalyzed';
''' (c) we also always enter types from other modules
'''
''' !!! To be ONLY used in 'CheckStructureCircularity'.
''' </summary>
''' <returns>True if detect type circularity code should step into 'typeToTest' type </returns>
Friend Function DetectTypeCircularity_ShouldStepIntoType(typeToTest As NamedTypeSymbol) As Boolean
If typeToTest.ContainingModule Is Nothing OrElse Not typeToTest.ContainingModule.Equals(Me.ContainingModule) Then
' Types from other modules should never be considered target types
Return True
End If
' We can not get the relative order of a declaration without a source location
If typeToTest.Locations.IsEmpty Then
Return True
End If
' We use simple comparison based on source location
Dim typeToTestLocation = typeToTest.Locations(0)
Debug.Assert(Me.Locations.Length > 0)
Dim structBeingAnalyzedLocation = Me.Locations(0)
Dim compilation = Me.DeclaringCompilation
Dim fileCompResult = compilation.CompareSourceLocations(typeToTestLocation, structBeingAnalyzedLocation)
' NOTE: we use '>=' for locations comparison; this is a safeguard against the case where two different
' types are declared in the files with same file name (if possible) and have the same location;
' if we used '>' we would not report the cycle, with '>=' we will report the cycle twice.
Return (fileCompResult > 0) OrElse
((fileCompResult = 0) AndAlso typeToTestLocation.SourceSpan.Start >= structBeingAnalyzedLocation.SourceSpan.Start)
End Function
Private Function DetermineDefaultPropertyName(membersByName As Dictionary(Of String, ImmutableArray(Of Symbol)), diagBag As DiagnosticBag) As String
Dim defaultPropertyName As String = Nothing
For Each pair In membersByName
Dim name = pair.Key
Dim members = pair.Value
Dim defaultProperty As PropertySymbol = Nothing
' Check if any of the properties are marked default.
For Each member In members
If member.Kind = SymbolKind.Property Then
Dim propertySymbol = DirectCast(member, PropertySymbol)
If propertySymbol.IsDefault Then
If defaultPropertyName Is Nothing Then
defaultProperty = propertySymbol
defaultPropertyName = name
If Not defaultProperty.ShadowsExplicitly Then
CheckDefaultPropertyAgainstAllBases(Me, defaultPropertyName, propertySymbol.Locations(0), diagBag)
End If
Else
' "'Default' can be applied to only one property name in a {0}."
diagBag.Add(ERRID.ERR_DuplicateDefaultProps1, propertySymbol.Locations(0), GetKindText())
End If
Exit For
End If
End If
Next
If defaultPropertyName IsNot Nothing AndAlso defaultPropertyName = name Then
Debug.Assert(defaultProperty IsNot Nothing)
' Report an error for any property with this name not marked as default.
For Each member In members
If (member.Kind = SymbolKind.Property) Then
Dim propertySymbol = DirectCast(member, SourcePropertySymbol)
If Not propertySymbol.IsDefault Then
' "'{0}' and '{1}' cannot overload each other because only one is declared 'Default'."
diagBag.Add(ERRID.ERR_DefaultMissingFromProperty2, propertySymbol.Locations(0), defaultProperty, propertySymbol)
End If
End If
Next
End If
Next
Return defaultPropertyName
End Function
' Check all bases of "namedType" and warn if they have a default property named "defaultPropertyName".
Private Sub CheckDefaultPropertyAgainstAllBases(namedType As NamedTypeSymbol, defaultPropertyName As String, location As Location, diagBag As DiagnosticBag)
If namedType.IsInterfaceType() Then
For Each iface In namedType.InterfacesNoUseSiteDiagnostics
CheckDefaultPropertyAgainstBase(defaultPropertyName, iface, location, diagBag)
Next
Else
CheckDefaultPropertyAgainstBase(defaultPropertyName, namedType.BaseTypeNoUseSiteDiagnostics, location, diagBag)
End If
End Sub
' Check and warn if "baseType" has a default property named "defaultProperty Name.
' If "baseType" doesn't have a default property, check its base types.
Private Sub CheckDefaultPropertyAgainstBase(defaultPropertyName As String, baseType As NamedTypeSymbol, location As Location, diagBag As DiagnosticBag)
If baseType IsNot Nothing Then
Dim baseDefaultPropertyName = baseType.DefaultPropertyName
If baseDefaultPropertyName IsNot Nothing Then
If Not CaseInsensitiveComparison.Equals(defaultPropertyName, baseDefaultPropertyName) Then
' BC40007: Default property '{0}' conflicts with the default property '{1}' in the base {2} '{3}'. '{0}' will be the default property
diagBag.Add(ERRID.WRN_DefaultnessShadowed4, location,
defaultPropertyName, baseDefaultPropertyName, baseType.GetKindText(), CustomSymbolDisplayFormatter.ShortErrorName(baseType))
End If
Else
' If this type didn't have a default property name, recursively check base(s) of this base.
' If this type did have a default property name, don't go any further.
CheckDefaultPropertyAgainstAllBases(baseType, defaultPropertyName, location, diagBag)
End If
End If
End Sub
''' <summary>
''' Returns true if at least one of the elements of this list needs to be injected into a
''' constructor because it's not a const or it is a const and it's type is either decimal
''' or date. Non const fields always require a constructor, so this function should be called to
''' determine if a synthesized constructor is needed that is not listed in members list.
''' </summary>
Friend Function AnyInitializerToBeInjectedIntoConstructor(
initializerSet As IEnumerable(Of ImmutableArray(Of FieldOrPropertyInitializer)),
includingNonMetadataConstants As Boolean
) As Boolean
If initializerSet IsNot Nothing Then
For Each initializers In initializerSet
For Each initializer In initializers
Dim fieldOrPropertyArray As ImmutableArray(Of Symbol) = initializer.FieldsOrProperties
If Not fieldOrPropertyArray.IsDefault Then
Debug.Assert(fieldOrPropertyArray.Length > 0)
Dim fieldOrProperty As Symbol = fieldOrPropertyArray.First
If fieldOrProperty.Kind = SymbolKind.Property Then
' All properties require initializers to be injected
Return True
Else
Dim fieldSymbol = DirectCast(fieldOrProperty, FieldSymbol)
If Not fieldSymbol.IsConst OrElse includingNonMetadataConstants AndAlso fieldSymbol.IsConstButNotMetadataConstant Then
Return True
End If
End If
End If
Next
Next
End If
Return False
End Function
''' <summary>
''' Performs a check for overloads/overrides/shadows conflicts, generates diagnostics.
''' </summary>
''' <param name="membersAndInitializers"></param>
''' <param name="diagBag"></param>
''' <remarks></remarks>
Private Sub CheckForOverloadOverridesShadowsClashesInSameType(membersAndInitializers As MembersAndInitializers, diagBag As DiagnosticBag)
For Each member In membersAndInitializers.Members
' list may contain both properties and methods
Dim checkProperties As Boolean = True
Dim checkMethods As Boolean = True
' result
Dim explicitlyShadows As Boolean = False
Dim explicitlyOverloads As Boolean = False
' symbol flags
Dim shadowsExplicitly As Boolean
Dim overloadsExplicitly As Boolean
Dim overridesExplicitly As Boolean
For Each symbol In member.Value
' only ordinary methods
Select Case symbol.Kind
Case SymbolKind.Method
If Not checkMethods Then
Continue For
End If
' skip properties from with this name if any
checkProperties = False
Case SymbolKind.Property
If Not checkProperties Then
Continue For
End If
' skip methods from with this name if any
checkMethods = False
Case Else
' other kind of member cancels the analysis
explicitlyShadows = False
explicitlyOverloads = False
Exit For
End Select
' initialize symbol flags
If (GetExplicitSymbolFlags(symbol, shadowsExplicitly, overloadsExplicitly, overridesExplicitly)) Then
If shadowsExplicitly Then
' if the method/property shadows explicitly the rest of the methods may be skipped
explicitlyShadows = True
Exit For
ElseIf overloadsExplicitly OrElse overridesExplicitly Then
explicitlyOverloads = True
' continue search
End If
End If
Next
' skip the whole name
If explicitlyShadows OrElse explicitlyOverloads Then
' all symbols are SourceMethodSymbol
For Each symbol In member.Value
If (symbol.Kind = SymbolKind.Method AndAlso checkMethods) OrElse (symbol.IsPropertyAndNotWithEvents AndAlso checkProperties) Then
' initialize symbol flags
If (GetExplicitSymbolFlags(symbol, shadowsExplicitly, overloadsExplicitly, overridesExplicitly)) Then
If explicitlyShadows Then
If Not shadowsExplicitly Then
Debug.Assert(symbol.Locations.Length > 0)
diagBag.Add(ERRID.ERR_MustShadow2, symbol.Locations(0), symbol.GetKindText(), symbol.Name)
End If
ElseIf explicitlyOverloads Then
If Not overridesExplicitly AndAlso Not overloadsExplicitly Then
Debug.Assert(symbol.Locations.Length > 0)
diagBag.Add(ERRID.ERR_MustBeOverloads2, symbol.Locations(0), symbol.GetKindText(), symbol.Name)
End If
End If
End If
End If
Next
End If
Next
End Sub
Private Function GetExplicitSymbolFlags(symbol As Symbol, ByRef shadowsExplicitly As Boolean, ByRef overloadsExplicitly As Boolean, ByRef overridesExplicitly As Boolean) As Boolean
Select Case symbol.Kind
Case SymbolKind.Method
Dim sourceMethodSymbol As SourceMethodSymbol = TryCast(symbol, SourceMethodSymbol)
If (sourceMethodSymbol Is Nothing) Then
Return False
End If
shadowsExplicitly = sourceMethodSymbol.ShadowsExplicitly
overloadsExplicitly = sourceMethodSymbol.OverloadsExplicitly
overridesExplicitly = sourceMethodSymbol.OverridesExplicitly
Return sourceMethodSymbol.MethodKind = MethodKind.Ordinary OrElse sourceMethodSymbol.MethodKind = MethodKind.DeclareMethod
Case SymbolKind.Property
Dim sourcePropertySymbol As SourcePropertySymbol = TryCast(symbol, SourcePropertySymbol)
If (sourcePropertySymbol Is Nothing) Then
Return False
End If
shadowsExplicitly = sourcePropertySymbol.ShadowsExplicitly
overloadsExplicitly = sourcePropertySymbol.OverloadsExplicitly
overridesExplicitly = sourcePropertySymbol.OverridesExplicitly
Return True
Case Else
Throw ExceptionUtilities.UnexpectedValue(symbol.Kind)
End Select
End Function
' Declare all the non-type members and put them in a list.
Private Function BuildNonTypeMembers(diagnostics As DiagnosticBag) As MembersAndInitializers
Dim membersBuilder As New MembersAndInitializersBuilder()
AddDeclaredNonTypeMembers(membersBuilder, diagnostics)
' Add the default constructor, if needed.
AddDefaultConstructorIfNeeded(membersBuilder, False, membersBuilder.InstanceInitializers, diagnostics)
' If there is a shared field, a shared constructor must be synthesized and added to the member list.
' Const fields of type Date or Decimal also require a synthesized shared constructor, but there was a decision
' to not add this to the member list in this case.
AddDefaultConstructorIfNeeded(membersBuilder, True, membersBuilder.StaticInitializers, diagnostics)
' If there are any "Handles" methods, optimistically create methods/ctors that would be hosting
' hookup code.
AddWithEventsHookupConstructorsIfNeeded(membersBuilder, diagnostics)
' Add "Group Class" members.
AddGroupClassMembersIfNeeded(membersBuilder, diagnostics)
' Add synthetic Main method, if needed.
AddEntryPointIfNeeded(membersBuilder)
CheckMemberDiagnostics(membersBuilder, diagnostics)
Dim membersAndInitializers = membersBuilder.ToReadOnlyAndFree()
' Check for overloads, overrides, shadows and implicit shadows clashes
CheckForOverloadOverridesShadowsClashesInSameType(membersAndInitializers, diagnostics)
Return membersAndInitializers
End Function
Protected Overridable Sub AddEntryPointIfNeeded(membersBuilder As MembersAndInitializersBuilder)
End Sub
Protected MustOverride Sub AddDeclaredNonTypeMembers(membersBuilder As MembersAndInitializersBuilder, diagnostics As DiagnosticBag)
Protected Overridable Sub AddGroupClassMembersIfNeeded(membersBuilder As MembersAndInitializersBuilder, diagnostics As DiagnosticBag)
End Sub
' Create symbol(s) for member syntax and add them to the member list
Protected Sub AddMember(memberSyntax As StatementSyntax,
binder As Binder,
diagBag As DiagnosticBag,
members As MembersAndInitializersBuilder,
ByRef staticInitializers As ArrayBuilder(Of FieldOrPropertyInitializer),
ByRef instanceInitializers As ArrayBuilder(Of FieldOrPropertyInitializer),
reportAsInvalid As Boolean)
' Partial methods are implemented by a postpass that matches up the declaration with the implementation.
' Here we treat them as independent methods.
Select Case memberSyntax.Kind
Case SyntaxKind.FieldDeclaration
Dim fieldDecl = DirectCast(memberSyntax, FieldDeclarationSyntax)
If reportAsInvalid Then
diagBag.Add(ERRID.ERR_InvalidInNamespace, fieldDecl.GetLocation())
End If
' Declare all variables that a declared by this syntax, and add them to the list.
SourceMemberFieldSymbol.Create(Me, fieldDecl, binder, members, staticInitializers, instanceInitializers, diagBag)
Case _
SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.ConstructorBlock,
SyntaxKind.OperatorBlock
Dim methodDecl = DirectCast(memberSyntax, MethodBlockBaseSyntax).BlockStatement
If reportAsInvalid Then
diagBag.Add(ERRID.ERR_InvalidInNamespace, methodDecl.GetLocation())
End If
Dim methodSymbol = CreateMethodMember(methodDecl, binder, diagBag)
If methodSymbol IsNot Nothing Then
AddMember(methodSymbol, binder, members, omitDiagnostics:=False)
End If
Case _
SyntaxKind.SubStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.SubNewStatement,
SyntaxKind.DeclareSubStatement,
SyntaxKind.DeclareFunctionStatement,
SyntaxKind.OperatorStatement
Dim methodDecl = DirectCast(memberSyntax, MethodBaseSyntax)
If reportAsInvalid Then
diagBag.Add(ERRID.ERR_InvalidInNamespace, methodDecl.GetLocation())
End If
Dim methodSymbol = CreateMethodMember(DirectCast(memberSyntax, MethodBaseSyntax), binder, diagBag)
If methodSymbol IsNot Nothing Then
AddMember(methodSymbol, binder, members, omitDiagnostics:=False)
End If
Case SyntaxKind.PropertyBlock
Dim propertyDecl = DirectCast(memberSyntax, PropertyBlockSyntax)
If reportAsInvalid Then
diagBag.Add(ERRID.ERR_InvalidInNamespace, propertyDecl.PropertyStatement.GetLocation())
End If
CreateProperty(propertyDecl.PropertyStatement, propertyDecl, binder, diagBag, members, staticInitializers, instanceInitializers)
Case SyntaxKind.PropertyStatement
Dim propertyDecl = DirectCast(memberSyntax, PropertyStatementSyntax)
If reportAsInvalid Then
diagBag.Add(ERRID.ERR_InvalidInNamespace, propertyDecl.GetLocation())
End If
CreateProperty(propertyDecl, Nothing, binder, diagBag, members, staticInitializers, instanceInitializers)
Case SyntaxKind.LabelStatement
' TODO (tomat): should be added to the initializers
Exit Select
Case SyntaxKind.EventStatement
Dim eventDecl = DirectCast(memberSyntax, EventStatementSyntax)
CreateEvent(eventDecl, Nothing, binder, diagBag, members)
Case SyntaxKind.EventBlock
Dim eventDecl = DirectCast(memberSyntax, EventBlockSyntax)
CreateEvent(eventDecl.EventStatement, eventDecl, binder, diagBag, members)
Case Else
If memberSyntax.Kind = SyntaxKind.EmptyStatement OrElse TypeOf memberSyntax Is ExecutableStatementSyntax Then
If binder.BindingTopLevelScriptCode Then
Debug.Assert(Not reportAsInvalid)
Dim initializer = Function(precedingInitializersLength As Integer)
Return New FieldOrPropertyInitializer(binder.GetSyntaxReference(memberSyntax), precedingInitializersLength)
End Function
SourceNamedTypeSymbol.AddInitializer(instanceInitializers, initializer, members.InstanceSyntaxLength)
ElseIf reportAsInvalid Then
diagBag.Add(ERRID.ERR_InvalidInNamespace, memberSyntax.GetLocation())
End If
End If
End Select
End Sub
Private Sub CreateProperty(syntax As PropertyStatementSyntax,
blockSyntaxOpt As PropertyBlockSyntax,
binder As Binder,
diagBag As DiagnosticBag,
members As MembersAndInitializersBuilder,
ByRef staticInitializers As ArrayBuilder(Of FieldOrPropertyInitializer),
ByRef instanceInitializers As ArrayBuilder(Of FieldOrPropertyInitializer))
Dim propertySymbol = SourcePropertySymbol.Create(Me, binder, syntax, blockSyntaxOpt, diagBag)
AddPropertyAndAccessors(propertySymbol, binder, members)
' initialization can happen because of a "= value" (InitializerOpt) or a "As New Type(...)" (AsClauseOpt)
Dim initializerOpt = syntax.Initializer
Dim asClauseOpt = syntax.AsClause
Dim equalsValueOrAsNewSyntax As VisualBasicSyntaxNode
If asClauseOpt IsNot Nothing AndAlso asClauseOpt.Kind = SyntaxKind.AsNewClause Then
equalsValueOrAsNewSyntax = asClauseOpt
Else
equalsValueOrAsNewSyntax = initializerOpt
End If
If equalsValueOrAsNewSyntax IsNot Nothing Then
Dim initializerOptRef = binder.GetSyntaxReference(equalsValueOrAsNewSyntax)
Dim initializer = Function(precedingInitializersLength As Integer)
Return New FieldOrPropertyInitializer(propertySymbol, initializerOptRef, precedingInitializersLength)
End Function
If propertySymbol.IsShared Then
AddInitializer(staticInitializers, initializer, members.StaticSyntaxLength)
Else
' auto implemented properties inside of structures can only have an initialization value
' if they are shared.
If propertySymbol.IsAutoProperty AndAlso
propertySymbol.ContainingType.TypeKind = TypeKind.Structure Then
Binder.ReportDiagnostic(diagBag, syntax.Identifier, ERRID.ERR_AutoPropertyInitializedInStructure)
End If
AddInitializer(instanceInitializers, initializer, members.InstanceSyntaxLength)
End If
End If
End Sub
Private Sub CreateEvent(syntax As EventStatementSyntax,
blockSyntaxOpt As EventBlockSyntax,
binder As Binder,
diagBag As DiagnosticBag,
members As MembersAndInitializersBuilder)
Dim propertySymbol = New SourceEventSymbol(Me, binder, syntax, blockSyntaxOpt, diagBag)
AddEventAndAccessors(propertySymbol, binder, members)
End Sub
Private Function CreateMethodMember(methodBaseSyntax As MethodBaseSyntax,
binder As Binder,
diagBag As DiagnosticBag) As SourceMethodSymbol
Select Case methodBaseSyntax.Kind
Case SyntaxKind.SubStatement, SyntaxKind.FunctionStatement
Return SourceMethodSymbol.CreateRegularMethod(Me, DirectCast(methodBaseSyntax, MethodStatementSyntax), binder, diagBag)
Case SyntaxKind.SubNewStatement
Return SourceMethodSymbol.CreateConstructor(Me, DirectCast(methodBaseSyntax, SubNewStatementSyntax), binder, diagBag)
Case SyntaxKind.OperatorStatement
Return SourceMethodSymbol.CreateOperator(Me, DirectCast(methodBaseSyntax, OperatorStatementSyntax), binder, diagBag)
Case SyntaxKind.DeclareSubStatement, SyntaxKind.DeclareFunctionStatement
Return SourceMethodSymbol.CreateDeclareMethod(Me, DirectCast(methodBaseSyntax, DeclareStatementSyntax), binder, diagBag)
Case Else
Throw ExceptionUtilities.UnexpectedValue(methodBaseSyntax.Kind)
End Select
End Function
''' <summary>
''' Check to see if we need a default instance|shared constructor, and if so, create it.
'''
''' NOTE: we only need a shared constructor if there are any initializers to be
''' injected into it, we don't create a constructor otherwise. In this case we also
''' ignore const fields which will still require to be injected, because in this case
''' we don't see the constructor to be visible in symbol table.
''' </summary>
Private Sub AddDefaultConstructorIfNeeded(members As MembersAndInitializersBuilder,
isShared As Boolean,
initializers As ArrayBuilder(Of ImmutableArray(Of FieldOrPropertyInitializer)),
diagnostics As DiagnosticBag)
If TypeKind = TypeKind.Submission Then
' Only add a constructor if it is not shared OR if there are shared initializers
If Not isShared OrElse Me.AnyInitializerToBeInjectedIntoConstructor(initializers, False) Then
' a submission can only have a single declaration:
Dim syntaxRef = SyntaxReferences.Single()
Dim binder As Binder = BinderBuilder.CreateBinderForType(m_containingModule, syntaxRef.SyntaxTree, Me)
Dim constructor As New SynthesizedSubmissionConstructorSymbol(syntaxRef, Me, isShared, binder, diagnostics)
AddMember(constructor, binder, members, omitDiagnostics:=False)
End If
ElseIf TypeKind = TypeKind.Class OrElse
TypeKind = TypeKind.Structure OrElse
TypeKind = TypeKind.Enum OrElse
(TypeKind = TypeKind.Module AndAlso isShared) Then
' Do we need to create a constructor? We need a constructor if this is
' an instance constructor, or if this is a shared constructor and
' there is at least one non-constant initializers
Dim anyInitializersToInject As Boolean =
Me.AnyInitializerToBeInjectedIntoConstructor(initializers, Not isShared)
' NOTE: for shared constructor we DO NOT check for non-metadata-const
' initializers, those will be addressed later
If isShared AndAlso Not anyInitializersToInject Then
Return
End If
Dim isDebuggable As Boolean = anyInitializersToInject
EnsureCtor(members, isShared, isDebuggable, diagnostics)
End If
If Not isShared AndAlso IsScriptClass Then
' a submission can only have a single declaration:
Dim syntaxRef = SyntaxReferences.Single()
Dim scriptInitializer = New SynthesizedInteractiveInitializerMethod(syntaxRef, Me, diagnostics)
AddSymbolToMembers(scriptInitializer, members.Members)
Dim scriptEntryPoint = SynthesizedEntryPointSymbol.Create(scriptInitializer, diagnostics)
AddSymbolToMembers(scriptEntryPoint, members.Members)
End If
End Sub
Private Sub EnsureCtor(members As MembersAndInitializersBuilder, isShared As Boolean, isDebuggable As Boolean, diagBag As DiagnosticBag)
Dim constructorName = If(isShared, WellKnownMemberNames.StaticConstructorName, WellKnownMemberNames.InstanceConstructorName)
' Check to see if we have already declared an instance|shared constructor.
Dim symbols As ArrayBuilder(Of Symbol) = Nothing
If members.Members.TryGetValue(constructorName, symbols) Then
Debug.Assert(symbols.Where(Function(sym) sym.Kind = SymbolKind.Method AndAlso
(DirectCast(sym, MethodSymbol).MethodKind = MethodKind.Constructor OrElse
DirectCast(sym, MethodSymbol).MethodKind = MethodKind.SharedConstructor)
).Any)
For Each method As MethodSymbol In symbols
If method.MethodKind = MethodKind.Constructor AndAlso method.ParameterCount = 0 Then
Return ' definitely don't need to synthesize a constructor
End If
Next
' have to synthesize a constructor if this is a non-shared struct
If TypeKind <> TypeKind.Structure OrElse isShared Then
Return ' already have an instance|shared constructor. Don't add another one.
End If
End If
' Add a new instance|shared constructor.
Dim syntaxRef = SyntaxReferences.First() ' use arbitrary part
' TODO: does it need to be deterministic?
Dim binder As Binder = BinderBuilder.CreateBinderForType(m_containingModule, syntaxRef.SyntaxTree, Me)
Dim constructor As New SynthesizedConstructorSymbol(syntaxRef, Me, isShared, isDebuggable, binder, diagBag)
AddMember(constructor, binder, members, omitDiagnostics:=False)
End Sub
Private Sub AddWithEventsHookupConstructorsIfNeeded(members As MembersAndInitializersBuilder, diagBag As DiagnosticBag)
If TypeKind = TypeKind.Submission Then
'TODO: anything to do here?
ElseIf TypeKind = TypeKind.Class OrElse TypeKind = TypeKind.Module Then
' we need a separate list of methods since we may need to modify the members dictionary.
Dim sourceMethodsWithHandles As ArrayBuilder(Of SourceMethodSymbol) = Nothing
For Each membersOfSameName In members.Members.Values
For Each member In membersOfSameName
Dim sourceMethod = TryCast(member, SourceMethodSymbol)
If sourceMethod IsNot Nothing Then
If Not sourceMethod.HandlesEvents Then
Continue For
End If
If sourceMethodsWithHandles Is Nothing Then
sourceMethodsWithHandles = ArrayBuilder(Of SourceMethodSymbol).GetInstance
End If
sourceMethodsWithHandles.Add(sourceMethod)
End If
Next
Next
If sourceMethodsWithHandles Is Nothing Then
' no source methods with Handles - we are done
Return
End If
' binder used if we need to find something in the base. will be created when needed
Dim baseBinder As Binder = Nothing
For Each sourceMethod In sourceMethodsWithHandles
Dim methodStatement = DirectCast(sourceMethod.DeclarationSyntax, MethodStatementSyntax)
For Each handlesClause In methodStatement.HandlesClause.Events
If handlesClause.EventContainer.Kind = SyntaxKind.KeywordEventContainer Then
If Not sourceMethod.IsShared Then
' if the method is not shared, we will be hooking up in the instance ctor
EnsureCtor(members, isShared:=False, isDebuggable:=False, diagBag:=diagBag)
Else
' if both event and handler are shared, then hookup goes into shared ctor
' otherwise into instance ctor
' find our event
Dim eventName = handlesClause.EventMember.Identifier.ValueText
Dim eventSym As EventSymbol = Nothing
' look in current members
If handlesClause.EventContainer.Kind <> SyntaxKind.MyBaseKeyword Then
Dim candidates As ArrayBuilder(Of Symbol) = Nothing
If members.Members.TryGetValue(eventName, candidates) Then
If candidates.Count = 1 AndAlso candidates(0).Kind = SymbolKind.Event Then
eventSym = DirectCast(candidates(0), EventSymbol)
End If
End If
End If
' try find in base
If eventSym Is Nothing Then
' Set up a binder.
baseBinder = If(baseBinder, BinderBuilder.CreateBinderForType(m_containingModule, methodStatement.SyntaxTree, Me))
Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
eventSym = SourceMemberMethodSymbol.FindEvent(Me.BaseTypeNoUseSiteDiagnostics, baseBinder, eventName, isThroughMyBase:=True, useSiteDiagnostics:=useSiteDiagnostics)
diagBag.Add(handlesClause.EventMember, useSiteDiagnostics)
End If
' still nothing?
If eventSym Is Nothing Then
Continue For
End If
EnsureCtor(members, eventSym.IsShared, isDebuggable:=False, diagBag:=diagBag)
End If
End If
Next
Next
sourceMethodsWithHandles.Free()
End If
End Sub
Private Sub AddPropertyAndAccessors(propertySymbol As SourcePropertySymbol,
binder As Binder,
members As MembersAndInitializersBuilder)
AddMember(propertySymbol, binder, members, omitDiagnostics:=False)
If propertySymbol.GetMethod IsNot Nothing Then
AddMember(propertySymbol.GetMethod, binder, members, omitDiagnostics:=False)
End If
If propertySymbol.SetMethod IsNot Nothing Then
AddMember(propertySymbol.SetMethod, binder, members, omitDiagnostics:=False)
End If
If propertySymbol.AssociatedField IsNot Nothing Then
AddMember(propertySymbol.AssociatedField, binder, members, omitDiagnostics:=False)
End If
End Sub
Private Sub AddEventAndAccessors(eventSymbol As SourceEventSymbol,
binder As Binder,
members As MembersAndInitializersBuilder)
AddMember(eventSymbol, binder, members, omitDiagnostics:=False)
If eventSymbol.AddMethod IsNot Nothing Then
AddMember(eventSymbol.AddMethod, binder, members, omitDiagnostics:=False)
End If
If eventSymbol.RemoveMethod IsNot Nothing Then
AddMember(eventSymbol.RemoveMethod, binder, members, omitDiagnostics:=False)
End If
If eventSymbol.RaiseMethod IsNot Nothing Then
AddMember(eventSymbol.RaiseMethod, binder, members, omitDiagnostics:=False)
End If
If eventSymbol.AssociatedField IsNot Nothing Then
AddMember(eventSymbol.AssociatedField, binder, members, omitDiagnostics:=False)
End If
End Sub
Private Sub CheckMemberDiagnostics(
members As MembersAndInitializersBuilder,
diagBag As DiagnosticBag)
If Me.Locations.Length > 1 AndAlso Not Me.IsPartial Then
' Suppress conflict member diagnostics when the enclosing type is an accidental duplicate
Return
End If
For Each sym As Symbol In members.DeferredMemberDiagnostic
' Check name for duplicate type declarations
' First check if the member name conflicts with a type declaration in the container then
' Check if the member name conflicts with another member in the container.
If Not CheckIfMemberNameConflictsWithTypeMember(sym, members, diagBag) Then
CheckIfMemberNameIsDuplicate(sym, diagBag, members)
End If
If sym.CanBeReferencedByName AndAlso
TypeParameters.MatchesAnyName(sym.Name) Then
If sym.IsImplicitlyDeclared Then
Dim symImplicitlyDefinedBy = sym.ImplicitlyDefinedBy(members.Members)
Debug.Assert(symImplicitlyDefinedBy IsNot Nothing)
' "{0} '{1}' implicitly defines a member '{2}' which has the same name as a type parameter."
Binder.ReportDiagnostic(diagBag,
symImplicitlyDefinedBy.Locations(0),
ERRID.ERR_SyntMemberShadowsGenericParam3,
symImplicitlyDefinedBy.GetKindText(),
symImplicitlyDefinedBy.Name,
sym.Name)
Else
' "'{0}' has the same name as a type parameter."
Binder.ReportDiagnostic(diagBag, sym.Locations(0), ERRID.ERR_ShadowingGenericParamWithMember1, sym.Name)
End If
End If
Next
End Sub
Friend Sub AddMember(sym As Symbol,
binder As Binder,
members As MembersAndInitializersBuilder,
omitDiagnostics As Boolean)
If Not omitDiagnostics Then
members.DeferredMemberDiagnostic.Add(sym)
End If
AddSymbolToMembers(sym, members.Members)
End Sub
Friend Sub AddSymbolToMembers(memberSymbol As Symbol,
members As Dictionary(Of String, ArrayBuilder(Of Symbol)))
Dim symbols As ArrayBuilder(Of Symbol) = Nothing
If members.TryGetValue(memberSymbol.Name, symbols) Then
symbols.Add(memberSymbol)
Else
symbols = New ArrayBuilder(Of Symbol)
symbols.Add(memberSymbol)
members(memberSymbol.Name) = symbols
End If
End Sub
Private Function CheckIfMemberNameConflictsWithTypeMember(sym As Symbol,
members As MembersAndInitializersBuilder,
diagBag As DiagnosticBag) As Boolean
' Check name for conflicts with type members
Dim definedTypes = Me.GetTypeMembers(sym.Name)
If definedTypes.Length > 0 Then
Dim type = definedTypes(0)
If Not Equals(TryCast(sym, TypeSymbol), type, TypeCompareKind.ConsiderEverything) Then
Return CheckIfMemberNameIsDuplicate(sym, type, members, diagBag, includeKind:=True)
End If
End If
Return False
End Function
Private Function CheckIfMemberNameIsDuplicate(sym As Symbol,
diagBag As DiagnosticBag,
members As MembersAndInitializersBuilder) As Boolean
' Check name for duplicate declarations
Dim definedSymbols As ArrayBuilder(Of Symbol) = Nothing
If members.Members.TryGetValue(sym.Name, definedSymbols) Then
Debug.Assert(definedSymbols.Count > 0)
Dim other = definedSymbols(0)
If (sym <> other) Then
Return CheckIfMemberNameIsDuplicate(sym, other, members, diagBag, includeKind:=False)
End If
End If
Return False
End Function
Private Function CheckIfMemberNameIsDuplicate(firstSymbol As Symbol,
secondSymbol As Symbol,
members As MembersAndInitializersBuilder,
diagBag As DiagnosticBag,
includeKind As Boolean) As Boolean
Dim firstAssociatedSymbol = secondSymbol.ImplicitlyDefinedBy(members.Members)
If firstAssociatedSymbol Is Nothing AndAlso secondSymbol.IsUserDefinedOperator() Then
' For the purpose of this check, operator methods are treated as implicitly defined by themselves.
firstAssociatedSymbol = secondSymbol
End If
Dim secondAssociatedSymbol = firstSymbol.ImplicitlyDefinedBy(members.Members)
If secondAssociatedSymbol Is Nothing AndAlso firstSymbol.IsUserDefinedOperator() Then
' For the purpose of this check, operator methods are treated as implicitly defined by themselves.
secondAssociatedSymbol = firstSymbol
End If
If firstAssociatedSymbol IsNot Nothing Then
If secondAssociatedSymbol Is Nothing Then
Dim asType = TryCast(firstAssociatedSymbol, TypeSymbol)
If asType IsNot Nothing AndAlso asType.IsEnumType Then
' enum members may conflict only with __Value and that produces a special diagnostics.
Return True
End If
' "{0} '{1}' implicitly defines '{2}', which conflicts with a member of the same name in {3} '{4}'."
Binder.ReportDiagnostic(
diagBag,
firstAssociatedSymbol.Locations(0),
ERRID.ERR_SynthMemberClashesWithMember5,
firstAssociatedSymbol.GetKindText(),
OverrideHidingHelper.AssociatedSymbolName(firstAssociatedSymbol),
secondSymbol.Name,
Me.GetKindText(),
Me.Name)
Return True
Else
' If both symbols are implicitly defined (say an overloaded property P where each
' overload implicitly defines get_P), no error is reported.
' If there are any errors in cases if defining members have same names.
' In such cases, the errors should be reported on the defining symbols.
If Not CaseInsensitiveComparison.Equals(firstAssociatedSymbol.Name,
secondAssociatedSymbol.Name) Then
'{0} '{1}' implicitly defines '{2}', which conflicts with a member implicitly declared for {3} '{4}' in {5} '{6}'.
Binder.ReportDiagnostic(
diagBag,
firstAssociatedSymbol.Locations(0),
ERRID.ERR_SynthMemberClashesWithSynth7,
firstAssociatedSymbol.GetKindText(),
OverrideHidingHelper.AssociatedSymbolName(firstAssociatedSymbol),
secondSymbol.Name,
secondAssociatedSymbol.GetKindText(),
OverrideHidingHelper.AssociatedSymbolName(secondAssociatedSymbol),
Me.GetKindText(),
Me.Name)
End If
End If
ElseIf secondAssociatedSymbol IsNot Nothing Then
' "{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in {4} '{5}'."
Binder.ReportDiagnostic(
diagBag,
secondSymbol.Locations(0),
ERRID.ERR_MemberClashesWithSynth6,
secondSymbol.GetKindText(),
secondSymbol.Name,
secondAssociatedSymbol.GetKindText(),
OverrideHidingHelper.AssociatedSymbolName(secondAssociatedSymbol),
Me.GetKindText(),
Me.Name)
Return True
ElseIf ((firstSymbol.Kind <> SymbolKind.Method) AndAlso (Not firstSymbol.IsPropertyAndNotWithEvents)) OrElse
(firstSymbol.Kind <> secondSymbol.Kind) Then
If Me.IsEnumType() Then
' For Enum members, give more specific simpler errors.
' "'{0}' is already declared in this {1}."
Binder.ReportDiagnostic(
diagBag,
firstSymbol.Locations(0),
ERRID.ERR_MultiplyDefinedEnumMember2,
firstSymbol.Name,
Me.GetKindText())
Else
' the formatting of this error message is quite special and needs special treatment
' e.g. 'goo' is already declared as 'Class Goo' in this class.
' "'{0}' is already declared as '{1}' in this {2}."
Binder.ReportDiagnostic(
diagBag,
firstSymbol.Locations(0),
ERRID.ERR_MultiplyDefinedType3,
firstSymbol.Name,
If(includeKind,
DirectCast(CustomSymbolDisplayFormatter.ErrorNameWithKind(secondSymbol), Object),
secondSymbol),
Me.GetKindText())
End If
Return True
End If
Return False
End Function
Public Overrides ReadOnly Property MemberNames As IEnumerable(Of String)
Get
Return _declaration.MemberNames
End Get
End Property
Friend Overrides Function GetMembersUnordered() As ImmutableArray(Of Symbol)
If _lazyMembersFlattened.IsDefault Then
Dim lookup = Me.MemberAndInitializerLookup
Dim result = lookup.Members.Flatten(Nothing) ' Do Not sort right now.
ImmutableInterlocked.InterlockedInitialize(Me._lazyMembersFlattened, result)
End If
Return _lazyMembersFlattened.ConditionallyDeOrder()
End Function
Public Overloads Overrides Function GetMembers() As ImmutableArray(Of Symbol)
If (m_lazyState And StateFlags.FlattenedMembersIsSortedMask) <> 0 Then
Return _lazyMembersFlattened
Else
Dim allMembers = Me.GetMembersUnordered()
If allMembers.Length >= 2 Then
allMembers = allMembers.Sort(LexicalOrderSymbolComparer.Instance)
ImmutableInterlocked.InterlockedExchange(_lazyMembersFlattened, allMembers)
End If
ThreadSafeFlagOperations.Set(m_lazyState, StateFlags.FlattenedMembersIsSortedMask)
Return allMembers
End If
End Function
Public Overloads Overrides Function GetMembers(name As String) As ImmutableArray(Of Symbol)
Dim lookup = Me.MemberAndInitializerLookup
Dim members As ImmutableArray(Of Symbol) = Nothing
If lookup.Members.TryGetValue(name, members) Then
Return members
End If
Return ImmutableArray(Of Symbol).Empty
End Function
Friend Overrides Function GetSimpleNonTypeMembers(name As String) As ImmutableArray(Of Symbol)
If _lazyMembersAndInitializers IsNot Nothing OrElse MemberNames.Contains(name, IdentifierComparison.Comparer) Then
Return GetMembers(name)
End If
Return ImmutableArray(Of Symbol).Empty
End Function
''' <summary>
''' In case the passed initializers require a shared constructor, this method returns a new MethodSymbol instance for the
''' shared constructor if there is not already an explicit shared constructor
''' </summary>
Friend Function CreateSharedConstructorsForConstFieldsIfRequired(binder As Binder, diagnostics As DiagnosticBag) As MethodSymbol
Dim lookup = Me.MemberAndInitializerLookup
Dim staticInitializers = lookup.StaticInitializers
If Not staticInitializers.IsDefaultOrEmpty Then
Dim symbols As ImmutableArray(Of Symbol) = Nothing
If Not MemberAndInitializerLookup.Members.TryGetValue(WellKnownMemberNames.StaticConstructorName, symbols) Then
' call AnyInitializerToBeInjectedIntoConstructor if only there is no static constructor
If Me.AnyInitializerToBeInjectedIntoConstructor(staticInitializers, True) Then
Dim syntaxRef = SyntaxReferences.First() ' use arbitrary part
Return New SynthesizedConstructorSymbol(syntaxRef, Me,
isShared:=True, isDebuggable:=True,
binder:=binder, diagnostics:=diagnostics)
End If
End If
End If
Return Nothing
End Function
Friend Overrides Iterator Function GetFieldsToEmit() As IEnumerable(Of FieldSymbol)
For Each member In GetMembersForCci()
If member.Kind = SymbolKind.Field Then
Yield DirectCast(member, FieldSymbol)
End If
Next
End Function
''' <summary>
''' Gets the static initializers.
''' </summary>
Public ReadOnly Property StaticInitializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer))
Get
Return Me.MemberAndInitializerLookup.StaticInitializers
End Get
End Property
''' <summary>
''' Gets the instance initializers.
''' </summary>
Public ReadOnly Property InstanceInitializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer))
Get
Return Me.MemberAndInitializerLookup.InstanceInitializers
End Get
End Property
Friend Function CalculateSyntaxOffsetInSynthesizedConstructor(position As Integer, tree As SyntaxTree, isShared As Boolean) As Integer
If IsScriptClass AndAlso Not isShared Then
Dim aggregateLength As Integer = 0
For Each declaration In Me._declaration.Declarations
Dim syntaxRef = declaration.SyntaxReference
If tree Is syntaxRef.SyntaxTree Then
Return aggregateLength + position
End If
aggregateLength += syntaxRef.Span.Length
Next
' This point should not be reachable.
Throw ExceptionUtilities.Unreachable
End If
Dim syntaxOffset As Integer
If TryCalculateSyntaxOffsetOfPositionInInitializer(position, tree, isShared, syntaxOffset:=syntaxOffset) Then
Return syntaxOffset
End If
If Me._declaration.Declarations.Length >= 1 AndAlso position = Me._declaration.Declarations(0).Location.SourceSpan.Start Then
' With dynamic analysis instrumentation, the introducing declaration of a type can provide
' the syntax associated with both the analysis payload local of a synthesized constructor
' and with the constructor itself. If the synthesized constructor includes an initializer with a lambda,
' that lambda needs a closure that captures the analysis payload of the constructor,
' and the offset of the syntax for the local within the constructor is by definition zero.
Return 0
End If
' This point should not be reachable. An implicit constructor has no body and no initializer,
' so the variable has to be declared in a member initializer.
Throw ExceptionUtilities.Unreachable
End Function
' Calculates a syntax offset of a syntax position that is contained in a property or field initializer (if it is in fact contained in one).
Friend Function TryCalculateSyntaxOffsetOfPositionInInitializer(position As Integer, tree As SyntaxTree, isShared As Boolean, ByRef syntaxOffset As Integer) As Boolean
Dim membersAndInitializers = GetMembersAndInitializers()
Dim allInitializers = If(isShared, membersAndInitializers.StaticInitializers, membersAndInitializers.InstanceInitializers)
Dim siblingInitializers = GetInitializersInSourceTree(tree, allInitializers)
Dim index = IndexOfInitializerContainingPosition(siblingInitializers, position)
If index < 0 Then
syntaxOffset = 0
Return False
End If
' |<-----------distanceFromCtorBody---------->|
' [ initializer 0 ][ initializer 1 ][ initializer 2 ][ initializer 3 ][ctor body]
' |<--preceding init len-->| ^
' position
Dim initializersLength = If(isShared, membersAndInitializers.StaticInitializersSyntaxLength, membersAndInitializers.InstanceInitializersSyntaxLength)
Dim distanceFromInitializerStart = position - siblingInitializers(index).Syntax.Span.Start
Dim distanceFromCtorBody = initializersLength - (siblingInitializers(index).PrecedingInitializersLength + distanceFromInitializerStart)
Debug.Assert(distanceFromCtorBody > 0)
' syntax offset 0 is at the start of the ctor body:
syntaxOffset = -distanceFromCtorBody
Return True
End Function
Private Shared Function GetInitializersInSourceTree(tree As SyntaxTree, initializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer))) As ImmutableArray(Of FieldOrPropertyInitializer)
Dim builder = ArrayBuilder(Of FieldOrPropertyInitializer).GetInstance()
For Each siblingInitializers As ImmutableArray(Of FieldOrPropertyInitializer) In initializers
If (siblingInitializers.First().Syntax.SyntaxTree Is tree) Then
builder.AddRange(siblingInitializers)
End If
Next
Return builder.ToImmutableAndFree()
End Function
Private Shared Function IndexOfInitializerContainingPosition(initializers As ImmutableArray(Of FieldOrPropertyInitializer), position As Integer) As Integer
' Search for the start of the span (the spans are non-overlapping and sorted)
Dim index = initializers.BinarySearch(position, Function(initializer, pos) initializer.Syntax.Span.Start.CompareTo(pos))
' Binary search returns non-negative result if the position is exactly the start of some span.
If index >= 0 Then
Return index
End If
' Otherwise, "Not index" is the closest span whose start is greater than the position.
' Make sure that this closest span contains the position.
index = (Not index) - 1
If index >= 0 AndAlso initializers(index).Syntax.Span.Contains(position) Then
Return index
End If
Return -1
End Function
Public Overrides ReadOnly Property MightContainExtensionMethods As Boolean
Get
' Only Modules can declare extension methods.
If _lazyContainsExtensionMethods = ThreeState.Unknown Then
If Not (_containingSymbol.Kind = SymbolKind.Namespace AndAlso Me.AllowsExtensionMethods() AndAlso Me.AnyMemberHasAttributes) Then
_lazyContainsExtensionMethods = ThreeState.False
End If
End If
Return _lazyContainsExtensionMethods <> ThreeState.False
End Get
End Property
Friend Overrides Sub BuildExtensionMethodsMap(map As Dictionary(Of String, ArrayBuilder(Of MethodSymbol)),
appendThrough As NamespaceSymbol)
If Me.MightContainExtensionMethods Then
Dim lookup = Me.MemberAndInitializerLookup
If Not appendThrough.BuildExtensionMethodsMap(map, lookup.Members) Then
' Didn't find any extension methods, record the fact.
_lazyContainsExtensionMethods = ThreeState.False
End If
End If
End Sub
Friend Overrides Sub AddExtensionMethodLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
options As LookupOptions,
originalBinder As Binder,
appendThrough As NamedTypeSymbol)
If Me.MightContainExtensionMethods Then
Dim lookup = Me.MemberAndInitializerLookup
If Not appendThrough.AddExtensionMethodLookupSymbolsInfo(nameSet, options, originalBinder, lookup.Members) Then
' Didn't find any extension methods, record the fact.
_lazyContainsExtensionMethods = ThreeState.False
End If
End If
End Sub
' Build the explicit interface map for this type.
'
' Also diagnoses the following errors and places diagnostics in the diagnostic bag:
' Same symbol implemented twice
' Interface symbol that should have been implemented wasn't.
' Generic interfaces might unify.
Private Function MakeExplicitInterfaceImplementationMap(diagnostics As DiagnosticBag) As MultiDictionary(Of Symbol, Symbol)
If Me.IsClassType() OrElse Me.IsStructureType() OrElse Me.IsInterfaceType() Then
CheckInterfaceUnificationAndVariance(diagnostics)
End If
If Me.IsClassType() OrElse Me.IsStructureType() Then
' Go through all explicit interface implementations and record them.
Dim map = New MultiDictionary(Of Symbol, Symbol)(ExplicitInterfaceImplementationTargetMemberEqualityComparer.Instance)
For Each implementingMember In Me.GetMembers()
For Each interfaceMember In GetExplicitInterfaceImplementations(implementingMember)
If ShouldReportImplementationError(interfaceMember) AndAlso map.ContainsKey(interfaceMember) Then
'the same symbol was implemented twice.
Dim diag = ErrorFactory.ErrorInfo(ERRID.ERR_MethodAlreadyImplemented2,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(interfaceMember.ContainingType),
CustomSymbolDisplayFormatter.ShortErrorName(interfaceMember))
diagnostics.Add(New VBDiagnostic(diag, GetImplementingLocation(implementingMember, interfaceMember)))
End If
map.Add(interfaceMember, implementingMember)
Next
Next
' Check to make sure all members of interfaces were implemented. Note that if our base class implemented
' an interface, we do not have to implemented those members again (although we can).
For Each ifaceSet In InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics.Values
For Each iface In ifaceSet
' Only check interfaces that our base type does NOT implement.
If Not Me.BaseTypeNoUseSiteDiagnostics.ImplementsInterface(iface, comparer:=Nothing, useSiteDiagnostics:=Nothing) Then
For Each ifaceMember In iface.GetMembers()
If ifaceMember.RequiresImplementation() AndAlso ShouldReportImplementationError(ifaceMember) Then
Dim implementingSet As MultiDictionary(Of Symbol, Symbol).ValueSet = map(ifaceMember)
Dim useSiteErrorInfo = ifaceMember.GetUseSiteErrorInfo()
If implementingSet.Count = 0 Then
'member was not implemented.
Dim diag = If(useSiteErrorInfo, ErrorFactory.ErrorInfo(ERRID.ERR_UnimplementedMember3,
If(Me.IsStructureType(), "Structure", "Class"),
CustomSymbolDisplayFormatter.ShortErrorName(Me),
ifaceMember,
CustomSymbolDisplayFormatter.ShortNameWithTypeArgs(iface)))
diagnostics.Add(New VBDiagnostic(diag, GetImplementsLocation(iface)))
ElseIf implementingSet.Count = 1 AndAlso ' Otherwise, a duplicate implementation error is reported above
useSiteErrorInfo IsNot Nothing Then
diagnostics.Add(New VBDiagnostic(useSiteErrorInfo, implementingSet.Single.Locations(0)))
End If
End If
Next
End If
Next
Next
If map.Count > 0 Then
Return map
Else
Return EmptyExplicitImplementationMap ' Better to use singleton and garbage collection the empty dictionary we just created.
End If
Else
Return EmptyExplicitImplementationMap
End If
End Function
' Should we report implementation errors for this member?
' We don't report errors on accessors, because we already report the errors on their containing property/event.
Private Function ShouldReportImplementationError(interfaceMember As Symbol) As Boolean
If interfaceMember.Kind = SymbolKind.Method AndAlso DirectCast(interfaceMember, MethodSymbol).MethodKind <> MethodKind.Ordinary Then
Return False
Else
Return True
End If
End Function
''' <summary>
''' Get a dictionary with all the explicitly implemented interface symbols declared on this type.
'''
''' key = interface method/property/event compared using <see cref="ExplicitInterfaceImplementationTargetMemberEqualityComparer"/>,
''' value = explicitly implementing methods/properties/events declared on this type (normally a single value, multiple in case of
''' an error).
'''
''' Getting this property also ensures that diagnostics relating to interface implementation, overriding, hiding and
''' overloading are created.
''' </summary>
''' <returns></returns>
Friend Overrides ReadOnly Property ExplicitInterfaceImplementationMap As MultiDictionary(Of Symbol, Symbol)
Get
If m_lazyExplicitInterfaceImplementationMap Is Nothing Then
Dim diagnostics As DiagnosticBag = DiagnosticBag.GetInstance()
Dim implementationMap = MakeExplicitInterfaceImplementationMap(diagnostics)
OverrideHidingHelper.CheckHidingAndOverridingForType(Me, diagnostics)
' checking the overloads accesses the parameter types. The parameters are now lazily created to not happen at
' method/property symbol creation time. That's the reason why this check is delayed until here.
CheckForOverloadsErrors(diagnostics)
m_containingModule.AtomicStoreReferenceAndDiagnostics(m_lazyExplicitInterfaceImplementationMap, implementationMap, diagnostics, CompilationStage.Declare)
diagnostics.Free()
End If
Return m_lazyExplicitInterfaceImplementationMap
End Get
End Property
''' <summary>
''' Reports the overloads error for this type.
''' </summary>
''' <param name="diagnostics">The diagnostics.</param>
Private Sub CheckForOverloadsErrors(diagnostics As DiagnosticBag)
Debug.Assert(Me.IsDefinition) ' Don't do this on constructed types
' Enums and Delegates have nothing to do.
Dim myTypeKind As TypeKind = Me.TypeKind
Dim operatorsKnownToHavePair As HashSet(Of MethodSymbol) = Nothing
If myTypeKind = TypeKind.Class OrElse myTypeKind = TypeKind.Interface OrElse myTypeKind = TypeKind.Structure OrElse myTypeKind = TypeKind.Module Then
Dim lookup = MemberAndInitializerLookup
Dim structEnumerator As Dictionary(Of String, ImmutableArray(Of Symbol)).Enumerator = lookup.Members.GetEnumerator
Dim canDeclareOperators As Boolean = (myTypeKind <> TypeKind.Module AndAlso myTypeKind <> TypeKind.Interface)
While structEnumerator.MoveNext()
Dim memberList As ImmutableArray(Of Symbol) = structEnumerator.Current.Value
' only proceed if there are multiple declarations of methods with the same name
If memberList.Length < 2 Then
' Validate operator overloading
If canDeclareOperators AndAlso CheckForOperatorOverloadingErrors(memberList, 0, structEnumerator, operatorsKnownToHavePair, diagnostics) Then
Continue While
End If
Continue While
End If
For Each memberKind In {SymbolKind.Method, SymbolKind.Property}
For memberIndex = 0 To memberList.Length - 2
Dim member As Symbol = memberList(memberIndex)
If member.Kind <> memberKind OrElse member.IsAccessor OrElse member.IsWithEventsProperty Then
Continue For
End If
' Validate operator overloading
If canDeclareOperators AndAlso memberKind = SymbolKind.Method AndAlso
CheckForOperatorOverloadingErrors(memberList, memberIndex, structEnumerator, operatorsKnownToHavePair, diagnostics) Then
Continue For
End If
Dim sourceMethod = TryCast(member, SourceMemberMethodSymbol)
If sourceMethod IsNot Nothing Then
Debug.Assert(Not sourceMethod.IsUserDefinedOperator())
If sourceMethod.IsUserDefinedOperator() Then
Continue For
End If
If sourceMethod.SuppressDuplicateProcDefDiagnostics Then
Continue For
End If
End If
' TODO: this is O(N^2), maybe this can be improved.
For nextMemberIndex = memberIndex + 1 To memberList.Length - 1
Dim nextMember = memberList(nextMemberIndex)
If nextMember.Kind <> memberKind OrElse nextMember.IsAccessor OrElse nextMember.IsWithEventsProperty Then
Continue For
End If
sourceMethod = TryCast(nextMember, SourceMemberMethodSymbol)
If sourceMethod IsNot Nothing Then
If sourceMethod.IsUserDefinedOperator() Then
Continue For
End If
If sourceMethod.SuppressDuplicateProcDefDiagnostics Then
Continue For
End If
End If
' only process non synthesized symbols
If Not member.IsImplicitlyDeclared AndAlso
Not nextMember.IsImplicitlyDeclared Then
' Overload resolution (CollectOverloadedCandidates) does similar check for imported members
' from the same container. Both places should be in sync. CheckForOperatorOverloadingErrors too.
Dim comparisonResults As SymbolComparisonResults = OverrideHidingHelper.DetailedSignatureCompare(
member,
nextMember,
SymbolComparisonResults.AllMismatches And Not (SymbolComparisonResults.CallingConventionMismatch Or SymbolComparisonResults.ConstraintMismatch))
Debug.Assert((comparisonResults And SymbolComparisonResults.PropertyInitOnlyMismatch) = 0)
' only report diagnostics if the signature is considered equal following VB rules.
If (comparisonResults And Not SymbolComparisonResults.MismatchesForConflictingMethods) = 0 Then
ReportOverloadsErrors(comparisonResults, member, nextMember, member.Locations(0), diagnostics)
Exit For
End If
End If
Next
Next
' Validate operator overloading for the last operator, it is not handled by the loop
If canDeclareOperators AndAlso memberKind = SymbolKind.Method AndAlso
CheckForOperatorOverloadingErrors(memberList, memberList.Length - 1, structEnumerator, operatorsKnownToHavePair, diagnostics) Then
Continue For
End If
Next
End While
End If
End Sub
''' <summary>
''' Returns True if memberList(memberIndex) is an operator.
''' Also performs operator overloading validation and reports appropriate errors.
''' </summary>
Private Function CheckForOperatorOverloadingErrors(
memberList As ImmutableArray(Of Symbol),
memberIndex As Integer,
membersEnumerator As Dictionary(Of String, ImmutableArray(Of Symbol)).Enumerator,
<[In](), Out()> ByRef operatorsKnownToHavePair As HashSet(Of MethodSymbol),
diagnostics As DiagnosticBag
) As Boolean
Dim member As Symbol = memberList(memberIndex)
If member.Kind <> SymbolKind.Method Then
Return False
End If
Dim method = DirectCast(member, MethodSymbol)
Dim significantDiff As SymbolComparisonResults = Not SymbolComparisonResults.MismatchesForConflictingMethods
Dim methodMethodKind As MethodKind = method.MethodKind
Select Case methodMethodKind
Case MethodKind.Conversion
significantDiff = significantDiff Or SymbolComparisonResults.ReturnTypeMismatch
Case MethodKind.UserDefinedOperator
Case Else
' Not an operator.
Return False
End Select
Dim opInfo As OverloadResolution.OperatorInfo = OverloadResolution.GetOperatorInfo(method.Name)
If Not OverloadResolution.ValidateOverloadedOperator(method, opInfo, diagnostics) Then
' Malformed operator, but still an operator.
Return True
End If
' Check conflicting overloading with other operators.
If IsConflictingOperatorOverloading(method, significantDiff, memberList, memberIndex + 1, diagnostics) Then
Return True
End If
' CType overloads across Widening and Narrowing, which use different metadata names.
' Need to handle this specially.
If methodMethodKind = MethodKind.Conversion Then
Dim otherName As String = If(IdentifierComparison.Equals(WellKnownMemberNames.ImplicitConversionName, method.Name),
WellKnownMemberNames.ExplicitConversionName, WellKnownMemberNames.ImplicitConversionName)
Dim otherMembers As ImmutableArray(Of Symbol) = Nothing
If MemberAndInitializerLookup.Members.TryGetValue(otherName, otherMembers) Then
While membersEnumerator.MoveNext()
If membersEnumerator.Current.Value = otherMembers Then
If IsConflictingOperatorOverloading(method, significantDiff, otherMembers, 0, diagnostics) Then
Return True
End If
Exit While
End If
End While
End If
End If
' Check for operators that must be declared in pairs.
Dim nameOfThePair As String = Nothing
If opInfo.IsUnary Then
Select Case opInfo.UnaryOperatorKind
Case UnaryOperatorKind.IsTrue
nameOfThePair = WellKnownMemberNames.FalseOperatorName
Case UnaryOperatorKind.IsFalse
nameOfThePair = WellKnownMemberNames.TrueOperatorName
End Select
Else
Select Case opInfo.BinaryOperatorKind
Case BinaryOperatorKind.Equals
nameOfThePair = WellKnownMemberNames.InequalityOperatorName
Case BinaryOperatorKind.NotEquals
nameOfThePair = WellKnownMemberNames.EqualityOperatorName
Case BinaryOperatorKind.LessThan
nameOfThePair = WellKnownMemberNames.GreaterThanOperatorName
Case BinaryOperatorKind.GreaterThan
nameOfThePair = WellKnownMemberNames.LessThanOperatorName
Case BinaryOperatorKind.LessThanOrEqual
nameOfThePair = WellKnownMemberNames.GreaterThanOrEqualOperatorName
Case BinaryOperatorKind.GreaterThanOrEqual
nameOfThePair = WellKnownMemberNames.LessThanOrEqualOperatorName
End Select
End If
If nameOfThePair IsNot Nothing AndAlso
(operatorsKnownToHavePair Is Nothing OrElse Not operatorsKnownToHavePair.Contains(method)) Then
Dim otherMembers As ImmutableArray(Of Symbol) = Nothing
If MemberAndInitializerLookup.Members.TryGetValue(nameOfThePair, otherMembers) Then
For Each other As Symbol In otherMembers
If other.IsUserDefinedOperator() Then
Dim otherMethod = DirectCast(other, MethodSymbol)
Dim comparisonResults As SymbolComparisonResults = MethodSignatureComparer.DetailedCompare(
method,
otherMethod,
SymbolComparisonResults.AllMismatches And
Not (SymbolComparisonResults.CallingConventionMismatch Or
SymbolComparisonResults.ConstraintMismatch Or
SymbolComparisonResults.CustomModifierMismatch Or
SymbolComparisonResults.NameMismatch))
If (comparisonResults And (Not SymbolComparisonResults.MismatchesForConflictingMethods Or SymbolComparisonResults.ReturnTypeMismatch)) = 0 Then
' Found the pair
If operatorsKnownToHavePair Is Nothing Then
operatorsKnownToHavePair = New HashSet(Of MethodSymbol)(ReferenceEqualityComparer.Instance)
End If
operatorsKnownToHavePair.Add(otherMethod)
Return True
End If
End If
Next
End If
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_MatchingOperatorExpected2,
SyntaxFacts.GetText(OverloadResolution.GetOperatorTokenKind(nameOfThePair)),
method), method.Locations(0))
End If
Return True
End Function
''' <summary>
''' See if any member in [memberList] starting with [memberIndex] conflict with [method],
''' report appropriate error and return true.
''' </summary>
Private Function IsConflictingOperatorOverloading(
method As MethodSymbol,
significantDiff As SymbolComparisonResults,
memberList As ImmutableArray(Of Symbol),
memberIndex As Integer,
diagnostics As DiagnosticBag
) As Boolean
For nextMemberIndex = memberIndex To memberList.Length - 1
Dim nextMember = memberList(nextMemberIndex)
If nextMember.Kind <> SymbolKind.Method Then
Continue For
End If
Dim nextMethod = DirectCast(nextMember, MethodSymbol)
If nextMethod.MethodKind <> method.MethodKind Then
Continue For
End If
Dim comparisonResults As SymbolComparisonResults = MethodSignatureComparer.DetailedCompare(
method,
nextMethod,
SymbolComparisonResults.AllMismatches And
Not (SymbolComparisonResults.CallingConventionMismatch Or
SymbolComparisonResults.ConstraintMismatch Or
SymbolComparisonResults.CustomModifierMismatch Or
SymbolComparisonResults.NameMismatch))
Debug.Assert((comparisonResults And SymbolComparisonResults.PropertyInitOnlyMismatch) = 0)
' only report diagnostics if the signature is considered equal following VB rules.
If (comparisonResults And significantDiff) = 0 Then
ReportOverloadsErrors(comparisonResults, method, nextMethod, method.Locations(0), diagnostics)
Return True
End If
Next
Return False
End Function
''' <summary>
''' Check for two different diagnostics on the set of implemented interfaces:
''' 1) It is invalid for a type to directly (vs through a base class) implement two interfaces that
''' unify (i.e. are the same for some substitution of type parameters).
'''
''' 2) It is a warning to implement variant interfaces twice with type arguments that could cause
''' ambiguity during method dispatch.
''' </summary>
Private Sub CheckInterfaceUnificationAndVariance(diagnostics As DiagnosticBag)
Dim interfaces = Me.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics
If interfaces.IsEmpty OrElse
(interfaces.Count = 1 AndAlso interfaces.Values.Single().Count = 1) Then
Return ' can't have any conflicts
End If
' Check no duplicate interfaces (ignoring tuple names)
Dim declaringSyntax = Me.GetDeclaringSyntaxNode(Of VisualBasicSyntaxNode)()
If declaringSyntax IsNot Nothing Then
For Each keySetPair In interfaces
If keySetPair.Value.Count > 1 Then
Dim other As NamedTypeSymbol = keySetPair.Key
For Each [interface] In keySetPair.Value
If other IsNot [interface] Then
Debug.Assert(EqualsIgnoringComparer.InstanceIgnoringTupleNames.Equals([interface], other))
Debug.Assert(Not TypeSymbol.Equals([interface], other, TypeCompareKind.ConsiderEverything))
ReportDuplicateInterfaceWithDifferentTupleNames(diagnostics, [interface], other)
End If
Next
End If
Next
End If
' We only need to check pairs of generic interfaces that have the same original definition. Put the interfaces
' into buckets by original definition.
Dim originalDefinitionBuckets As New MultiDictionary(Of NamedTypeSymbol, NamedTypeSymbol)
For Each iface In interfaces.Keys
If iface.IsGenericType Then
originalDefinitionBuckets.Add(iface.OriginalDefinition, iface)
End If
Next
' Compare all pairs of interfaces in each bucket.
For Each kvp In originalDefinitionBuckets
If kvp.Value.Count >= 2 Then
Dim i1 As Integer = 0
For Each interface1 In kvp.Value
Dim i2 As Integer = 0
For Each interface2 In kvp.Value
If i2 > i1 Then
Debug.Assert(interface2.IsGenericType AndAlso TypeSymbol.Equals(interface1.OriginalDefinition, interface2.OriginalDefinition, TypeCompareKind.ConsiderEverything))
' Check for interface unification, then variance ambiguity
If TypeUnification.CanUnify(Me, interface1, interface2) Then
ReportInterfaceUnificationError(diagnostics, interface1, interface2)
ElseIf VarianceAmbiguity.HasVarianceAmbiguity(Me, interface1, interface2, Nothing) Then
ReportVarianceAmbiguityWarning(diagnostics, interface1, interface2)
End If
End If
i2 += 1
Next
i1 += 1
Next
End If
Next
End Sub
Private Sub ReportOverloadsErrors(comparisonResults As SymbolComparisonResults, firstMember As Symbol, secondMember As Symbol, location As Location, diagnostics As DiagnosticBag)
Debug.Assert((comparisonResults And SymbolComparisonResults.PropertyInitOnlyMismatch) = 0)
If (Me.Locations.Length > 1 AndAlso Not Me.IsPartial) Then
' if there was an error with the enclosing class, suppress these diagnostics
ElseIf comparisonResults = 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_DuplicateProcDef1, firstMember), location)
Else
' TODO: maybe rewrite these diagnostics to if/elseifs to report just one diagnostic per
' symbol. This would reduce the error count, but may lead to a new diagnostics once the
' previous one was fixed (byref + return type).
If (comparisonResults And SymbolComparisonResults.TupleNamesMismatch) <> 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_DuplicateProcDefWithDifferentTupleNames2, firstMember, secondMember), location)
End If
If (comparisonResults And SymbolComparisonResults.ParameterByrefMismatch) <> 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadWithByref2, firstMember, secondMember), location)
End If
If (comparisonResults And SymbolComparisonResults.ReturnTypeMismatch) <> 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadWithReturnType2, firstMember, secondMember), location)
End If
If (comparisonResults And SymbolComparisonResults.ParamArrayMismatch) <> 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadWithArrayVsParamArray2, firstMember, secondMember), location)
End If
If (comparisonResults And SymbolComparisonResults.OptionalParameterMismatch) <> 0 AndAlso (comparisonResults And SymbolComparisonResults.TotalParameterCountMismatch) = 0 Then
' We have Optional/Required parameter disparity AND the same number of parameters
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadWithOptional2, firstMember, secondMember), location)
End If
' With changes in overloading with optional parameters this should never happen
Debug.Assert((comparisonResults And SymbolComparisonResults.OptionalParameterTypeMismatch) = 0)
'If (comparisonResults And SymbolComparisonResults.OptionalParameterTypeMismatch) <> 0 Then
' diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadWithOptionalTypes2, firstMember, secondMember), location)
' ...
' Dev10 only checks the equality of the default values if the types match in
' CompareParams, so we need to suppress the diagnostic here.
If (comparisonResults And SymbolComparisonResults.OptionalParameterValueMismatch) <> 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadWithDefault2, firstMember, secondMember), location)
End If
If (comparisonResults And SymbolComparisonResults.PropertyAccessorMismatch) <> 0 Then
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_OverloadingPropertyKind2, firstMember, secondMember), location)
End If
End If
End Sub
''' <summary>
''' Interface1 and Interface2 conflict for some type arguments. Report the correct error in the correct location.
''' </summary>
Private Sub ReportInterfaceUnificationError(diagnostics As DiagnosticBag, interface1 As NamedTypeSymbol, interface2 As NamedTypeSymbol)
If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then
' Report error on second implement, for consistency.
Dim temp = interface1
interface1 = interface2
interface2 = temp
End If
' The direct base interfaces that interface1/2 were inherited through.
Dim directInterface1 As NamedTypeSymbol = Nothing
Dim directInterface2 As NamedTypeSymbol = Nothing
Dim location1, location2 As Location
location1 = GetImplementsLocation(interface1, directInterface1)
location2 = GetImplementsLocation(interface2, directInterface2)
Dim isInterface As Boolean = Me.IsInterfaceType()
Dim diag As DiagnosticInfo
If (TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything)) Then
diag = ErrorFactory.ErrorInfo(If(isInterface, ERRID.ERR_InterfaceUnifiesWithInterface2, ERRID.ERR_InterfacePossiblyImplTwice2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1))
ElseIf (Not TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything)) Then
diag = ErrorFactory.ErrorInfo(If(isInterface, ERRID.ERR_InterfaceUnifiesWithBase3, ERRID.ERR_ClassInheritsInterfaceUnifiesWithBase3),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface1))
ElseIf (TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso Not TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything)) Then
diag = ErrorFactory.ErrorInfo(If(isInterface, ERRID.ERR_BaseUnifiesWithInterfaces3, ERRID.ERR_ClassInheritsBaseUnifiesWithInterfaces3),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1))
Else
Debug.Assert(Not TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso Not TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything))
diag = ErrorFactory.ErrorInfo(If(isInterface, ERRID.ERR_InterfaceBaseUnifiesWithBase4, ERRID.ERR_ClassInheritsInterfaceBaseUnifiesWithBase4),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface1))
End If
diagnostics.Add(New VBDiagnostic(diag, location2))
End Sub
''' <summary>
''' Interface1 and Interface2 have variable ambiguity. Report the warning in the correct location.
''' </summary>
Private Sub ReportVarianceAmbiguityWarning(diagnostics As DiagnosticBag, interface1 As NamedTypeSymbol, interface2 As NamedTypeSymbol)
Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
Dim hasVarianceAmbiguity As Boolean = VarianceAmbiguity.HasVarianceAmbiguity(Me, interface1, interface2, useSiteDiagnostics)
If hasVarianceAmbiguity OrElse Not useSiteDiagnostics.IsNullOrEmpty Then
If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then
' Report error on second implement, for consistency.
Dim temp = interface1
interface1 = interface2
interface2 = temp
End If
' The direct base interfaces that interface1/2 were inherited through.
Dim directInterface1 As NamedTypeSymbol = Nothing
Dim directInterface2 As NamedTypeSymbol = Nothing
Dim location1, location2 As Location
location1 = GetImplementsLocation(interface1, directInterface1)
location2 = GetImplementsLocation(interface2, directInterface2)
If Not diagnostics.Add(location2, useSiteDiagnostics) AndAlso hasVarianceAmbiguity Then
Dim diag As DiagnosticInfo
diag = ErrorFactory.ErrorInfo(ERRID.WRN_VarianceDeclarationAmbiguous3,
CustomSymbolDisplayFormatter.QualifiedName(directInterface2),
CustomSymbolDisplayFormatter.QualifiedName(directInterface1),
CustomSymbolDisplayFormatter.ErrorNameWithKind(interface1.OriginalDefinition))
diagnostics.Add(New VBDiagnostic(diag, location2))
End If
End If
End Sub
''' <summary>
''' Interface1 and Interface2 match except for their tuple names. Report the error in the correct location.
''' </summary>
Private Sub ReportDuplicateInterfaceWithDifferentTupleNames(diagnostics As DiagnosticBag, interface1 As NamedTypeSymbol, interface2 As NamedTypeSymbol)
If GetImplementsLocation(interface1).SourceSpan.Start > GetImplementsLocation(interface2).SourceSpan.Start Then
' Report error on second implement, for consistency.
Dim temp = interface1
interface1 = interface2
interface2 = temp
End If
' The direct base interfaces that interface1/2 were inherited through.
Dim directInterface1 As NamedTypeSymbol = Nothing
Dim directInterface2 As NamedTypeSymbol = Nothing
Dim location1 As Location = GetImplementsLocation(interface1, directInterface1)
Dim location2 As Location = GetImplementsLocation(interface2, directInterface2)
Dim diag As DiagnosticInfo
If (TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything)) Then
diag = ErrorFactory.ErrorInfo(If(IsInterface, ERRID.ERR_InterfaceInheritedTwiceWithDifferentTupleNames2, ERRID.ERR_InterfaceImplementedTwiceWithDifferentTupleNames2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1))
ElseIf (Not TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything)) Then
diag = ErrorFactory.ErrorInfo(If(IsInterface, ERRID.ERR_InterfaceInheritedTwiceWithDifferentTupleNames3, ERRID.ERR_InterfaceImplementedTwiceWithDifferentTupleNames3),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface1))
ElseIf (TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso Not TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything)) Then
diag = ErrorFactory.ErrorInfo(If(IsInterface, ERRID.ERR_InterfaceInheritedTwiceWithDifferentTupleNamesReverse3, ERRID.ERR_InterfaceImplementedTwiceWithDifferentTupleNamesReverse3),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1))
Else
Debug.Assert(Not TypeSymbol.Equals(directInterface1, interface1, TypeCompareKind.ConsiderEverything) AndAlso Not TypeSymbol.Equals(directInterface2, interface2, TypeCompareKind.ConsiderEverything))
diag = ErrorFactory.ErrorInfo(If(IsInterface, ERRID.ERR_InterfaceInheritedTwiceWithDifferentTupleNames4, ERRID.ERR_InterfaceImplementedTwiceWithDifferentTupleNames4),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface2),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(interface1),
CustomSymbolDisplayFormatter.ShortNameWithTypeArgsAndContainingTypes(directInterface1))
End If
diagnostics.Add(New VBDiagnostic(diag, location2))
End Sub
#End Region
#Region "Attributes"
Protected Sub SuppressExtensionAttributeSynthesis()
Debug.Assert(_lazyEmitExtensionAttribute <> ThreeState.True)
_lazyEmitExtensionAttribute = ThreeState.False
End Sub
Private ReadOnly Property EmitExtensionAttribute As Boolean
Get
If _lazyEmitExtensionAttribute = ThreeState.Unknown Then
BindAllMemberAttributes(cancellationToken:=Nothing)
End If
Debug.Assert(_lazyEmitExtensionAttribute <> ThreeState.Unknown)
Return _lazyEmitExtensionAttribute = ThreeState.True
End Get
End Property
Friend Overrides Sub AddSynthesizedAttributes(compilationState As ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
MyBase.AddSynthesizedAttributes(compilationState, attributes)
If EmitExtensionAttribute Then
AddSynthesizedAttribute(attributes, Me.DeclaringCompilation.SynthesizeExtensionAttribute())
End If
End Sub
#End Region
Friend ReadOnly Property AnyMemberHasAttributes As Boolean
Get
If (Not Me._lazyAnyMemberHasAttributes.HasValue()) Then
Me._lazyAnyMemberHasAttributes = Me._declaration.AnyMemberHasAttributes.ToThreeState()
End If
Return Me._lazyAnyMemberHasAttributes.Value()
End Get
End Property
End Class
Friend Class EqualsIgnoringComparer
Inherits EqualityComparer(Of TypeSymbol)
Public Shared ReadOnly Property InstanceIgnoringTupleNames As EqualsIgnoringComparer =
New EqualsIgnoringComparer(TypeCompareKind.IgnoreTupleNames)
Public Shared ReadOnly Property InstanceCLRSignatureCompare As EqualsIgnoringComparer =
New EqualsIgnoringComparer(TypeCompareKind.AllIgnoreOptionsForVB And Not TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds)
Private ReadOnly _comparison As TypeCompareKind
Public Sub New(comparison As TypeCompareKind)
_comparison = comparison
End Sub
Public Overrides Function Equals(type1 As TypeSymbol, type2 As TypeSymbol) As Boolean
Return If(type1 Is Nothing,
type2 Is Nothing,
type1.IsSameType(type2, _comparison))
End Function
Public Overrides Function GetHashCode(obj As TypeSymbol) As Integer
Return If(obj Is Nothing, 0, obj.GetHashCode())
End Function
End Class
End Namespace
|
tannergooding/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMemberContainerTypeSymbol.vb
|
Visual Basic
|
apache-2.0
| 226,393
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.FindSymbols
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Rename
Imports Microsoft.CodeAnalysis.Rename.ConflictEngine
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Simplification
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Rename
Friend Class VisualBasicRenameRewriterLanguageService
Inherits AbstractRenameRewriterLanguageService
Public Shared ReadOnly Instance As New VisualBasicRenameRewriterLanguageService()
Private Sub New()
End Sub
#Region "Annotate"
Public Overrides Function AnnotateAndRename(parameters As RenameRewriterParameters) As SyntaxNode
Dim renameRewriter = New RenameRewriter(parameters)
Return renameRewriter.Visit(parameters.SyntaxRoot)
End Function
Private Class RenameRewriter
Inherits VisualBasicSyntaxRewriter
Private ReadOnly _documentId As DocumentId
Private ReadOnly _renameRenamableSymbolDeclaration As RenameAnnotation
Private ReadOnly _solution As Solution
Private ReadOnly _replacementText As String
Private ReadOnly _originalText As String
Private ReadOnly _possibleNameConflicts As ICollection(Of String)
Private ReadOnly _renameLocations As Dictionary(Of TextSpan, RenameLocation)
Private ReadOnly _conflictLocations As IEnumerable(Of TextSpan)
Private ReadOnly _semanticModel As SemanticModel
Private ReadOnly _cancellationToken As CancellationToken
Private ReadOnly _renamedSymbol As ISymbol
Private ReadOnly _aliasSymbol As IAliasSymbol
Private ReadOnly _renamableDeclarationLocation As Location
Private ReadOnly _renameSpansTracker As RenamedSpansTracker
Private ReadOnly _isVerbatim As Boolean
Private ReadOnly _replacementTextValid As Boolean
Private ReadOnly _isRenamingInStrings As Boolean
Private ReadOnly _isRenamingInComments As Boolean
Private ReadOnly _stringAndCommentTextSpans As ISet(Of TextSpan)
Private ReadOnly _simplificationService As ISimplificationService
Private ReadOnly _annotatedIdentifierTokens As New HashSet(Of SyntaxToken)
Private ReadOnly _invocationExpressionsNeedingConflictChecks As New HashSet(Of InvocationExpressionSyntax)
Private ReadOnly _syntaxFactsService As ISyntaxFactsService
Private ReadOnly _semanticFactsService As ISemanticFactsService
Private ReadOnly _renameAnnotations As AnnotationTable(Of RenameAnnotation)
Private ReadOnly Property AnnotateForComplexification As Boolean
Get
Return Me._skipRenameForComplexification > 0 AndAlso Not Me._isProcessingComplexifiedSpans
End Get
End Property
Private _skipRenameForComplexification As Integer = 0
Private _isProcessingComplexifiedSpans As Boolean
Private _modifiedSubSpans As List(Of ValueTuple(Of TextSpan, TextSpan)) = Nothing
Private _speculativeModel As SemanticModel
Private _isProcessingStructuredTrivia As Integer
Private ReadOnly _complexifiedSpans As HashSet(Of TextSpan) = New HashSet(Of TextSpan)
Private Sub AddModifiedSpan(oldSpan As TextSpan, newSpan As TextSpan)
newSpan = New TextSpan(oldSpan.Start, newSpan.Length)
If Not Me._isProcessingComplexifiedSpans Then
_renameSpansTracker.AddModifiedSpan(_documentId, oldSpan, newSpan)
Else
Me._modifiedSubSpans.Add((oldSpan, newSpan))
End If
End Sub
Public Sub New(parameters As RenameRewriterParameters)
MyBase.New(visitIntoStructuredTrivia:=True)
_documentId = parameters.Document.Id
_renameRenamableSymbolDeclaration = parameters.RenamedSymbolDeclarationAnnotation
_solution = parameters.OriginalSolution
_replacementText = parameters.ReplacementText
_originalText = parameters.OriginalText
_possibleNameConflicts = parameters.PossibleNameConflicts
_renameLocations = parameters.RenameLocations
_conflictLocations = parameters.ConflictLocationSpans
_cancellationToken = parameters.CancellationToken
_semanticModel = DirectCast(parameters.SemanticModel, SemanticModel)
_renamedSymbol = parameters.RenameSymbol
_replacementTextValid = parameters.ReplacementTextValid
_renameSpansTracker = parameters.RenameSpansTracker
_isRenamingInStrings = parameters.OptionSet.RenameInStrings
_isRenamingInComments = parameters.OptionSet.RenameInComments
_stringAndCommentTextSpans = parameters.StringAndCommentTextSpans
_aliasSymbol = TryCast(Me._renamedSymbol, IAliasSymbol)
_renamableDeclarationLocation = Me._renamedSymbol.Locations.Where(Function(loc) loc.IsInSource AndAlso loc.SourceTree Is _semanticModel.SyntaxTree).FirstOrDefault()
_simplificationService = parameters.Document.Project.LanguageServices.GetService(Of ISimplificationService)()
_syntaxFactsService = parameters.Document.Project.LanguageServices.GetService(Of ISyntaxFactsService)()
_semanticFactsService = parameters.Document.Project.LanguageServices.GetService(Of ISemanticFactsService)()
_isVerbatim = Me._syntaxFactsService.IsVerbatimIdentifier(_replacementText)
_renameAnnotations = parameters.RenameAnnotations
End Sub
Public Overrides Function Visit(node As SyntaxNode) As SyntaxNode
If node Is Nothing Then
Return node
End If
Dim isInConflictLambdaBody = False
Dim lambdas = node.GetAncestorsOrThis(Of MultiLineLambdaExpressionSyntax)()
If lambdas.Count() <> 0 Then
For Each lambda In lambdas
If Me._conflictLocations.Any(Function(cf)
Return cf.Contains(lambda.Span)
End Function) Then
isInConflictLambdaBody = True
Exit For
End If
Next
End If
Dim shouldComplexifyNode = Me.ShouldComplexifyNode(node, isInConflictLambdaBody)
Dim result As SyntaxNode
If shouldComplexifyNode Then
Me._skipRenameForComplexification += 1
result = MyBase.Visit(node)
Me._skipRenameForComplexification -= 1
result = Complexify(node, result)
Else
result = MyBase.Visit(node)
End If
Return result
End Function
Private Function ShouldComplexifyNode(node As SyntaxNode, isInConflictLambdaBody As Boolean) As Boolean
Return Not isInConflictLambdaBody AndAlso
_skipRenameForComplexification = 0 AndAlso
Not _isProcessingComplexifiedSpans AndAlso
_conflictLocations.Contains(node.Span) AndAlso
(TypeOf node Is ExpressionSyntax OrElse
TypeOf node Is StatementSyntax OrElse
TypeOf node Is AttributeSyntax OrElse
TypeOf node Is SimpleArgumentSyntax OrElse
TypeOf node Is CrefReferenceSyntax OrElse
TypeOf node Is TypeConstraintSyntax)
End Function
Private Function Complexify(originalNode As SyntaxNode, newNode As SyntaxNode) As SyntaxNode
If Me._complexifiedSpans.Contains(originalNode.Span) Then
Return newNode
Else
Me._complexifiedSpans.Add(originalNode.Span)
End If
Me._isProcessingComplexifiedSpans = True
Me._modifiedSubSpans = New List(Of ValueTuple(Of TextSpan, TextSpan))()
Dim annotation = New SyntaxAnnotation()
newNode = newNode.WithAdditionalAnnotations(annotation)
Dim speculativeTree = originalNode.SyntaxTree.GetRoot(_cancellationToken).ReplaceNode(originalNode, newNode)
newNode = speculativeTree.GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
Me._speculativeModel = GetSemanticModelForNode(newNode, Me._semanticModel)
Debug.Assert(_speculativeModel IsNot Nothing, "expanding a syntax node which cannot be speculated?")
' There are cases when we change the type of node to make speculation work (e.g.,
' for AsNewClauseSyntax), so getting the newNode from the _speculativeModel
' ensures the final node replacing the original node is found.
newNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
Dim oldSpan = originalNode.Span
Dim expandParameter = originalNode.GetAncestorsOrThis(Of LambdaExpressionSyntax).Count() = 0
Dim expandedNewNode = DirectCast(_simplificationService.Expand(newNode,
_speculativeModel,
annotationForReplacedAliasIdentifier:=Nothing,
expandInsideNode:=AddressOf IsExpandWithinMultiLineLambda,
expandParameter:=expandParameter,
cancellationToken:=_cancellationToken), SyntaxNode)
Dim annotationForSpeculativeNode = New SyntaxAnnotation()
expandedNewNode = expandedNewNode.WithAdditionalAnnotations(annotationForSpeculativeNode)
speculativeTree = originalNode.SyntaxTree.GetRoot(_cancellationToken).ReplaceNode(originalNode, expandedNewNode)
Dim probableRenameNode = speculativeTree.GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
Dim speculativeNewNode = speculativeTree.GetAnnotatedNodes(Of SyntaxNode)(annotationForSpeculativeNode).First()
Me._speculativeModel = GetSemanticModelForNode(speculativeNewNode, Me._semanticModel)
Debug.Assert(_speculativeModel IsNot Nothing, "expanding a syntax node which cannot be speculated?")
' There are cases when we change the type of node to make speculation work (e.g.,
' for AsNewClauseSyntax), so getting the newNode from the _speculativeModel
' ensures the final node replacing the original node is found.
probableRenameNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
speculativeNewNode = Me._speculativeModel.SyntaxTree.GetRoot(_cancellationToken).GetAnnotatedNodes(Of SyntaxNode)(annotationForSpeculativeNode).First()
Dim renamedNode = MyBase.Visit(probableRenameNode)
If Not ReferenceEquals(renamedNode, probableRenameNode) Then
renamedNode = renamedNode.WithoutAnnotations(annotation)
probableRenameNode = expandedNewNode.GetAnnotatedNodes(Of SyntaxNode)(annotation).First()
expandedNewNode = expandedNewNode.ReplaceNode(probableRenameNode, renamedNode)
End If
Dim newSpan = expandedNewNode.Span
probableRenameNode = probableRenameNode.WithoutAnnotations(annotation)
expandedNewNode = Me._renameAnnotations.WithAdditionalAnnotations(expandedNewNode, New RenameNodeSimplificationAnnotation() With {.OriginalTextSpan = oldSpan})
Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans)
Me._modifiedSubSpans = Nothing
Me._isProcessingComplexifiedSpans = False
Me._speculativeModel = Nothing
Return expandedNewNode
End Function
Private Function IsExpandWithinMultiLineLambda(node As SyntaxNode) As Boolean
If node Is Nothing Then
Return False
End If
If Me._conflictLocations.Contains(node.Span) Then
Return True
End If
If node.IsParentKind(SyntaxKind.MultiLineSubLambdaExpression) OrElse
node.IsParentKind(SyntaxKind.MultiLineFunctionLambdaExpression) Then
Dim parent = DirectCast(node.Parent, MultiLineLambdaExpressionSyntax)
If ReferenceEquals(parent.SubOrFunctionHeader, node) Then
Return True
Else
Return False
End If
End If
Return True
End Function
Private Function IsPossibleNameConflict(possibleNameConflicts As ICollection(Of String), candidate As String) As Boolean
For Each possibleNameConflict In possibleNameConflicts
If CaseInsensitiveComparison.Equals(possibleNameConflict, candidate) Then
Return True
End If
Next
Return False
End Function
Private Function UpdateAliasAnnotation(newToken As SyntaxToken) As SyntaxToken
If Me._aliasSymbol IsNot Nothing AndAlso Not Me.AnnotateForComplexification AndAlso newToken.HasAnnotations(AliasAnnotation.Kind) Then
newToken = RenameUtilities.UpdateAliasAnnotation(newToken, Me._aliasSymbol, Me._replacementText)
End If
Return newToken
End Function
Private Async Function RenameAndAnnotateAsync(token As SyntaxToken, newToken As SyntaxToken, isRenameLocation As Boolean, isOldText As Boolean) As Task(Of SyntaxToken)
If newToken.IsKind(SyntaxKind.NewKeyword) Then
' The constructor definition cannot be renamed in Visual Basic
Return newToken
End If
If Me._isProcessingComplexifiedSpans Then
If isRenameLocation Then
Dim annotation = Me._renameAnnotations.GetAnnotations(Of RenameActionAnnotation)(token).FirstOrDefault()
If annotation IsNot Nothing Then
newToken = RenameToken(token, newToken, annotation.Prefix, annotation.Suffix)
AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length))
Else
newToken = RenameToken(token, newToken, prefix:=Nothing, suffix:=Nothing)
End If
End If
Return newToken
End If
Dim symbols = RenameUtilities.GetSymbolsTouchingPosition(token.Span.Start, Me._semanticModel, Me._solution.Workspace, Me._cancellationToken)
' this is the compiler generated backing field of a non custom event. We need to store a "Event" suffix to properly rename it later on.
Dim prefix = If(isRenameLocation AndAlso Me._renameLocations(token.Span).IsRenamableAccessor, newToken.ValueText.Substring(0, newToken.ValueText.IndexOf("_"c) + 1), String.Empty)
Dim suffix As String = Nothing
If symbols.Length = 1 Then
Dim symbol = symbols(0)
If symbol.IsConstructor() Then
symbol = symbol.ContainingSymbol
End If
If symbol.Kind = SymbolKind.Field AndAlso symbol.IsImplicitlyDeclared Then
Dim fieldSymbol = DirectCast(symbol, IFieldSymbol)
If fieldSymbol.Type.IsDelegateType AndAlso
fieldSymbol.Type.IsImplicitlyDeclared AndAlso
DirectCast(fieldSymbol.Type, INamedTypeSymbol).AssociatedSymbol IsNot Nothing Then
suffix = "Event"
End If
If fieldSymbol.AssociatedSymbol IsNot Nothing AndAlso
fieldSymbol.AssociatedSymbol.IsKind(SymbolKind.Property) AndAlso
fieldSymbol.Name = "_" + fieldSymbol.AssociatedSymbol.Name Then
prefix = "_"
End If
ElseIf symbol.IsConstructor AndAlso
symbol.ContainingType.IsImplicitlyDeclared AndAlso
symbol.ContainingType.IsDelegateType AndAlso
symbol.ContainingType.AssociatedSymbol IsNot Nothing Then
suffix = "EventHandler"
ElseIf TypeOf symbol Is INamedTypeSymbol Then
Dim namedTypeSymbol = DirectCast(symbol, INamedTypeSymbol)
If namedTypeSymbol.IsImplicitlyDeclared AndAlso
namedTypeSymbol.IsDelegateType() AndAlso
namedTypeSymbol.AssociatedSymbol IsNot Nothing Then
suffix = "EventHandler"
End If
End If
If Not isRenameLocation AndAlso TypeOf (symbol) Is INamespaceSymbol AndAlso token.GetPreviousToken().Kind = SyntaxKind.NamespaceKeyword Then
Return newToken
End If
End If
If isRenameLocation AndAlso Not Me.AnnotateForComplexification Then
Dim oldSpan = token.Span
newToken = RenameToken(token, newToken, prefix:=prefix, suffix:=suffix)
AddModifiedSpan(oldSpan, newToken.Span)
End If
Dim renameDeclarationLocations As RenameDeclarationLocationReference() =
Await ConflictResolver.CreateDeclarationLocationAnnotationsAsync(_solution, symbols, _cancellationToken).ConfigureAwait(False)
Dim isNamespaceDeclarationReference = False
If isRenameLocation AndAlso token.GetPreviousToken().Kind = SyntaxKind.NamespaceKeyword Then
isNamespaceDeclarationReference = True
End If
Dim isMemberGroupReference = _semanticFactsService.IsInsideNameOfExpression(_semanticModel, token.Parent, _cancellationToken)
Dim renameAnnotation = New RenameActionAnnotation(
token.Span,
isRenameLocation,
prefix,
suffix,
isOldText,
renameDeclarationLocations,
isNamespaceDeclarationReference,
isInvocationExpression:=False,
isMemberGroupReference:=isMemberGroupReference)
_annotatedIdentifierTokens.Add(token)
newToken = Me._renameAnnotations.WithAdditionalAnnotations(newToken, renameAnnotation, New RenameTokenSimplificationAnnotation() With {.OriginalTextSpan = token.Span})
If Me._renameRenamableSymbolDeclaration IsNot Nothing AndAlso _renamableDeclarationLocation = token.GetLocation() Then
newToken = Me._renameAnnotations.WithAdditionalAnnotations(newToken, Me._renameRenamableSymbolDeclaration)
End If
Return newToken
End Function
Private Function IsInRenameLocation(token As SyntaxToken) As Boolean
If Not Me._isProcessingComplexifiedSpans Then
Return Me._renameLocations.ContainsKey(token.Span)
Else
If token.HasAnnotations(AliasAnnotation.Kind) Then
Return False
End If
If Me._renameAnnotations.HasAnnotations(Of RenameActionAnnotation)(token) Then
Return Me._renameAnnotations.GetAnnotations(Of RenameActionAnnotation)(token).First().IsRenameLocation
End If
If TypeOf token.Parent Is SimpleNameSyntax AndAlso token.Kind <> SyntaxKind.GlobalKeyword AndAlso token.Parent.Parent.IsKind(SyntaxKind.QualifiedName, SyntaxKind.QualifiedCrefOperatorReference) Then
Dim symbol = Me._speculativeModel.GetSymbolInfo(token.Parent, Me._cancellationToken).Symbol
If symbol IsNot Nothing AndAlso Me._renamedSymbol.Kind <> SymbolKind.Local AndAlso Me._renamedSymbol.Kind <> SymbolKind.RangeVariable AndAlso
(Equals(symbol, Me._renamedSymbol) OrElse SymbolKey.GetComparer(ignoreCase:=True, ignoreAssemblyKeys:=False).Equals(symbol.GetSymbolKey(), Me._renamedSymbol.GetSymbolKey())) Then
Return True
End If
End If
Return False
End If
End Function
Public Overrides Function VisitToken(oldToken As SyntaxToken) As SyntaxToken
If oldToken = Nothing Then
Return oldToken
End If
Dim newToken = oldToken
Dim shouldCheckTrivia = Me._stringAndCommentTextSpans.Contains(oldToken.Span)
If shouldCheckTrivia Then
Me._isProcessingStructuredTrivia += 1
newToken = MyBase.VisitToken(newToken)
Me._isProcessingStructuredTrivia -= 1
Else
newToken = MyBase.VisitToken(newToken)
End If
newToken = UpdateAliasAnnotation(newToken)
' Rename matches in strings and comments
newToken = RenameWithinToken(oldToken, newToken)
' We don't want to annotate XmlName with RenameActionAnnotation
If newToken.Kind = SyntaxKind.XmlNameToken Then
Return newToken
End If
Dim isRenameLocation = IsInRenameLocation(oldToken)
Dim isOldText = CaseInsensitiveComparison.Equals(oldToken.ValueText, _originalText)
Dim tokenNeedsConflictCheck = isRenameLocation OrElse
isOldText OrElse
CaseInsensitiveComparison.Equals(oldToken.ValueText, _replacementText) OrElse
IsPossibleNameConflict(_possibleNameConflicts, oldToken.ValueText)
If tokenNeedsConflictCheck Then
newToken = RenameAndAnnotateAsync(oldToken, newToken, isRenameLocation, isOldText).WaitAndGetResult_CanCallOnBackground(_cancellationToken)
If Not Me._isProcessingComplexifiedSpans Then
_invocationExpressionsNeedingConflictChecks.AddRange(oldToken.GetAncestors(Of InvocationExpressionSyntax)())
End If
End If
Return newToken
End Function
Private Function GetAnnotationForInvocationExpression(invocationExpression As InvocationExpressionSyntax) As RenameActionAnnotation
Dim identifierToken As SyntaxToken = Nothing
Dim expressionOfInvocation = invocationExpression.Expression
While expressionOfInvocation IsNot Nothing
Select Case expressionOfInvocation.Kind
Case SyntaxKind.IdentifierName, SyntaxKind.GenericName
identifierToken = DirectCast(expressionOfInvocation, SimpleNameSyntax).Identifier
Exit While
Case SyntaxKind.SimpleMemberAccessExpression
identifierToken = DirectCast(expressionOfInvocation, MemberAccessExpressionSyntax).Name.Identifier
Exit While
Case SyntaxKind.QualifiedName
identifierToken = DirectCast(expressionOfInvocation, QualifiedNameSyntax).Right.Identifier
Exit While
Case SyntaxKind.ParenthesizedExpression
expressionOfInvocation = DirectCast(expressionOfInvocation, ParenthesizedExpressionSyntax).Expression
Case SyntaxKind.MeExpression
Exit While
Case Else
' This isn't actually an invocation, so there's no member name to check.
Return Nothing
End Select
End While
If identifierToken <> Nothing AndAlso Not Me._annotatedIdentifierTokens.Contains(identifierToken) Then
Dim symbolInfo = Me._semanticModel.GetSymbolInfo(invocationExpression, Me._cancellationToken)
Dim symbols As IEnumerable(Of ISymbol) = Nothing
If symbolInfo.Symbol Is Nothing Then
Return Nothing
Else
symbols = SpecializedCollections.SingletonEnumerable(symbolInfo.Symbol)
End If
Dim renameDeclarationLocations As RenameDeclarationLocationReference() =
ConflictResolver.CreateDeclarationLocationAnnotationsAsync(_solution, symbols, _cancellationToken).WaitAndGetResult_CanCallOnBackground(_cancellationToken)
Dim renameAnnotation = New RenameActionAnnotation(
identifierToken.Span,
isRenameLocation:=False,
prefix:=Nothing,
suffix:=Nothing,
renameDeclarationLocations:=renameDeclarationLocations,
isOriginalTextLocation:=False,
isNamespaceDeclarationReference:=False,
isInvocationExpression:=True,
isMemberGroupReference:=False)
Return renameAnnotation
End If
Return Nothing
End Function
Public Overrides Function VisitInvocationExpression(node As InvocationExpressionSyntax) As SyntaxNode
Dim result = MyBase.VisitInvocationExpression(node)
If _invocationExpressionsNeedingConflictChecks.Contains(node) Then
Dim renameAnnotation = GetAnnotationForInvocationExpression(node)
If renameAnnotation IsNot Nothing Then
result = Me._renameAnnotations.WithAdditionalAnnotations(result, renameAnnotation)
End If
End If
Return result
End Function
Private Function RenameToken(oldToken As SyntaxToken, newToken As SyntaxToken, prefix As String, suffix As String) As SyntaxToken
Dim parent = oldToken.Parent
Dim currentNewIdentifier = Me._replacementText
Dim oldIdentifier = newToken.ValueText
Dim isAttributeName = SyntaxFacts.IsAttributeName(parent)
If isAttributeName Then
Debug.Assert(Me._renamedSymbol.IsAttribute() OrElse Me._aliasSymbol.Target.IsAttribute())
If oldIdentifier <> Me._renamedSymbol.Name Then
Dim withoutSuffix = String.Empty
If currentNewIdentifier.TryReduceAttributeSuffix(withoutSuffix) Then
currentNewIdentifier = withoutSuffix
End If
End If
Else
If Not String.IsNullOrEmpty(prefix) Then
currentNewIdentifier = prefix + currentNewIdentifier
End If
If Not String.IsNullOrEmpty(suffix) Then
currentNewIdentifier = currentNewIdentifier + suffix
End If
End If
' determine the canonical identifier name (unescaped, no type char, ...)
Dim valueText = currentNewIdentifier
Dim name = SyntaxFactory.ParseName(currentNewIdentifier)
If name.ContainsDiagnostics Then
name = SyntaxFactory.IdentifierName(currentNewIdentifier)
End If
If name.IsKind(SyntaxKind.GlobalName) Then
valueText = currentNewIdentifier
ElseIf name.IsKind(SyntaxKind.IdentifierName) Then
valueText = DirectCast(name, IdentifierNameSyntax).Identifier.ValueText
End If
If Me._isVerbatim Then
newToken = newToken.CopyAnnotationsTo(SyntaxFactory.BracketedIdentifier(newToken.LeadingTrivia, valueText, newToken.TrailingTrivia))
Else
newToken = newToken.CopyAnnotationsTo(SyntaxFactory.Identifier(
newToken.LeadingTrivia,
If(oldToken.GetTypeCharacter() = TypeCharacter.None, currentNewIdentifier, currentNewIdentifier + oldToken.ToString().Last()),
False,
valueText,
oldToken.GetTypeCharacter(),
newToken.TrailingTrivia))
If Me._replacementTextValid AndAlso
oldToken.GetTypeCharacter() <> TypeCharacter.None AndAlso
(SyntaxFacts.GetKeywordKind(valueText) = SyntaxKind.REMKeyword OrElse Me._syntaxFactsService.IsVerbatimIdentifier(newToken)) Then
newToken = Me._renameAnnotations.WithAdditionalAnnotations(newToken, RenameInvalidIdentifierAnnotation.Instance)
End If
End If
If Me._replacementTextValid Then
If newToken.IsBracketed Then
' a reference location should always be tried to be unescaped, whether it was escaped before rename
' or the replacement itself is escaped.
newToken = newToken.WithAdditionalAnnotations(Simplifier.Annotation)
Else
newToken = TryEscapeIdentifierToken(newToken)
End If
End If
Return newToken
End Function
Private Function RenameInStringLiteral(oldToken As SyntaxToken, newToken As SyntaxToken, createNewStringLiteral As Func(Of SyntaxTriviaList, String, String, SyntaxTriviaList, SyntaxToken)) As SyntaxToken
Dim originalString = newToken.ToString()
Dim replacedString As String = RenameLocations.ReferenceProcessing.ReplaceMatchingSubStrings(originalString, _originalText, _replacementText)
If replacedString <> originalString Then
Dim oldSpan = oldToken.Span
newToken = createNewStringLiteral(newToken.LeadingTrivia, replacedString, replacedString, newToken.TrailingTrivia)
AddModifiedSpan(oldSpan, newToken.Span)
Return newToken.CopyAnnotationsTo(Me._renameAnnotations.WithAdditionalAnnotations(newToken, New RenameTokenSimplificationAnnotation() With {.OriginalTextSpan = oldSpan}))
End If
Return newToken
End Function
Private Function RenameInCommentTrivia(trivia As SyntaxTrivia) As SyntaxTrivia
Dim originalString = trivia.ToString()
Dim replacedString As String = RenameLocations.ReferenceProcessing.ReplaceMatchingSubStrings(originalString, _originalText, _replacementText)
If replacedString <> originalString Then
Dim oldSpan = trivia.Span
Dim newTrivia = SyntaxFactory.CommentTrivia(replacedString)
AddModifiedSpan(oldSpan, newTrivia.Span)
Return trivia.CopyAnnotationsTo(Me._renameAnnotations.WithAdditionalAnnotations(newTrivia, New RenameTokenSimplificationAnnotation() With {.OriginalTextSpan = oldSpan}))
End If
Return trivia
End Function
Private Function RenameInTrivia(token As SyntaxToken, leadingOrTrailingTriviaList As IEnumerable(Of SyntaxTrivia)) As SyntaxToken
Return token.ReplaceTrivia(leadingOrTrailingTriviaList, Function(oldTrivia, newTrivia)
If newTrivia.Kind = SyntaxKind.CommentTrivia Then
Return RenameInCommentTrivia(newTrivia)
End If
Return newTrivia
End Function)
End Function
Private Function RenameWithinToken(oldToken As SyntaxToken, newToken As SyntaxToken) As SyntaxToken
If Me._isProcessingComplexifiedSpans OrElse
(Me._isProcessingStructuredTrivia = 0 AndAlso Not Me._stringAndCommentTextSpans.Contains(oldToken.Span)) Then
Return newToken
End If
If Me._isRenamingInStrings Then
If newToken.Kind = SyntaxKind.StringLiteralToken Then
newToken = RenameInStringLiteral(oldToken, newToken, AddressOf SyntaxFactory.StringLiteralToken)
ElseIf newToken.Kind = SyntaxKind.InterpolatedStringTextToken Then
newToken = RenameInStringLiteral(oldToken, newToken, AddressOf SyntaxFactory.InterpolatedStringTextToken)
End If
End If
If Me._isRenamingInComments Then
If newToken.Kind = SyntaxKind.XmlTextLiteralToken Then
newToken = RenameInStringLiteral(oldToken, newToken, AddressOf SyntaxFactory.XmlTextLiteralToken)
ElseIf newToken.Kind = SyntaxKind.XmlNameToken AndAlso CaseInsensitiveComparison.Equals(oldToken.ValueText, _originalText) Then
Dim newIdentifierToken = SyntaxFactory.XmlNameToken(newToken.LeadingTrivia, _replacementText, SyntaxFacts.GetKeywordKind(_replacementText), newToken.TrailingTrivia)
newToken = newToken.CopyAnnotationsTo(Me._renameAnnotations.WithAdditionalAnnotations(newIdentifierToken, New RenameTokenSimplificationAnnotation() With {.OriginalTextSpan = oldToken.Span}))
AddModifiedSpan(oldToken.Span, newToken.Span)
End If
If newToken.HasLeadingTrivia Then
Dim updatedToken = RenameInTrivia(oldToken, oldToken.LeadingTrivia)
If updatedToken <> oldToken Then
newToken = newToken.WithLeadingTrivia(updatedToken.LeadingTrivia)
End If
End If
If newToken.HasTrailingTrivia Then
Dim updatedToken = RenameInTrivia(oldToken, oldToken.TrailingTrivia)
If updatedToken <> oldToken Then
newToken = newToken.WithTrailingTrivia(updatedToken.TrailingTrivia)
End If
End If
End If
Return newToken
End Function
End Class
#End Region
#Region "Declaration Conflicts"
Public Overrides Function LocalVariableConflict(
token As SyntaxToken,
newReferencedSymbols As IEnumerable(Of ISymbol)) As Boolean
' This scenario is not present in VB and only in C#
Return False
End Function
Public Overrides Function ComputeDeclarationConflictsAsync(
replacementText As String,
renamedSymbol As ISymbol,
renameSymbol As ISymbol,
referencedSymbols As IEnumerable(Of ISymbol),
baseSolution As Solution,
newSolution As Solution,
reverseMappedLocations As IDictionary(Of Location, Location),
cancellationToken As CancellationToken
) As Task(Of ImmutableArray(Of Location))
Dim conflicts = ArrayBuilder(Of Location).GetInstance()
If renamedSymbol.Kind = SymbolKind.Parameter OrElse
renamedSymbol.Kind = SymbolKind.Local OrElse
renamedSymbol.Kind = SymbolKind.RangeVariable Then
Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken)
' Find the method block or field declaration that we're in. Note the LastOrDefault
' so we find the uppermost one, since VariableDeclarators live in methods too.
Dim methodBase = token.Parent.AncestorsAndSelf.Where(Function(s) TypeOf s Is MethodBlockBaseSyntax OrElse TypeOf s Is VariableDeclaratorSyntax) _
.LastOrDefault()
Dim visitor As New LocalConflictVisitor(token, newSolution, cancellationToken)
visitor.Visit(methodBase)
conflicts.AddRange(visitor.ConflictingTokens.Select(Function(t) t.GetLocation()) _
.Select(Function(loc) reverseMappedLocations(loc)))
' If this is a parameter symbol for a partial method definition, be sure we visited
' the implementation part's body.
If renamedSymbol.Kind = SymbolKind.Parameter AndAlso
renamedSymbol.ContainingSymbol.Kind = SymbolKind.Method Then
Dim methodSymbol = DirectCast(renamedSymbol.ContainingSymbol, IMethodSymbol)
If methodSymbol.PartialImplementationPart IsNot Nothing Then
Dim matchingParameterSymbol = methodSymbol.PartialImplementationPart.Parameters((DirectCast(renamedSymbol, IParameterSymbol)).Ordinal)
token = matchingParameterSymbol.Locations.Single().FindToken(cancellationToken)
methodBase = token.GetAncestor(Of MethodBlockSyntax)
visitor = New LocalConflictVisitor(token, newSolution, cancellationToken)
visitor.Visit(methodBase)
conflicts.AddRange(visitor.ConflictingTokens.Select(Function(t) t.GetLocation()) _
.Select(Function(loc) reverseMappedLocations(loc)))
End If
End If
' in VB parameters of properties are not allowed to be the same as the containing property
If renamedSymbol.Kind = SymbolKind.Parameter AndAlso
renamedSymbol.ContainingSymbol.Kind = SymbolKind.Property AndAlso
CaseInsensitiveComparison.Equals(renamedSymbol.ContainingSymbol.Name, renamedSymbol.Name) Then
Dim propertySymbol = renamedSymbol.ContainingSymbol
While propertySymbol IsNot Nothing
conflicts.AddRange(renamedSymbol.ContainingSymbol.Locations _
.Select(Function(loc) reverseMappedLocations(loc)))
propertySymbol = propertySymbol.OverriddenMember
End While
End If
ElseIf renamedSymbol.Kind = SymbolKind.Label Then
Dim token = renamedSymbol.Locations.Single().FindToken(cancellationToken)
Dim containingMethod = token.Parent.FirstAncestorOrSelf(Of SyntaxNode)(
Function(s) TypeOf s Is MethodBlockBaseSyntax OrElse
TypeOf s Is LambdaExpressionSyntax)
Dim visitor As New LabelConflictVisitor(token)
visitor.Visit(containingMethod)
conflicts.AddRange(visitor.ConflictingTokens.Select(Function(t) t.GetLocation()) _
.Select(Function(loc) reverseMappedLocations(loc)))
ElseIf renamedSymbol.Kind = SymbolKind.Method Then
conflicts.AddRange(
DeclarationConflictHelpers.GetMembersWithConflictingSignatures(DirectCast(renamedSymbol, IMethodSymbol), trimOptionalParameters:=True) _
.Select(Function(loc) reverseMappedLocations(loc)))
ElseIf renamedSymbol.Kind = SymbolKind.Property Then
conflicts.AddRange(
DeclarationConflictHelpers.GetMembersWithConflictingSignatures(DirectCast(renamedSymbol, IPropertySymbol), trimOptionalParameters:=True) _
.Select(Function(loc) reverseMappedLocations(loc)))
AddConflictingParametersOfProperties(
referencedSymbols.Concat(renameSymbol).Where(Function(sym) sym.Kind = SymbolKind.Property),
renamedSymbol.Name,
conflicts)
ElseIf renamedSymbol.Kind = SymbolKind.TypeParameter Then
For Each location In renamedSymbol.Locations
Dim token = location.FindToken(cancellationToken)
Dim currentTypeParameter = token.Parent
For Each typeParameter In DirectCast(currentTypeParameter.Parent, TypeParameterListSyntax).Parameters
If typeParameter IsNot currentTypeParameter AndAlso CaseInsensitiveComparison.Equals(token.ValueText, typeParameter.Identifier.ValueText) Then
conflicts.Add(reverseMappedLocations(typeParameter.Identifier.GetLocation()))
End If
Next
Next
End If
' if the renamed symbol is a type member, it's name should not conflict with a type parameter
If renamedSymbol.ContainingType IsNot Nothing AndAlso renamedSymbol.ContainingType.GetMembers(renamedSymbol.Name).Contains(renamedSymbol) Then
Dim conflictingLocations = renamedSymbol.ContainingType.TypeParameters _
.Where(Function(t) CaseInsensitiveComparison.Equals(t.Name, renamedSymbol.Name)) _
.SelectMany(Function(t) t.Locations)
For Each location In conflictingLocations
Dim typeParameterToken = location.FindToken(cancellationToken)
conflicts.Add(reverseMappedLocations(typeParameterToken.GetLocation()))
Next
End If
Return Task.FromResult(conflicts.ToImmutableAndFree())
End Function
Public Overrides Async Function ComputeImplicitReferenceConflictsAsync(
renameSymbol As ISymbol, renamedSymbol As ISymbol,
implicitReferenceLocations As IEnumerable(Of ReferenceLocation),
cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of Location))
' Handle renaming of symbols used for foreach
Dim implicitReferencesMightConflict = renameSymbol.Kind = SymbolKind.Property AndAlso
CaseInsensitiveComparison.Equals(renameSymbol.Name, "Current")
implicitReferencesMightConflict = implicitReferencesMightConflict OrElse
(renameSymbol.Kind = SymbolKind.Method AndAlso
(CaseInsensitiveComparison.Equals(renameSymbol.Name, "MoveNext") OrElse
CaseInsensitiveComparison.Equals(renameSymbol.Name, "GetEnumerator")))
' TODO: handle Dispose for using statement and Add methods for collection initializers.
If implicitReferencesMightConflict Then
If Not CaseInsensitiveComparison.Equals(renamedSymbol.Name, renameSymbol.Name) Then
For Each implicitReferenceLocation In implicitReferenceLocations
Dim token = Await implicitReferenceLocation.Location.SourceTree.GetTouchingTokenAsync(
implicitReferenceLocation.Location.SourceSpan.Start, cancellationToken, findInsideTrivia:=False).ConfigureAwait(False)
If token.Kind = SyntaxKind.ForKeyword AndAlso token.Parent.IsKind(SyntaxKind.ForEachStatement) Then
Return ImmutableArray.Create(DirectCast(token.Parent, ForEachStatementSyntax).Expression.GetLocation())
End If
Next
End If
End If
Return ImmutableArray(Of Location).Empty
End Function
#End Region
''' <summary>
''' Gets the top most enclosing statement as target to call MakeExplicit on.
''' It's either the enclosing statement, or if this statement is inside of a lambda expression, the enclosing
''' statement of this lambda.
''' </summary>
''' <param name="token">The token to get the complexification target for.</param>
Public Overrides Function GetExpansionTargetForLocation(token As SyntaxToken) As SyntaxNode
Return GetExpansionTarget(token)
End Function
Private Shared Function GetExpansionTarget(token As SyntaxToken) As SyntaxNode
' get the directly enclosing statement
Dim enclosingStatement = token.FirstAncestorOrSelf(Function(n) TypeOf (n) Is ExecutableStatementSyntax)
' for nodes in a using, for or for each statement, we do not need the enclosing _executable_ statement, which is the whole block.
' it's enough to expand the using, for or foreach statement.
Dim possibleSpecialStatement = token.FirstAncestorOrSelf(Function(n) n.Kind = SyntaxKind.ForStatement OrElse
n.Kind = SyntaxKind.ForEachStatement OrElse
n.Kind = SyntaxKind.UsingStatement OrElse
n.Kind = SyntaxKind.CatchBlock)
If possibleSpecialStatement IsNot Nothing Then
If enclosingStatement Is possibleSpecialStatement.Parent Then
enclosingStatement = If(possibleSpecialStatement.Kind = SyntaxKind.CatchBlock,
DirectCast(possibleSpecialStatement, CatchBlockSyntax).CatchStatement,
possibleSpecialStatement)
End If
End If
' see if there's an enclosing lambda expression
Dim possibleLambdaExpression As SyntaxNode = Nothing
If enclosingStatement Is Nothing Then
possibleLambdaExpression = token.FirstAncestorOrSelf(Function(n) TypeOf (n) Is LambdaExpressionSyntax)
End If
Dim enclosingCref = token.FirstAncestorOrSelf(Function(n) TypeOf (n) Is CrefReferenceSyntax)
If enclosingCref IsNot Nothing Then
Return enclosingCref
End If
' there seems to be no statement above this one. Let's see if we can at least get an SimpleNameSyntax
Return If(enclosingStatement, If(possibleLambdaExpression, token.FirstAncestorOrSelf(Function(n) TypeOf (n) Is SimpleNameSyntax)))
End Function
#Region "Helper Methods"
Public Overrides Function IsIdentifierValid(replacementText As String, syntaxFactsService As ISyntaxFactsService) As Boolean
replacementText = SyntaxFacts.MakeHalfWidthIdentifier(replacementText)
Dim possibleIdentifier As String
If syntaxFactsService.IsTypeCharacter(replacementText.Last()) Then
' We don't allow to use identifiers with type characters
Return False
Else
If replacementText.StartsWith("[", StringComparison.Ordinal) AndAlso replacementText.EndsWith("]", StringComparison.Ordinal) Then
possibleIdentifier = replacementText
Else
possibleIdentifier = "[" & replacementText & "]"
End If
End If
' Make sure we got an identifier.
If Not syntaxFactsService.IsValidIdentifier(possibleIdentifier) Then
' We still don't have an identifier, so let's fail
Return False
End If
' This is a valid Identifier
Return True
End Function
Public Overrides Function ComputePossibleImplicitUsageConflicts(
renamedSymbol As ISymbol,
semanticModel As SemanticModel,
originalDeclarationLocation As Location,
newDeclarationLocationStartingPosition As Integer,
cancellationToken As CancellationToken) As ImmutableArray(Of Location)
' TODO: support other implicitly used methods like dispose
If CaseInsensitiveComparison.Equals(renamedSymbol.Name, "MoveNext") OrElse
CaseInsensitiveComparison.Equals(renamedSymbol.Name, "GetEnumerator") OrElse
CaseInsensitiveComparison.Equals(renamedSymbol.Name, "Current") Then
If TypeOf renamedSymbol Is IMethodSymbol Then
If DirectCast(renamedSymbol, IMethodSymbol).IsOverloads AndAlso
(renamedSymbol.GetAllTypeArguments().Length <> 0 OrElse
DirectCast(renamedSymbol, IMethodSymbol).Parameters.Length <> 0) Then
Return ImmutableArray(Of Location).Empty
End If
End If
If TypeOf renamedSymbol Is IPropertySymbol Then
If DirectCast(renamedSymbol, IPropertySymbol).IsOverloads Then
Return ImmutableArray(Of Location).Empty
End If
End If
' TODO: Partial methods currently only show the location where the rename happens As a conflict.
' Consider showing both locations as a conflict.
Dim baseType = renamedSymbol.ContainingType?.GetBaseTypes().FirstOrDefault()
If baseType IsNot Nothing Then
Dim implicitSymbols = semanticModel.LookupSymbols(
newDeclarationLocationStartingPosition,
baseType,
renamedSymbol.Name) _
.Where(Function(sym) Not sym.Equals(renamedSymbol))
For Each symbol In implicitSymbols
If symbol.GetAllTypeArguments().Length <> 0 Then
Continue For
End If
If symbol.Kind = SymbolKind.Method Then
Dim method = DirectCast(symbol, IMethodSymbol)
If CaseInsensitiveComparison.Equals(symbol.Name, "MoveNext") Then
If Not method.ReturnsVoid AndAlso Not method.Parameters.Any() AndAlso method.ReturnType.SpecialType = SpecialType.System_Boolean Then
Return ImmutableArray.Create(originalDeclarationLocation)
End If
ElseIf CaseInsensitiveComparison.Equals(symbol.Name, "GetEnumerator") Then
' we are a bit pessimistic here.
' To be sure we would need to check if the returned type Is having a MoveNext And Current as required by foreach
If Not method.ReturnsVoid AndAlso
Not method.Parameters.Any() Then
Return ImmutableArray.Create(originalDeclarationLocation)
End If
End If
ElseIf CaseInsensitiveComparison.Equals(symbol.Name, "Current") Then
Dim [property] = DirectCast(symbol, IPropertySymbol)
If Not [property].Parameters.Any() AndAlso Not [property].IsWriteOnly Then
Return ImmutableArray.Create(originalDeclarationLocation)
End If
End If
Next
End If
End If
Return ImmutableArray(Of Location).Empty
End Function
Public Overrides Sub TryAddPossibleNameConflicts(symbol As ISymbol, replacementText As String, possibleNameConflicts As ICollection(Of String))
Dim halfWidthReplacementText = SyntaxFacts.MakeHalfWidthIdentifier(replacementText)
Const AttributeSuffix As String = "Attribute"
Const AttributeSuffixLength As Integer = 9
Debug.Assert(AttributeSuffixLength = AttributeSuffix.Length, "Assert (AttributeSuffixLength = AttributeSuffix.Length) failed.")
If replacementText.Length > AttributeSuffixLength AndAlso CaseInsensitiveComparison.Equals(halfWidthReplacementText.Substring(halfWidthReplacementText.Length - AttributeSuffixLength), AttributeSuffix) Then
Dim conflict = replacementText.Substring(0, replacementText.Length - AttributeSuffixLength)
If Not possibleNameConflicts.Contains(conflict) Then
possibleNameConflicts.Add(conflict)
End If
End If
If symbol.Kind = SymbolKind.Property Then
For Each conflict In {"_" + replacementText, "get_" + replacementText, "set_" + replacementText}
If Not possibleNameConflicts.Contains(conflict) Then
possibleNameConflicts.Add(conflict)
End If
Next
End If
' consider both versions of the identifier (escaped and unescaped)
Dim valueText = replacementText
Dim kind = SyntaxFacts.GetKeywordKind(replacementText)
If kind <> SyntaxKind.None Then
valueText = SyntaxFacts.GetText(kind)
Else
Dim name = SyntaxFactory.ParseName(replacementText)
If name.Kind = SyntaxKind.IdentifierName Then
valueText = DirectCast(name, IdentifierNameSyntax).Identifier.ValueText
End If
End If
If Not CaseInsensitiveComparison.Equals(valueText, replacementText) Then
possibleNameConflicts.Add(valueText)
End If
End Sub
''' <summary>
''' Gets the semantic model for the given node.
''' If the node belongs to the syntax tree of the original semantic model, then returns originalSemanticModel.
''' Otherwise, returns a speculative model.
''' The assumption for the later case is that span start position of the given node in it's syntax tree is same as
''' the span start of the original node in the original syntax tree.
''' </summary>
''' <param name="node"></param>
''' <param name="originalSemanticModel"></param>
Public Shared Function GetSemanticModelForNode(node As SyntaxNode, originalSemanticModel As SemanticModel) As SemanticModel
If node.SyntaxTree Is originalSemanticModel.SyntaxTree Then
' This is possible if the previous rename phase didn't rewrite any nodes in this tree.
Return originalSemanticModel
End If
Dim syntax = node
Dim nodeToSpeculate = syntax.GetAncestorsOrThis(Of SyntaxNode).Where(Function(n) SpeculationAnalyzer.CanSpeculateOnNode(n)).LastOrDefault
If nodeToSpeculate Is Nothing Then
If syntax.IsKind(SyntaxKind.CrefReference) Then
nodeToSpeculate = DirectCast(syntax, CrefReferenceSyntax).Name
ElseIf syntax.IsKind(SyntaxKind.TypeConstraint) Then
nodeToSpeculate = DirectCast(syntax, TypeConstraintSyntax).Type
Else
Return Nothing
End If
End If
Dim isInNamespaceOrTypeContext = SyntaxFacts.IsInNamespaceOrTypeContext(TryCast(syntax, ExpressionSyntax))
Dim position = nodeToSpeculate.SpanStart
Return SpeculationAnalyzer.CreateSpeculativeSemanticModelForNode(nodeToSpeculate, DirectCast(originalSemanticModel, SemanticModel), position, isInNamespaceOrTypeContext)
End Function
#End Region
End Class
End Namespace
|
reaction1989/roslyn
|
src/Workspaces/VisualBasic/Portable/Rename/VisualBasicRenameRewriterLanguageService.vb
|
Visual Basic
|
apache-2.0
| 58,576
|
Imports SistFoncreagro.BussinessEntities
Imports System.Data.SqlClient
Imports System.Data
Public Class JornadaLaboralRepository : Inherits MasterDataAccess : Implements IJornadaLaboralRepository
Public Function GetDiasDescansoEnControlAsistenciaByRangoFechas(ByVal IdPeriodoLaboral As Integer, ByVal FI As Date, ByVal FF As Date) As Decimal Implements IJornadaLaboralRepository.GetDiasDescansoEnControlAsistenciaByRangoFechas
Dim command As SqlCommand = MyBase.CreateSPCommand("GetDiasDescansoEnControlAsistenciaByRangoFechas")
command.Parameters.AddWithValue("IdPeriodoLaboral", IdPeriodoLaboral)
command.Parameters.AddWithValue("FI", FI)
command.Parameters.AddWithValue("FF", FF)
Return command.ExecuteScalar()
'Dim i As Int32
'Using reader As SqlDataReader = MyBase.ExecuteReader(command)
' If reader.Read Then
' If Not reader.IsDBNull(0) Then
' i = reader.GetValue(0)
' End If
' Else
' i = 0 'command.Parameters("idCargo").Value
' End If
'End Using
'Return i
End Function
Public Function GetDiasFeriadosEnControlAsistenciaByRangoFechas(ByVal IdPeriodoLaboral As Integer, ByVal FI As Date, ByVal FF As Date) As Decimal Implements IJornadaLaboralRepository.GetDiasFeriadosEnControlAsistenciaByRangoFechas
Dim command As SqlCommand = MyBase.CreateSPCommand("GetDiasFeriadosEnControlAsistenciaByRangoFechas")
command.Parameters.AddWithValue("IdPeriodoLaboral", IdPeriodoLaboral)
command.Parameters.AddWithValue("FI", FI)
command.Parameters.AddWithValue("FF", FF)
Return command.ExecuteScalar()
End Function
Public Function GetDiasNoLaboradosNoSubsidiadosByIdJornadaLaboral(ByVal IdJornalaLaboral As Integer) As Decimal Implements IJornadaLaboralRepository.GetDiasNoLaboradosNoSubsidiadosByIdJornadaLaboral
Dim command As SqlCommand = MyBase.CreateSPCommand("GetDiasNoLaboradosNoSubsidiadosByIdJornadaLaboral")
command.Parameters.AddWithValue("IdJornalaLaboral", IdJornalaLaboral)
Return command.ExecuteScalar()
End Function
Public Function GetDiasNoLaboradosSubsidiadosByIdJornadaLaboral(ByVal IdJornalaLaboral As Integer) As Decimal Implements IJornadaLaboralRepository.GetDiasNoLaboradosSubsidiadosByIdJornadaLaboral
Dim command As SqlCommand = MyBase.CreateSPCommand("GetDiasNoLaboradosSubsidiadosByIdJornadaLaboral")
command.Parameters.AddWithValue("IdJornalaLaboral", IdJornalaLaboral)
Return command.ExecuteScalar()
End Function
Public Function GetJornadaLaboralPeriodoByIdPeriodoLaboralByIdPeriodoDeclaracion(ByVal IdPeriodoLaboral As Integer, ByVal IdPeriodoDeclaracion As Integer) As BussinessEntities.JornadaLaboralPeriodo Implements IJornadaLaboralRepository.GetJornadaLaboralPeriodoByIdPeriodoLaboralByIdPeriodoDeclaracion
Dim command As SqlCommand = MyBase.CreateSPCommand("GetJornadaLaboralPeriodoByIdPeriodoLaboralByIdPeriodoDeclaracion")
command.Parameters.AddWithValue("IdPeriodoLaboral", IdPeriodoLaboral)
command.Parameters.AddWithValue("IdPeriodoDeclaracion", IdPeriodoDeclaracion)
Return command.ExecuteScalar()
End Function
Public Function GetSumHExtra25ControlAsistByFechasByIdPeriodoLaboral(ByVal IdPeriodoLaboral As Integer, ByVal MinHE25 As Decimal, ByVal MaxHE25 As Decimal, ByVal FI As Date, ByVal FF As Date) As Decimal Implements IJornadaLaboralRepository.GetSumHExtra25ControlAsistByFechasByIdPeriodoLaboral
Dim command As SqlCommand = MyBase.CreateSPCommand("GetSumHExtra25ControlAsistByFechasByIdPeriodoLaboral")
command.Parameters.AddWithValue("IdPeriodoLaboral", IdPeriodoLaboral)
command.Parameters.AddWithValue("MinHE25", MinHE25)
command.Parameters.AddWithValue("MaxHE25", MaxHE25)
command.Parameters.AddWithValue("FI", FI)
command.Parameters.AddWithValue("FF", FF)
Return command.ExecuteScalar()
End Function
Public Function GetSumHExtra35ControlAsistByFechasByIdPeriodoLaboral(ByVal IdPeriodoLaboral As Integer, ByVal MaxHE25 As Decimal, ByVal FI As Date, ByVal FF As Date) As Decimal Implements IJornadaLaboralRepository.GetSumHExtra35ControlAsistByFechasByIdPeriodoLaboral
Dim command As SqlCommand = MyBase.CreateSPCommand("GetSumHExtra35ControlAsistByFechasByIdPeriodoLaboral")
command.Parameters.AddWithValue("IdPeriodoLaboral", IdPeriodoLaboral)
command.Parameters.AddWithValue("MaxHE25", MaxHE25)
command.Parameters.AddWithValue("FI", FI)
command.Parameters.AddWithValue("FF", FF)
Return command.ExecuteScalar()
End Function
Public Function SaveJORNADALABORALPERIODO(ByVal JornadaLaboralPeriodo As BussinessEntities.JornadaLaboralPeriodo) As Integer Implements IJornadaLaboralRepository.SaveJORNADALABORALPERIODO
Dim command As SqlCommand = MyBase.CreateSPCommand("SaveJORNADALABORALPERIODO")
command.Parameters.AddWithValue("IdJornadaLaboral", JornadaLaboralPeriodo.IdJornadaLaboral)
command.Parameters.AddWithValue("IdPeriodoDeclaracion", JornadaLaboralPeriodo.IdPeriodoDeclaracion)
command.Parameters.AddWithValue("IdPeriodoLaboral", JornadaLaboralPeriodo.IdPeriodoLaboral)
command.Parameters.AddWithValue("DiasEfecTrabajados", JornadaLaboralPeriodo.DiasEfecTrabajados)
command.Parameters.AddWithValue("DiasDescanso", JornadaLaboralPeriodo.DiasDescanso)
command.Parameters.AddWithValue("DiasFeriados", JornadaLaboralPeriodo.DiasFeriados)
command.Parameters.AddWithValue("HorasOrdinarias", JornadaLaboralPeriodo.HorasOrdinarias)
command.Parameters.AddWithValue("HorasExtraordinarias25", JornadaLaboralPeriodo.HorasExtraordinarias25)
command.Parameters.AddWithValue("HorasExtraordinarias35", JornadaLaboralPeriodo.HorasExtraordinarias35)
command.Parameters.AddWithValue("DiasNoSubsidiados", JornadaLaboralPeriodo.DiasNoSubsidiados)
command.Parameters.AddWithValue("DiasSubsidiados", JornadaLaboralPeriodo.DiasSubsidiados)
'command.Parameters("idCargo").Direction = ParameterDirection.Output
'MyBase.ExecuteNonQuery(command)
Dim i As Int32
Using reader As SqlDataReader = MyBase.ExecuteReader(command)
If reader.Read Then
If Not reader.IsDBNull(0) Then
i = reader.GetValue(0)
End If
Else
i = 0 'command.Parameters("idCargo").Value
End If
End Using
Return i
'command.ExecuteReader(CommandBehavior.SingleRow).Item(0)
End Function
Private Function SelectObjectFactory(ByVal command As SqlCommand) As List(Of JornadaLaboralPeriodo)
Dim lista As New List(Of JornadaLaboralPeriodo)
Dim ausenciasPeriodoBL As New AusenciaPeriodoRepository
Using reader As SqlDataReader = MyBase.ExecuteReader(command)
While reader.Read
Dim entity As New JornadaLaboralPeriodo
If Not reader.IsDBNull(reader.GetOrdinal("IdJornadaLaboral")) Then
entity.IdJornadaLaboral = reader.GetValue(reader.GetOrdinal("IdJornadaLaboral"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("IdPeriodoDeclaracion")) Then
entity.IdPeriodoDeclaracion = reader.GetValue(reader.GetOrdinal("IdPeriodoDeclaracion"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("IdPeriodoLaboral")) Then
entity.IdPeriodoLaboral = reader.GetValue(reader.GetOrdinal("IdPeriodoLaboral"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("DiasEfecTrabajados")) Then
entity.DiasEfecTrabajados = reader.GetValue(reader.GetOrdinal("DiasEfecTrabajados"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("DiasDescanso")) Then
entity.DiasDescanso = reader.GetValue(reader.GetOrdinal("DiasDescanso"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("DiasFeriados")) Then
entity.DiasFeriados = reader.GetValue(reader.GetOrdinal("DiasFeriados"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("HorasOrdinarias")) Then
entity.HorasOrdinarias = reader.GetValue(reader.GetOrdinal("HorasOrdinarias"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("HorasExtraordinarias25")) Then
entity.HorasExtraordinarias25 = reader.GetValue(reader.GetOrdinal("HorasExtraordinarias25"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("HorasExtraordinarias35")) Then
entity.HorasExtraordinarias35 = reader.GetValue(reader.GetOrdinal("HorasExtraordinarias35"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("DiasNoSubsidiados")) Then
entity.DiasNoSubsidiados = reader.GetValue(reader.GetOrdinal("DiasNoSubsidiados"))
End If
If Not reader.IsDBNull(reader.GetOrdinal("DiasSubsidiados")) Then
entity.DiasSubsidiados = reader.GetValue(reader.GetOrdinal("DiasSubsidiados"))
End If
entity.listaAusenciaEntity = ausenciasPeriodoBL.GetAusenciasPeriodoByIdJornadaLaboral(entity.IdJornadaLaboral)
lista.Add(entity)
End While
End Using
'El indice depende de la columna con la que este en el SP
Return lista
'
End Function
End Class
|
crackper/SistFoncreagro
|
SistFoncreagro.DataAccess/My Project/JornadaLaboralRepository.vb
|
Visual Basic
|
mit
| 9,721
|
Imports NServiceBus
Public Class VBMultiTestSaga
Inherits Saga(Of VBMultiTestSaga.SagaData)
Public Class SagaData
Inherits ContainSagaData
Public Property Correlation As String
End Class
Protected Overrides Sub ConfigureHowToFindSaga(ByVal mapper As SagaPropertyMapper(Of SagaData))
mapper.ConfigureMapping(Of MessageA)(Function(msg) msg.Correlation).ToSaga(Function(saga) saga.Correlation)
mapper.ConfigureMapping(Of MessageD)(Function(msg) msg.DifferentName).ToSaga(Function(saga) saga.Correlation)
mapper.ConfigureMapping(Of MessageC)(Function(msg) msg.Part1 + msg.Part2 + $"{msg.Part1}{msg.Part2}" + String.Format("{0}{1}", msg.Part1, msg.Part2)) _
.ToSaga(Function(saga) saga.Correlation)
End Sub
End Class
|
NServiceBusSqlPersistence/NServiceBus.SqlPersistence
|
src/VBTestCode/VBMultiTestSaga.vb
|
Visual Basic
|
mit
| 787
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
Me.Button6 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Button7 = New System.Windows.Forms.Button()
Me.Label3 = New System.Windows.Forms.Label()
Me.Button8 = New System.Windows.Forms.Button()
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.HelpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.CheckForUpdatesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.MenuStrip1.SuspendLayout()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(16, 361)
Me.Button1.Margin = New System.Windows.Forms.Padding(4)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(176, 51)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Amazon"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(344, 361)
Me.Button2.Margin = New System.Windows.Forms.Padding(4)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(176, 51)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Asus"
Me.Button2.UseVisualStyleBackColor = True
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(16, 507)
Me.Button3.Margin = New System.Windows.Forms.Padding(4)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(176, 51)
Me.Button3.TabIndex = 2
Me.Button3.Text = "Barnes Noble"
Me.Button3.UseVisualStyleBackColor = True
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(344, 507)
Me.Button4.Margin = New System.Windows.Forms.Padding(4)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(176, 51)
Me.Button4.TabIndex = 3
Me.Button4.Text = "HTC"
Me.Button4.UseVisualStyleBackColor = True
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(711, 361)
Me.Button5.Margin = New System.Windows.Forms.Padding(4)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(175, 51)
Me.Button5.TabIndex = 4
Me.Button5.Text = "LGE"
Me.Button5.UseVisualStyleBackColor = True
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(711, 507)
Me.Button6.Margin = New System.Windows.Forms.Padding(4)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(175, 51)
Me.Button6.TabIndex = 5
Me.Button6.Text = "Samsung"
Me.Button6.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(230, 64)
Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(355, 17)
Me.Label1.TabIndex = 6
Me.Label1.Text = "To Get Started, Please Select Your Device Manufactor!"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(142, 93)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(635, 17)
Me.Label2.TabIndex = 7
Me.Label2.Text = "If you own a LG Viper which is running COT 2.2, please click on GoLabs as your de" & _
"vice manufactor."
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(344, 237)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(176, 51)
Me.Button7.TabIndex = 8
Me.Button7.Text = "GoLabs"
Me.Button7.UseVisualStyleBackColor = True
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(158, 120)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(581, 17)
Me.Label3.TabIndex = 9
Me.Label3.Text = "Users who wish to install a beta recovery must have a beta forum account, and log" & _
"in below."
'
'Button8
'
Me.Button8.Location = New System.Drawing.Point(806, 13)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(93, 33)
Me.Button8.TabIndex = 10
Me.Button8.Text = "Login"
Me.Button8.UseVisualStyleBackColor = True
'
'MenuStrip1
'
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem, Me.ToolsToolStripMenuItem, Me.HelpToolStripMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(911, 24)
Me.MenuStrip1.TabIndex = 11
Me.MenuStrip1.Text = "MenuStrip1"
'
'FileToolStripMenuItem
'
Me.FileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ExitToolStripMenuItem})
Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem"
Me.FileToolStripMenuItem.Size = New System.Drawing.Size(37, 20)
Me.FileToolStripMenuItem.Text = "File"
'
'ExitToolStripMenuItem
'
Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"
Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.ExitToolStripMenuItem.Text = "Exit"
'
'ToolsToolStripMenuItem
'
Me.ToolsToolStripMenuItem.Name = "ToolsToolStripMenuItem"
Me.ToolsToolStripMenuItem.Size = New System.Drawing.Size(48, 20)
Me.ToolsToolStripMenuItem.Text = "Tools"
'
'HelpToolStripMenuItem
'
Me.HelpToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.CheckForUpdatesToolStripMenuItem})
Me.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"
Me.HelpToolStripMenuItem.Size = New System.Drawing.Size(44, 20)
Me.HelpToolStripMenuItem.Text = "Help"
'
'CheckForUpdatesToolStripMenuItem
'
Me.CheckForUpdatesToolStripMenuItem.Name = "CheckForUpdatesToolStripMenuItem"
Me.CheckForUpdatesToolStripMenuItem.Size = New System.Drawing.Size(171, 22)
Me.CheckForUpdatesToolStripMenuItem.Text = "Check for Updates"
'
'Form2
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(911, 569)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.MenuStrip1)
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MainMenuStrip = Me.MenuStrip1
Me.Margin = New System.Windows.Forms.Padding(4)
Me.Name = "Form2"
Me.Text = "Select Your Device Manufactor"
Me.MenuStrip1.ResumeLayout(False)
Me.MenuStrip1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip
Friend WithEvents FileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents ExitToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents ToolsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents HelpToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents CheckForUpdatesToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
End Class
|
thenameisnigel/OpenRecoveryInstall_Win
|
OpenCannibal/Form2.Designer.vb
|
Visual Basic
|
mit
| 10,386
|
' | Version 10.1
' | Copyright 2014 Esri
' |
' | Licensed under the Apache License, Version 2.0 (the "License");
' | you may not use this file except in compliance with the License.
' | You may obtain a copy of the License at
' |
' | http://www.apache.org/licenses/LICENSE-2.0
' |
' | Unless required by applicable law or agreed to in writing, software
' | distributed under the License is distributed on an "AS IS" BASIS,
' | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' | See the License for the specific language governing permissions and
' | limitations under the License.
Option Strict Off
Option Explicit On
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic
Imports System
Imports System.Configuration
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports ESRI.ArcGIS.Framework
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.SystemUI
Imports ESRI.ArcGIS.ADF.CATIDs
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.ArcMapUI
'Imports ESRI.ArcGIS.ArcMap
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.Editor
Imports ESRI.ArcGIS.DataSourcesGDB
''' <summary>
''' Designer class of the dockable window add-in. It contains user interfaces that
''' make up the dockable window.
''' </summary>
'''
Partial Public Class CostEstimatingWindow
Inherits UserControl
Private Shared m_BufferAmountConvext As Double = 60
Private Shared m_BufferAmount As Double = 15
Private Shared s_enabled As Boolean
'Shared References
Private Shared s_dgCIP As myDG
Private Shared s_tbCntCIPDetails As TabControl
Private Shared s_lstInventory As ListBox
Private Shared s_btnSavePrj As System.Windows.Forms.Button
Private Shared s_btnClear As System.Windows.Forms.Button
Private Shared s_btnSave As System.Windows.Forms.Button
Private Shared s_btnStartEditing As System.Windows.Forms.Button
Private Shared s_btnStopEditing As System.Windows.Forms.Button
Private Shared s_btnSelect As System.Windows.Forms.RadioButton
Private Shared s_btnSelectAssets As System.Windows.Forms.RadioButton
Private Shared s_btnSketch As System.Windows.Forms.RadioButton
Private Shared s_btnSelectPrj As System.Windows.Forms.RadioButton
Private Shared s_lblTotalCost As System.Windows.Forms.Label
Private Shared s_lblTotLength As System.Windows.Forms.Label
Private Shared s_lblLength As System.Windows.Forms.Label
Private Shared s_lblTotArea As System.Windows.Forms.Label
Private Shared s_lblArea As System.Windows.Forms.Label
Private Shared s_lblTotPnt As System.Windows.Forms.Label
Private Shared s_lblPoint As System.Windows.Forms.Label
Private Shared s_gpBxCIPCostingLayers As System.Windows.Forms.GroupBox
Private Shared s_gpBxControls As System.Windows.Forms.GroupBox
Private Shared s_gpBxCIPCan As System.Windows.Forms.GroupBox
Private Shared s_gpBxSwitch As System.Windows.Forms.GroupBox
Private Shared s_gpBxCIPInven As System.Windows.Forms.GroupBox
Private Shared s_gpBxCIPPrj As System.Windows.Forms.GroupBox
Private Shared s_cboAction As System.Windows.Forms.ComboBox
Private Shared s_cboDefLayers As System.Windows.Forms.ComboBox
Private Shared s_cboStrategy As System.Windows.Forms.ComboBox
Private Shared s_cboCIPInvTypes As System.Windows.Forms.ComboBox
Private Shared s_TotalDisplay As System.Windows.Forms.FlowLayoutPanel
Private Shared s_tblDisabled As System.Windows.Forms.TableLayoutPanel
Private Shared s_ctxMenu As System.Windows.Forms.ContextMenuStrip
Private Shared s_ShowLength As ToolStripItem
Private Shared s_ShowPoint As ToolStripItem
Private Shared s_ShowArea As ToolStripItem
Private Shared s_numCIPInvCount As System.Windows.Forms.NumericUpDown
Public Sub init()
End Sub
Private Sub New(ByVal hook As Object)
Try
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.Hook = hook
Dim txtTmp As String = My.Globals.Functions.GetConfigValue("BufferAmount")
If (txtTmp <> "") Then
Double.TryParse(txtTmp, m_BufferAmount)
End If
txtTmp = My.Globals.Functions.GetConfigValue("BufferAmountConvex")
If (txtTmp <> "") Then
Double.TryParse(txtTmp, m_BufferAmountConvext)
End If
'Init Shared Controls
s_tblDisabled = tblDisabled
s_tbCntCIPDetails = tbCntCIPDetails
' s_tbCntCIPDetails.Dock = DockStyle.Fill
s_lstInventory = lstInventory
s_btnSavePrj = btnSavePrj
s_btnSave = btnSave
s_btnClear = btnClear
s_btnStartEditing = btnStartEditing
s_btnStopEditing = btnStopEditing
s_btnSelect = btnSelect
s_btnSelectAssets = btnSelectAssets
s_btnSketch = btnSketch
AddHandler s_btnSketch.Click, AddressOf btnSketch_Click
s_lblTotalCost = lblTotalCost
s_lblTotLength = lblTotLength
s_lblLength = lblLength
s_lblTotArea = lblTotArea
s_lblArea = lblArea
s_lblTotPnt = lblTotPnt
s_lblPoint = lblPoint
s_gpBxCIPCostingLayers = gpBxCIPCostingLayers
s_gpBxControls = gpBxControls
s_gpBxCIPCan = gpBxCIPCan
s_cboDefLayers = cboDefLayers
s_cboStrategy = cboStrategy
s_cboAction = cboAction
s_cboCIPInvTypes = cboCIPInvTypes
s_gpBxSwitch = gpBxSwitch
s_gpBxCIPInven = gpBxCIPInven
s_gpBxCIPPrj = gpBxCIPPrj
s_TotalDisplay = TotalDisplay
s_btnSelectPrj = btnSelectPrj
s_ctxMenu = ctxMenu
s_ShowArea = ShowArea
s_ShowLength = ShowLength
s_ShowPoint = ShowPoint
s_numCIPInvCount = numCIPInvCount
' Add any initialization after the InitializeComponent() call.
makeImagesTrans()
InitGrid()
createGraphicSymbols()
'gpBxSwitch.Dock = DockStyle.Right
's_gpBxSwitch.Width = 85
's_gpBxCIPInven.Visible = False
's_gpBxCIPCostingLayers.Visible = False
's_gpBxCIPPrj.Visible = False
's_gpBxCIPCan.Visible = True
s_gpBxCIPCan.Dock = DockStyle.Fill
s_gpBxCIPInven.Dock = DockStyle.Fill
s_gpBxCIPPrj.Dock = DockStyle.Fill
s_gpBxCIPCostingLayers.Dock = DockStyle.Fill
' btnToggle.BackgroundImage = My.Resources.Leftdark
' btnToggle.BackgroundImageLayout = ImageLayout.Zoom
's_gpBxCIPCostingLayers.Visible = False
's_gpBxCIPInven.Visible = False
's_gpBxCIPPrj.Visible = False
's_gpBxControls.Visible = False
's_gpBxCIPCan.Visible = False
's_gpBxSwitch.Visible = False
SetEnabled(CostEstimatingExtension.IsExtensionEnabled)
s_lblTotLength.Text = ".00"
s_lblTotArea.Text = ".00"
s_lblTotPnt.Text = "0"
s_lblTotalCost.Text = FormatCurrency("0.00", 2, TriState.True, TriState.True) 'Format(Total, "#,###.00")
s_lblTotalCost.Parent.Refresh()
If (Not CostEstimatingWindow.Exists) Then
Return
End If
CostEstimatingWindow.ResetControls(True)
If CostEstimatingExtension.CheckForCIPLayers() Then
CostEstimatingExtension.initCIPLayers()
CostEstimatingWindow.EnableWindowControls(True)
CostEstimatingExtension.raiseEventInExt(True)
CostEstimatingWindow.LoadControlsToDetailForm()
Else
CostEstimatingWindow.EnableWindowControls(False)
CostEstimatingExtension.raiseEventInExt(False)
End If
CostEstimatingWindow.EnableSavePrj()
CostEstimatingWindow.SetEnabled(True)
loadDefLayersCboBox()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: New" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub SetEnabled(ByVal enabled As Boolean)
s_enabled = enabled
If s_gpBxCIPCostingLayers Is Nothing Then Return
If enabled Then
s_gpBxSwitch.Width = 85
s_gpBxCIPInven.Visible = False
s_gpBxCIPCostingLayers.Visible = False
s_gpBxCIPPrj.Visible = False
s_gpBxCIPCan.Visible = True
s_gpBxControls.Visible = True
s_gpBxSwitch.Visible = True
s_tblDisabled.Visible = False
Else
s_gpBxCIPCan.Visible = False
s_gpBxCIPCostingLayers.Visible = False
s_gpBxCIPInven.Visible = False
s_gpBxCIPPrj.Visible = False
s_gpBxControls.Visible = False
s_gpBxSwitch.Visible = False
s_tblDisabled.Visible = True
End If
' if the dockable window was never displayed, listview could be null
'hide controls
'If s_listView Is Nothing Then
' Return
'End If
'If enabled Then
' s_label.Visible = False
' s_listView.Visible = True
'Else
' Clear()
' s_label.Visible = True
' s_listView.Visible = False
'End If
End Sub
#Region "Overrides"
Protected Overrides Sub Finalize()
Try
If s_dgCIP IsNot Nothing Then
s_dgCIP.Dispose()
End If
s_dgCIP = Nothing
MyBase.Finalize()
Catch ex As Exception
End Try
End Sub
#End Region
#Region "Private Shared functions"
Private Shared Sub ShuffleControls(ByVal Vertical As Boolean)
If s_tbCntCIPDetails Is Nothing Then Return
If s_tbCntCIPDetails.SelectedIndex = -1 Then Return
If s_tbCntCIPDetails.TabPages.Count = 0 Then Return
If Vertical Then
Try
'Spacing between last control and the bottom of the page
Dim pBottomPadding As Integer = 120
'Padding for the left of each control
Dim pLeftPadding As Integer = 10
'Spacing between firstcontrol and the top
Dim pTopPadding As Integer = 3
'Padding for the right of each control
Dim pRightPadding As Integer = 15
Dim pCurTabIdx As Integer = s_tbCntCIPDetails.SelectedIndex
Dim pTbPageCo() As TabPage = Nothing
Dim pCurTabPage As TabPage = New TabPage
'pCurTabPage.Name = strName
'pCurTabPage.Text = strName
Dim pCntlNextTop As Integer = pTopPadding
For Each tb As TabPage In s_tbCntCIPDetails.TabPages
Dim bLoop As Boolean = True
While bLoop = True
If tb.Controls.Count = 0 Then
Exit While
End If
Dim cnt As Control = tb.Controls(0)
If TypeOf cnt Is System.Windows.Forms.Button Then
tb.Controls.Remove(cnt)
Else
cnt.Top = pCntlNextTop
cnt.Width = s_tbCntCIPDetails.Width
If TypeOf cnt Is Panel Then
For Each pnlCnt As Control In cnt.Controls
If TypeOf pnlCnt Is System.Windows.Forms.Button Then
Dim controls() As Control = CType(CType(pnlCnt, System.Windows.Forms.Button).Parent, Panel).Controls.Find("txtEdit" & pnlCnt.Tag, False)
If controls.Length = 1 Then
controls(0).Width = controls(0).Width - pnlCnt.Width - 5
pnlCnt.Left = controls(0).Width + controls(0).Left + 5
End If
ElseIf TypeOf pnlCnt Is CustomPanel Then
pnlCnt.Width = cnt.Width - pRightPadding - pLeftPadding
If pnlCnt.Controls.Count = 2 Then
pnlCnt.Controls(0).Left = pLeftPadding
pnlCnt.Controls(1).Left = (pnlCnt.Width / 2)
End If
Else
pnlCnt.Width = s_tbCntCIPDetails.Width - pLeftPadding - pRightPadding
End If
'End If
Next
End If
pCurTabPage.Controls.Add(cnt)
pCntlNextTop = pCntlNextTop + cnt.Height + pTopPadding
If pCntlNextTop >= s_tbCntCIPDetails.Height - pBottomPadding Then
'Dim pBtn As System.Windows.Forms.Button
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnSaveEdit"
'pBtn.Text = "Save"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) - pBtn.Width - 10
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnClearEdit"
'pBtn.Text = "Clear"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) + 10
If pTbPageCo Is Nothing Then
ReDim Preserve pTbPageCo(0)
Else
ReDim Preserve pTbPageCo(pTbPageCo.Length)
End If
pTbPageCo(pTbPageCo.Length - 1) = pCurTabPage
pCurTabPage = New TabPage
'pCurTabPage.Name = strName
'pCurTabPage.Text = strName
pCntlNextTop = pTopPadding
'pBtn = Nothing
End If
End If
End While
Next
If pCurTabPage.Controls.Count > 0 Then
'Dim pBtn As System.Windows.Forms.Button
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnSaveEdit"
'pBtn.Text = "Save"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) - pBtn.Width - 10
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnClearEdit"
'pBtn.Text = "Clear"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) + 10
If pTbPageCo Is Nothing Then
ReDim Preserve pTbPageCo(0)
Else
ReDim Preserve pTbPageCo(pTbPageCo.Length)
End If
pTbPageCo(pTbPageCo.Length - 1) = pCurTabPage
Else
End If
s_tbCntCIPDetails.TabPages.Clear()
For Each tbp As TabPage In pTbPageCo
s_tbCntCIPDetails.TabPages.Add(tbp)
tbp.Visible = True
tbp.Update()
Next
If s_tbCntCIPDetails.TabPages.Count >= pCurTabIdx Then
s_tbCntCIPDetails.SelectedIndex = pCurTabIdx
Else
s_tbCntCIPDetails.SelectedIndex = s_tbCntCIPDetails.TabPages.Count - 1
End If
pTbPageCo = Nothing
pCurTabPage = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ShuffleControls" & vbCrLf & ex.Message)
End Try
Else 'horizontel
Try
'Spacing between last control and the bottom of the page
Dim pBottomPadding As Integer = 25
'Padding for the left of each control
Dim pLeftPadding As Integer = 10
'Spacing between firstcontrol and the top
Dim pTopPadding As Integer = 3
'Padding for the right of each control
Dim pRightPadding As Integer = 15
Dim pCntSpacing As Integer = 5
Dim pCurTabIdx As Integer = s_tbCntCIPDetails.SelectedIndex
Dim pTbPageCo() As TabPage = Nothing
Dim pCurTabPage As TabPage = New TabPage
pCurTabPage.Name = "Page 1"
pCurTabPage.Text = "Page 1"
Dim pCntlNextTop As Integer = pTopPadding
Dim pCntlNextLeft As Integer = pLeftPadding
For Each tb As TabPage In s_tbCntCIPDetails.TabPages
Dim bLoop As Boolean = True
While bLoop = True
If tb.Controls.Count = 0 Then
Exit While
End If
Dim cnt As Control = tb.Controls(0)
If TypeOf cnt Is System.Windows.Forms.Button Then
tb.Controls.Remove(cnt)
Else
cnt.Top = pCntlNextTop
cnt.Left = pCntlNextLeft
cnt.Width = My.Globals.Constants.c_ControlWidth
If TypeOf cnt Is Panel Then
For Each pnlCnt As Control In cnt.Controls
If TypeOf pnlCnt Is System.Windows.Forms.Button Then
Dim controls() As Control = CType(CType(pnlCnt, System.Windows.Forms.Button).Parent, Panel).Controls.Find("txtEdit" & pnlCnt.Tag, False)
If controls.Length = 1 Then
controls(0).Width = cnt.Width - cnt.Height - 5
pnlCnt.Left = controls(0).Width + controls(0).Left + 5
End If
ElseIf TypeOf pnlCnt Is CustomPanel Then
pnlCnt.Width = cnt.Width - pRightPadding - pLeftPadding
If pnlCnt.Controls.Count = 2 Then
pnlCnt.Controls(0).Left = pLeftPadding
pnlCnt.Controls(1).Left = (pnlCnt.Width / 2)
End If
Else
pnlCnt.Width = cnt.Width - pLeftPadding - pRightPadding
End If
'End If
Next
End If
If pCntlNextTop + cnt.Height + pTopPadding >= s_tbCntCIPDetails.Parent.Parent.Height - s_gpBxControls.Height - pBottomPadding - pBottomPadding Then
'Dim pBtn As System.Windows.Forms.Button
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnSaveEdit"
'pBtn.Text = "Save"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) - pBtn.Width - 10
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnClearEdit"
'pBtn.Text = "Clear"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) + 10
'If pCntlNextLeft + pCntSpacing + (My.Globals.Constants.c_ControlWidth * 2) > s_tbCntlDisplay.Width Then
If pCntlNextLeft + pCntSpacing + (My.Globals.Constants.c_ControlWidth * 2) > s_tbCntCIPDetails.Parent.Parent.Width - s_gpBxSwitch.Width Then
If pTbPageCo Is Nothing Then
ReDim Preserve pTbPageCo(0)
Else
ReDim Preserve pTbPageCo(pTbPageCo.Length)
End If
pTbPageCo(pTbPageCo.Length - 1) = pCurTabPage
pCurTabPage = New TabPage
pCurTabPage.Name = "Page" & pTbPageCo.Length + 1
pCurTabPage.Text = "Page" & pTbPageCo.Length + 1
pCntlNextTop = pTopPadding
pCntlNextLeft = pLeftPadding
Else
pCntlNextTop = pTopPadding
pCntlNextLeft = pCntlNextLeft + My.Globals.Constants.c_ControlWidth + pCntSpacing
End If
cnt.Top = pCntlNextTop
cnt.Left = pCntlNextLeft
pCurTabPage.Controls.Add(cnt)
pCntlNextTop = pCntlNextTop + cnt.Height + pTopPadding
'pBtn = Nothing
Else
pCurTabPage.Controls.Add(cnt)
pCntlNextTop = pCntlNextTop + cnt.Height + pTopPadding
End If
End If
End While
Next
If pCurTabPage.Controls.Count > 0 Then
'Dim pBtn As System.Windows.Forms.Button
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnSaveEdit"
'pBtn.Text = "Save"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) - pBtn.Width - 10
'pBtn = New System.Windows.Forms.Button
'pBtn.Name = "btnClearEdit"
'pBtn.Text = "Clear"
'pBtn.Font = My.Globals.Constants.c_Fnt
'pBtn.Top = pCntlNextTop
'pBtn.AutoSize = True
'AddHandler pBtn.Click, AddressOf ClearSaveButtonClick
'pCurTabPage.Controls.Add(pBtn)
'pBtn.Left = (tbCntCIPDetails.Width / 2) + 10
If pTbPageCo Is Nothing Then
ReDim Preserve pTbPageCo(0)
Else
ReDim Preserve pTbPageCo(pTbPageCo.Length)
End If
pTbPageCo(pTbPageCo.Length - 1) = pCurTabPage
Else
End If
s_tbCntCIPDetails.TabPages.Clear()
For Each tbp As TabPage In pTbPageCo
s_tbCntCIPDetails.TabPages.Add(tbp)
tbp.Visible = True
tbp.Update()
Next
If s_tbCntCIPDetails.TabPages.Count >= pCurTabIdx Then
s_tbCntCIPDetails.SelectedIndex = pCurTabIdx
Else
s_tbCntCIPDetails.SelectedIndex = s_tbCntCIPDetails.TabPages.Count - 1
End If
pTbPageCo = Nothing
pCurTabPage = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ShuffleControls" & vbCrLf & ex.Message)
End Try
End If
End Sub
Private Shared Sub AddControls()
Try
'Exit if the layer is not found
If My.Globals.Variables.v_CIPLayerOver Is Nothing Then Exit Sub
If My.Globals.Variables.v_CIPLayerOver.FeatureClass Is Nothing Then Exit Sub
Dim pLeftPadding As Integer = 10
'Clear out the controls from the container
s_tbCntCIPDetails.TabPages.Clear()
s_tbCntCIPDetails.Controls.Clear()
Dim pTbPg As TabPage = New TabPage
s_tbCntCIPDetails.TabPages.Add(pTbPg)
'Controls to display attributes
'Dim pTbPg As TabPage = Nothing
Dim pTxtBox As TextBox
Dim pLbl As Label
Dim pNumBox As NumericUpDown
Dim pBtn As System.Windows.Forms.Button
Dim pCBox As ComboBox
Dim pRDButton As RadioButton
Dim pDateTime As DateTimePicker
'Spacing between each control
Dim intCtrlSpace As Integer = 5
'Spacing between a lable and a control
Dim intLabelCtrlSpace As Integer = 0
'Set the width of each control
' Dim my.Globals.Constants.c_ControlWidth As Integer = 50
'used for sizing text, only used when text is larger then display
Dim g As Graphics
Dim s As SizeF
'Used to loop through featurelayer
Dim pDCs As IFields
Dim pDc As IField
Dim pSubTypeDefValue As Integer = 0
'Get the columns for hte layer
pDCs = My.Globals.Variables.v_CIPLayerOver.FeatureClass.Fields
Dim pSubType As ISubtypes = My.Globals.Variables.v_CIPLayerOver.FeatureClass
If pSubType.HasSubtype Then
pSubTypeDefValue = pSubType.DefaultSubtypeCode 'pfl.Columns(pfl.SubtypeColumnIndex).DefaultValue
End If
'Field Name
Dim strfld As String
'Field Alias
Dim strAli As String
Dim pDom As IDomain
For i = 0 To pDCs.FieldCount - 1
pDc = pDCs.Field(i)
Dim pLayerFields As ILayerFields
Dim pFieldInfo As IFieldInfo
pLayerFields = My.Globals.Variables.v_CIPLayerOver
pFieldInfo = pLayerFields.FieldInfo(pLayerFields.FindField(pDc.Name))
' pFieldInfo.Visible = False
If pFieldInfo.Visible = False Then
ElseIf pDc.Name = My.Globals.Constants.c_CIPProjectLayCostField Then
ElseIf pDc.Name = My.Globals.Constants.c_CIPProjectLayTotLenField Then
ElseIf pDc.Name = My.Globals.Constants.c_CIPProjectLayTotAreaField Then
ElseIf pDc.Name = My.Globals.Constants.c_CIPProjectLayTotPntField Then
Else
pDom = Nothing
'Get the field names
strfld = pDc.Name
strAli = pDc.AliasName
'Check the field types
If My.Globals.Variables.v_CIPLayerOver.FeatureClass.ShapeFieldName = strfld Or My.Globals.Variables.v_CIPLayerOver.FeatureClass.OIDFieldName = strfld Or _
UCase(strfld) = UCase("shape.len") Or UCase(strfld) = UCase("shape.area") Or _
UCase(strfld) = UCase("shape_length") Or _
UCase(strfld) = UCase("shape_len") Or UCase(strfld) = UCase("shape_area") Or _
UCase(strfld) = UCase("LASTUPDATE") Or UCase(strfld) = UCase("LASTEDITOR") Or pDc.Editable = False _
Or My.Globals.Variables.v_CIPLayerOver.FeatureClass.AreaField.Name = strfld Or My.Globals.Variables.v_CIPLayerOver.FeatureClass.LengthField.Name = strfld Then
'Reserved Columns
ElseIf pSubType.SubtypeFieldName = strfld Then
'Create a lable for the field name
pLbl = New Label
'Apply the field alias to the field name
pLbl.Text = strAli & " (Set This Value First)"
'Link the field to the name of the control
pLbl.Name = "lblEdit" & strfld
'Add the control at the determined Location
pLbl.Left = 0
pLbl.Top = 0
pLbl.ForeColor = Color.Blue
'Apply global font
pLbl.Font = My.Globals.Constants.c_FntLbl
'Create a graphics object to messure the text
g = pLbl.CreateGraphics
s = g.MeasureString(pLbl.Text, pLbl.Font)
pLbl.Height = s.Height
'If the text is larger then the control, truncate the control
If s.Width >= My.Globals.Constants.c_ControlWidth Then
pLbl.Width = My.Globals.Constants.c_ControlWidth
Else 'Use autosize if it fits
pLbl.AutoSize = True
End If
If My.Globals.Functions.SubtypeCount(pSubType.Subtypes) = 2 Then
Dim pNewGpBox As New CustomPanel
pNewGpBox.Tag = strfld
pNewGpBox.BorderStyle = Windows.Forms.BorderStyle.None
pNewGpBox.BackColor = Color.White
' pNewGpBox.BorderColor = Pens.LightGray
pNewGpBox.Width = My.Globals.Constants.c_ControlWidth
pNewGpBox.Top = 0
pNewGpBox.Left = 0
pRDButton = New RadioButton
pRDButton.Font = My.Globals.Constants.c_Fnt
pRDButton.Name = "Rdo1Sub"
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.SubtypeValuesAtIndex(0, pSubType, codeVal, displayVal)
pRDButton.Tag = codeVal
pRDButton.Text = displayVal
pRDButton.Left = pLeftPadding
pRDButton.AutoSize = True
pNewGpBox.Controls.Add(pRDButton)
pNewGpBox.Height = pRDButton.Height + 12
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2
pRDButton = New RadioButton
pRDButton.Font = My.Globals.Constants.c_Fnt
pRDButton.Name = "Rdo2Sub"
My.Globals.Functions.SubtypeValuesAtIndex(1, pSubType, codeVal, displayVal)
pRDButton.Tag = codeVal
pRDButton.Text = displayVal
pRDButton.Left = pNewGpBox.Width / 2
pRDButton.AutoSize = True
pNewGpBox.Controls.Add(pRDButton)
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pNewGpBox.Top = pLbl.Height + 5
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pNewGpBox.Height + pLbl.Height + 10
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pNewGpBox)
pTbPg.Controls.Add(pPnl)
pNewGpBox = Nothing
' pPf = Nothing
Else
pCBox = New ComboBox
pCBox.Tag = strfld
pCBox.Name = "cboEdt" & strfld
pCBox.Left = 0
pCBox.Top = 0
pCBox.Width = My.Globals.Constants.c_ControlWidth
pCBox.Height = pCBox.Height + 5
pCBox.DropDownStyle = ComboBoxStyle.DropDownList
pCBox.Font = My.Globals.Constants.c_Fnt
pCBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never
pCBox.DataSource = My.Globals.Functions.SubtypeToList(pSubType)
pCBox.DisplayMember = "Display"
pCBox.ValueMember = "Value"
' pCmdBox.MaxLength = pDc.Length
AddHandler pCBox.SelectionChangeCommitted, AddressOf cmbSubTypChange_Click
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pCBox.Top = pLbl.Height + 5
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pCBox.Height + pLbl.Height + 15
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pCBox)
pTbPg.Controls.Add(pPnl)
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.SubtypeValuesAtIndex(0, pSubType, codeVal, displayVal)
pCBox.Text = displayVal
End If
Else
If pSubType.HasSubtype Then
pDom = pSubType.Domain(pSubTypeDefValue, pDc.Name)
Else
pDom = pDc.Domain
End If
'No Domain Found
If pDom Is Nothing Then
If pDc.Type = esriFieldType.esriFieldTypeString Or _
pDc.Type = esriFieldType.esriFieldTypeDouble Or _
pDc.Type = esriFieldType.esriFieldTypeInteger Or _
pDc.Type = esriFieldType.esriFieldTypeSingle Or _
pDc.Type = esriFieldType.esriFieldTypeSmallInteger Then
'Create a lable for the field name
pLbl = New Label
'Apply the field alias to the field name
pLbl.Text = strAli
'Link the field to the name of the control
pLbl.Name = "lblEdit" & strfld
'Add the control at the determined Location
pLbl.Left = 0
pLbl.Top = 0
'Apply global font
pLbl.Font = My.Globals.Constants.c_FntLbl
'Create a graphics object to messure the text
g = pLbl.CreateGraphics
s = g.MeasureString(pLbl.Text, pLbl.Font)
pLbl.Height = s.Height
'If the text is larger then the control, truncate the control
If s.Width >= My.Globals.Constants.c_ControlWidth Then
pLbl.Width = My.Globals.Constants.c_ControlWidth
Else 'Use autosize if it fits
pLbl.AutoSize = True
End If
'Create a new control to display the attributes
pTxtBox = New TextBox
'Tag the control with the field it represents
pTxtBox.Tag = Trim(strfld)
'Name the field with the field name
pTxtBox.Name = "txtEdit" & strfld
'Locate the control on the display
pTxtBox.Left = 0
pTxtBox.Width = My.Globals.Constants.c_ControlWidth
If pDc.Type = esriFieldType.esriFieldTypeString Then
'Make the box taller if it is a long field
If pDc.Length > 125 Then
pTxtBox.Multiline = True
pTxtBox.Height = pTxtBox.Height * 3
End If
End If
If pDc.Length > 0 Then
pTxtBox.MaxLength = pDc.Length
End If
'Apply global font
pTxtBox.Font = My.Globals.Constants.c_Fnt
'Group into panels to assist resizing
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pTxtBox.Top = 5 + pLbl.Height
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pTxtBox.Height + pLbl.Height + 10
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pTxtBox)
pTbPg.Controls.Add(pPnl)
ElseIf pDc.Type = esriFieldType.esriFieldTypeDate Then
'Create a lable for the field name
pLbl = New Label
'Apply the field alias to the field name
pLbl.Text = strAli
'Link the field to the name of the control
pLbl.Name = "lblEdit" & strfld
'Add the control at the determined Location
pLbl.Left = 0
' pLbl.Top = pNextControlTop
'Apply global font
pLbl.Font = My.Globals.Constants.c_FntLbl
'Create a graphics object to messure the text
g = pLbl.CreateGraphics
s = g.MeasureString(pLbl.Text, pLbl.Font)
pLbl.Height = s.Height
'If the text is larger then the control, truncate the control
If s.Width >= My.Globals.Constants.c_ControlWidth Then
pLbl.Width = My.Globals.Constants.c_ControlWidth
Else 'Use autosize if it fits
pLbl.AutoSize = True
End If
'Determine the Location for the next control
' pNextControlTop = pLbl.Top + s.Height + intLabelCtrlSpace
pDateTime = New DateTimePicker
pDateTime.Font = My.Globals.Constants.c_Fnt
'pDateTime.CustomFormat = "m/d/yyyy"
pDateTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom
pDateTime.CustomFormat = "M-d-yy" ' h:mm tt"
pDateTime.ShowCheckBox = True
pDateTime.Tag = strfld
pDateTime.Name = "dtEdt" & strfld
pDateTime.Left = 0
' pDateTime.Top = pNextControlTop
pDateTime.Width = My.Globals.Constants.c_ControlWidth
'Determine the Location for the next control
'pNextControlTop = pDateTime.Top + pDateTime.Height + intCtrlSpace
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pDateTime.Top = 5 + pLbl.Height
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pDateTime.Height + pLbl.Height + 10
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pDateTime)
pTbPg.Controls.Add(pPnl)
ElseIf pDc.Type = esriFieldType.esriFieldTypeBlob Then
'Create a lable for the field name
pLbl = New Label
'Apply the field alias to the field name
pLbl.Text = strAli
'Link the field to the name of the control
pLbl.Name = "lblEdit" & strfld
'Add the control at the determined Location
pLbl.Left = 0
pLbl.Top = 0
'Apply global font
pLbl.Font = My.Globals.Constants.c_FntLbl
'Create a graphics object to messure the text
g = pLbl.CreateGraphics
s = g.MeasureString(pLbl.Text, pLbl.Font)
pLbl.Height = s.Height
'If the text is larger then the control, truncate the control
If s.Width >= My.Globals.Constants.c_ControlWidth Then
pLbl.Width = 0
Else 'Use autosize if it fits
pLbl.AutoSize = True
End If
'Determine the Location for the next control
'Create a new control to display the attributes
pTxtBox = New TextBox
'Disable the control
' pPic.ReadOnly = True
'Tag the control with the field it represents
pTxtBox.Tag = Trim(strfld)
'Name the field with the field name
pTxtBox.Name = "txtEdit" & strfld
'Locate the control on the display
pTxtBox.Left = 0
pTxtBox.Top = 0
pTxtBox.Width = My.Globals.Constants.c_ControlWidth - pTxtBox.Height
If pDc.Type = esriFieldType.esriFieldTypeString Then
'Make the box taller if it is a long field
If pDc.Length > 125 Then
pTxtBox.Multiline = True
pTxtBox.Height = pTxtBox.Height * 3
End If
End If
If pDc.Length > 0 Then
pTxtBox.MaxLength = pDc.Length
End If
pTxtBox.BackgroundImageLayout = ImageLayout.Stretch
'Apply global font
pTxtBox.Font = My.Globals.Constants.c_Fnt
pBtn = New Windows.Forms.Button
pBtn.Tag = Trim(strfld)
'Name the field with the field name
pBtn.Name = "btnEdit" & strfld
'Locate the control on the display
pBtn.Left = pTxtBox.Left + pTxtBox.Width + 5
pBtn.Top = 0
Dim img As System.Drawing.Bitmap
img = My.Resources.Open2
img.MakeTransparent(img.GetPixel(img.Width - 1, 1))
pBtn.BackgroundImageLayout = ImageLayout.Center
pBtn.BackgroundImage = img
img = Nothing
pBtn.Width = pTxtBox.Height
pBtn.Height = pTxtBox.Height
AddHandler pBtn.Click, AddressOf btnLoadImgClick
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pTxtBox.Top = 5 + pLbl.Height
pBtn.Top = pTxtBox.Top
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pTxtBox.Height + pLbl.Height + 10
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pTxtBox)
pPnl.Controls.Add(pBtn)
pTbPg.Controls.Add(pPnl)
End If
Else
If TypeOf pDom Is CodedValueDomain Then
Dim pCV As ICodedValueDomain
'Create a lable for the field name
pLbl = New Label
'Apply the field alias to the field name
pLbl.Text = strAli
'Link the field to the name of the control
pLbl.Name = "lblEdit" & strfld
'Add the control at the determined Location
pLbl.Left = 0
pLbl.Top = 0
'Apply global font
pLbl.Font = My.Globals.Constants.c_FntLbl
'Create a graphics object to messure the text
g = pLbl.CreateGraphics
s = g.MeasureString(pLbl.Text, pLbl.Font)
pLbl.Height = s.Height
'If the text is larger then the control, truncate the control
If s.Width >= My.Globals.Constants.c_ControlWidth Then
pLbl.Width = My.Globals.Constants.c_ControlWidth
Else 'Use autosize if it fits
pLbl.AutoSize = True
End If
'Determine the Location for the next control
' pNextControlTop = pLbl.Top + s.Height + intLabelCtrlSpace
pCV = CType(pDom, CodedValueDomain)
' pTbPg.Controls.Add(pLbl)
If pCV.CodeCount = 2 Then
Dim pNewGpBox As New CustomPanel
pNewGpBox.Tag = strfld
pNewGpBox.BorderStyle = Windows.Forms.BorderStyle.None
pNewGpBox.BackColor = Color.White
' pNewGpBox.BorderColor = Pens.LightGray
pNewGpBox.Width = My.Globals.Constants.c_ControlWidth
pNewGpBox.Top = 0
pNewGpBox.Left = 0
pRDButton = New RadioButton
pRDButton.Name = "Rdo1"
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.DomainValuesAtIndex(0, pCV, codeVal, displayVal)
pRDButton.Tag = codeVal
pRDButton.Text = displayVal
pRDButton.Font = My.Globals.Constants.c_Fnt
'Dim pPf As SizeF = pRDButton.CreateGraphics.MeasureString(pRDButton.Text, pRDButton.Font)
''pRDButton.Height = pPf.Height
'pRDButton.Width = pPf.Width + 25
pRDButton.Left = pLeftPadding
pRDButton.AutoSize = True
pNewGpBox.Controls.Add(pRDButton)
pNewGpBox.Height = pRDButton.Height + 12
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2
pRDButton = New RadioButton
pRDButton.Font = My.Globals.Constants.c_Fnt
pRDButton.Name = "Rdo2"
My.Globals.Functions.DomainValuesAtIndex(1, pCV, codeVal, displayVal)
pRDButton.Tag = codeVal
pRDButton.Text = displayVal
pRDButton.Left = pNewGpBox.Width / 2
'pPf = pRDButton.CreateGraphics.MeasureString(pRDButton.Text, pRDButton.Font)
'pRDButton.Height = pPf.Height
'pRDButton.Width = pPf.Width + 25
pRDButton.AutoSize = True
pNewGpBox.Controls.Add(pRDButton)
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2
' pTbPg.Controls.Add(pNewGpBox)
' pNextControlTop = pNewGpBox.Top + pNewGpBox.Height + 7 + intLabelCtrlSpace
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pNewGpBox.Top = 5 + pLbl.Height
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pNewGpBox.Height + pLbl.Height + 10
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pNewGpBox)
pTbPg.Controls.Add(pPnl)
pNewGpBox = Nothing
' pPf = Nothing
Else
pCBox = New ComboBox
pCBox.Tag = strfld
pCBox.Name = "cboEdt" & strfld
pCBox.Left = 0
pCBox.Top = 0
pCBox.Width = My.Globals.Constants.c_ControlWidth
pCBox.Height = pCBox.Height + 5
pCBox.DropDownStyle = ComboBoxStyle.DropDownList
pCBox.Font = My.Globals.Constants.c_Fnt
pCBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never
pCBox.DataSource = My.Globals.Functions.DomainToList(pCV)
pCBox.DisplayMember = "Display"
pCBox.ValueMember = "Value"
' pCmdBox.MaxLength = pDc.Length
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pCBox.Top = 5 + pLbl.Height
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pCBox.Height + pLbl.Height + 15
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pCBox)
pTbPg.Controls.Add(pPnl)
' pTbPg.Controls.Add(pCBox)
' MsgBox(pCBox.Items.Count)
pCBox.Visible = True
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.DomainValuesAtIndex(0, pCV, codeVal, displayVal)
pCBox.Text = displayVal
'Try
'pCBox.SelectedIndex = 0
'Catch ex As Exception
'End Try
pCBox.Visible = True
pCBox.Refresh()
' pNextControlTop = pCBox.Top + pCBox.Height + 7 + intLabelCtrlSpace
End If
ElseIf TypeOf pDom Is RangeDomain Then
Dim pRV As IRangeDomain
'Create a lable for the field name
pLbl = New Label
'Apply the field alias to the field name
pLbl.Text = strAli
'Link the field to the name of the control
pLbl.Name = "lblEdit" & strfld
'Add the control at the determined Location
pLbl.Left = 0
pLbl.Top = 0
'Apply global font
pLbl.Font = My.Globals.Constants.c_FntLbl
'Create a graphics object to messure the text
g = pLbl.CreateGraphics
s = g.MeasureString(pLbl.Text, pLbl.Font)
pLbl.Height = s.Height
'If the text is larger then the control, truncate the control
If s.Width >= My.Globals.Constants.c_ControlWidth Then
pLbl.Width = My.Globals.Constants.c_ControlWidth
Else 'Use autosize if it fits
pLbl.AutoSize = True
End If
'Determine the Location for the next control
pRV = CType(pDom, RangeDomain)
pNumBox = New NumericUpDown
' AddHandler pNumBox.MouseDown, AddressOf numericClickEvt_MouseDown
If pDc.Type = esriFieldType.esriFieldTypeInteger Then
pNumBox.DecimalPlaces = 0
ElseIf pDc.Type = esriFieldType.esriFieldTypeDouble Then
pNumBox.DecimalPlaces = 2 'pDc.DataType.
ElseIf pDc.Type = esriFieldType.esriFieldTypeSingle Then
pNumBox.DecimalPlaces = 1 'pDc.DataType.
Else
pNumBox.DecimalPlaces = 2 'pDc.DataType.
End If
pNumBox.Minimum = pRV.MinValue
pNumBox.Maximum = pRV.MaxValue
Dim pf As NumericUpDownAcceleration = New NumericUpDownAcceleration(3, CInt((pNumBox.Maximum - pNumBox.Minimum) * 0.02))
pNumBox.Accelerations.Add(pf)
pNumBox.Tag = strfld
pNumBox.Name = "numEdt" & strfld
pNumBox.Left = 0
pNumBox.BackColor = Color.White
pNumBox.Top = 0
pNumBox.Width = My.Globals.Constants.c_ControlWidth
pNumBox.Font = My.Globals.Constants.c_Fnt
Dim pPnl As Panel = New Panel
pPnl.BorderStyle = Windows.Forms.BorderStyle.None
pLbl.Top = 0
pNumBox.Top = 5 + pLbl.Height
pPnl.Width = My.Globals.Constants.c_ControlWidth
pPnl.Margin = New Padding(0)
pPnl.Padding = New Padding(0)
pPnl.Top = 0
pPnl.Left = 0
pPnl.Height = pNumBox.Height + pLbl.Height + 15
pPnl.Controls.Add(pLbl)
pPnl.Controls.Add(pNumBox)
pTbPg.Controls.Add(pPnl)
End If
End If
End If
pLayerFields = Nothing
pFieldInfo = Nothing
End If
Next 'pDC
If pSubType.HasSubtype Then
SubtypeChange(pSubTypeDefValue, pSubType.SubtypeFieldName)
End If
'cleanup
pBtn = Nothing
pDCs = Nothing
pDc = Nothing
pTbPg = Nothing
pTxtBox = Nothing
pLbl = Nothing
pNumBox = Nothing
pRDButton = Nothing
pCBox = Nothing
pDateTime = Nothing
g = Nothing
s = Nothing
s_tbCntCIPDetails.ResumeLayout()
s_tbCntCIPDetails.Refresh()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: AddControls" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub cmbSubTypChange_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If CType(sender, ComboBox).SelectedIndex = -1 Then Return
SubtypeChange(CType(sender, ComboBox).SelectedValue, CType(sender, ComboBox).Tag)
End Sub
Private Shared Sub SubtypeChange(ByVal value As Integer, ByVal SubtypeField As String)
Try
Dim intSubVal As Integer = value
'Feature layer being Identified
'Exit if the layer is not found
If My.Globals.Variables.v_CIPLayerOver Is Nothing Then Exit Sub
Dim strFld As String
Dim pCmbBox As ComboBox
Dim pNUP As NumericUpDown
Dim pCV As ICodedValueDomain
Dim pRg As IRangeDomain
Dim pSubTypes As ISubtypes = My.Globals.Variables.v_CIPLayerOver.FeatureClass
Dim pLeftPadding As Integer = 10
'Loop through all controls
For Each tbPg As TabPage In s_tbCntCIPDetails.TabPages
For Each cntrl As Control In tbPg.Controls
'If the control is a combobox, then reapply the domain
If TypeOf cntrl Is Panel Then
For Each cntrlPnl As Control In cntrl.Controls
If TypeOf cntrlPnl Is ComboBox Then
pCmbBox = cntrlPnl
If SubtypeField <> pCmbBox.Tag.ToString Then
'Get the Field
strFld = pCmbBox.Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Get the domain
pCV = pSubTypes.Domain(intSubVal, strFld)
If pCV Is Nothing Then
pCmbBox.DataSource = Nothing
Else
'If the domain has two values, remove the combo box and add a custompanel
If pCV.CodeCount = 2 Then
Dim pNewGpBox As New CustomPanel
Dim pRDButton As RadioButton
pNewGpBox.Tag = pCmbBox.Tag
pNewGpBox.BorderStyle = Windows.Forms.BorderStyle.None
pNewGpBox.BackColor = Color.White
' pNewGpBox.BorderColor = Pens.LightGray
pNewGpBox.Width = pCmbBox.Width
pNewGpBox.Top = pCmbBox.Top
pNewGpBox.Left = pCmbBox.Left
pRDButton = New RadioButton
pRDButton.Name = "Rdo1"
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.SubtypeValuesAtIndex(0, pCV, codeVal, displayVal)
pRDButton.Tag = codeVal
pRDButton.Text = displayVal
pRDButton.Left = pLeftPadding
pRDButton.AutoSize = True
pNewGpBox.Controls.Add(pRDButton)
pNewGpBox.Height = pRDButton.Height + 12
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2
pRDButton = New RadioButton
pRDButton.Name = "Rdo2"
My.Globals.Functions.SubtypeValuesAtIndex(1, pCV, codeVal, displayVal)
pRDButton.Tag = codeVal
pRDButton.Text = displayVal
pRDButton.Left = pNewGpBox.Width / 2
pRDButton.AutoSize = True
pNewGpBox.Controls.Add(pRDButton)
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2
tbPg.Controls.Add(pNewGpBox)
Try
tbPg.Controls.Remove(pCmbBox)
'Dim cnts() As Control = tbPg.Controls.Find("lblEdit" & strFld, False)
'If cnts.Length > 0 Then
' tbPg.Controls.Remove(cnts(0))
'End If
Catch ex As Exception
End Try
pNewGpBox = Nothing
pRDButton = Nothing
Else
'Set the domain value
pCmbBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never
pCmbBox.DataSource = My.Globals.Functions.DomainToList(pCV)
pCmbBox.DisplayMember = "Display"
pCmbBox.ValueMember = "Value"
pCmbBox.Visible = True
pCmbBox.Refresh()
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.SubtypeValuesAtIndex(0, pCV, codeVal, displayVal)
pCmbBox.Text = displayVal
End If
End If
End If
'If the contorl is a coded value domain with two values
ElseIf TypeOf cntrlPnl Is CustomPanel Then
'Get the Field
strFld = cntrlPnl.Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Get the fomain
pCV = pSubTypes.Domain(intSubVal, strFld)
If pCV Is Nothing Then
cntrlPnl.Controls.Clear()
Else
'If the domain has more than two values, remove the custompanel and add a combo box
If pCV.CodeCount = 2 Then
Try
'Set up the proper domain values
Dim pRdoBut As RadioButton
pRdoBut = cntrlPnl.Controls("Rdo1")
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.SubtypeValuesAtIndex(0, pCV, codeVal, displayVal)
pRdoBut.Tag = codeVal
pRdoBut.Text = displayVal
pRdoBut = cntrlPnl.Controls("Rdo2")
My.Globals.Functions.SubtypeValuesAtIndex(1, pCV, codeVal, displayVal)
pRdoBut.Tag = codeVal
pRdoBut.Text = displayVal
Catch ex As Exception
End Try
Else
Dim pCBox As ComboBox
pCBox = New ComboBox
pCBox.Tag = strFld
pCBox.Name = "cboEdt" & strFld
pCBox.Left = cntrlPnl.Left
pCBox.Top = cntrlPnl.Top
pCBox.Width = cntrlPnl.Width
pCBox.Height = pCBox.Height + 5
pCBox.DropDownStyle = ComboBoxStyle.DropDownList
pCBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never
pCBox.DataSource = My.Globals.Functions.DomainToList(pCV)
pCBox.DisplayMember = "Display"
pCBox.ValueMember = "Value"
pCBox.Visible = True
pCBox.Refresh()
Dim codeVal As String = "", displayVal As String = ""
My.Globals.Functions.SubtypeValuesAtIndex(0, pCV, codeVal, displayVal)
pCBox.Text = displayVal
' pCmdBox.MaxLength = pDc.Length
tbPg.Controls.Add(pCBox)
' MsgBox(pCBox.Items.Count)
pCBox.Visible = True
pCBox.Refresh()
tbPg.Controls.Remove(cntrlPnl)
pCBox = Nothing
End If
End If
'If the contorl is a range domain
ElseIf TypeOf cntrlPnl Is NumericUpDown Then
'get the control
pNUP = cntrlPnl
'Get the field
strFld = pNUP.Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Get the domain
pRg = pSubTypes.Domain(intSubVal, strFld)
If pRg Is Nothing Then
pNUP.Enabled = False
Else
pNUP.Enabled = True
pNUP.Minimum = pRg.MinValue
pNUP.Maximum = pRg.MaxValue
End If
pNUP.Refresh()
End If
Next
End If
Next
Next
Catch ex As Exception
MsgBox("Error in the edit control subtype change" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnLoadImgClick(ByVal sender As Object, ByVal e As System.EventArgs)
Try
'Opens a dialog to browse out for an image
Dim openFileDialog1 As System.Windows.Forms.OpenFileDialog
openFileDialog1 = New System.Windows.Forms.OpenFileDialog()
'Filter the image types
openFileDialog1.Filter = "Jpg (*.jpg) |*.jpg|Bitmap (*.bmp) |*.bmp|Gif (*.gif)| *.gif"
'If the user selects an image
If openFileDialog1.ShowDialog() = DialogResult.OK Then
'Set the path of the image to the text box
Dim controls() As Control = CType(CType(sender, Windows.Forms.Button).Parent, Panel).Controls.Find("txtEdit" & sender.tag, False)
'If the control was found
If controls.Length > 0 Then
controls(0).Text = openFileDialog1.FileName
End If
End If
Catch ex As Exception
MsgBox("Error in the edit control loading an image" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub LoadExistingAssetsToForm(ByVal ProjectName As String)
'Dim pCIPLayerPrj As IFeatureLayer = Nothing
'Dim pCIPLayerOver As IFeatureLayer = Nothing
'Dim pCIPLayerPoint As IFeatureLayer = Nothing
'Dim pCIPLayerPolygon As IFeatureLayer = Nothing
'Dim pCIPLayerPolyline As IFeatureLayer = Nothing
' Dim pCIPInvTable As ITable = Nothing
'Dim pDefTbl As ITable
Try
' pCIPLayerPoint = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPointLayName)
' pCIPLayerPolygon = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPolygonLayName)
'pCIPLayerPolyline = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPolylineLayName)
'
'pCIPInvTable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPInvLayName, my.ArcMap.Document.FocusMap )
'Dim pInvFilt As IQueryFilter = New QueryFilter
'pInvFilt.WhereClause = my.Globals.Constants.c_CIPInvLayProjNameField & " = '" & ProjectName & "'"
'Dim pInvCur As ICursor
'pInvCur = pCIPInvTable.Search(pInvFilt, True)
'Dim pInvRow As IRow = pInvCur.NextRow
'Do Until pInvRow Is Nothing
' lstInventory.Items.Add(pInvRow.Value(pInvRow.Fields.FindField(my.Globals.Constants.c_CIPInvLayInvTypefield)) & ": " & pInvRow.Value(pInvRow.Fields.FindField(my.Globals.Constants.c_CIPInvLayNumOfInvField)))
' pInvRow = pInvCur.NextRow
'Loop
'pInvRow = Nothing
'Marshal.ReleaseComObject(pInvCur)
'pInvFilt = Nothing
'pInvCur = Nothing
'pDefTbl = My.Globals.Functions.FindTable(My.Globals.Constants.c_CIPDefTableName, My.ArcMap.Document.FocusMap)
'If pDefTbl Is Nothing Then
' Return
'End If
For i = 0 To 2
Dim pFilt As IQueryFilter = New QueryFilter
Dim pFCur As IFeatureCursor = Nothing
pFilt.WhereClause = My.Globals.Constants.c_CIPProjectAssetNameField & " = '" & ProjectName & "'"
Select Case i
Case 0
pFCur = My.Globals.Variables.v_CIPLayerPoint.Search(pFilt, True)
Case 1
pFCur = My.Globals.Variables.v_CIPLayerPolygon.Search(pFilt, True)
Case 2
pFCur = My.Globals.Variables.v_CIPLayerPolyline.Search(pFilt, True)
End Select
Dim pfeat As IFeature
pfeat = pFCur.NextFeature
Dim pLastFeatLay As String = ""
Dim pLastFeatFiltField1 As String = ""
Dim pLastFeatFiltField2 As String = ""
Do Until pfeat Is Nothing
If pLastFeatLay = "" Or pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField)) <> pLastFeatLay Then
Dim pDefFilt As IQueryFilter = New QueryFilter
pDefFilt.WhereClause = My.Globals.Constants.c_CIPDefNameField & " = '" & pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField)) & "'"
Dim pDefCurs As ICursor = My.Globals.Variables.v_CIPTableDef.Search(pDefFilt, True)
If pDefCurs Is Nothing Then Return
Dim pRow As IRow
pRow = pDefCurs.NextRow
pLastFeatFiltField1 = ""
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) IsNot Nothing Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) IsNot DBNull.Value Then
pLastFeatFiltField1 = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1))
End If
End If
pLastFeatFiltField2 = ""
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) IsNot Nothing Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) IsNot DBNull.Value Then
pLastFeatFiltField2 = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2))
End If
End If
pLastFeatLay = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField))
pRow = Nothing
Marshal.ReleaseComObject(pDefCurs)
pDefCurs = Nothing
pDefFilt = Nothing
End If
Dim strType As String = ""
Dim strID As String = ""
Dim strCost As String = ""
Dim strAddCost As String = ""
Dim strLen As Double = "0.0"
Dim strTotCost As String = ""
Dim strExt1 As String = ""
Dim strExt2 As String = ""
Dim strOID As String = ""
Dim strPro1 As String = ""
Dim strPro2 As String = ""
Dim strStrat As String = ""
Dim strAction As String = ""
Dim strMulti As String = ""
Dim strNotes As String = ""
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField)) IsNot DBNull.Value Then
strType = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField))
End If
End If
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetIDField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetIDField)) IsNot DBNull.Value Then
strID = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetIDField))
End If
End If
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetCostField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetCostField)) IsNot DBNull.Value Then
strCost = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetCostField))
End If
End If
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetAddCostField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetAddCostField)) IsNot DBNull.Value Then
strAddCost = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetAddCostField))
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetLenField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetLenField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetLenField)) IsNot DBNull.Value Then
strLen = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetLenField))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTotCostField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTotCostField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTotCostField)) IsNot DBNull.Value Then
strTotCost = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTotCostField))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt1Field) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt1Field)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt1Field)) IsNot DBNull.Value Then
strExt1 = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt1Field))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt2Field) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt2Field)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt2Field)) IsNot DBNull.Value Then
strExt2 = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt2Field))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetOIDField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetOIDField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetOIDField)) IsNot DBNull.Value Then
strOID = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetOIDField))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt1Field) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt1Field)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt1Field)) IsNot DBNull.Value Then
strPro1 = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt1Field))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt2Field) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt2Field)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt2Field)) IsNot DBNull.Value Then
strPro2 = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt2Field))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetStrategyField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetStrategyField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetStrategyField)) IsNot DBNull.Value Then
strStrat = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetStrategyField))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetActionField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetActionField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetActionField)) IsNot DBNull.Value Then
strAction = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetActionField))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetMultiField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetMultiField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetMultiField)) IsNot DBNull.Value Then
strMulti = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetMultiField))
End If
End If
End If
If pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetNotesField) > 0 Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetNotesField)) IsNot Nothing Then
If pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetNotesField)) IsNot DBNull.Value Then
strNotes = pfeat.Value(pfeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetNotesField))
End If
End If
End If
loadRecord(pfeat.Shape, strType, strType, strID, strCost, strAddCost, strLen, strTotCost, strExt1, strExt2, _
pLastFeatFiltField1, pLastFeatFiltField2, strOID, strPro1, strPro2, strStrat, strAction, strMulti, strNotes)
pfeat = pFCur.NextFeature
Loop
pFilt = Nothing
pfeat = Nothing
Marshal.ReleaseComObject(pFCur)
pFCur = Nothing
Next i
If s_dgCIP.Rows.Count > 0 Then
s_dgCIP.Rows(0).Selected = True
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: LoadExistingAssetsToForm" & vbCrLf & ex.Message)
End Try
End Sub
Public Shared Sub EnableWindowControls(ByVal enable As Boolean)
Try
If s_btnSketch Is Nothing Then Return
If enable Then
s_btnSketch.Enabled = True
s_btnSelect.Enabled = True
s_cboDefLayers.Enabled = True
s_btnSelectAssets.Enabled = True
s_btnSelectPrj.Enabled = True
s_btnClear.Enabled = True
s_cboStrategy.Enabled = True
s_cboAction.Enabled = True
Else
s_btnSketch.Enabled = False
s_btnSelect.Enabled = False
s_btnSelectPrj.Enabled = False
s_cboDefLayers.Enabled = False
s_btnSelectAssets.Enabled = False
s_cboStrategy.Enabled = False
s_cboAction.Enabled = False
'pUID.Value = "{ce0409b7-5c18-4b55-90ad-56701a01eea7}"
'Try
' pCmdItem = pIDoc.CommandBars.Find(pUID)
' If My.ArcMap.Application.CurrentTool IsNot Nothing Then
' If My.ArcMap.Application.CurrentTool Is pCmdItem Then
' My.ArcMap.Application.CurrentTool = Nothing
' End If
' End If
'Catch ex As Exception
'End Try
End If
loadStrategyCboBox()
loadDefLayersCboBox()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: EnableCIPTools" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Function FindPrjAtLocation(ByVal pPnt As IPoint) As IFeature
Dim pSFilt As ISpatialFilter = Nothing
Dim pFCurs As IFeatureCursor = Nothing
Try
'Sub to load a record to the form
'Gets the feature layer
'Determine if the layer has subtypes
pSFilt = New SpatialFilter
pSFilt.Geometry = pPnt
pSFilt.GeometryField = My.Globals.Variables.v_CIPLayerOver.FeatureClass.ShapeFieldName
pSFilt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
pFCurs = My.Globals.Variables.v_CIPLayerOver.Search(pSFilt, True)
If pFCurs Is Nothing Then Return Nothing
Return pFCurs.NextFeature
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: FindPrjAtLocation" & vbCrLf & ex.Message)
Return Nothing
Finally
pSFilt = Nothing
Marshal.ReleaseComObject(pFCurs)
pFCurs = Nothing
End Try
End Function
Private Shared Function loadProjectToForm(ByVal pFeat As IFeature) As String
If pFeat Is Nothing Then Return ""
' Dim pFCurs As IFeatureCursor = Nothing
Dim pFC As IFeatureClass = Nothing
Dim strPrjName As String = ""
Dim strFld As String = ""
Dim pSubType As ISubtypes = Nothing
Dim bSubType As Boolean
' Dim pSFilt As ISpatialFilter = Nothing
Try
pFC = pFeat.Class
pSubType = pFC
bSubType = pSubType.HasSubtype
'If the layer has subtypes, load the subtype value first
If bSubType Then
'Loop through each control in the tab control
For Each pCntrl As Control In s_tbCntCIPDetails.Controls
'If the control is a tabpage
If TypeOf pCntrl Is TabPage Then
'Loop through each ocntrol on the tab oage
For Each cCntrl As Control In pCntrl.Controls
'If the control is a combo box(used for domains)
If TypeOf cCntrl Is Panel Then
For Each cCntrlPnl As Control In cCntrl.Controls
If TypeOf cCntrlPnl Is ComboBox Then
'Get the field
strFld = CType(cCntrlPnl, ComboBox).Tag
'Make sure no link is specified
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'If the field is the subtype field
If pSubType.SubtypeFieldName = strFld Then
'Set the value
If pFeat.Value(pFeat.Fields.FindField(strFld)) IsNot DBNull.Value Then
CType(cCntrlPnl, ComboBox).SelectedValue = pFeat.Value(pFeat.Fields.FindField(strFld))
Else
CType(cCntrlPnl, ComboBox).SelectedIndex = 0
End If
'Raise the subtype change event, this loads all the proper domains based on the subtype value
Call cmbSubTypChange_Click(CType(cCntrlPnl, ComboBox), Nothing)
Exit For
End If
End If
Next cCntrlPnl
End If
Next
End If
Next
End If
'Loop through all the controls and set their value
For Each pCntrl As Control In s_tbCntCIPDetails.Controls
If TypeOf pCntrl Is TabPage Then
For Each cCntrl As Control In pCntrl.Controls
'If the control is a 2 value domain(Checkboxs)
If TypeOf cCntrl Is Panel Then
For Each cCntrlPnl As Control In cCntrl.Controls
If TypeOf cCntrlPnl Is CustomPanel Then
'Get the Field
strFld = CType(cCntrlPnl, CustomPanel).Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Get the target value
Dim pTargetVal As String = ""
If pFeat.Value(pFeat.Fields.FindField(strFld)) IsNot DBNull.Value Then
pTargetVal = pFeat.Value(pFeat.Fields.FindField(strFld))
ElseIf pFeat.Value(pFeat.Fields.FindField(strFld)) Is DBNull.Value Then
If pFeat.Fields.Field(pFeat.Fields.FindField(strFld)).DefaultValue Is DBNull.Value Then
pTargetVal = ""
Else
pTargetVal = pFeat.Fields.Field(pFeat.Fields.FindField(strFld)).DefaultValue 'pFL.Columns(strFld).DefaultValue
End If
ElseIf pFeat.Value(pFeat.Fields.FindField(strFld)) = "" Then
If pFeat.Fields.Field(pFeat.Fields.FindField(strFld)).DefaultValue Is DBNull.Value Then
pTargetVal = ""
Else
pTargetVal = pFeat.Fields.Field(pFeat.Fields.FindField(strFld)).DefaultValue
End If
Else
If pFeat.Fields.Field(pFeat.Fields.FindField(strFld)).DefaultValue Is DBNull.Value Then
pTargetVal = ""
Else
pTargetVal = pFeat.Fields.Field(pFeat.Fields.FindField(strFld)).DefaultValue
End If
End If
Dim pCsPn As CustomPanel = cCntrlPnl
'Loop through the checkboxes to set the proper value
For Each rdCn As Control In pCsPn.Controls
If TypeOf rdCn Is RadioButton Then
If pTargetVal = "" Then
CType(rdCn, RadioButton).Checked = True
Exit For
End If
If rdCn.Tag.ToString = pTargetVal Then
CType(rdCn, RadioButton).Checked = True
Exit For
End If
End If
Next
'If the control is a text box
ElseIf TypeOf cCntrlPnl Is TextBox Then
'Get the field
strFld = CType(cCntrlPnl, TextBox).Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Set the Value
If pFeat.Value(pFeat.Fields.FindField(strFld)) IsNot DBNull.Value Then
CType(cCntrlPnl, TextBox).Text = pFeat.Value(pFeat.Fields.FindField(strFld)).ToString
Else
' CType(cCntrlPnl, TextBox).Text = ""
End If
If strFld = My.Globals.Constants.c_CIPProjectAssetNameField Then
strPrjName = pFeat.Value(pFeat.Fields.FindField(strFld)).ToString
End If
'if the control is a combo box(domain)
ElseIf TypeOf cCntrlPnl Is ComboBox Then
'Get the field
strFld = CType(cCntrlPnl, ComboBox).Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Skip the subtype column
If pSubType.SubtypeFieldName <> strFld Then
'Set the value
If pFeat.Value(pFeat.Fields.FindField(strFld)) IsNot DBNull.Value Then
If pFeat.Value(pFeat.Fields.FindField(strFld)).ToString = "" Or pFeat.Value(pFeat.Fields.FindField(strFld)) Is DBNull.Value Then
' Dim pCV As CodedValueDomain = CType(cCntrlPnl, ComboBox).DataSource
' Dim i As Integer = pCV.Rows.Count
'If CType(cCntrlPnl, ComboBox).DataSource IsNot Nothing Then
' CType(cCntrlPnl, ComboBox).Text = CType(cCntrlPnl, ComboBox).DataSource.Rows(0)("Value")
'End If
Else
CType(cCntrlPnl, ComboBox).SelectedValue = pFeat.Value(pFeat.Fields.FindField(strFld))
End If
'CType(cCntrlPnl, ComboBox).Text = pFeat.Value(pFeat.Fields.FindField(strFld)).ToString
Else
CType(cCntrlPnl, ComboBox).SelectedIndex = 0
End If
End If
'if the contorl is a data time field
ElseIf TypeOf cCntrlPnl Is DateTimePicker Then
'Get the field
strFld = CType(cCntrlPnl, DateTimePicker).Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Get and set the value
If pFeat.Value(pFeat.Fields.FindField(strFld)) IsNot DBNull.Value Then
CType(cCntrlPnl, DateTimePicker).Text = pFeat.Value(pFeat.Fields.FindField(strFld)).ToString
CType(cCntrlPnl, DateTimePicker).Checked = True
Else
CType(cCntrlPnl, DateTimePicker).Checked = False
End If
'If the field is a range domain
ElseIf TypeOf cCntrlPnl Is NumericUpDown Then
'Get the field
strFld = CType(cCntrlPnl, NumericUpDown).Tag
If strFld.IndexOf("|") > 0 Then
strFld = Trim(strFld.Substring(0, strFld.IndexOf("|")))
End If
'Get and set the value
If pFeat.Value(pFeat.Fields.FindField(strFld)) Is DBNull.Value Then
CType(cCntrlPnl, NumericUpDown).ReadOnly = True
ElseIf pFeat.Value(pFeat.Fields.FindField(strFld)) > CType(cCntrlPnl, NumericUpDown).Maximum Or _
pFeat.Value(pFeat.Fields.FindField(strFld)) < CType(cCntrlPnl, NumericUpDown).Minimum Then
CType(cCntrlPnl, NumericUpDown).ReadOnly = True
Else
CType(cCntrlPnl, NumericUpDown).Value = pFeat.Value(pFeat.Fields.FindField(strFld)).ToString
End If
End If
Next
End If
Next
End If
Next
' Marshal.ReleaseComObject(pSFilt)
Return strPrjName
Catch ex As Exception
' MsgBox("Error in the edit control record loader" & vbCrLf & ex.Message)
Return ""
Finally
' pSFilt = Nothing
' Marshal.ReleaseComObject(pFCurs)
pSubType = Nothing
pFeat = Nothing
' pFCurs = Nothing
End Try
End Function
Friend Shared Sub ResetControls(ByVal DeactivateTools As Boolean)
Try
ClearControl()
RemoveControl(False)
s_lstInventory.Items.Clear()
s_btnSavePrj.Enabled = False
If DeactivateTools Then
s_btnSelect.Checked = False
s_btnSelectAssets.Checked = False
s_btnSketch.Checked = False
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ResetGrid" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub loadLayersToPanel()
Try
s_gpBxCIPCostingLayers.Controls.Clear()
If My.Globals.Variables.v_CIPTableDef Is Nothing Then
Return
End If
Dim pCurs As ICursor = My.Globals.Variables.v_CIPTableDef.Search(Nothing, True)
If pCurs Is Nothing Then Return
Dim pRow As IRow
pRow = pCurs.NextRow
Do Until pRow Is Nothing
Dim pChk As CheckBox = New CheckBox
pChk.Font = My.Globals.Constants.c_FntSmall
pChk.AutoSize = True
pChk.Text = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
pChk.Tag = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField)) IsNot Nothing And pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField)) IsNot DBNull.Value Then
If UCase(pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField))) = "FALSE" Or UCase(pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField))) = "NO" Then
pChk.Checked = False
Else
pChk.Checked = True
End If
Else
pChk.Checked = False
End If
AddHandler pChk.CheckedChanged, AddressOf layerChecked
s_gpBxCIPCostingLayers.Controls.Add(pChk)
pRow = pCurs.NextRow
pChk = Nothing
Loop
Marshal.ReleaseComObject(pCurs)
pCurs = Nothing
pRow = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: LoadLayersToPanel" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub EnableSavePrj()
Try
If s_btnSavePrj Is Nothing Then Return
If My.Globals.Variables.v_SaveEnabled Then
If s_dgCIP.Rows.Count > 0 Then
s_btnSavePrj.Enabled = True
Else
s_btnSavePrj.Enabled = False
End If
Else
s_btnSavePrj.Enabled = False
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: EnableSavePrj" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub deleteCIPProjects(ByVal prjName As String)
'Dim pCIPLayerPrj As IFeatureLayer = Nothing
'Dim pCIPLayerOver As IFeatureLayer = Nothing
'Dim pCIPLayerPoint As IFeatureLayer = Nothing
'Dim pCIPLayerPolygon As IFeatureLayer = Nothing
'Dim pCIPLayerPolyline As IFeatureLayer = Nothing
'Dim pCIPInvTable As ITable = Nothing
Dim pFC As IFeatureClass = Nothing
Dim pTbl As ITable = Nothing
Dim pQFilt As IQueryFilter = Nothing
Try
'pCIPLayerPrj = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectLayName)
'pCIPLayerOver = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPOverviewLayName)
'pCIPLayerPoint = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPointLayName)
'pCIPLayerPolygon = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPolygonLayName)
'pCIPLayerPolyline = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPolylineLayName)
'pCIPInvTable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPInvLayName, my.ArcMap.Document.FocusMap )
pQFilt = New QueryFilter
pQFilt.WhereClause = My.Globals.Constants.c_CIPProjectAssetNameField & " = '" & prjName & "'"
pFC = My.Globals.Variables.v_CIPLayerPrj.FeatureClass
pTbl = pFC
pTbl.DeleteSearchedRows(pQFilt)
pFC = My.Globals.Variables.v_CIPLayerOver.FeatureClass
pTbl = pFC
pTbl.DeleteSearchedRows(pQFilt)
pFC = My.Globals.Variables.v_CIPLayerOverPoint.FeatureClass
pTbl = pFC
pTbl.DeleteSearchedRows(pQFilt)
pFC = My.Globals.Variables.v_CIPLayerPoint.FeatureClass
pTbl = pFC
pTbl.DeleteSearchedRows(pQFilt)
pFC = My.Globals.Variables.v_CIPLayerPolygon.FeatureClass
pTbl = pFC
pTbl.DeleteSearchedRows(pQFilt)
pFC = My.Globals.Variables.v_CIPLayerPolyline.FeatureClass
pTbl = pFC
pTbl.DeleteSearchedRows(pQFilt)
'pFC = pCIPInvTable.FeatureClass
'pTbl = pFC
'pTbl.DeleteSearchedRows(pQFilt)
'For i = 0 To 5
' Select Case i
' Case 0
' Case 1
' Case 2
' Case 3
' Case 4
' Case 5
' End Select
'Next
'Dim pDelBuf As IFeatureBuffer
'Dim pDelCurs As IFeatureCursor = pCIPLayerPrj.FeatureClass.Update(pQFilt, False)
'Dim pFeat As IFeature
'Do Until pDelCurs.NextFeature Is Nothing
' pDelCurs.DeleteFeature()
'Loop
Catch ex As Exception
Finally
'pCIPLayerPrj = Nothing
'pCIPLayerOver = Nothing
'pCIPLayerPoint = Nothing
'pCIPLayerPolygon = Nothing
'pCIPLayerPolyline = Nothing
'pCIPInvTable = Nothing
pFC = Nothing
pTbl = Nothing
pQFilt = Nothing
End Try
End Sub
Private Shared Sub CreateCIPProject() 'ByVal strPrjName As String, ByVal strPrjCost As String, ByVal StartDate As Date, ByVal EndDate As Date, ByVal CIPStat As String, ByVal CIPStim As String, ByVal strEng As String, ByVal strManager As String, ByVal strNotes As String)
'Dim pCIPLayerPrj As IFeatureLayer = Nothing
'Dim pCIPLayerOver As IFeatureLayer = Nothing
'Dim pCIPLayerPoint As IFeatureLayer = Nothing
'Dim pCIPLayerPolygon As IFeatureLayer = Nothing
'Dim pCIPLayerPolyline As IFeatureLayer = Nothing
'' Dim pCIPInvTable As ITable = Nothing
Try
'pCIPLayerPrj = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectLayName)
'pCIPLayerOver = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPOverviewLayName)
'pCIPLayerPoint = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPointLayName)
'pCIPLayerPolygon = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPolygonLayName)
'pCIPLayerPolyline = My.Globals.Functions.FindLayer(My.Globals.Constants.c_CIPProjectPolylineLayName)
' pCIPInvTable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPInvLayName, my.ArcMap.Document.FocusMap )
If My.Globals.Variables.v_CIPLayerOver Is Nothing Or My.Globals.Variables.v_CIPLayerOverPoint Is Nothing Or My.Globals.Variables.v_CIPLayerPrj Is Nothing Or My.Globals.Variables.v_CIPLayerPoint Is Nothing _
Or My.Globals.Variables.v_CIPLayerPolyline Is Nothing Or My.Globals.Variables.v_CIPLayerPolygon Is Nothing Then 'Or pCIPInvTable Is Nothing Then
MsgBox("The CIP Project layer is not in the geodatabase being edited, exiting")
Return
End If
Catch ex As Exception
End Try
Dim pProDlg As IProgressDialog2 = Nothing
Try
Dim pOverGeo As IGeometry = New Polygon
Dim pPrjGeo As IGeometry = New Polygon
Dim pTopo As ITopologicalOperator = Nothing
Dim pPntCnt As Integer = 0
Dim pTotArea As Double
Dim pProDlgFact As IProgressDialogFactory
Dim pStepPro As IStepProgressor
Dim pTrkCan As ITrackCancel
If My.Globals.Variables.v_Editor.EditState = esriEditState.esriStateNotEditing Then
MsgBox("Please Start editing")
Return
End If
' Create a CancelTracker
pTrkCan = New CancelTracker
' Create the ProgressDialog. This automatically displays the dialog
pProDlgFact = New ProgressDialogFactory
pProDlg = pProDlgFact.Create(pTrkCan, 0)
' Set the properties of the ProgressDialog
pProDlg.CancelEnabled = True
pProDlg.Description = "Creating CIP Project"
pProDlg.Title = "Processing..."
pProDlg.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral
' Set the properties of the Step Progressor
pStepPro = pProDlg
pStepPro.MinRange = 0
pStepPro.MaxRange = s_dgCIP.RowCount + 1
pStepPro.StepValue = 1
pStepPro.Message = "Loading Candidates to CIP Project "
' Step. Do your big process here.
Dim boolCont As Boolean = True
pProDlg.ShowDialog()
Dim pCIPFeat As IFeature = My.Globals.Variables.v_CIPLayerPrj.FeatureClass.CreateFeature
Dim pCIPOverFeat As IFeature = My.Globals.Variables.v_CIPLayerOver.FeatureClass.CreateFeature
Dim pCIPOverPointFeat As IFeature = My.Globals.Variables.v_CIPLayerOverPoint.FeatureClass.CreateFeature
pStepPro.Message = "Getting Project info"
Dim pPrjName As String = ""
My.Globals.Variables.v_Editor.StartOperation()
For Each tbpg As TabPage In s_tbCntCIPDetails.TabPages
For Each pnlCnt As Control In tbpg.Controls
If TypeOf pnlCnt Is Panel Then
For Each inCnt As Control In pnlCnt.Controls
If TypeOf inCnt Is TextBox Then
If inCnt.Tag = My.Globals.Constants.c_CIPProjectAssetNameField Then
pPrjName = inCnt.Text
If pPrjName = "" Then
MsgBox("Please provide a project name")
My.Globals.Variables.v_Editor.AbortOperation()
Return
End If
End If
If pCIPFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverPointFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
ElseIf TypeOf inCnt Is DateTimePicker Then
If pCIPFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverPointFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
ElseIf TypeOf inCnt Is ComboBox Then
If pCIPFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverPointFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
ElseIf TypeOf inCnt Is NumericUpDown Then
If pCIPFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
If pCIPOverPointFeat.Fields.FindField(inCnt.Tag) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(inCnt.Tag)) = inCnt.Text
End If
End If
Next
ElseIf TypeOf pnlCnt Is CustomPanel Then
If CType(pnlCnt.Controls(0), RadioButton).Checked = True Then
If pCIPFeat.Fields.FindField(pnlCnt.Tag) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(pnlCnt.Tag)) = CType(pnlCnt.Controls(0), RadioButton).Tag
End If
If pCIPOverFeat.Fields.FindField(pnlCnt.Tag) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(pnlCnt.Tag)) = CType(pnlCnt.Controls(0), RadioButton).Tag
End If
If pCIPOverPointFeat.Fields.FindField(pnlCnt.Tag) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(pnlCnt.Tag)) = CType(pnlCnt.Controls(0), RadioButton).Tag
End If
Else
If pCIPFeat.Fields.FindField(pnlCnt.Tag) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(pnlCnt.Tag)) = CType(pnlCnt.Controls(0), RadioButton).Tag
End If
If pCIPOverFeat.Fields.FindField(pnlCnt.Tag) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(pnlCnt.Tag)) = CType(pnlCnt.Controls(0), RadioButton).Tag
End If
If pCIPOverPointFeat.Fields.FindField(pnlCnt.Tag) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(pnlCnt.Tag)) = CType(pnlCnt.Controls(0), RadioButton).Tag
End If
End If
End If
Next
Next
If pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotLenField) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotLenField)) = s_lblTotLength.Text
End If
If pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotAreaField) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotAreaField)) = pTotArea
End If
If pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotPntField) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotPntField)) = pPntCnt
End If
If pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCostField) > 0 Then
pCIPFeat.Value(pCIPFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCostField)) = s_lblTotalCost.Text
End If
If pCIPFeat.Fields.FindField("LASTUPDATE") > 0 Then
pCIPFeat.Value(pCIPOverFeat.Fields.FindField("LASTUPDATE")) = Now 'FormatDateTime(Now, DateFormat.LongDate)
End If
If pCIPFeat.Fields.FindField("LASTEDITOR") > 0 Then
pCIPFeat.Value(pCIPOverFeat.Fields.FindField("LASTEDITOR")) = SystemInformation.UserName
End If
If pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotAreaField) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotAreaField)) = pTotArea
End If
If pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotPntField) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotPntField)) = pPntCnt
End If
If pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotLenField) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotLenField)) = s_lblTotLength.Text
End If
If pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCostField) > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCostField)) = s_lblTotalCost.Text
End If
If pCIPOverFeat.Fields.FindField("LASTUPDATE") > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField("LASTUPDATE")) = Now 'FormatDateTime(Now, DateFormat.LongDate)
End If
If pCIPOverFeat.Fields.FindField("LASTEDITOR") > 0 Then
pCIPOverFeat.Value(pCIPOverFeat.Fields.FindField("LASTEDITOR")) = SystemInformation.UserName
End If
If pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotAreaField) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotAreaField)) = pTotArea
End If
If pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotPntField) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotPntField)) = pPntCnt
End If
If pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotLenField) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayTotLenField)) = s_lblTotLength.Text
End If
If pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCostField) > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCostField)) = s_lblTotalCost.Text
End If
If pCIPOverPointFeat.Fields.FindField("LASTUPDATE") > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField("LASTUPDATE")) = Now 'FormatDateTime(Now, DateFormat.LongDate)
End If
If pCIPOverPointFeat.Fields.FindField("LASTEDITOR") > 0 Then
pCIPOverPointFeat.Value(pCIPOverPointFeat.Fields.FindField("LASTEDITOR")) = SystemInformation.UserName
End If
pStepPro.Message = "Checking Project Name"
If pPrjName = "" Then
MsgBox("The CIP Project name is was not found or is invalid")
My.Globals.Variables.v_Editor.AbortOperation()
Return
End If
Try
Dim pQFilt As IQueryFilter = New QueryFilter
pQFilt.WhereClause = My.Globals.Constants.c_CIPProjectLayNameField & " = '" & pPrjName & "'"
If My.Globals.Variables.v_CIPLayerPrj.FeatureClass.FeatureCount(pQFilt) <> 0 Then
If MsgBox("The CIP Project name is already in use, Override project?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
deleteCIPProjects(pPrjName)
Else
pQFilt = Nothing
My.Globals.Variables.v_Editor.AbortOperation()
Return
End If
End If
Catch ex As Exception
MsgBox("Error trying to check Project Names - Make sure the overview layer has a field named: " & My.Globals.Constants.c_CIPProjectAssetNameField)
My.Globals.Variables.v_Editor.AbortOperation()
Return
End Try
Dim pGeometryDefTest As IGeometryDef
Dim pFieldsTest As IFields
Dim lGeomIndex As Integer
Dim pFieldTest As IField
Dim bZAware As Boolean
Dim bMAware As Boolean
Dim pZAware As IZAware
pStepPro.Message = "Costing Candidates"
For Each pDataRow As DataGridViewRow In s_dgCIP.Rows
Dim strTag As String
pStepPro.Message = "Loading Candidates to CIP Project " & pDataRow.Cells(0).Value & ":" & pDataRow.Cells("OID").Value
strTag = "CIPTools:" & pDataRow.Cells("ASSETTYP").Value & ":" & pDataRow.Cells("OID").Value
Dim pGeo As IGeometry = My.Globals.Functions.GetShapeFromGraphic(strTag, "CIPTools:")
Dim pTmpGeo As IGeometry
Dim pNewFeat As IFeature
'Dim pGeometryDefTest As IGeometryDef
'Dim pFieldsTest As IFields
'Dim lGeomIndex As Integer
'Dim pFieldTest As IField
'Dim bZAware As Boolean
'Dim bMAware As Boolean
Dim pDS As IGeoDataset = My.Globals.Variables.v_CIPLayerPolygon
pGeo.Project(pDS.SpatialReference)
Select Case pGeo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
pTmpGeo = pGeo
pNewFeat = My.Globals.Variables.v_CIPLayerPolygon.FeatureClass.CreateFeature
pTotArea = pTotArea + CType(pNewFeat.Shape, IArea).Area
pFieldsTest = My.Globals.Variables.v_CIPLayerPolygon.FeatureClass.Fields
lGeomIndex = pFieldsTest.FindField(My.Globals.Variables.v_CIPLayerPolygon.FeatureClass.ShapeFieldName)
pFieldTest = pFieldsTest.Field(lGeomIndex)
pGeometryDefTest = pFieldTest.GeometryDef
' Determine if M or Z aware
bZAware = pGeometryDefTest.HasZ
pZAware = pGeo
If bZAware = False Then
''Dim pGeoNew As IGeometry = New Polyline
If (pZAware.ZAware) Then
'pZAware.DropZs()
pZAware.ZAware = False
Else
End If
Else
If pZAware.ZAware = False Then
pZAware.ZAware = True
Dim pZ As IZ = pGeo
pZ.SetConstantZ(0)
End If
End If
bMAware = pGeometryDefTest.HasM
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
pTopo = pGeo
pTmpGeo = pTopo.Buffer(m_BufferAmount)
pNewFeat = My.Globals.Variables.v_CIPLayerPolyline.FeatureClass.CreateFeature
pFieldsTest = My.Globals.Variables.v_CIPLayerPolyline.FeatureClass.Fields
lGeomIndex = pFieldsTest.FindField(My.Globals.Variables.v_CIPLayerPolyline.FeatureClass.ShapeFieldName)
pFieldTest = pFieldsTest.Field(lGeomIndex)
pGeometryDefTest = pFieldTest.GeometryDef
' Determine if M or Z aware
bZAware = pGeometryDefTest.HasZ
pZAware = pGeo
If bZAware = False Then
''Dim pGeoNew As IGeometry = New Polyline
If (pZAware.ZAware) Then
'pZAware.DropZs()
pZAware.ZAware = False
Else
End If
Else
If pZAware.ZAware = True Then
'pZAware.ZAware = True
Dim pZ As IZ = pGeo
' pZ.CalculateNonSimpleZs()
' pZ.SetConstantZ(0)
Else
pZAware.ZAware = True
Dim pZ As IZ = pGeo
pZ.SetConstantZ(0)
End If
End If
bMAware = pGeometryDefTest.HasM
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
pTopo = pGeo
pTmpGeo = pTopo.Buffer(m_BufferAmount)
pNewFeat = My.Globals.Variables.v_CIPLayerPoint.FeatureClass.CreateFeature
pPntCnt = pPntCnt + 1
pFieldsTest = My.Globals.Variables.v_CIPLayerPoint.FeatureClass.Fields
lGeomIndex = pFieldsTest.FindField(My.Globals.Variables.v_CIPLayerPoint.FeatureClass.ShapeFieldName)
pFieldTest = pFieldsTest.Field(lGeomIndex)
pGeometryDefTest = pFieldTest.GeometryDef
' Determine if M or Z aware
bZAware = pGeometryDefTest.HasZ
pZAware = pGeo
If bZAware = False Then
''Dim pGeoNew As IGeometry = New Polyline
If (pZAware.ZAware) Then
'pZAware.DropZs()
pZAware.ZAware = False
Else
End If
Else
If pZAware.ZAware = False Then
pZAware.ZAware = True
' Dim pZ As IZ = pGeo
'pZ.SetConstantZ(0)
Dim pntZ As IPoint = pGeo
pntZ.Z = 0
End If
End If
bMAware = pGeometryDefTest.HasM
Case Else
Continue For
End Select
If pOverGeo Is Nothing Or pOverGeo.IsEmpty Then
pOverGeo = pTmpGeo
Else
pTopo = pOverGeo
pOverGeo = pTopo.Union(pTmpGeo)
End If
pTmpGeo = Nothing
pNewFeat.Shape = pGeo
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetNameField)) = pPrjName
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTypeField)) = pDataRow.Cells("ASSETTYP").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetIDField)) = pDataRow.Cells("ASSETID").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetCostField)) = pDataRow.Cells("COST").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetAddCostField)) = pDataRow.Cells("ADDCOST").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetTotCostField)) = pDataRow.Cells("TOTCOST").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt1Field)) = pDataRow.Cells("exFiltVal1").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetExistingFilt2Field)) = pDataRow.Cells("exFiltVal2").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt1Field)) = pDataRow.Cells("proFiltVal1").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetProposedFilt2Field)) = pDataRow.Cells("proFiltVal2").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetOIDField)) = pDataRow.Cells("OID").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetNotesField)) = pDataRow.Cells("Notes").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetMultiField)) = pDataRow.Cells("Multi").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetStrategyField)) = pDataRow.Cells("Strategy").Value
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetActionField)) = pDataRow.Cells("Action").Value
If pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetLenField) > 0 Then
pNewFeat.Value(pNewFeat.Fields.FindField(My.Globals.Constants.c_CIPProjectAssetLenField)) = pDataRow.Cells("LENGTH").Value()
End If
If pNewFeat.Fields.FindField("LASTUPDATE") > 0 Then
pNewFeat.Value(pNewFeat.Fields.FindField("LASTUPDATE")) = Now ' FormatDateTime(Now, DateFormat.LongDate)
End If
If pNewFeat.Fields.FindField("LASTEDITOR") > 0 Then
pNewFeat.Value(pNewFeat.Fields.FindField("LASTEDITOR")) = SystemInformation.UserName
End If
pNewFeat.Store()
boolCont = pTrkCan.Continue
If Not boolCont Then
My.Globals.Variables.v_Editor.AbortOperation()
Exit Try
End If
pGeo = Nothing
pTmpGeo = Nothing
pNewFeat = Nothing
pStepPro.Step()
Next
If pOverGeo IsNot Nothing And pOverGeo.IsEmpty = False Then
pStepPro.Message = "Creating Project Extents"
Dim pClone As IClone = pOverGeo
Dim pPoly As IPolygon = pClone.Clone
Dim pOverTopo As ITopologicalOperator = pPoly
Dim pUnitConverter As IUnitConverter = New UnitConverter
Dim pGeoDs As IGeoDataset = My.Globals.Variables.v_CIPLayerOver
Dim pBufAmount As Double
If TypeOf pGeoDs.SpatialReference Is IProjectedCoordinateSystem Then
Dim pPrjCoord As IProjectedCoordinateSystem
pPrjCoord = pGeoDs.SpatialReference
pBufAmount = pUnitConverter.ConvertUnits(m_BufferAmount, ESRI.ArcGIS.esriSystem.esriUnits.esriFeet, My.Globals.Functions.ConvertUnitType(pPrjCoord.CoordinateUnit))
pPrjCoord = Nothing
Else
Dim pGeoCoord As IGeographicCoordinateSystem
pGeoCoord = pGeoDs.SpatialReference
pBufAmount = pUnitConverter.ConvertUnits(m_BufferAmount, ESRI.ArcGIS.esriSystem.esriUnits.esriFeet, My.Globals.Functions.ConvertUnitType(pGeoCoord.CoordinateUnit))
pGeoCoord = Nothing
End If
pGeoDs = Nothing
pOverTopo = pOverTopo.ConvexHull()
pOverTopo = pOverTopo.Buffer(m_BufferAmountConvext)
pFieldsTest = My.Globals.Variables.v_CIPLayerOver.FeatureClass.Fields
lGeomIndex = pFieldsTest.FindField(My.Globals.Variables.v_CIPLayerOver.FeatureClass.ShapeFieldName)
pFieldTest = pFieldsTest.Field(lGeomIndex)
pGeometryDefTest = pFieldTest.GeometryDef
' Determine if M or Z aware
bZAware = pGeometryDefTest.HasZ
pZAware = pOverTopo
If bZAware = False Then
''Dim pGeoNew As IGeometry = New Polyline
If (pZAware.ZAware) Then
'pZAware.DropZs()
pZAware.ZAware = False
Else
End If
Else
If pZAware.ZAware = True Then
'pZAware.ZAware = True
Dim pZ As IZ = pOverTopo
' pZ.CalculateNonSimpleZs()
' pZ.SetConstantZ(0)
Else
pZAware.ZAware = True
Dim pZ As IZ = pOverTopo
pZ.SetConstantZ(0)
End If
End If
pFieldsTest = My.Globals.Variables.v_CIPLayerPrj.FeatureClass.Fields
lGeomIndex = pFieldsTest.FindField(My.Globals.Variables.v_CIPLayerPrj.FeatureClass.ShapeFieldName)
pFieldTest = pFieldsTest.Field(lGeomIndex)
pGeometryDefTest = pFieldTest.GeometryDef
' Determine if M or Z aware
bZAware = pGeometryDefTest.HasZ
pZAware = pOverGeo
If bZAware = False Then
''Dim pGeoNew As IGeometry = New Polyline
If (pZAware.ZAware) Then
'pZAware.DropZs()
pZAware.ZAware = False
Else
End If
Else
If pZAware.ZAware = True Then
'pZAware.ZAware = True
Dim pZ As IZ = pOverGeo
' pZ.CalculateNonSimpleZs()
' pZ.SetConstantZ(0)
Else
pZAware.ZAware = True
Dim pZ As IZ = pOverGeo
pZ.SetConstantZ(0)
End If
End If
Dim pOverPnt As IGeometry = CType(pOverTopo, IArea).Centroid
pFieldsTest = My.Globals.Variables.v_CIPLayerOverPoint.FeatureClass.Fields
lGeomIndex = pFieldsTest.FindField(My.Globals.Variables.v_CIPLayerOverPoint.FeatureClass.ShapeFieldName)
pFieldTest = pFieldsTest.Field(lGeomIndex)
pGeometryDefTest = pFieldTest.GeometryDef
' Determine if M or Z aware
bZAware = pGeometryDefTest.HasZ
pZAware = pOverPnt
If bZAware = False Then
''Dim pGeoNew As IGeometry = New Polyline
If (pZAware.ZAware) Then
'pZAware.DropZs()
pZAware.ZAware = False
Else
End If
Else
If pZAware.ZAware = True Then
'pZAware.ZAware = True
Dim pZ As IZ = pOverPnt
' pZ.CalculateNonSimpleZs()
' pZ.SetConstantZ(0)
Else
Try
pZAware.ZAware = True
Dim pntZ As IPoint = pOverPnt
pntZ.Z = 0
' Dim pZ As IZ = pOverPnt
' pZ.SetConstantZ(0)
Catch ex As Exception
End Try
End If
End If
pCIPFeat.Shape = pOverGeo
pCIPOverFeat.Shape = pOverTopo 'pPoly 'pgoncoll
pCIPOverPointFeat.Shape = pOverPnt 'CType(pOverTopo, IArea).Centroid 'pPoly 'pgoncoll
pCIPFeat.Store()
pCIPOverFeat.Store()
pCIPOverPointFeat.Store()
pClone = Nothing
pCIPFeat = Nothing
pCIPOverFeat = Nothing
pCIPOverPointFeat = Nothing
pUnitConverter = Nothing
pPoly = Nothing
End If
'Try
' If lstInventory.Items.Count > 0 Then
' For Each lstItem As String In lstInventory.Items
' Dim pRow As IRow = pCIPInvTable.CreateRow
' pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPInvLayProjNameField)) = pPrjName
' Dim pVals() As String = lstItem.Split(":")
' pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPInvLayInvTypefield)) = Trim(pVals(0))
' pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPInvLayNumOfInvField)) = Trim(pVals(1))
' pRow.Store()
' pRow = Nothing
' Next
' End If
'Catch ex As Exception
' MsgBox("Error saving inventory, project will save")
'End Try
My.Globals.Variables.v_Editor.StopOperation("CIP Project Created")
ClearControl()
pStepPro.Step()
pOverGeo = Nothing
pPrjGeo = Nothing
pTopo = Nothing
pProDlgFact = Nothing
pStepPro = Nothing
pTrkCan = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: CreateCIPProject" & vbCrLf & ex.Message)
My.Globals.Variables.v_Editor.AbortOperation()
Finally
If pProDlg IsNot Nothing Then
pProDlg.HideDialog()
Marshal.ReleaseComObject(pProDlg)
pProDlg = Nothing
End If
End Try
My.ArcMap.Document.ActiveView.Refresh()
'pCIPLayerPrj = Nothing
'pCIPLayerOver = Nothing
'pCIPLayerPoint = Nothing
'pCIPLayerPolygon = Nothing
'pCIPLayerPolyline = Nothing
'pCIPInvTable = Nothing
End Sub
Private Shared Function createSimpleRenderer(ByVal type As ESRI.ArcGIS.Geometry.esriGeometryType) As ISimpleRenderer
Try
Dim pSimpleRenderer As ISimpleRenderer = New SimpleRenderer
Dim pColor As IColor
pColor = New RgbColor
pColor.RGB = RGB(255, 25, 25)
Select Case type
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryLine
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
' create a new fill symbol
Dim pFillSymbol As ISimpleFillSymbol = New SimpleFillSymbol
pFillSymbol = New SimpleFillSymbol
pFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSHollow
' set the color of the fill symbol
pFillSymbol.Color = pColor
Dim pLineSymbol As ISimpleLineSymbol
pLineSymbol = New SimpleLineSymbol
pLineSymbol.Width = 2
pLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
' set the color of the fill symbol
pLineSymbol.Color = pColor
pFillSymbol.Outline = pLineSymbol
' set the renderer's symbol, label, and description
pSimpleRenderer.Symbol = pFillSymbol
pLineSymbol = Nothing
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
' create a new fill symbol
Dim pFillSymbol As ISimpleLineSymbol
pFillSymbol = New SimpleLineSymbol
pFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
' set the color of the fill symbol
pFillSymbol.Color = pColor
pFillSymbol.Width = 2
' set the renderer's symbol, label, and description
pSimpleRenderer.Symbol = pFillSymbol
pFillSymbol = Nothing
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
' create a new fill symbol
Dim pFillSymbol As ISimpleMarkerSymbol
pFillSymbol = New SimpleMarkerSymbol
pFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle
' set the color of the fill symbol
pFillSymbol.Color = pColor
' set the renderer's symbol, label, and description
pSimpleRenderer.Symbol = pFillSymbol
pFillSymbol = Nothing
Case Else
End Select
pSimpleRenderer.Label = "CIP"
pSimpleRenderer.Description = ""
pSimpleRenderer = Nothing
pColor = Nothing
Return pSimpleRenderer
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: createSimpleRenderer" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Sub createGraphicSymbols()
Try
My.Globals.Variables.v_PolygonGraphicSymbol = New SimpleFillSymbol
My.Globals.Variables.v_PolygonHighlightGraphicSymbol = New SimpleFillSymbol
My.Globals.Variables.v_LineGraphicSymbol = New MultiLayerLineSymbol
My.Globals.Variables.v_LineHighlightGraphicSymbol = New SimpleLineSymbol
My.Globals.Variables.v_PointGraphicSymbol = New MultiLayerMarkerSymbol
My.Globals.Variables.v_PointHighlightGraphicSymbol = New SimpleMarkerSymbol
Dim pSelectColor As IColor
Dim pColor As IColor
Dim pOutColor As IColor
pColor = New RgbColor
pColor.RGB = My.Globals.Constants.c_DrawColor
pOutColor = New RgbColor
pOutColor.RGB = My.Globals.Constants.c_OutDrawColor
pSelectColor = New RgbColor
pSelectColor.RGB = My.Globals.Constants.c_HighlightColor
My.Globals.Variables.v_PolygonGraphicSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSHollow
My.Globals.Variables.v_PolygonHighlightGraphicSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSHollow
' set the color of the fill symbol
My.Globals.Variables.v_PolygonGraphicSymbol.Color = pColor
My.Globals.Variables.v_PolygonHighlightGraphicSymbol.Color = pSelectColor
Dim pLineSymbol As ISimpleLineSymbol
pLineSymbol = New SimpleLineSymbol
pLineSymbol.Width = 3
pLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
' set the color of the fill symbol
pLineSymbol.Color = pColor
My.Globals.Variables.v_PolygonGraphicSymbol.Outline = pLineSymbol
pLineSymbol.Color = pSelectColor
My.Globals.Variables.v_PolygonHighlightGraphicSymbol.Outline = pLineSymbol
Dim pLineSym As ISimpleLineSymbol = New SimpleLineSymbol
pLineSym.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
' set the color of the fill symbol
pLineSym.Color = pOutColor
pLineSym.Width = 4
Dim pOutLineSym As ISimpleLineSymbol = New SimpleLineSymbol
pOutLineSym.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
' set the color of the fill symbol
pOutLineSym.Color = pColor
pOutLineSym.Width = 6
My.Globals.Variables.v_LineGraphicSymbol.AddLayer(pOutLineSym)
My.Globals.Variables.v_LineGraphicSymbol.AddLayer(pLineSym)
My.Globals.Variables.v_LineHighlightGraphicSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
' set the color of the fill symbol
My.Globals.Variables.v_LineHighlightGraphicSymbol.Color = pSelectColor
My.Globals.Variables.v_LineHighlightGraphicSymbol.Width = 6
Dim pOutMarkSym As IMarkerSymbol = New SimpleMarkerSymbol
Dim pMarkSym As IMarkerSymbol = New SimpleMarkerSymbol
' pMarkSym.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle
' set the color of the fill symbol
pMarkSym.Color = pColor
pOutMarkSym.Size = 4
'pOutMarkSym.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle
' set the color of the fill symbol
pOutMarkSym.Color = pOutColor
pOutMarkSym.Size = 6
My.Globals.Variables.v_PointGraphicSymbol.AddLayer(pMarkSym)
My.Globals.Variables.v_PointGraphicSymbol.AddLayer(pOutMarkSym)
pOutMarkSym = Nothing
pMarkSym = Nothing
My.Globals.Variables.v_PointHighlightGraphicSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle
' set the color of the fill symbol
My.Globals.Variables.v_PointHighlightGraphicSymbol.Color = pSelectColor
pOutMarkSym = Nothing
pMarkSym = Nothing
pOutLineSym = Nothing
pLineSym = Nothing
pSelectColor = Nothing
pColor = Nothing
pLineSymbol = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: createGraphicSymbols" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub ClearControl()
Try
If s_enabled = False Then Return
If s_tbCntCIPDetails Is Nothing Then Return
For Each tbpg As TabPage In s_tbCntCIPDetails.TabPages
For Each pnlCnt As Control In tbpg.Controls
If TypeOf pnlCnt Is Panel Then
For Each inCnt As Control In pnlCnt.Controls
If TypeOf inCnt Is TextBox Then
inCnt.Text = ""
ElseIf TypeOf inCnt Is DateTimePicker Then
ElseIf TypeOf inCnt Is ComboBox Then
ElseIf TypeOf inCnt Is NumericUpDown Then
End If
Next
ElseIf TypeOf pnlCnt Is CustomPanel Then
If CType(pnlCnt.Controls(0), RadioButton).Checked = True Then
Else
End If
End If
Next
Next
My.Globals.Variables.v_LastSelection = ""
UnSelectRow(My.Globals.Variables.v_LastSelection)
RemoveHandler s_dgCIP.SelectionChanged, AddressOf dgCIP_SelectionChanged
s_dgCIP.Rows.Clear()
AddHandler s_dgCIP.SelectionChanged, AddressOf dgCIP_SelectionChanged
s_lstInventory.Items.Clear()
s_lblTotLength.Text = ".00"
s_lblTotArea.Text = ".00"
s_lblTotPnt.Text = "0"
s_lblTotalCost.Text = FormatCurrency("0.00", 2, TriState.True, TriState.True) 'Format(Total, "#,###.00")
s_lblTotalCost.Parent.Refresh()
Cleargraphics()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ClearControl" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub makeImagesTrans()
Try
For Each cnt As Control In s_gpBxControls.Controls
If TypeOf cnt Is System.Windows.Forms.Button Then
Dim img As System.Drawing.Bitmap
img = CType(cnt, System.Windows.Forms.Button).Image
If img IsNot Nothing Then
img.MakeTransparent(img.GetPixel(0, 0))
CType(cnt, System.Windows.Forms.Button).Image = img
End If
img = Nothing
ElseIf TypeOf cnt Is System.Windows.Forms.CheckBox Then
Dim img As System.Drawing.Bitmap
img = CType(cnt, System.Windows.Forms.CheckBox).Image
If img IsNot Nothing Then
img.MakeTransparent(img.GetPixel(0, 0))
CType(cnt, System.Windows.Forms.CheckBox).Image = img
End If
img = Nothing
End If
Next
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: makeImagesTrans" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub RemoveControl(ByVal Save As Boolean)
Try
For Each cnt As Control In s_dgCIP.Controls
If TypeOf cnt Is TextBox Then
If Save Then
SaveTextBox(cnt)
End If
s_dgCIP.Controls.Remove(cnt)
ElseIf TypeOf cnt Is ComboBox Then
s_dgCIP.Controls.Remove(cnt)
End If
Next
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: RemoveControl" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub addTextBox(ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
Try
Dim Rectangle As System.Drawing.Rectangle = s_dgCIP.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False)
Dim pTxtBox As TextBox = New TextBox
pTxtBox.Left = Rectangle.Left
pTxtBox.Top = Rectangle.Top
pTxtBox.Width = Rectangle.Width
pTxtBox.Tag = e.ColumnIndex & "|" & e.RowIndex
pTxtBox.Height = Rectangle.Height - 20
pTxtBox.Text = s_dgCIP.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
s_dgCIP.Controls.Add(pTxtBox)
pTxtBox.Focus()
pTxtBox.Show()
Rectangle = Nothing
pTxtBox = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: addTextBox" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub addComboBox(ByVal e As System.Windows.Forms.DataGridViewCellEventArgs, ByVal ListValues As ArrayList)
Try
Dim Rectangle As System.Drawing.Rectangle = s_dgCIP.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False)
Dim pCboBox As System.Windows.Forms.ComboBox = New System.Windows.Forms.ComboBox
pCboBox.DropDownStyle = Windows.Forms.ComboBoxStyle.DropDownList
pCboBox.Left = Rectangle.Left
pCboBox.Top = Rectangle.Top
pCboBox.Width = Rectangle.Width
pCboBox.DataSource = ListValues
pCboBox.DisplayMember = "Display"
pCboBox.ValueMember = "Value"
pCboBox.Tag = e.ColumnIndex & "|" & e.RowIndex
pCboBox.Height = Rectangle.Height - 20
pCboBox.DropDownWidth = 300
s_dgCIP.Controls.Add(pCboBox)
pCboBox.Show()
AddHandler pCboBox.SelectedValueChanged, AddressOf comboClick
Rectangle = Nothing
pCboBox.DroppedDown = True
pCboBox = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: addComboBox" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub saveCombo(ByVal pCboBox As System.Windows.Forms.ComboBox)
Try
Dim pRowCol() As String = pCboBox.Tag.ToString.Split("|")
If s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value = pCboBox.Text Then
pCboBox.Parent.Controls.Remove(pCboBox)
Return
End If
'
' MsgBox("Translate display values to code values")
s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value = pCboBox.Text
'Dim pExistingDis1 As String = ""
'Dim pExistingDis2 As String = ""
Dim pExistingVal1 As String = ""
Dim pExistingVal2 As String = ""
Dim pReplaceDis1 As String = ""
Dim pReplaceDis2 As String = ""
Dim pReplaceVal1 As String = ""
Dim pReplaceVal2 As String = ""
pReplaceDis1 = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value
pReplaceDis2 = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value
pReplaceVal1 = pReplaceDis1
pReplaceVal2 = pReplaceDis2
Dim pAssetLay As IFeatureLayer = My.Globals.Functions.FindLayer(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").Value)
Dim pDomFilt1 As IDomain = Nothing
If s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld1").Value <> "" Then
If pAssetLay.FeatureClass.Fields.FindField(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld1").Value) > 0 Then
pDomFilt1 = pAssetLay.FeatureClass.Fields.Field(pAssetLay.FeatureClass.Fields.FindField(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld1").Value)).Domain
If TypeOf pDomFilt1 Is ICodedValueDomain Then
pReplaceVal1 = My.Globals.Functions.GetDomainValue(pReplaceDis1, pDomFilt1)
pExistingVal1 = My.Globals.Functions.GetDomainValue(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("exFiltVal1").Value, pDomFilt1)
End If
End If
End If
Dim pDomFilt2 As IDomain = Nothing
If s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld2").Value <> "" Then
If pAssetLay.FeatureClass.Fields.FindField(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld2").Value) > 0 Then
pDomFilt2 = pAssetLay.FeatureClass.Fields.Field(pAssetLay.FeatureClass.Fields.FindField(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld2").Value)).Domain
If TypeOf pDomFilt2 Is ICodedValueDomain Then
pReplaceVal2 = My.Globals.Functions.GetDomainValue(pReplaceDis2, pDomFilt2)
pExistingVal2 = My.Globals.Functions.GetDomainValue(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("exFiltVal2").Value, pDomFilt2)
End If
End If
End If
Dim pSubVal As String = My.Globals.Functions.GetSubtypeValue(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("STRATEGY").FormattedValue.ToString, My.Globals.Variables.v_CIPTableCost)
Dim pSubDec As String = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("STRATEGY").FormattedValue.ToString
If s_dgCIP.Columns(CInt(pRowCol(0))).Name = "STRATEGY" Then
Dim pSubType As ISubtypes = My.Globals.Variables.v_CIPTableCost
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ACTION").Value = _
My.Globals.Functions.GetDomainDisplay(pSubType.DefaultValue(pSubVal, My.Globals.Constants.c_CIPCostActionField), pSubType.Domain(pSubVal, My.Globals.Constants.c_CIPCostActionField))
If UCase(pCboBox.Text) = UCase("Proposed") Then
'dgCIP.Rows(CInt(pRowCol(1))).Cells("exFiltVal1").Value = ""
'dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value = ""'dgCIP.Rows(CInt(pRowCol(1))).Cells("exFiltVal2").Value
'System.Configuration.ConfigurationManager.AppSettings("CIPReplacementValue")
ElseIf UCase(pCboBox.Text) = UCase(My.Globals.Variables.v_CIPReplaceValue) Then
getReplacementValues(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ACTION").Value, pExistingVal1, pExistingVal2, pReplaceVal1, pReplaceVal2)
If pReplaceVal1 <> "" And pDomFilt1 IsNot Nothing Then
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value = My.Globals.Functions.GetDomainDisplay(pReplaceVal1, pDomFilt1)
Else
If pReplaceVal1 <> "" Then
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value = pReplaceVal1
Else
pReplaceVal1 = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value
pReplaceVal1 = My.Globals.Functions.GetDomainValue(pReplaceVal1, pDomFilt1)
End If
End If
If pReplaceVal2 <> "" And pDomFilt2 IsNot Nothing Then
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value = My.Globals.Functions.GetDomainDisplay(pReplaceVal2, pDomFilt2)
Else
If pReplaceVal2 <> "" Then
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value = pReplaceVal2
Else
pReplaceVal2 = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value
pReplaceVal2 = My.Globals.Functions.GetDomainValue(pReplaceVal2, pDomFilt2)
End If
End If
Else
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("exFiltVal1").Value
s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("exFiltVal2").Value
pReplaceVal2 = pExistingVal2
pReplaceVal1 = pExistingVal1
End If
End If
Dim pDS As IDataset = pAssetLay.FeatureClass
Dim strFCName As String = My.Globals.Functions.getClassName(pDS)
Dim pCostRow As IRow = CheckForCostFeat(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").Value, strFCName, pSubVal, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ACTION").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ACTION").Value, pReplaceVal1, pReplaceVal2)
'dgCIP.Rows(CInt(pRowCol(1))).Cells("STRATEGY").Value
If pCostRow IsNot Nothing Then
applyCostToRow(pCostRow, pRowCol(1))
End If
pCostRow = Nothing
pCboBox.Parent.Controls.Remove(pCboBox)
pDomFilt2 = Nothing
pDomFilt1 = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: saveCombo" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub SetRowsTotal(ByVal Row As Integer)
Try
Dim dblAddVal As Double = 0
If s_dgCIP.Rows(Row).Cells("ADDCOST").Value IsNot Nothing Then
If s_dgCIP.Rows(Row).Cells("ADDCOST").Value IsNot DBNull.Value Then
If IsNumeric(s_dgCIP.Rows(Row).Cells("ADDCOST").Value) Then
dblAddVal = s_dgCIP.Rows(Row).Cells("ADDCOST").Value
End If
End If
End If
Dim dblCostVal As Double = 0
If s_dgCIP.Rows(Row).Cells("COST").Value IsNot Nothing Then
If s_dgCIP.Rows(Row).Cells("COST").Value IsNot DBNull.Value Then
If IsNumeric(s_dgCIP.Rows(Row).Cells("COST").Value) Then
dblCostVal = s_dgCIP.Rows(Row).Cells("COST").Value
End If
End If
End If
Dim dblTotCost As Double = dblCostVal
If s_dgCIP.Rows(Row).Cells("LENGTH").Value IsNot Nothing Then
If s_dgCIP.Rows(Row).Cells("LENGTH").Value IsNot DBNull.Value Then
If s_dgCIP.Rows(Row).Cells("LENGTH").Value <> 0 Then
dblTotCost = s_dgCIP.Rows(Row).Cells("LENGTH").Value * dblCostVal
End If
End If
End If
If s_dgCIP.Rows(Row).Cells("MULTI").Value IsNot Nothing Then
If s_dgCIP.Rows(Row).Cells("MULTI").Value IsNot DBNull.Value Then
If IsNumeric(s_dgCIP.Rows(Row).Cells("MULTI").Value) Then
If s_dgCIP.Rows(Row).Cells("MULTI").Value <> 0 Then
dblTotCost = dblTotCost * s_dgCIP.Rows(Row).Cells("MULTI").Value
End If
End If
End If
End If
dblTotCost = dblTotCost + dblAddVal
If IsNumeric(dblTotCost) Then
s_dgCIP.Rows(Row).Cells("TOTCOST").Value = FormatCurrency(dblTotCost, 2, TriState.True, True) 'Format(Math.Round(dblTotCost, 2), "#,###.00")
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: setRowsTotal" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub applyCostToRow(ByVal CostRow As IRow, ByVal Row As Integer)
Try
If CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)) IsNot Nothing Then
If CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)) IsNot DBNull.Value Then
If IsNumeric(CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField))) Then
s_dgCIP.Rows(Row).Cells("ADDCOST").Value = FormatCurrency(CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)), 2, TriState.True, TriState.True)
Else
s_dgCIP.Rows(Row).Cells("ADDCOST").Value = FormatCurrency(0.0, 2, TriState.True, TriState.True)
End If
Else
s_dgCIP.Rows(Row).Cells("ADDCOST").Value = FormatCurrency(0.0, 2, TriState.True, TriState.True)
End If
Else
s_dgCIP.Rows(Row).Cells("ADDCOST").Value = FormatCurrency(0.0, 2, TriState.True, TriState.True)
End If
If CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)) IsNot Nothing Then
If CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)) IsNot DBNull.Value Then
If IsNumeric(CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostCostField))) Then
s_dgCIP.Rows(Row).Cells("COST").Value = FormatCurrency(CostRow.Value(CostRow.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)), 2, TriState.True, TriState.True)
Else
s_dgCIP.Rows(Row).Cells("COST").Value = FormatCurrency(0.0, 2, TriState.True, TriState.True)
End If
Else
s_dgCIP.Rows(Row).Cells("COST").Value = FormatCurrency(0.0, 2, TriState.True, TriState.True)
End If
Else
s_dgCIP.Rows(Row).Cells("COST").Value = FormatCurrency(0.0, 2, TriState.True, TriState.True)
End If
SetRowsTotal(Row)
setProjectCostAndTotal()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: applyCostToRow" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub SaveTextBox(ByVal pTxtBox As System.Windows.Forms.TextBox)
Try
Dim pRowCol() As String = pTxtBox.Tag.ToString.Split("|")
Dim strExistVal As String = ""
If s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value IsNot Nothing Then
strExistVal = s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value.ToString
End If
If strExistVal.Replace("$", "") <> pTxtBox.Text Then
Select Case s_dgCIP.Columns(CInt(pRowCol(0))).Name
Case "Notes"
s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value = pTxtBox.Text
Case "proFiltVal1", "proFiltVal2"
s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value = pTxtBox.Text
Dim subVal As String = s_dgCIP.Rows(CInt(pRowCol(1))).Cells("STRATEGY").Value
Dim pFl As IFeatureLayer = My.Globals.Functions.FindLayer(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").FormattedValue.ToString)
Dim pD As IDomain = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld1").FormattedValue.ToString)).Domain
Dim dmVal1 As String = My.Globals.Functions.GetDomainValue(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value.ToString(), pD)
pD = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("FiltFld2").FormattedValue.ToString)).Domain
Dim dmVal2 As String = My.Globals.Functions.GetDomainValue(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value, pD)
' s_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal1").Value
's_dgCIP.Rows(CInt(pRowCol(1))).Cells("proFiltVal2").Value
Dim pCostRow As IRow = CheckForCostFeat(s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ASSETTYP").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("STRATEGY").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ACTION").Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("ACTION").Value, dmVal1, dmVal2)
'(s_dgCIP.Rows(CInt(pRowCol(1))).Cells(0).Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells(4).Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells(5).Value, s_dgCIP.Rows(CInt(pRowCol(1))).Cells("OID").Value)
If pCostRow IsNot Nothing Then
applyCostToRow(pCostRow, pRowCol(1))
setProjectCostAndTotal()
End If
pCostRow = Nothing
Case "MULTI"
If IsNumeric(pTxtBox.Text) Then
s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value = pTxtBox.Text
SetRowsTotal(pRowCol(1))
End If
setProjectCostAndTotal()
Case Else
If IsNumeric(pTxtBox.Text) Then
s_dgCIP.Rows(CInt(pRowCol(1))).Cells(CInt(pRowCol(0))).Value = FormatCurrency(pTxtBox.Text, 2, TriState.True, TriState.True)
SetRowsTotal(pRowCol(1))
End If
setProjectCostAndTotal()
End Select
End If
pTxtBox.Parent.Controls.Remove(pTxtBox)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: SaveTextBox" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub RowRemoved(ByVal Tag As String)
Try
My.ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, RemoveGraphic(Tag), My.ArcMap.Document.ActiveView.Extent)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: RowRemoved" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Function RemoveGraphic(ByVal Tag As String) As IGeometry
Try
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
Dim pElem As IElement
Dim pElProp As IElementProperties
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
If Not (Tag.Contains("CIPTools:")) Then
Tag = "CIPTools:" & Tag
End If
Do Until pElem Is Nothing
pElProp = pElem
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty.ToString.Contains("CIPTools:") Then
Dim pStrElem As String = pElProp.CustomProperty.ToString
If pStrElem = Tag Then
If My.Globals.Variables.v_LastSelection = Tag Then
My.Globals.Variables.v_LastSelection = ""
End If
My.ArcMap.Document.ActiveView.GraphicsContainer.DeleteElement(pElem)
Return pElem.Geometry
' m_pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElem.Geometry, m_pMxDoc.ActiveView.Extent)
Exit Do
End If
End If
End If
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
pElem = Nothing
pElProp = Nothing
Return Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: RowRemoved" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Sub AddGraphic(ByVal pGeo As IGeometry, ByVal Tag As String)
Try
Dim pElem As IElement
Dim pElementProp As IElementProperties2
Select Case pGeo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
Dim pFSElem As IMarkerElement
pFSElem = New MarkerElement
pFSElem.Symbol = My.Globals.Variables.v_PointGraphicSymbol
pElem = pFSElem
pElem.Geometry = pGeo
pElementProp = pElem
pFSElem = Nothing
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
Dim pFSElem As IFillShapeElement
pFSElem = New PolygonElement
pFSElem.Symbol = My.Globals.Variables.v_PolygonGraphicSymbol
pElem = pFSElem
pElem.Geometry = pGeo
pElementProp = pElem
pFSElem = Nothing
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
Dim pFSElem As ILineElement
pFSElem = New LineElement
pFSElem.Symbol = My.Globals.Variables.v_LineGraphicSymbol
pElem = pFSElem
pElem.Geometry = pGeo
pElementProp = pElem
pFSElem = Nothing
Case Else
MsgBox("Unsupported type, exiting, AddGraphic function")
Return
End Select
pElementProp.CustomProperty = "CIPTools:" & Tag
pElementProp.Name = Tag
My.ArcMap.Document.ActiveView.GraphicsContainer.AddElement(pElem, 0)
pElem = Nothing
pElementProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: AddGraphic" & vbCrLf & ex.Message)
End Try
End Sub
'Private Shared function CheckForCostCbo(ByVal strLayName As String, ByVal strFilt1 As String, ByVal strFilt2 As String, ByVal OID As Integer) As IRow
' Try
' Dim pAssetLay As IFeatureLayer = My.Globals.Functions.findLayer(strLayName, my.ArcMap.Document.FocusMap )
' Dim pDefTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPDefTableName, my.ArcMap.Document.FocusMap )
' Dim pCostTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPCostTableName, my.ArcMap.Document.FocusMap )
' Dim pQFiltDef As IQueryFilter = New QueryFilter
' Dim pSQL As String = ""
' pSQL = my.Globals.Constants.c_CIPDefNameField & " = '" & strLayName & "'"
' ' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostActiveField & " = 'Yes' OR " & my.Globals.Constants.c_CIPCostActiveField & " is Null)"
' pQFiltDef.WhereClause = pSQL
' Dim pDefCurs As ICursor
' pDefCurs = pDefTbl.Search(pQFiltDef, True)
' Dim pDefRow As IRow = pDefCurs.NextRow
' '"(" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & "' OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' If Not pDefRow Is Nothing Then
' If pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField1)) IsNot Nothing Then
' If pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField1)) IsNot DBNull.Value Then
' If Trim(strFilt1) <> "" Then
' If pAssetLay.FeatureClass.Fields.Field(pAssetLay.FeatureClass.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField1)))).Domain Is Nothing Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' Else
' pSQL = my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' End If
' Else
' Dim pDom As IDomain = pAssetLay.FeatureClass.Fields.Field(pAssetLay.FeatureClass.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField1)))).Domain
' If TypeOf pDom Is ICodedValueDomain Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField1 & " = '" & GetDomainValue(strFilt1, pDom) & "'"
' Else
' pSQL = my.Globals.Constants.c_CIPCostFiltField1 & " = " & GetDomainValue(strFilt1, pDom)
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' Else
' pSQL = my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' End If
' End If
' pDom = Nothing
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' Else
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' End If
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' Else
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' End If
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' Else
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' End If
' End If
' If pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField2)) IsNot Nothing Then
' If pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField2)) IsNot DBNull.Value Then
' If Trim(strFilt2) <> "" Then
' If pAssetLay.FeatureClass.Fields.Field(pAssetLay.FeatureClass.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField2)))).Domain Is Nothing Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' End If
' Else
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2 & ""
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2 & ""
' End If
' End If
' Else
' Dim pDom As IDomain = pAssetLay.FeatureClass.Fields.Field(pAssetLay.FeatureClass.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPDefFiltField2)))).Domain
' If TypeOf pDom Is ICodedValueDomain Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField2 & " = '" & GetDomainValue(strFilt2, pDom) & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & GetDomainValue(strFilt2, pDom) & "'"
' End If
' Else
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField2 & " = " & GetDomainValue(strFilt2, pDom)
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = " & GetDomainValue(strFilt2, pDom)
' End If
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' End If
' Else
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2 & ""
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2 & ""
' End If
' End If
' End If
' pDom = Nothing
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND " & "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' Else
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND " & "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' End If
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' Else
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' End If
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' Else
' If pSQL = "" Then
' pSQL = "(" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' End If
' End If
' If pSQL = "" Then
' pSQL = my.Globals.Constants.c_CIPCostNameField & " = '" & strLayName & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostNameField & " = '" & strLayName & "'"
' End If
' ' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostActiveField & " = 'Yes' OR " & my.Globals.Constants.c_CIPCostActiveField & " is Null)"
' End If
' pQFiltDef = New QueryFilter
' pQFiltDef.WhereClause = pSQL
' pDefCurs = pCostTbl.Search(pQFiltDef, True)
' If pDefCurs IsNot Nothing Then
' pDefRow = pDefCurs.NextRow
' 'If pAssetLay IsNot Nothing Then
' ' Do Until pDefRow Is Nothing
' ' If pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) Is Nothing Then
' ' If pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) Is DBNull.Value Then
' ' Dim pQfilt As IQueryFilter = New QueryFilter
' ' pQfilt.WhereClause = pAssetLay.FeatureClass.OIDFieldName & " = " & OID & _
' ' pDefRow.Value(pDefRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField))
' ' If pAssetLay.FeatureClass.FeatureCount(pQfilt) > 0 Then Exit Do
' ' Else
' ' Exit Do
' ' End If
' ' Else
' ' Exit Do
' ' End If
' ' pDefRow = pDefCurs.NextRow
' ' Loop
' 'End If
' End If
' Marshal.ReleaseComObject(pDefCurs)
' pQFiltDef = Nothing
' pAssetLay = Nothing
' pDefTbl = Nothing
' pCostTbl = Nothing
' pDefCurs = Nothing
' Return pDefRow
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: CheckForCostCBO" & vbCrLf & ex.Message)
' Return Nothing
' End Try
'End Function
'Private Shared function CheckForCostTxt(ByVal strLayName As String, ByVal strFilt1 As String, ByVal strFilt2 As String, ByVal oid As Integer) As IRow
' Try
' Dim pAssetLay As IFeatureLayer = My.Globals.Functions.findLayer(strLayName, my.ArcMap.Document.FocusMap )
' Dim pDefTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPDefTableName, my.ArcMap.Document.FocusMap )
' Dim pCostTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPCostTableName, my.ArcMap.Document.FocusMap )
' Dim pQFiltDef As IQueryFilter = New QueryFilter
' Dim pSQL As String = ""
' pSQL = my.Globals.Constants.c_CIPCostNameField & " = '" & strLayName & "'"
' ' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostActiveField & " = 'Yes' OR " & my.Globals.Constants.c_CIPCostActiveField & " is Null)"
' If Trim(strFilt1) <> "" Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFilt1 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFilt1
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' End If
' If strFilt2 <> "" Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFilt2 & "'"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' Else
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFilt2
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' End If
' Dim pQFiltCost As IQueryFilter = New QueryFilter
' pQFiltCost.WhereClause = pSQL
' Dim pCurs As ICursor = pCostTbl.Search(pQFiltCost, True)
' Dim pRow As IRow
' If pCurs IsNot Nothing Then
' pRow = pCurs.NextRow
' '' Dim pFL As IFeatureLayer = My.Globals.Functions.findLayer(strLayName, my.ArcMap.Document.FocusMap )
' 'If pAssetLay IsNot Nothing Then
' ' If CInt(oid) > 0 Then
' ' Do Until pRow Is Nothing
' ' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) IsNot Nothing Then
' ' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) IsNot DBNull.Value Then
' ' pQFiltCost.WhereClause = pAssetLay.FeatureClass.OIDFieldName & " = " & oid & _
' ' pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField))
' ' If pAssetLay.FeatureClass.FeatureCount(pQFiltCost) > 0 Then
' ' Exit Do
' ' End If
' ' Else
' ' Exit Do
' ' End If
' ' Else
' ' Exit Do
' ' End If
' ' pRow = pCurs.NextRow
' ' Loop
' ' End If
' 'End If
' End If
' Marshal.ReleaseComObject(pCurs)
' pCurs = Nothing
' pQFiltCost = Nothing
' pAssetLay = Nothing
' pDefTbl = Nothing
' pCostTbl = Nothing
' pRow = Nothing
' Return pRow
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: CheckForCostTxt" & vbCrLf & ex.Message)
' Return Nothing
' End Try
'End Function
Private Shared Function getFeatureCount(ByVal pFeatLayer As IFeatureLayer, ByVal pGeo As IGeometry, Optional ByVal sql As String = "") As Integer
Try
If pGeo.IsEmpty Then Return 0
Dim pSpatFilt As ISpatialFilter = New SpatialFilter
pSpatFilt.GeometryField = pFeatLayer.FeatureClass.ShapeFieldName
pSpatFilt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
pSpatFilt.Geometry = pGeo
If sql <> "" Then
pSpatFilt.WhereClause = sql
End If
getFeatureCount = pFeatLayer.FeatureClass.FeatureCount(pSpatFilt)
pSpatFilt = Nothing
Return getFeatureCount
Catch ex As Exception
MsgBox("Error in the Costing Tools - getFeatureCount" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Function ValidDefTable(ByVal DefTable As ITable) As Boolean
Try
If DefTable.Fields.FindField(My.Globals.Constants.c_CIPDefNameField) < 0 Then Return False
If DefTable.Fields.FindField(My.Globals.Constants.c_CIPDefLenField) < 0 Then Return False
If DefTable.Fields.FindField(My.Globals.Constants.c_CIPDefIDField) < 0 Then Return False
If DefTable.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2) < 0 Then Return False
If DefTable.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1) < 0 Then Return False
If DefTable.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField) < 0 Then Return False
Return True
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIP Selection: ValidDefTable" & vbCrLf & ex.Message)
Return False
End Try
End Function
'Private Shared function CheckForCostFeatWithAdv(ByVal strLayName As String, ByVal strFiltField1 As String, ByVal strFiltField2 As String, ByVal FeatureToCost As IFeature, ByVal SourceLayer As IFeatureLayer) As IRow
' Try
' Dim pDefTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPDefTableName, my.ArcMap.Document.FocusMap )
' Dim pCostTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPCostTableName, my.ArcMap.Document.FocusMap )
' Dim pQFiltDef As IQueryFilter = New QueryFilter
' Dim pSQL As String = ""
' pSQL = my.Globals.Constants.c_CIPCostNameField & " = '" & strLayName & "'"
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostActiveField & " = 'Yes' OR " & my.Globals.Constants.c_CIPCostActiveField & " is Null)"
' If Trim(strFiltField1) <> "" Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & FeatureToCost.Value(FeatureToCost.Fields.FindField(strFiltField1)) & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = " & FeatureToCost.Value(FeatureToCost.Fields.FindField(strFiltField1))
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = ''"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' End If
' If strFiltField2 <> "" Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & FeatureToCost.Value(FeatureToCost.Fields.FindField(strFiltField2)) & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = " & FeatureToCost.Value(FeatureToCost.Fields.FindField(strFiltField2))
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = ''"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' End If
' Dim pQFiltCost As IQueryFilter = New QueryFilter
' pQFiltCost.WhereClause = pSQL
' Dim pCurs As ICursor = pCostTbl.Search(pQFiltCost, True)
' Dim pRow As IRow = Nothing
' If pCurs IsNot Nothing Then
' pRow = pCurs.NextRow
' Do Until pRow Is Nothing
' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) IsNot Nothing Then
' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) IsNot DBNull.Value Then
' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) <> "" Then
' pQFiltCost.WhereClause = SourceLayer.FeatureClass.OIDFieldName & " = " & FeatureToCost.OID & _
' pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField))
' If SourceLayer.FeatureClass.FeatureCount(pQFiltCost) > 0 Then
' Exit Do
' Else
' End If
' Else
' Exit Do
' End If
' Else
' Exit Do
' End If
' Else
' Exit Do
' End If
' pRow = pCurs.NextRow
' Loop
' End If
' Marshal.ReleaseComObject(pCurs)
' pCurs = Nothing
' pQFiltCost = Nothing
' pDefTbl = Nothing
' pCostTbl = Nothing
' Return pRow
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: CheckForCostFeature" & vbCrLf & ex.Message)
' Return Nothing
' End Try
'End Function
Private Shared Function CheckForCostFeat(ByVal strLayNameConfig As String, ByVal strClassName As String, ByVal strStrat As String, ByVal strActionVal As String, ByVal strActionLookup As String, ByVal strFiltVal1 As String, ByVal strFiltVal2 As String) As IRow
Try
Dim pQFilt As IQueryFilter = New QueryFilter
Dim pSQL As String = ""
Dim pRow As IRow = Nothing
Dim pCurs As ICursor
If strLayNameConfig = strClassName Then
Dim pFL As IFeatureLayer = My.Globals.Functions.FindLayer(strLayNameConfig)
If pFL IsNot Nothing Then
pSQL = "(" & My.Globals.Constants.c_CIPDefNameField & " = '" & strLayNameConfig & "' OR "
Dim pFC As IFeatureClass = pFL.FeatureClass
Dim pDT As IDataset = pFC
Dim strName As String = pDT.Name
If strName = "" Then
strName = pDT.BrowseName
End If
If strName = "" Then
strName = pDT.FullName.ToString
End If
If strName.Contains(".") Then
strName = strName.Substring(strName.LastIndexOf("."))
End If
pSQL = pSQL & My.Globals.Constants.c_CIPDefNameField & " = '" & pDT.Name & "' ) "
Else
pSQL = "" & My.Globals.Constants.c_CIPDefNameField & " = '" & strLayNameConfig & "' "
End If
Else
pSQL = "(" & My.Globals.Constants.c_CIPDefNameField & " = '" & strLayNameConfig & "' or "
pSQL = pSQL & My.Globals.Constants.c_CIPDefNameField & " = '" & strClassName & "' ) "
End If
' pSQL = "(" & My.Globals.Constants.c_CIPDefNameField & " = '" & strLayNameConfig & "' or "
' pSQL = pSQL & My.Globals.Constants.c_CIPDefNameField & " = '" & strClassName & "' ) "
pQFilt.WhereClause = pSQL
pCurs = My.Globals.Variables.v_CIPTableDef.Search(pQFilt, True)
If pCurs Is Nothing Then Return Nothing
pRow = pCurs.NextRow
If pRow Is Nothing Then Return Nothing
Dim strFiltField1 As String = "", strFiltField2 As String = ""
If pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1) > 0 Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) IsNot Nothing Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) IsNot DBNull.Value Then
strFiltField1 = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1))
End If
End If
End If
If pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2) > 0 Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) IsNot Nothing Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) IsNot DBNull.Value Then
strFiltField2 = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2))
End If
End If
End If
pSQL = "(" & My.Globals.Constants.c_CIPCostNameField & " = '" & strLayNameConfig & "' OR "
pSQL = pSQL & My.Globals.Constants.c_CIPCostNameField & " = '" & strClassName & "')"
If My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostStrategyField)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostStrategyField & " = '" & strStrat & "'"
Else
If IsNumeric(strStrat) = False Then
strStrat = My.Globals.Functions.GetSubtypeValue(strStrat, My.Globals.Variables.v_CIPTableCost)
End If
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostStrategyField & " = " & strStrat & ""
End If
If strActionVal = strActionLookup Then
pSQL = pSQL & " AND ("
Dim strAct As String = strActionVal
pSQL = pSQL & My.Globals.Constants.c_CIPCostActionField & " = '" & strAct & "' OR "
strAct = strActionLookup
strAct = My.Globals.Functions.GetDomainValue(strAct, ActionDomain(strStrat, My.Globals.Variables.v_CIPTableCost))
pSQL = pSQL & My.Globals.Constants.c_CIPCostActionField & " = '" & strAct & "' "
pSQL = pSQL & ")"
Else
pSQL = pSQL & " AND ("
Dim strAct As String = strActionVal
strAct = My.Globals.Functions.GetDomainValue(strAct, My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.FindField(My.Globals.Constants.c_CIPCostActionField)).Domain)
pSQL = pSQL & My.Globals.Constants.c_CIPCostActionField & " = '" & strAct & "' OR "
strAct = strActionLookup
strAct = My.Globals.Functions.GetDomainValue(strAct, My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.FindField(My.Globals.Constants.c_CIPCostActionField)).Domain)
pSQL = pSQL & My.Globals.Constants.c_CIPCostActionField & " = '" & strAct & "' "
pSQL = pSQL & ")"
End If
If strFiltField1 <> "" Then
If Trim(strFiltVal1) <> "" Then
If My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFiltVal1 & "'"
Else
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostFiltField1 & " = " & strFiltVal1
End If
Else
If My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND (" & My.Globals.Constants.c_CIPCostFiltField1 & " = ''"
pSQL = pSQL & " OR " & My.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
End If
End If
End If
If strFiltField2 <> "" Then
If Trim(strFiltVal2) <> "" Then
If My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFiltVal2 & "'"
Else
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostFiltField2 & " = " & strFiltVal2
End If
Else
If My.Globals.Variables.v_CIPTableCost.Fields.Field(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND (" & My.Globals.Constants.c_CIPCostFiltField2 & " = ''"
pSQL = pSQL & " OR " & My.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
End If
End If
End If
pQFilt = New QueryFilter
pQFilt.WhereClause = pSQL
pCurs = My.Globals.Variables.v_CIPTableCost.Search(pQFilt, True)
pRow = Nothing
If pCurs IsNot Nothing Then
pRow = pCurs.NextRow
End If
Marshal.ReleaseComObject(pCurs)
pCurs = Nothing
pQFilt = Nothing
Return pRow
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: CheckForCostFeature" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Sub getReplacementValues(ByVal strLayNameConfig As String, ByVal strClassName As String, ByVal strAction As String, ByVal strFiltVal1 As String, ByVal strFiltVal2 As String, ByRef strDefVal1 As String, ByRef strDefVal2 As String)
Try
Dim pQFiltDef As IQueryFilter = New QueryFilter
Dim pSQL As String = ""
pSQL = "(" & My.Globals.Constants.c_CIPReplaceNameField & " = '" & strLayNameConfig & "' or "
pSQL = pSQL & My.Globals.Constants.c_CIPReplaceNameField & " = '" & strClassName & "')"
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPCostActionField & " = '" & strAction & "'"
If Trim(strFiltVal1) <> "" Then
If My.Globals.Variables.v_CIPTableReplace.Fields.Field(My.Globals.Variables.v_CIPTableReplace.Fields.FindField(My.Globals.Constants.c_CIPReplaceFiltField1)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPReplaceFiltField1 & " = '" & strFiltVal1 & "'"
Else
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPReplaceFiltField1 & " = " & strFiltVal1
End If
Else
If My.Globals.Variables.v_CIPTableReplace.Fields.Field(My.Globals.Variables.v_CIPTableReplace.Fields.FindField(My.Globals.Constants.c_CIPReplaceFiltField1)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND (" & My.Globals.Constants.c_CIPReplaceFiltField1 & " = ''"
pSQL = pSQL & " OR " & My.Globals.Constants.c_CIPReplaceFiltField1 & " is NULL" & ")"
End If
End If
If Trim(strFiltVal2) <> "" Then
If My.Globals.Variables.v_CIPTableReplace.Fields.Field(My.Globals.Variables.v_CIPTableReplace.Fields.FindField(My.Globals.Constants.c_CIPReplaceFiltField2)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPReplaceFiltField2 & " = '" & strFiltVal2 & "'"
Else
pSQL = pSQL & " AND " & My.Globals.Constants.c_CIPReplaceFiltField2 & " = " & strFiltVal2
End If
Else
If My.Globals.Variables.v_CIPTableReplace.Fields.Field(My.Globals.Variables.v_CIPTableReplace.Fields.FindField(My.Globals.Constants.c_CIPReplaceFiltField2)).Type = esriFieldType.esriFieldTypeString Then
pSQL = pSQL & " AND (" & My.Globals.Constants.c_CIPReplaceFiltField2 & " = ''"
pSQL = pSQL & " OR " & My.Globals.Constants.c_CIPReplaceFiltField2 & " is NULL" & ")"
End If
End If
Dim pQFiltCost As IQueryFilter = New QueryFilter
pQFiltCost.WhereClause = pSQL
Dim pCurs As ICursor = My.Globals.Variables.v_CIPTableReplace.Search(pQFiltCost, True)
strDefVal1 = strFiltVal1
strDefVal2 = strFiltVal2
Dim pRow As IRow = Nothing
If pCurs IsNot Nothing Then
pRow = pCurs.NextRow
If pRow IsNot Nothing Then
If strFiltVal1 <> "" Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPReplaceDefField1)) IsNot Nothing Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPReplaceDefField1)) IsNot DBNull.Value Then
strDefVal1 = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPReplaceDefField1))
End If
End If
End If
If strFiltVal2 <> "" Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPReplaceDefField2)) IsNot Nothing Then
If pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPReplaceDefField2)) IsNot DBNull.Value Then
strDefVal2 = pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPReplaceDefField2))
End If
End If
End If
End If
End If
pRow = Nothing
Marshal.ReleaseComObject(pCurs)
pCurs = Nothing
pQFiltCost = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: getReplacementValues" & vbCrLf & ex.Message)
Return
End Try
End Sub
'Private Shared function CheckForCostFeatByValue(ByVal strLayName As String, ByVal strFiltfield1 As String, ByVal strFiltField2 As String, ByVal strFiltVal1 As String, ByVal strFiltVal2 As String, ByVal FeatureToCost As IFeature, ByVal SourceLayer As IFeatureLayer) As IRow
' Try
' Dim pDefTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPDefTableName, my.ArcMap.Document.FocusMap )
' Dim pCostTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPCostTableName, my.ArcMap.Document.FocusMap )
' Dim pQFiltDef As IQueryFilter = New QueryFilter
' Dim pSQL As String = ""
' pSQL = my.Globals.Constants.c_CIPCostNameField & " = '" & strLayName & "'"
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostActiveField & " = 'Yes' OR " & my.Globals.Constants.c_CIPCostActiveField & " is Null)"
' If Trim(strFiltfield1) <> "" Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = '" & strFiltVal1 & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField1 & " = " & strFiltVal1
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField1)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField1 & " = ''"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField1 & " is NULL" & ")"
' End If
' End If
' If strFiltField2 <> "" Then
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = '" & strFiltVal2 & "'"
' Else
' pSQL = pSQL & " AND " & my.Globals.Constants.c_CIPCostFiltField2 & " = " & strFiltVal2
' End If
' Else
' If pCostTbl.Fields.Field(pCostTbl.Fields.FindField(my.Globals.Constants.c_CIPCostFiltField2)).Type = esriFieldType.esriFieldTypeString Then
' pSQL = pSQL & " AND (" & my.Globals.Constants.c_CIPCostFiltField2 & " = ''"
' pSQL = pSQL & " OR " & my.Globals.Constants.c_CIPCostFiltField2 & " is NULL" & ")"
' End If
' End If
' Dim pQFiltCost As IQueryFilter = New QueryFilter
' pQFiltCost.WhereClause = pSQL
' Dim pCurs As ICursor = pCostTbl.Search(pQFiltCost, True)
' Dim pRow As IRow = Nothing
' If pCurs IsNot Nothing Then
' pRow = pCurs.NextRow
' Do Until pRow Is Nothing
' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) IsNot Nothing Then
' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) IsNot DBNull.Value Then
' If pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField)) <> "" Then
' pQFiltCost.WhereClause = SourceLayer.FeatureClass.OIDFieldName & " = " & FeatureToCost.OID & _
' pRow.Value(pRow.Fields.FindField(my.Globals.Constants.c_CIPCostAdvFiltField))
' If SourceLayer.FeatureClass.FeatureCount(pQFiltCost) > 0 Then
' Exit Do
' Else
' End If
' Else
' Exit Do
' End If
' Else
' Exit Do
' End If
' Else
' Exit Do
' End If
' pRow = pCurs.NextRow
' Loop
' End If
' Marshal.ReleaseComObject(pCurs)
' pCurs = Nothing
' pQFiltCost = Nothing
' pDefTbl = Nothing
' pCostTbl = Nothing
' Return pRow
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: CheckForCostFeature" & vbCrLf & ex.Message)
' Return Nothing
' End Try
'End Function
Private Shared Sub saveControl()
Try
For Each cnt As Control In s_dgCIP.Controls
If TypeOf cnt Is TextBox Then
SaveTextBox(cnt)
ElseIf TypeOf cnt Is ComboBox Then
saveCombo(cnt)
End If
Next
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: saveControl" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub addQuote(ByVal chrCode As Single)
Try
For Each cnt As Control In s_dgCIP.Controls
If TypeOf cnt Is TextBox Then
Dim pLoc As Int16 = CType(cnt, TextBox).SelectionStart
cnt.Text = cnt.Text.Substring(0, pLoc) & Chr(chrCode) & cnt.Text.Substring(pLoc)
CType(cnt, TextBox).SelectionStart = pLoc + 1
End If
Next
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: addQuote" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub addPeriod()
Try
For Each cnt As Control In s_dgCIP.Controls
If TypeOf cnt Is TextBox Then
If cnt.Text.Contains(".") Then Return
Dim pLoc As Int16 = CType(cnt, TextBox).SelectionStart
cnt.Text = cnt.Text.Substring(0, pLoc) & Chr(46) & cnt.Text.Substring(pLoc)
CType(cnt, TextBox).SelectionStart = pLoc + 1
End If
Next
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: addQuote" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub deleteRecord()
Try
If s_dgCIP.Rows.Count = 0 Then Return
Dim strTag As String = s_dgCIP.SelectedRows(0).Cells(0).Value & ":" & s_dgCIP.SelectedRows(0).Cells("OID").Value
s_dgCIP.Rows.Remove(s_dgCIP.SelectedRows(0))
RowRemoved(strTag)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: deleteRecord" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub InitGrid()
Try
s_dgCIP = New myDG
s_dgCIP.AllowUserToAddRows = False
s_dgCIP.EditMode = DataGridViewEditMode.EditProgrammatically
s_dgCIP.AllowUserToDeleteRows = False
AddHandler s_dgCIP.RowsAdded, AddressOf dgCIP_RowsAdded
AddHandler s_dgCIP.Scroll, AddressOf dgCIP_Scroll
AddHandler s_dgCIP.CellClick, AddressOf dgCIP_CellClick
AddHandler s_dgCIP.CellMouseClick, AddressOf dgCIP_CellMouseClick
AddHandler s_dgCIP.DataGridKeyIntercept, AddressOf dgCIP_DataGridKeyIntercept
AddHandler s_dgCIP.SelectionChanged, AddressOf dgCIP_SelectionChanged
s_gpBxCIPCan.Controls.Add(s_dgCIP)
s_dgCIP.Dock = DockStyle.Fill
s_dgCIP.ColumnCount = 18
With s_dgCIP.ColumnHeadersDefaultCellStyle
.BackColor = Color.Navy
.ForeColor = Color.White
.Font = New Font(s_dgCIP.Font, FontStyle.Bold)
.Alignment = DataGridViewContentAlignment.MiddleCenter
End With
With s_dgCIP
.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
.CellBorderStyle = DataGridViewCellBorderStyle.Single
.GridColor = Color.Black
.RowHeadersVisible = False
.Columns(0).Name = "ASSETTYP"
.Columns(0).HeaderText = "Source Asset"
.Columns(1).Name = "ASSETID"
.Columns(1).HeaderText = "Asset ID"
.Columns(2).Name = "STRATEGY"
.Columns(2).HeaderText = "Strategy"
.Columns(3).Name = "ACTION"
.Columns(3).HeaderText = "Action"
.Columns(4).Name = "exFiltVal1"
.Columns(4).HeaderText = "Existing: 1"
.Columns(5).Name = "exFiltVal2"
.Columns(5).HeaderText = "Existing: 2"
.Columns(6).Name = "proFiltVal1"
.Columns(6).HeaderText = "Proposed: 1"
.Columns(7).Name = "proFiltVal2"
.Columns(7).HeaderText = "Proposed: 2"
.Columns(8).Name = "COST"
.Columns(8).HeaderText = "Cost"
.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
.Columns(9).Name = "MULTI"
.Columns(9).HeaderText = "Multiplier"
.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
.Columns(10).Name = "ADDCOST"
.Columns(10).HeaderText = "Add. Cost"
.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
.Columns(11).Name = "LENGTH"
.Columns(11).HeaderText = "Length/Area"
.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
.Columns(12).Name = "TOTCOST"
.Columns(12).HeaderText = "Total Cost"
.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
.Columns(12).DefaultCellStyle.Font = _
New Font(s_dgCIP.DefaultCellStyle.Font, FontStyle.Bold)
.Columns(13).Name = "GeoType"
.Columns(13).HeaderText = "GeoType"
.Columns(13).Visible = False
.Columns(14).Name = "FiltFld1"
.Columns(14).HeaderText = "FiltFld1"
.Columns(14).Visible = False
.Columns(15).Name = "FiltFld2"
.Columns(15).HeaderText = "FiltFld2"
.Columns(15).Visible = False
.Columns(16).Name = "OID"
.Columns(16).HeaderText = "OID"
.Columns(16).Visible = False
.Columns(17).Name = "Notes"
.Columns(17).HeaderText = "Notes"
.Columns(17).Visible = True
.SelectionMode = DataGridViewSelectionMode.FullRowSelect
.MultiSelect = False
.Dock = DockStyle.Fill
End With
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: InitGrid" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Function GetTarget() As layerAndTypes
Try
If s_cboDefLayers.Items.Count = 0 Then Return Nothing
Return s_cboDefLayers.SelectedItem
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: GetTarget" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Friend Shared Sub HighlightAtLocation(ByVal Envelope As IEnvelope)
Dim pMxApp As IMxApplication
Dim pEnumElem As IEnumElement
Dim pElem As IElement
Dim pElemProp As IElementProperties
Try
pEnumElem = My.ArcMap.Document.ActiveView.GraphicsContainer.LocateElementsByEnvelope(Envelope)
If pEnumElem IsNot Nothing Then
pElem = pEnumElem.Next
If pElem IsNot Nothing Then
pElemProp = pElem
If pElemProp.CustomProperty IsNot Nothing Then
If pElemProp.CustomProperty.ToString.Contains("CIPTools") Then
Dim pStrTag() As String = pElemProp.CustomProperty.ToString.Split(":")
If pStrTag.Length = 3 Then
FindRow(pStrTag(1), pStrTag(2)).Selected = True
Return
ElseIf pStrTag.Length = 4 Then
FindRow(pStrTag(1), pStrTag(2) & ":" & pStrTag(3)).Selected = True
Return
End If
End If
End If
pElemProp = Nothing
End If
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: HighlightAtLocation" & vbCrLf & ex.Message)
Finally
pMxApp = Nothing
pEnumElem = Nothing
pElem = Nothing
End Try
End Sub
Friend Shared Sub HighlightAtLocation(ByVal pPnt As IPoint)
Dim pEnumElem As IEnumElement
Dim pElem As IElement
Dim pElemProp As IElementProperties
Try
'Dim pMxApp As IMxApplication
' pMxApp = m_application
' Dim pPnt As IPoint = pMxApp.Display.DisplayTransformation.ToMapPoint(x, y)
pEnumElem = My.ArcMap.Document.ActiveView.GraphicsContainer.LocateElements(pPnt, My.Globals.Functions.ConvertUnits(15, My.ArcMap.Document.FocusMap.MapUnits))
If pEnumElem IsNot Nothing Then
pElem = pEnumElem.Next
If pElem IsNot Nothing Then
pElemProp = pElem
If pElemProp.CustomProperty IsNot Nothing Then
If pElemProp.CustomProperty.ToString.Contains("CIPTools") Then
Dim pStrTag() As String = pElemProp.CustomProperty.ToString.Split(":")
If pStrTag.Length = 3 Then
FindRow(pStrTag(1), pStrTag(2)).Selected = True
End If
End If
End If
pElemProp = Nothing
End If
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: HighlightAtLocation" & vbCrLf & ex.Message)
Finally
pEnumElem = Nothing
pElem = Nothing
pElemProp = Nothing
End Try
End Sub
Private Shared Function FindRow(ByVal LayerName As String, ByVal OID As String) As DataGridViewRow
Try
If s_dgCIP.Rows.Count = 0 Then Return Nothing
For Each pRow As DataGridViewRow In s_dgCIP.Rows
If pRow.Cells("ASSETTYP").Value.ToString = LayerName And pRow.Cells("OID").Value = OID Then
Return pRow
End If
Next
Return Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: FindRow" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Function GetCIPWorkspace() As IWorkspace
Try
If My.Globals.Variables.v_CIPLayerOver Is Nothing Then Return Nothing
If My.Globals.Variables.v_CIPLayerOver.FeatureClass Is Nothing Then Return Nothing
Dim pDataset As IDataset = My.Globals.Variables.v_CIPLayerOver
GetCIPWorkspace = pDataset.Workspace
' My.Globals.Variables.v_CIPLayerOver = Nothing
pDataset = Nothing
Return GetCIPWorkspace
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: GetCIPWorkspace" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Function CheckEditingWorkspace(ByVal WorkSpace As IWorkspace) As Boolean
Try
If WorkSpace Is Nothing Then Return False
Return My.Globals.Variables.v_Editor.EditWorkspace.Equals(WorkSpace)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: CheckEditingWorkspace" & vbCrLf & ex.Message)
Return False
End Try
End Function
Private Shared Sub loadDefLayersCboBox()
Try
If My.Globals.Variables.v_CIPTableDef Is Nothing Then
setDefLayersToDropdown(Nothing)
Return
End If
Dim pQFilt As IQueryFilter = New QueryFilter
pQFilt.WhereClause = My.Globals.Constants.c_CIPDefActiveField & " = " & "'Yes'" & " OR " & My.Globals.Constants.c_CIPDefActiveField & " is null"
Dim pCurs As ICursor = My.Globals.Variables.v_CIPTableDef.Search(pQFilt, True)
If pCurs Is Nothing Then Return
Dim pRow As IRow
pRow = pCurs.NextRow
Dim pAr As ArrayList = New ArrayList
Do Until pRow Is Nothing
Dim pFL As IFeatureLayer = My.Globals.Functions.FindLayer(pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)))
If pFL IsNot Nothing Then
If pFL.FeatureClass IsNot Nothing Then
pAr.Add(New layerAndTypes(pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)), pFL.FeatureClass.ShapeType))
End If
End If
pRow = pCurs.NextRow
pFL = Nothing
Loop
setDefLayersToDropdown(pAr)
Marshal.ReleaseComObject(pCurs)
pCurs = Nothing
pQFilt = Nothing
pAr = Nothing
pRow = Nothing
Catch ex As Exception
If Not ex.Message.Contains("COM object") Then
MsgBox("Error in the Costing Tools - CIPProjectWindow: loadDefLayersCboBox" & vbCrLf & ex.Message)
End If
End Try
End Sub
Private Shared Function ActionDomain(ByVal subTypeVal As Integer, ByVal pCostTbl As ITable) As IDomain
'Dim pDefTbl As ITable = My.Globals.Functions.findTable(my.Globals.Constants.c_CIPCostTableName, my.ArcMap.Document.FocusMap )
'If pDefTbl Is Nothing Then
' cboAction.DataSource = Nothing
' Return Nothing
'End If
Try
Dim pSubType As ISubtypes = pCostTbl
Dim pDom As ICodedValueDomain
Dim pFl As IField
pFl = pCostTbl.Fields.Field(pCostTbl.Fields.FindField(My.Globals.Constants.c_CIPCostActionField))
If pSubType.HasSubtype Then
pDom = pSubType.Domain(subTypeVal, pFl.Name)
Else
pDom = pFl.Domain
End If
If pDom Is Nothing Then
MsgBox("Action Domains is missing")
Return Nothing
End If
pFl = Nothing
pSubType = Nothing
Return pDom
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ActionDomain" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Private Shared Sub loadActionCboBox()
Try
If s_cboStrategy.Text = "" Then Return
If s_cboStrategy.DataSource Is Nothing Then Return
If My.Globals.Variables.v_CIPTableCost Is Nothing Then
Return
End If
s_cboAction.DisplayMember = "Display"
s_cboAction.ValueMember = "Value"
' s_cboAction.DataSource = My.Globals.Functions.DomainToList(ActionDomain(CType(s_cboStrategy.SelectedValue, My.Globals.Functions.DomSubList).Value, My.Globals.Variables.v_CIPTableCost))
s_cboAction.DataSource = My.Globals.Functions.DomainToList(ActionDomain(s_cboStrategy.SelectedValue, My.Globals.Variables.v_CIPTableCost))
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: loadActionCboBox" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub loadStrategyCboBox()
Try
If My.Globals.Variables.v_CIPTableCost Is Nothing Then
s_cboStrategy.DataSource = Nothing
Return
End If
Dim pSubType As ISubtypes = My.Globals.Variables.v_CIPTableCost
Dim pLst As ArrayList = My.Globals.Functions.SubtypeToList(pSubType)
If pLst Is Nothing Then
MsgBox("The Subtype list for the cost table is empty")
End If
If pLst.Count = 0 Then
MsgBox("The Subtype list for the cost table is empty")
End If
'RemoveHandler
s_cboStrategy.DisplayMember = "Display"
s_cboStrategy.ValueMember = "Value"
s_cboStrategy.DataSource = pLst
pLst = Nothing
pSubType = Nothing
Catch ex As Exception
If Not ex.Message.Contains("COM object") Then
MsgBox("Error in the Costing Tools - CIPProjectWindow: loadStrategyCboBox" & vbCrLf & ex.Message)
End If
End Try
End Sub
Private Shared Function AddRecordFromGraphic(ByVal geo As IGeometry, ByVal AddToGraphicLayer As Boolean, ByVal ConfigLayerName As String, Optional ByVal oid As Integer = -9999999) As Boolean
Try
If geo Is Nothing Then Return False
Dim pFl As IFeatureLayer = My.Globals.Functions.FindLayer(ConfigLayerName)
If pFl Is Nothing Then Return False
Dim pDS As IDataset = pFl.FeatureClass
Dim pFCName As String = My.Globals.Functions.getClassName(pDS)
Dim pTblCursor As ICursor
Dim pDefRow As IRow
Dim pCostRow As IRow
Dim pQFilt As IQueryFilter
Dim strMultiField As String = ""
Dim strLenField As String = ""
Dim dblSourceCost As Double = 0.0
Dim dblSourceAddCost As Double = 0.0
Dim dblLength As Double = 0.0
Dim strNotes As String = ""
Dim dblTotalCost As Double = 0.0
Dim dblMulti As Double = 1.0
Dim strFiltVal1 As String = ""
Dim strFiltVal2 As String = ""
Dim strFiltField1 As String = ""
Dim strFiltField2 As String = ""
Dim strDefVal1 As String = "", strDefVal2 As String = ""
If My.Globals.Variables.v_CIPTableCost Is Nothing Then
MsgBox("The CIP Cost table cannot be found, exiting")
Return False
End If
If My.Globals.Variables.v_CIPTableDef Is Nothing Then
MsgBox("The CIP Definition table cannot be found, exiting")
Return False
End If
pQFilt = New QueryFilter
pQFilt.WhereClause = "(" & My.Globals.Constants.c_CIPDefNameField & " = '" & ConfigLayerName & "' OR " & _
My.Globals.Constants.c_CIPDefNameField & " = '" & pFCName & "')" & _
" AND (" & My.Globals.Constants.c_CIPDefActiveField & " = " & "'Yes'" & " OR " & My.Globals.Constants.c_CIPDefActiveField & " is null)"
pTblCursor = My.Globals.Variables.v_CIPTableDef.Search(pQFilt, True)
pDefRow = pTblCursor.NextRow
If pDefRow Is Nothing Then
pQFilt = Nothing
Marshal.ReleaseComObject(pTblCursor)
pTblCursor = Nothing
Return False
End If
Dim pSQL As String = ""
If My.Globals.Constants.c_CIPDefFiltField1 <> "" Then
If pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1) > 0 Then
If pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) IsNot Nothing Then
If pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) IsNot DBNull.Value Then
strFiltField1 = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1))
End If
End If
End If
End If
If My.Globals.Constants.c_CIPDefFiltField2 <> "" Then
If pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2) > 0 Then
If pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) IsNot Nothing Then
If pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) IsNot DBNull.Value Then
strFiltField2 = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2))
End If
End If
End If
End If
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField)) Is Nothing Then
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField)) Is DBNull.Value Then
If Not Trim(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField))) = "" Then
If pFl.FeatureClass.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField))) < 0 Then
MsgBox(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField)) & " does not exist in layer " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & ", exiting")
Return False
Else
strMultiField = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField))
End If
End If
End If
End If
If strFiltField1 <> "" Then
If pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField1)).DefaultValue IsNot Nothing Then
If pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField1)).DefaultValue IsNot DBNull.Value Then
strDefVal1 = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField1)).DefaultValue
End If
End If
End If
If strFiltField2 <> "" Then
If pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField2)).DefaultValue IsNot Nothing Then
If pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField2)).DefaultValue IsNot DBNull.Value Then
strDefVal2 = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField2)).DefaultValue
End If
End If
End If
' MsgBox("Do sketchs have a strategy of new")
pCostRow = CheckForCostFeat(ConfigLayerName, pFCName, s_cboStrategy.SelectedValue, s_cboAction.Text, s_cboAction.SelectedValue, strDefVal1, strDefVal2)
Select Case geo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
Try
dblLength = CType(geo, ICurve).Length
Catch ex As Exception
End Try
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
Try
dblLength = Math.Abs(CType(geo, IArea).Area)
Catch ex As Exception
End Try
End Select
If pCostRow IsNot Nothing Then
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)) Is Nothing Then
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)) Is DBNull.Value Then
dblSourceCost = pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostCostField))
End If
End If
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)) Is Nothing Then
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)) Is DBNull.Value Then
dblSourceAddCost = pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField))
End If
End If
Select Case geo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
dblTotalCost = (dblMulti * dblSourceCost) + dblSourceAddCost
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
dblTotalCost = (dblLength * dblSourceCost * dblMulti) + dblSourceAddCost
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
dblTotalCost = (dblMulti * dblLength * dblSourceCost) + dblSourceAddCost
End Select
'dblTotalCost = dblMulti * dblTotalCost
End If
If strFiltField1 <> "" Then
If pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField1)).Domain IsNot Nothing Then
Dim pDom As IDomain = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField1)).Domain
If pDom.Type = esriDomainType.esriDTCodedValue Then
strDefVal1 = My.Globals.Functions.GetDomainDisplay(strDefVal1, pDom)
End If
End If
End If
If strFiltField2 <> "" Then
If pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField2)).Domain IsNot Nothing Then
Dim pDom As IDomain = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(strFiltField2)).Domain
If pDom.Type = esriDomainType.esriDTCodedValue Then
strDefVal2 = My.Globals.Functions.GetDomainDisplay(strDefVal2, pDom)
End If
End If
End If
If oid = -9999999 Then
oid = My.Globals.Variables.v_intSketchID
My.Globals.Variables.v_intSketchID = My.Globals.Variables.v_intSketchID - 1
End If
loadRecord(geo, ConfigLayerName, pFCName, "Sketch:" & oid, dblSourceCost, dblSourceAddCost, dblLength, dblTotalCost, strFiltVal1, strFiltVal2, strFiltField1, strFiltField2, oid, strDefVal1, strDefVal2, s_cboStrategy.Text, s_cboAction.Text, dblMulti, strNotes)
setProjectCostAndTotal()
My.ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, My.ArcMap.Document.ActiveView.Extent)
pFl = Nothing
pQFilt = Nothing
pCostRow = Nothing
pDefRow = Nothing
Marshal.ReleaseComObject(pTblCursor)
pTblCursor = Nothing
Return True
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: AddRecordFromGraphic" & vbCrLf & ex.Message)
End Try
End Function
Private Shared Sub loadGraphicsToGrid()
Try
Dim pElem As IElement
Dim pElProp As IElementProperties
Try
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Do Until pElem Is Nothing
pElProp = pElem
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty.ToString.Contains("CIPTools:") Then
Dim strProp() As String = pElProp.CustomProperty.ToString.Split(":")
' Dim strEl As String = pElProp.CustomProperty
AddRecordFromGraphic(pElem.Geometry, False, strProp(1), strProp(2))
End If
End If
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
Catch ex As Exception
Finally
End Try
pElem = Nothing
pElProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: loadGraphicsToGrid" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Function Split_At_Point(ByVal pSplitPoint As IPoint, ByVal pPline As IPolyline) As IPolyline
Try
Dim boolSplitHappened As Boolean
Dim lngNewPartIndex As Long
Dim lngNewSegmentIndex As Long
pPline.SplitAtPoint(pSplitPoint, False, True, boolSplitHappened, lngNewPartIndex, lngNewSegmentIndex)
Return pPline
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: Split_At_Point" & vbCrLf & ex.Message, MsgBoxStyle.DefaultButton1, "Error")
Return Nothing
End Try
End Function
Private Shared Sub splitSegmentAtLocation(ByVal pPnt As IPoint, ByVal Split As Boolean)
Dim pNewRow As DataGridViewRow
Dim pNewGeoCol As IGeometryCollection = Nothing
Dim pElem As IElement = Nothing
Dim hitDistance As System.Double = 0
Dim hitPartIndex As System.Int32 = 0
Dim hitPoint As IPoint = New ESRI.ArcGIS.Geometry.Point
Dim hitSegmentIndex As System.Int32 = 0
Dim rightSide As System.Boolean = Nothing
Dim hitTest As ESRI.ArcGIS.Geometry.IHitTest = Nothing
Dim foundGeometry As System.Boolean = False
Dim pPolyLine1 As IPolyline
Dim pPolyLine2 As IPolyline
Try
If s_dgCIP.SelectedRows.Count = 0 Then Return
If s_dgCIP.SelectedRows(0).Cells("Geotype").Value <> "Polyline" Then
MsgBox("Only lines are supported")
Return
End If
Dim strTag As String = "CIPTools:" & s_dgCIP.SelectedRows(0).Cells("ASSETTYP").Value & ":" & s_dgCIP.SelectedRows(0).Cells("OID").Value
pElem = getCIPGraphic(strTag)
If pElem.Geometry Is Nothing Then Return
hitTest = CType(pElem.Geometry, ESRI.ArcGIS.Geometry.IHitTest)
foundGeometry = hitTest.HitTest(pPnt, My.Globals.Functions.ConvertFeetToMapUnits(30), ESRI.ArcGIS.Geometry.esriGeometryHitPartType.esriGeometryPartBoundary, hitPoint, hitDistance, hitPartIndex, hitSegmentIndex, rightSide)
If foundGeometry = True Then
Dim pGeoColl As IGeometryCollection
pGeoColl = Split_At_Point(hitPoint, pElem.Geometry)
If pGeoColl.GeometryCount = 1 Then
MsgBox("The split point was at the end of the line, no split occured", , "Cost Estimating Tools")
ElseIf pGeoColl.GeometryCount = 2 Then
'UnSelectRow(strTag)
Dim pTag() As String = strTag.Split(":")
Dim strExistingSplitTag As String = ""
If pTag.Length = 4 Then
strExistingSplitTag = pTag(3)
' strTag = pTag(0) & ":" & pTag(1) & ":" & pTag(2)
End If
pNewGeoCol = New Polyline
pNewGeoCol.AddGeometry(pGeoColl.Geometry(0))
pPolyLine1 = pNewGeoCol
pNewGeoCol = New Polyline
pNewGeoCol.AddGeometry(pGeoColl.Geometry(1))
pPolyLine2 = pNewGeoCol
RemoveGraphic(strTag)
If Split Then
'1st half
AddGraphic(pPolyLine1, pTag(1) & ":" & pTag(2) & ":" & strExistingSplitTag & "a")
s_dgCIP.SelectedRows(0).Cells("OID").Value = pTag(2) & ":" & strExistingSplitTag & "a"
If s_dgCIP.SelectedRows(0).Cells("NOTES").FormattedValue.ToString = "" Then
s_dgCIP.SelectedRows(0).Cells("NOTES").Value = "User Reshaped"
Else
s_dgCIP.SelectedRows(0).Cells("NOTES").Value = s_dgCIP.SelectedRows(0).Cells("NOTES").FormattedValue.ToString & " | " & "User Reshaped"
End If
s_dgCIP.SelectedRows(0).Cells("LENGTH").Value = Format(pPolyLine1.Length, "#,###.00")
SetRowsTotal(s_dgCIP.SelectedRows(0).Index)
'2nd half
AddGraphic(pPolyLine2, pTag(1) & ":" & pTag(2) & ":" & strExistingSplitTag & "b")
pNewRow = CopyRecord(s_dgCIP.SelectedRows(0).Index)
pNewRow.Cells("OID").Value = pTag(2) & ":" & strExistingSplitTag & "b"
pNewRow.Cells("LENGTH").Value = Format(pPolyLine2.Length, "#,###.00")
SetRowsTotal(pNewRow.Index)
SelectRow(pTag(0) & ":" & pTag(1) & ":" & pTag(2) & ":" & strExistingSplitTag & "a")
Else
If pPolyLine1.Length > pPolyLine2.Length Then
If strExistingSplitTag <> "" Then
strExistingSplitTag = ":" & strExistingSplitTag
End If
AddGraphic(pPolyLine1, pTag(1) & ":" & pTag(2) & strExistingSplitTag)
'1st half
s_dgCIP.SelectedRows(0).Cells("OID").Value = pTag(2) & strExistingSplitTag ' & "a"
If s_dgCIP.SelectedRows(0).Cells("NOTES").FormattedValue.ToString = "" Then
s_dgCIP.SelectedRows(0).Cells("NOTES").Value = "User Reshaped"
Else
s_dgCIP.SelectedRows(0).Cells("NOTES").Value = s_dgCIP.SelectedRows(0).Cells("NOTES").FormattedValue & " | " & "User Reshaped"
End If
s_dgCIP.SelectedRows(0).Cells("LENGTH").Value = Format(pPolyLine1.Length, "#,###.00")
SetRowsTotal(s_dgCIP.SelectedRows(0).Index)
Else
If strExistingSplitTag <> "" Then
strExistingSplitTag = ":" & strExistingSplitTag
End If
AddGraphic(pPolyLine2, pTag(1) & ":" & pTag(2) & strExistingSplitTag)
'1st half
s_dgCIP.SelectedRows(0).Cells("OID").Value = pTag(2) & strExistingSplitTag ' & "a"
If s_dgCIP.SelectedRows(0).Cells("NOTES").FormattedValue.ToString = "" Then
s_dgCIP.SelectedRows(0).Cells("NOTES").Value = "User Reshaped"
Else
s_dgCIP.SelectedRows(0).Cells("NOTES").Value = s_dgCIP.SelectedRows(0).Cells("NOTES").FormattedValue & " | " & "User Reshaped"
End If
s_dgCIP.SelectedRows(0).Cells("LENGTH").Value = Format(pPolyLine2.Length, "#,###.00")
SetRowsTotal(s_dgCIP.SelectedRows(0).Index)
End If
SelectRow(pTag(0) & ":" & pTag(1) & ":" & pTag(2) & strExistingSplitTag)
End If
setProjectCostAndTotal()
My.ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, hitTest, My.ArcMap.Document.ActiveView.Extent)
Else
MsgBox("Unsupported Split")
Return
End If
Else
MsgBox("A location was not found on the line, please click closer", , "ArcGIS Cost Estimate Tools")
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: splitSegmentAtLocation" & vbCrLf & ex.Message, MsgBoxStyle.DefaultButton1, "Error")
Finally
pPolyLine1 = Nothing
pPolyLine2 = Nothing
pNewRow = Nothing
pNewGeoCol = Nothing
pElem = Nothing
hitPoint = Nothing
hitTest = Nothing
End Try
End Sub
#End Region
#Region "Events"
Private Shared Sub cboStrategy_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboStrategy.SelectedIndexChanged
Try
If s_cboStrategy Is Nothing Then Return
loadActionCboBox()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: cboStrategy_SelectedIndexChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub gpBxCIPPrj_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gpBxCIPPrj.Resize
Try
If s_gpBxCIPPrj Is Nothing Then Return
If s_gpBxCIPPrj.Visible = False Then Exit Sub
ShuffleControls(False)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: gpBxCIPPrj_Resize" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnRemoveInv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemoveInv.Click
Try
If s_lstInventory Is Nothing Then Return
If s_lstInventory.SelectedItem IsNot Nothing Then
s_lstInventory.Items.Remove(s_lstInventory.SelectedItem)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnRemoveInv_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub lblTotalCost_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTotalCost.TextChanged
Try
If s_lblTotalCost Is Nothing Then Return
Dim g As Graphics
Dim s As SizeF
g = s_lblTotalCost.CreateGraphics
s = g.MeasureString(s_lblTotalCost.Text, s_lblTotalCost.Font)
s_TotalDisplay.Left = s_lblTotalCost.Left + s.Width + 10
'lblLength.Left = lblTotalCost.Left + s.Width + 10
'lblTotLength.Left = lblLength.Left + lblLength.Width
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: lblTotalCost_TextChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnSelectPrj_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSelectPrj.Click
Try
If s_btnSelectPrj Is Nothing Then Return
If s_btnSelectPrj.Checked = True Then
My.ArcMap.Application.CurrentTool = ArcGIS4LocalGovernment.CostEstimatingExtension.GetSelectPrjTool
Else
My.ArcMap.Application.CurrentTool = Nothing
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnSelectPrj_clcik" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnStopEditing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStopEditing.Click
If My.Globals.Variables.v_Editor Is Nothing Then Return
If My.Globals.Variables.v_Editor.EditState <> esriEditState.esriStateNotEditing Then
My.Globals.Variables.v_Editor.StopEditing(True)
End If
End Sub
Private Shared Sub gpBxCIPCostingLayers_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gpBxCIPCostingLayers.Resize
If s_gpBxCIPCostingLayers Is Nothing Then Return
Dim pTop, pleft As Integer
pTop = 25
pleft = 15
Dim g As Graphics
Dim s As SizeF
For Each cnt As Control In s_gpBxCIPCostingLayers.Controls
cnt.Left = pleft
cnt.Top = pTop
pTop = pTop + cnt.Height + 5
g = cnt.CreateGraphics
s = g.MeasureString(cnt.Text, cnt.Font)
If s.Width > 250 Then
Do Until s.Width < 240
cnt.Text = cnt.Text.Substring(0, cnt.Text.Length - 1)
s = g.MeasureString(cnt.Text, cnt.Font)
Loop
cnt.Text = cnt.Text + ".."
cnt.Width = 260
cnt.AutoSize = False
Else
cnt.AutoSize = True
End If
If pTop + cnt.Height >= s_gpBxCIPCostingLayers.Height - 10 Then
pTop = 25
pleft = pleft + 260
End If
Next
s = Nothing
g = Nothing
End Sub
Private Shared Sub layerChecked(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim pMouse As IMouseCursor
pMouse = New MouseCursor
pMouse.SetCursor(2)
If My.Globals.Variables.v_Editor.EditState = esriEditState.esriStateNotEditing Then
MsgBox("You must be editing to toggle cost status")
RemoveHandler CType(sender, CheckBox).CheckedChanged, AddressOf layerChecked
CType(sender, CheckBox).Checked = Not CType(sender, CheckBox).Checked
AddHandler CType(sender, CheckBox).CheckedChanged, AddressOf layerChecked
Return
End If
If My.Globals.Variables.v_CIPTableDef Is Nothing Then
Return
End If
Dim pQFilt As IQueryFilter = New QueryFilter
pQFilt.WhereClause = My.Globals.Constants.c_CIPDefNameField & " = '" & CType(sender, CheckBox).Tag & "'"
Dim pCurs As ICursor = My.Globals.Variables.v_CIPTableDef.Search(pQFilt, False)
If pCurs Is Nothing Then Return
Dim pRow As IRow
pRow = pCurs.NextRow
If pRow Is Nothing Then
MsgBox("Cost Layer not found, If you removed the layer, please add it back")
Else
My.Globals.Variables.v_Editor.StartOperation()
If CType(sender, CheckBox).Checked = False Then
pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField)) = "No"
Else
pRow.Value(pRow.Fields.FindField(My.Globals.Constants.c_CIPDefActiveField)) = "Yes"
End If
pRow.Store()
Marshal.ReleaseComObject(pRow)
My.Globals.Variables.v_Editor.StopOperation("Cost Change")
End If
Marshal.ReleaseComObject(pCurs)
pCurs = Nothing
pQFilt = Nothing
pRow = Nothing
Marshal.ReleaseComObject(pMouse)
pMouse = Nothing
loadDefLayersCboBox()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: LayerCheck" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnSavePrj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSavePrj.Click
Try
If s_btnSavePrj Is Nothing Then Return
CreateCIPProject() 'txtPrjName.Text, lblTotalCost.Text, dtTimeStart.Value.ToShortDateString, dtTimeEnd.Value.ToShortDateString, cboCIPStat.Text, cboCIPStim.Text, cboEnginner.Text, cboPrjMan.Text, txtNotes.Text)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnSavePrj_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Try
ResetControls(False)
'' CostEstimatingExtension.DeactivateCIPTools(False)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnClear_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub rdoBtnShowCan_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBtnShowCan.CheckedChanged
Try
If s_gpBxCIPCan Is Nothing Then Return
If CType(sender, RadioButton).Checked = True Then
s_gpBxCIPCan.Visible = True
s_gpBxCIPCostingLayers.Visible = False
s_gpBxCIPPrj.Visible = False
s_gpBxCIPInven.Visible = False
Call gpBxCIPCostingLayers_Resize(Nothing, Nothing)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: rdoBtnShowCan_CheckedChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub rdoBtnShowDetails_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBtnShowDetails.CheckedChanged
Try
If CType(sender, RadioButton).Checked = True Then
s_gpBxCIPCan.Visible = False
s_gpBxCIPCostingLayers.Visible = False
s_gpBxCIPPrj.Visible = True
s_gpBxCIPInven.Visible = False
Call gpBxCIPCostingLayers_Resize(Nothing, Nothing)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: rdoBtnShowDetails_CheckedChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub rdoShowInv_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoShowInv.CheckedChanged
Try
If CType(sender, RadioButton).Checked = True Then
s_gpBxCIPCan.Visible = False
s_gpBxCIPCostingLayers.Visible = False
s_gpBxCIPPrj.Visible = False
s_gpBxCIPInven.Visible = True
Call gpBxCIPCostingLayers_Resize(Nothing, Nothing)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: rdoShowInv_CheckedChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub rdoBtnShowLayers_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBtnShowLayers.CheckedChanged
Try
If CType(sender, RadioButton).Checked = True Then
s_gpBxCIPCan.Visible = False
s_gpBxCIPCostingLayers.Visible = True
s_gpBxCIPPrj.Visible = False
loadLayersToPanel()
s_gpBxCIPInven.Visible = False
Call gpBxCIPCostingLayers_Resize(Nothing, Nothing)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: rdoBtnShowLayers_CheckedChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnAddInv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddInv.Click
Try
s_lstInventory.Items.Add(s_cboCIPInvTypes.Text & ":" & s_numCIPInvCount.Value)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnAddInv_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Function getCIPGraphic(ByVal Tag As String) As IElement
Try
Dim pElem As IElement
Dim pElProp As IElementProperties
Try
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Do Until pElem Is Nothing
pElProp = pElem
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty.ToString.Contains("CIPTools:") Then
Dim strEl As String = pElProp.CustomProperty
If strEl = Tag Then
Return pElem
End If
End If
End If
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: getCIPGrpahic" & vbCrLf & ex.Message)
Finally
pElProp = Nothing
End Try
pElem = Nothing
pElProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: getCIPGrpahic" & vbCrLf & ex.Message)
End Try
Return Nothing
End Function
Private Shared Sub RowChanged(ByVal Tag As String)
Try
Dim pElem As IElement
Dim pElProp As IElementProperties
Dim pNewGeo As IGeometry = Nothing, pOldGeo As IGeometry = Nothing
Try
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Do Until pElem Is Nothing
pElProp = pElem
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty.ToString.Contains("CIPTools:") Then
Dim strEl As String = pElProp.CustomProperty
If strEl = Tag Then
If TypeOf pElem Is IPolygonElement Then
Dim pFSElem As IFillShapeElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PolygonHighlightGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is ILineElement Then
Dim pFSElem As ILineElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_LineHighlightGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is IMarkerElement Then
Dim pFSElem As IMarkerElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PointHighlightGraphicSymbol
pFSElem = Nothing
End If
pNewGeo = pElem.Geometry
End If
If strEl = My.Globals.Variables.v_LastSelection Then
If TypeOf pElem Is IPolygonElement Then
Dim pFSElem As IFillShapeElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PolygonGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is ILineElement Then
Dim pFSElem As ILineElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_LineGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is IMarkerElement Then
Dim pFSElem As IMarkerElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PointGraphicSymbol
pFSElem = Nothing
End If
pOldGeo = pElem.Geometry
End If
End If
End If
If pNewGeo IsNot Nothing And pOldGeo IsNot Nothing Then Exit Do
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
My.Globals.Variables.v_LastSelection = Tag
'If pNewGeo IsNot Nothing Then
' m_pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pNewGeo, m_pMxDoc.ActiveView.Extent)
'End If
'If pOldGeo IsNot Nothing Then
' m_pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pOldGeo, m_pMxDoc.ActiveView.Extent)
'End If
My.ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pOldGeo, My.ArcMap.Document.ActiveView.Extent)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: RowChanged" & vbCrLf & ex.Message)
Finally
End Try
pNewGeo = Nothing
pOldGeo = Nothing
pElem = Nothing
pElProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: RowChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub UnSelectRow(ByVal Tag As String)
Try
Dim pElem As IElement
Dim pElProp As IElementProperties
Dim pNewGeo As IGeometry = Nothing, pOldGeo As IGeometry = Nothing
Try
If My.ArcMap.Document Is Nothing Then Return
If My.ArcMap.Document.ActiveView Is Nothing Then Return
If My.ArcMap.Document.ActiveView.GraphicsContainer Is Nothing Then Return
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Do Until pElem Is Nothing
pElProp = pElem
If pElProp IsNot Nothing Then
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty.ToString.Contains("CIPTools:") Then
Dim strEl As String = pElProp.CustomProperty
If strEl = Tag Then
My.Globals.Variables.v_LastSelection = ""
If TypeOf pElem Is IPolygonElement Then
Dim pFSElem As IFillShapeElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PolygonGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is ILineElement Then
Dim pFSElem As ILineElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_LineGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is IMarkerElement Then
Dim pFSElem As IMarkerElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PointGraphicSymbol
pFSElem = Nothing
End If
'm_pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pOldGeo, My.Globals.Variables.v_pMxDoc.ActiveView.Extent)
Return
End If
End If
End If
End If
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: UnRowChanged" & vbCrLf & ex.Message)
Finally
End Try
pNewGeo = Nothing
pOldGeo = Nothing
pElem = Nothing
pElProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: unSelectRow" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub SelectRow(ByVal Tag As String)
Try
Dim pElem As IElement
Dim pElProp As IElementProperties
Dim pNewGeo As IGeometry = Nothing, pOldGeo As IGeometry = Nothing
Try
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Do Until pElem Is Nothing
pElProp = pElem
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty.ToString.Contains("CIPTools:") Then
Dim strEl As String = pElProp.CustomProperty
If strEl = Tag Then
If TypeOf pElem Is IPolygonElement Then
Dim pFSElem As IFillShapeElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PolygonHighlightGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is ILineElement Then
Dim pFSElem As ILineElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_LineHighlightGraphicSymbol
pFSElem = Nothing
ElseIf TypeOf pElem Is IMarkerElement Then
Dim pFSElem As IMarkerElement
pFSElem = pElem
pFSElem.Symbol = My.Globals.Variables.v_PointHighlightGraphicSymbol
pFSElem = Nothing
End If
My.Globals.Variables.v_LastSelection = Tag
' m_pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pOldGeo, m_pMxDoc.ActiveView.Extent)
Return
End If
End If
End If
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: SelectRow" & vbCrLf & ex.Message)
Finally
End Try
pNewGeo = Nothing
pOldGeo = Nothing
pElem = Nothing
pElProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: SelectRow" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub CIPProjectWindow_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
Try
If s_gpBxSwitch Is Nothing Then Return
s_gpBxSwitch.Width = 85
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: CIPProjectWindow_Resize" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub txtPrjName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
EnableSavePrj()
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: txtPrjName_TextChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub dgCIP_RowsAdded(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs)
Try
If s_dgCIP Is Nothing Then Return
If s_dgCIP.Rows.Count > 0 Then
If My.Globals.Variables.v_Editor.EditState = esriEditState.esriStateEditing Then
s_btnSavePrj.Enabled = True
Else
s_btnSavePrj.Enabled = False
End If
Else
s_btnSavePrj.Enabled = False
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: s_dgCIP_RowsAdded" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub dgCIP_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
Try
If s_dgCIP Is Nothing Then Return
RemoveControl(True)
If e.RowIndex = -1 Then Return
If s_dgCIP.Columns(e.ColumnIndex).Name = "proFiltVal1" Then
If UCase(s_dgCIP.Rows(e.RowIndex).Cells("Strategy").Value) <> UCase(My.Globals.Variables.v_CIPAbandonValue) Then
'Or s_dgCIP.Rows(e.RowIndex).Cells("Strategy").Value = "Rehabilitate" Or s_dgCIP.Rows(e.RowIndex).Cells("Strategy").Value = "Proposed" Then
If s_dgCIP.Rows(e.RowIndex).Cells("FiltFld1").FormattedValue.ToString = "" Then
addTextBox(e)
Else
Dim pFl As IFeatureLayer = My.Globals.Functions.FindLayer(s_dgCIP.Rows(e.RowIndex).Cells("ASSETTYP").FormattedValue.ToString)
Dim pFeat As IFeature
If s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString.Contains("-") Then
pFeat = Nothing
Else
If s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString.Contains(":") Then
pFeat = pFl.FeatureClass.GetFeature(s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString.Split(":")(0))
Else
pFeat = pFl.FeatureClass.GetFeature(s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString)
End If
End If
Dim pD As IDomain = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(s_dgCIP.Rows(e.RowIndex).Cells("FiltFld1").FormattedValue.ToString)).Domain
If pD Is Nothing Then
addTextBox(e)
Else
If TypeOf pD Is ICodedValueDomain Then
Dim pCdV As ICodedValueDomain = pD
addComboBox(e, My.Globals.Functions.DomainToList(pCdV))
pCdV = Nothing
Else
addTextBox(e)
End If
End If
End If
End If
ElseIf s_dgCIP.Columns(e.ColumnIndex).Name = "proFiltVal2" Then
If UCase(s_dgCIP.Rows(e.RowIndex).Cells("Strategy").Value) <> UCase(My.Globals.Variables.v_CIPAbandonValue) Then 's_dgCIP.Rows(e.RowIndex).Cells("Strategy").Value = "Replacement" Or s_dgCIP.Rows(e.RowIndex).Cells("Strategy").Value = "Proposed" Then
If s_dgCIP.Rows(e.RowIndex).Cells("FiltFld2").FormattedValue.ToString = "" Then
addTextBox(e)
Else
Dim pFl As IFeatureLayer = My.Globals.Functions.FindLayer(s_dgCIP.Rows(e.RowIndex).Cells("ASSETTYP").FormattedValue.ToString)
Dim pFeat As IFeature
If s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString.Contains("-") Then
pFeat = Nothing
Else
If s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString.Contains(":") Then
pFeat = pFl.FeatureClass.GetFeature(s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString.Split(":")(0))
Else
pFeat = pFl.FeatureClass.GetFeature(s_dgCIP.Rows(e.RowIndex).Cells("OID").FormattedValue.ToString)
End If
End If
Dim pD As IDomain = pFl.FeatureClass.Fields.Field(pFl.FeatureClass.Fields.FindField(s_dgCIP.Rows(e.RowIndex).Cells("FiltFld2").FormattedValue.ToString)).Domain
If pD Is Nothing Then
addTextBox(e)
Else
If TypeOf pD Is ICodedValueDomain Then
Dim pCdV As ICodedValueDomain = pD
addComboBox(e, My.Globals.Functions.DomainToList(pCdV))
pCdV = Nothing
Else
addTextBox(e)
End If
End If
End If
End If
ElseIf s_dgCIP.Columns(e.ColumnIndex).Name.ToUpper = "Action".ToUpper Then
If My.Globals.Variables.v_CIPTableDef Is Nothing Then
Return
End If
Dim pSubVal As String = My.Globals.Functions.GetSubtypeValue(s_dgCIP.Rows(e.RowIndex).Cells("STRATEGY").FormattedValue.ToString, My.Globals.Variables.v_CIPTableCost)
Dim pDom As IDomain = ActionDomain(pSubVal, My.Globals.Variables.v_CIPTableCost)
addComboBox(e, My.Globals.Functions.DomainToList(pDom))
pDom = Nothing
ElseIf s_dgCIP.Columns(e.ColumnIndex).Name.ToUpper = "Strategy".ToUpper Then
addComboBox(e, s_cboStrategy.DataSource)
ElseIf s_dgCIP.Columns(e.ColumnIndex).Name.ToUpper = "NOTES" Or _
s_dgCIP.Columns(e.ColumnIndex).Name.ToUpper = "MULTI" Or _
s_dgCIP.Columns(e.ColumnIndex).Name.ToUpper = "COST" Or _
s_dgCIP.Columns(e.ColumnIndex).Name.ToUpper = "ADDCOST" Then
addTextBox(e)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: s_dgCIP_CellClick" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub comboClick(ByVal sender As Object, ByVal e As System.EventArgs)
Try
saveCombo(sender)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: comboClick" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub dgCIP_Scroll(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs)
Try
If s_dgCIP Is Nothing Then Return
RemoveControl(True)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: s_dgCIP_Scroll" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub dgCIP_DataGridKeyIntercept(ByVal e As Integer)
Try
If s_dgCIP Is Nothing Then Return
If e = Keys.Escape Then
RemoveControl(False)
ElseIf e = Keys.Enter Then
saveControl()
ElseIf e = 34 Then
addQuote(34)
ElseIf e = 39 Then
addQuote(39)
ElseIf e = 96 Then
addQuote(96)
ElseIf e = 222 Then
addQuote(222)
ElseIf e = 46 Then
addPeriod()
'ElseIf e = 46 Then
' deleteRecord()
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools -CIPProjectWindow: s_dgCIP_DataGridKeyIntercept" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub dgCIP_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
If s_dgCIP Is Nothing Then Return
Dim strTag As String
If s_dgCIP.SelectedRows.Count > 0 Then
strTag = "CIPTools:" & s_dgCIP.SelectedRows(0).Cells("ASSETTYP").Value & ":" & s_dgCIP.SelectedRows(0).Cells("OID").Value
RowChanged(strTag)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: s_dgCIP_SelectionChanged" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnStartEditing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartEditing.Click
Try
If s_btnStartEditing Is Nothing Then Return
Dim pMouse As IMouseCursor
pMouse = New MouseCursor
pMouse.SetCursor(2)
Dim pWkSpace As IWorkspace = GetCIPWorkspace()
If pWkSpace IsNot Nothing Then
If My.Globals.Variables.v_Editor.EditState = esriEditState.esriStateNotEditing Then
My.Globals.Variables.v_Editor.StartEditing(pWkSpace)
Else
If CheckEditingWorkspace(pWkSpace) Then
Else
MsgBox("A edit session is already active on another workspace")
End If
End If
Else
MsgBox("The CIP layers are not present, cannot start editing")
End If
pWkSpace = Nothing
pMouse = Nothing
Catch ex As Exception
'If (ex.Message.ToString().Contains("a lock")) Then
MsgBox("The workspace could not be edited, it may be locked by another edit session.")
'Else
'MsgBox("Error in the Costing Tools - CIPProjectWindow: btnStartEditing_Click" & vbCrLf & ex.Message)
'End If
End Try
End Sub
Private Shared Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
If s_btnSave Is Nothing Then Return
Dim workspaceEdit As IWorkspaceEdit2 = My.Globals.Variables.v_Editor.EditWorkspace
If workspaceEdit.IsInEditOperation Then
workspaceEdit.StopEditOperation()
End If
My.Globals.Variables.v_Editor.StopEditing(True)
My.Globals.Variables.v_Editor.StartEditing(workspaceEdit)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnSave_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub ctxMenu_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ctxMenu.ItemClicked
Try
If s_ctxMenu Is Nothing Then Return
Select Case UCase(e.ClickedItem.Name)
Case UCase("tlStDelete")
deleteRecord()
Case UCase("tlStZoom")
Case UCase("tlStFlash")
End Select
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ctxMenu_ItemClicked" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub dgCIP_CellMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs)
Try
If s_dgCIP Is Nothing Then Return
If e.RowIndex >= 0 And e.ColumnIndex >= 0 And e.Button = MouseButtons.Right Then
s_dgCIP.Rows(e.RowIndex).Selected = True
Dim r As System.Drawing.Rectangle = s_dgCIP.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, True)
s_ctxMenu.Show(sender, r.Left + e.X, r.Top + e.Y)
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: s_dgCIP_CellMouseClick" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnSelectAssets_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectAssets.Click
Try
If s_btnSelectAssets Is Nothing Then Return
If s_btnSelectAssets.Checked = True Then
My.ArcMap.Application.CurrentTool = ArcGIS4LocalGovernment.CostEstimatingExtension.GetSelectAssetTool
Else
My.ArcMap.Application.CurrentTool = Nothing
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: s_btnSelectAssets_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
Try
If s_btnSelect Is Nothing Then Return
If s_btnSelect.Checked = True Then
My.ArcMap.Application.CurrentTool = ArcGIS4LocalGovernment.CostEstimatingExtension.GetSelectCostedAssetTool
Else
My.ArcMap.Application.CurrentTool = Nothing
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnSelect_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub btnSketch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
If s_btnSketch Is Nothing Then Return
Dim pCmdItem As ICommandItem
pCmdItem = My.Globals.Functions.GetCommand("ArcGIS4LocalGovernment_CreateAssetForGrid")
If My.ArcMap.Application.CurrentTool IsNot pCmdItem Then
My.ArcMap.Application.CurrentTool = pCmdItem
pCmdItem = Nothing
s_cboDefLayers.Enabled = False
Else
s_cboDefLayers.Enabled = True
My.ArcMap.Application.CurrentTool = Nothing
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: btnSelect_Click" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub ctxMenuTotals_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ctxMenuTotals.ItemClicked
Try
If s_ShowLength Is Nothing Then Return
If e.ClickedItem Is s_ShowLength Then
s_lblTotLength.Visible = Not CType(e.ClickedItem, ToolStripMenuItem).Checked
s_lblLength.Visible = Not CType(e.ClickedItem, ToolStripMenuItem).Checked
ElseIf e.ClickedItem Is s_ShowArea Then
s_lblTotArea.Visible = Not CType(e.ClickedItem, ToolStripMenuItem).Checked
s_lblArea.Visible = Not CType(e.ClickedItem, ToolStripMenuItem).Checked
ElseIf e.ClickedItem Is s_ShowPoint Then
s_lblTotPnt.Visible = Not CType(e.ClickedItem, ToolStripMenuItem).Checked
s_lblPoint.Visible = Not CType(e.ClickedItem, ToolStripMenuItem).Checked
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: ctxMenuTotals_ItemClicked" & vbCrLf & ex.Message, MsgBoxStyle.DefaultButton1, "Error")
End Try
End Sub
'Private Shared Sub ApplyDomainToProject()
' Try
' Dim pPrjLay As IFeatureLayer = My.Globals.Functions.findLayer(My.Globals.Constants.c_CIPProjectLayName, my.ArcMap.Document.FocusMap )
' If pPrjLay IsNot Nothing Then
' If pPrjLay.FeatureClass IsNot Nothing Then
' If pPrjLay.FeatureClass.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCIPStimField) > 0 Then
' Dim pFld As IField = pPrjLay.FeatureClass.Fields.Field(pPrjLay.FeatureClass.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCIPStimField))
' Dim pDom As IDomain = pFld.Domain
' Dim pLst As IList
' If pDom IsNot Nothing Then
' pLst = DomainToList(pDom)
' s_cboCIPStim.DataSource = pLst
' s_cboCIPStim.SelectedItem = pFld.DefaultValue
' End If
' pFld = pPrjLay.FeatureClass.Fields.Field(pPrjLay.FeatureClass.Fields.FindField(My.Globals.Constants.c_CIPProjectLayCIPStatField))
' pDom = pFld.Domain
' If pDom IsNot Nothing Then
' pLst = DomainToList(pDom)
' s_cboCIPStat.DataSource = pLst
' s_cboCIPStat.SelectedItem = pFld.DefaultValue
' End If
' pFld = pPrjLay.FeatureClass.Fields.Field(pPrjLay.FeatureClass.Fields.FindField(My.Globals.Constants.c_CIPProjectLayPrjManField))
' pDom = pFld.Domain
' If pDom IsNot Nothing Then
' pLst = DomainToList(pDom)
' s_cboPrjMan.DataSource = pLst
' s_cboPrjMan.SelectedItem = pFld.DefaultValue
' End If
' pFld = pPrjLay.FeatureClass.Fields.Field(pPrjLay.FeatureClass.Fields.FindField(My.Globals.Constants.c_CIPProjectLaySenEngField))
' pDom = pFld.Domain
' If pDom IsNot Nothing Then
' pLst = DomainToList(pDom)
' s_cboEnginner.DataSource = pLst
' s_cboEnginner.SelectedItem = pFld.DefaultValue
' End If
' pLst = Nothing
' pFld = Nothing
' pDom = Nothing
' End If
' End If
' End If
' pPrjLay = Nothing
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: ApplyDomainToProject" & vbCrLf & ex.Message)
' End Try
'End Sub
'Private Shared function onMapChange() As Boolean
' Try
' Call onActiveViewChanged()
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: onMapChange" & vbCrLf & ex.Message)
' End Try
'End Function
'Private Shared Sub LoadControlsToDetailForm()
' Try
' If s_tbCntCIPDetails.Controls.Count = 0 Then
' 'add controls from the overlview layer
' AddControls()
' ShuffleControls(False)
' End If
' 'If s_cboCIPInvTypes.DataSource Is Nothing Then
' ' Dim pInvTbl As ITable = My.Globals.Functions.findTable(My.Globals.Constants.c_CIPInvLayName, my.ArcMap.Document.FocusMap )
' ' If pInvTbl IsNot Nothing Then
' ' If pInvTbl.Fields.FindField(My.Globals.Constants.c_CIPInvLayInvTypefield) > 0 Then
' ' Dim pFld As IField = pInvTbl.Fields.Field(pInvTbl.Fields.FindField(My.Globals.Constants.c_CIPInvLayInvTypefield))
' ' Dim pDom As IDomain = pFld.Domain
' ' Dim pLst As IList
' ' If pDom IsNot Nothing Then
' ' pLst = DomainToList(pDom)
' ' s_cboCIPInvTypes.DataSource = pLst
' ' s_cboCIPInvTypes.DisplayMember = "getDisplay"
' ' s_cboCIPInvTypes.ValueMember = "getValue"
' ' s_cboCIPInvTypes.SelectedItem = pFld.DefaultValue
' ' End If
' ' pLst = Nothing
' ' pFld = Nothing
' ' pDom = Nothing
' ' End If
' ' End If
' ' pInvTbl = Nothing
' 'End If
' Catch ex As Exception
' MsgBox("Error in the Costing Tools - CIPProjectWindow: ApplyDomainToProject" & vbCrLf & ex.Message)
' End Try
'End Sub
#End Region
#Region "IDockableWindowDef Members"
'Public ReadOnly Property UserData() As Object Implements ESRI.ArcGIS.Framework.IDockableWindowDef.UserData
' Get
' Return Me
' End Get
'End Property
#End Region
#Region "Friend Shared Functions"
Friend Shared Sub EditingStarted()
Try
Dim pWkSpace As IWorkspace = GetCIPWorkspace()
If CheckEditingWorkspace(pWkSpace) Then
If s_btnSave Is Nothing Then Return
s_btnSave.Enabled = True
s_btnStartEditing.Enabled = False
s_btnStopEditing.Enabled = True
s_gpBxCIPCostingLayers.Enabled = True
s_btnClear.Enabled = True
My.Globals.Variables.v_SaveEnabled = True
EnableSavePrj()
Else
If s_btnSave Is Nothing Then Return
s_btnSave.Enabled = False
s_btnStartEditing.Enabled = False
s_btnStopEditing.Enabled = False
s_gpBxCIPCostingLayers.Enabled = False
My.Globals.Variables.v_SaveEnabled = False
EnableSavePrj()
'btnClear.Enabled = False
End If
pWkSpace = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: m_EditorEvents_OnStartEditing" & vbCrLf & ex.Message)
End Try
End Sub
Public Shared Sub EditingStopped()
Try
If s_btnSave Is Nothing Then Return
s_btnSave.Enabled = False
s_gpBxCIPCostingLayers.Enabled = False
s_btnStartEditing.Enabled = True
s_btnStopEditing.Enabled = False
My.Globals.Variables.v_SaveEnabled = False
' btnClear.Enabled = False
EnableSavePrj()
'If gpBxCIPCostingLayers.Visible = True Then
' gpBxCIPCostingLayers.Visible = False
' If gpBxSwitch.Dock = DockStyle.Left Then
' gpBxCIPPrj.Visible = True
' gpBxCIPCan.Visible = False
' Else
' gpBxCIPPrj.Visible = False
' gpBxCIPCan.Visible = True
' End If
'End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: m_EditorEvents_OnStopEditing" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub SplitLines(ByVal pPnt As IPoint, ByVal Split As Boolean)
splitSegmentAtLocation(pPnt, Split)
End Sub
Friend Shared Sub LoadProjectFromLocation(ByVal pPnt As IPoint)
Dim pFeat As IFeature
Try
pFeat = FindPrjAtLocation(pPnt)
If pFeat Is Nothing Then Return
ClearControl()
Dim strPrjName As String = loadProjectToForm(pFeat)
If strPrjName = "" Then Return
LoadExistingAssetsToForm(strPrjName)
setProjectCostAndTotal()
' Call s_dgCIP_SelectionChanged(Nothing, Nothing)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: LoadProjectFromLocation" & vbCrLf & ex.Message)
Finally
pFeat = Nothing
End Try
End Sub
'Friend Shared Function EnableTools() As Boolean
' Return s_btnSelectAssets.Enabled
'End Function
Friend Shared Sub LoadAssetsByShape(ByVal pEnv As IEnvelope)
Dim pProDlgFact As IProgressDialogFactory = Nothing
Dim pStepPro As IStepProgressor = Nothing
Dim pProDlg As IProgressDialog2 = Nothing
Dim pTrkCan As ITrackCancel = Nothing
Try
If s_dgCIP.RowCount = 0 Then
Cleargraphics()
End If
'Dim pDefTbl As ITable
'pDefTbl = My.Globals.Functions.FindTable(My.Globals.Constants.c_CIPDefTableName, m_pMxDoc.FocusMap)
Dim pDefCursor As ICursor
Dim pDefRow As IRow
Dim pDefFilt As IQueryFilter = New QueryFilter
pDefFilt.WhereClause = My.Globals.Constants.c_CIPDefActiveField & " = " & "'Yes'" & " OR " & My.Globals.Constants.c_CIPDefActiveField & " is null"
If My.Globals.Variables.v_CIPTableDef Is Nothing Then
MsgBox("The CIP Definition table cannot be found, exiting")
Return
End If
If ValidDefTable(My.Globals.Variables.v_CIPTableDef) = False Then
MsgBox("The CIP Definition table schema is incorrect, exiting")
Return
End If
If My.Globals.Variables.v_CIPTableDef.RowCount(pDefFilt) = 0 Then
MsgBox("The CIP Definition table does not contain active values, exiting")
Return
End If
pDefCursor = My.Globals.Variables.v_CIPTableDef.Search(pDefFilt, True)
pDefRow = pDefCursor.NextRow
If pDefRow Is Nothing Then
MsgBox("The CIP Definition table does not contain any values, exiting")
setDefLayersToDropdown(Nothing)
Return
End If
Dim boolCont As Boolean
' Create a CancelTracker
pTrkCan = New CancelTracker
' Create the ProgressDialog. This automatically displays the dialog
pProDlgFact = New ProgressDialogFactory
pProDlg = pProDlgFact.Create(pTrkCan, 0)
' Set the properties of the ProgressDialog
pProDlg.CancelEnabled = True
pProDlg.Description = "Processing Cost Table"
pProDlg.Title = "Costing Assets"
pProDlg.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral
' Set the properties of the Step Progressor
pStepPro = pProDlg
pStepPro.MinRange = 1
pStepPro.MaxRange = My.Globals.Variables.v_CIPTableDef.RowCount(Nothing) + 1
pStepPro.StepValue = 1
pStepPro.Message = "Loading Cost Tables"
' Step. Do your big process here.
boolCont = True
' Dim iLoopCnt As Int16 = 0
pProDlg.ShowDialog()
Do Until pDefRow Is Nothing
Dim pAssetFl As IFeatureLayer = Nothing
' iLoopCnt = iLoopCnt + 1
Dim pArr As ArrayList = My.Globals.Functions.FindLayers(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)))
For Each pAssetFl In pArr
'pAssetFl = My.Globals.Functions.FindLayer(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)))
If pAssetFl IsNot Nothing Then
If My.Globals.Functions.isVisible(pAssetFl) = False Then
pStepPro.Message = "Skipping assets from " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & " Not visible"
Else
Dim pRowCount As Integer = getFeatureCount(pAssetFl, pEnv, "")
pStepPro.Message = "Costing " & pRowCount & " assets from " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
If pRowCount > 0 Then
Dim pDs As IDataset = pAssetFl.FeatureClass
' Dim pAssetSelectionSet As ISelectionSet2 = getSelectionSet(pAssetFl, pEnv, "")
Dim strSourceClassName As String = My.Globals.Functions.getClassName(pDs)
Dim strSourceLayerNameConfig As String = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
' pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
' Dim pCostQFilt As IQueryFilter = New QueryFilter
' Dim pSQL As String = My.Globals.Constants.c_CIPCostNameField & " = '" & strSourceLayer & "'"
' pSQL = pSQL & " AND (" & My.Globals.Constants.c_CIPCostActiveField & " = 'Yes' OR " & My.Globals.Constants.c_CIPCostActiveField & " is Null)"
' pCostQFilt.WhereClause = pSQL
' pStepPro.Message = "Checking Cost table for " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
'If pRowCount > 0 Then
'pStepPro.Message = "Looking up Cost for " & pRowCount & " assets from " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
Dim strFiltField1 As String = ""
Dim strFiltField2 As String = ""
Dim strMultiField As String = ""
Dim strLenField As String = ""
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField)) Is Nothing Then
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField)) Is DBNull.Value Then
If Not Trim(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField))) = "" Then
If pAssetFl.FeatureClass.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField))) < 0 Then
MsgBox(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField)) & " does not exist in layer " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & ", exiting")
Return
Else
strMultiField = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefMultiField))
End If
End If
End If
End If
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField)) Is Nothing Then
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField)) Is DBNull.Value Then
If Not Trim(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField))) = "" Then
If UCase(Trim(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField)))).Contains("SHAPE") Then
If pAssetFl.FeatureClass.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField))) > 0 Then
strLenField = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField))
ElseIf pAssetFl.FeatureClass.FindField("Shape.len") > 0 Then
strLenField = "Shape.len"
ElseIf pAssetFl.FeatureClass.FindField("Shape_length") > 0 Then
strLenField = "Shape_length"
ElseIf pAssetFl.FeatureClass.FindField("Shape.length") > 0 Then
strLenField = "Shape.length"
ElseIf pAssetFl.FeatureClass.FindField("Shape_len") > 0 Then
strLenField = "Shape_len"
End If
If strLenField = "" Then
MsgBox(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField)) & " does not exist in layer " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & ", exiting")
Return
End If
Else
If pAssetFl.FeatureClass.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField))) < 0 Then
MsgBox(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField)) & " does not exist in layer " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & ", exiting")
Return
Else
strLenField = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefLenField))
End If
End If
End If
End If
End If
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) Is Nothing Then
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) Is DBNull.Value Then
If Not Trim(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1))) = "" Then
If pAssetFl.FeatureClass.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1))) < 0 Then
MsgBox(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1)) & " does not exist in layer " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & ", exiting")
Return
Else
strFiltField1 = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField1))
End If
End If
End If
End If
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) Is Nothing Then
If Not pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) Is DBNull.Value Then
If Not Trim(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2))) = "" Then
If pAssetFl.FeatureClass.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2))) < 0 Then
MsgBox(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2)) & " does not exist in layer " & pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField)) & ", exiting")
Return
Else
strFiltField2 = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefFiltField2))
End If
End If
End If
End If
Dim pSpatQ As ISpatialFilter = New SpatialFilter
pSpatQ.Geometry = pEnv
pSpatQ.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
pSpatQ.GeometryField = pAssetFl.FeatureClass.ShapeFieldName
Dim pFCursor As IFeatureCursor = pAssetFl.FeatureClass.Search(pSpatQ, True)
Dim pFeat As IFeature = pFCursor.NextFeature
Dim loopCnt As Integer = 1
Do Until pFeat Is Nothing
pStepPro.Message = "Processing " & loopCnt & " of " & pRowCount & " for " & strSourceLayerNameConfig
Dim strDefVal1 As String = "", strDefVal2 As String = ""
Dim strSourceLayerID As String
Dim dblSourceCost As Double = 0.0
Dim dblSourceAddCost As Double = 0.0
Dim dblLength As Double = 0.0
Dim strNotes As String = ""
Dim dblTotalCost As Double = 0.0
Dim dblMulti As Double = 1.0
Dim strFiltVal1 As String = ""
Dim strFiltVal2 As String = ""
Dim strFiltValDisplay1 As String = ""
Dim strFiltValDisplay2 As String = ""
Dim pGeo As IGeometry
pGeo = pFeat.Shape
'strSourceLayer = pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefNameField))
Try
If pFeat.Value(pFeat.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefIDField)))) Is Nothing Then
MsgBox("The ID is missing for asset with an OID of " & pFeat.OID & " in " & strSourceLayerNameConfig & vbCrLf & "Skipping this asset")
pFeat = pFCursor.NextFeature
Continue Do
ElseIf pFeat.Value(pFeat.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefIDField)))) Is DBNull.Value Then
MsgBox("The ID is missing for asset with an OID of " & pFeat.OID & " in " & strSourceLayerNameConfig & vbCrLf & "Skipping this asset")
pFeat = pFCursor.NextFeature
Continue Do
Else
strSourceLayerID = pFeat.Value(pFeat.Fields.FindField(pDefRow.Value(pDefRow.Fields.FindField(My.Globals.Constants.c_CIPDefIDField))))
End If
Catch ex As Exception
MsgBox("The ID Field cannot be found for: " & strSourceLayerNameConfig)
Exit Do
End Try
If strMultiField <> "" Then
If Not pFeat.Value(pFeat.Fields.FindField(strMultiField)) Is Nothing Then
If Not pFeat.Value(pFeat.Fields.FindField(strMultiField)) Is DBNull.Value Then
If IsNumeric(pFeat.Value(pFeat.Fields.FindField(strMultiField))) Then
If CInt(pFeat.Value(pFeat.Fields.FindField(strMultiField))) <> 0 Then
dblMulti = pFeat.Value(pFeat.Fields.FindField(strMultiField))
End If
End If
End If
End If
End If
If strFiltField1 <> "" Then
If Not pFeat.Value(pFeat.Fields.FindField(strFiltField1)) Is Nothing Then
If Not pFeat.Value(pFeat.Fields.FindField(strFiltField1)) Is DBNull.Value Then
strFiltVal1 = pFeat.Value(pFeat.Fields.FindField(strFiltField1))
strFiltValDisplay1 = strFiltVal1
If pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField1)).Domain IsNot Nothing Then
Dim pDom As IDomain = pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField1)).Domain
If pDom.Type = esriDomainType.esriDTCodedValue Then
strFiltValDisplay1 = My.Globals.Functions.GetDomainDisplay(pFeat.Value(pFeat.Fields.FindField(strFiltField1)), pDom)
End If
End If
End If
End If
End If
If strFiltField2 <> "" Then
If Not pFeat.Value(pFeat.Fields.FindField(strFiltField2)) Is Nothing Then
If Not pFeat.Value(pFeat.Fields.FindField(strFiltField2)) Is DBNull.Value Then
strFiltVal2 = pFeat.Value(pFeat.Fields.FindField(strFiltField2))
strFiltValDisplay2 = strFiltVal2
If pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField2)).Domain IsNot Nothing Then
Dim pDom As IDomain = pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField2)).Domain
If pDom.Type = esriDomainType.esriDTCodedValue Then
strFiltValDisplay2 = My.Globals.Functions.GetDomainDisplay(strFiltVal2, pDom)
End If
End If
End If
End If
End If
'System.Configuration.ConfigurationManager.AppSettings("CIPReplacementValue")
If UCase(s_cboStrategy.Text) = UCase(My.Globals.Variables.v_CIPReplaceValue) Then
getReplacementValues(strSourceLayerNameConfig, strSourceClassName, s_cboAction.SelectedValue, strFiltVal1, strFiltVal2, strDefVal1, strDefVal2)
Else
strDefVal2 = strFiltVal2
strDefVal1 = strFiltVal1
End If
Try
If strLenField <> "" Then
dblLength = pFeat.Value(pFeat.Fields.FindField(strLenField))
End If
Select Case pGeo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
If dblLength = 0.0 Then
dblLength = CType(pGeo, IArea).Area
End If
End Select
Catch ex As Exception
MsgBox("The length field for: " & strSourceLayerNameConfig & " is not correct")
pFeat = pFCursor.NextFeature
Continue Do
End Try
Dim pCostRow As IRow = CheckForCostFeat(strSourceClassName, strSourceLayerNameConfig, s_cboStrategy.SelectedValue, s_cboAction.Text, s_cboAction.SelectedValue, strDefVal1, strDefVal2)
If pCostRow IsNot Nothing Then
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)) Is Nothing Then
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostCostField)) Is DBNull.Value Then
dblSourceCost = pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostCostField))
End If
End If
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)) Is Nothing Then
If Not pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField)) Is DBNull.Value Then
dblSourceAddCost = pCostRow.Value(My.Globals.Variables.v_CIPTableCost.Fields.FindField(My.Globals.Constants.c_CIPCostAddCostField))
End If
End If
Select Case pGeo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
dblTotalCost = (dblMulti * dblSourceCost) + dblSourceAddCost
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
dblTotalCost = (dblMulti * dblLength * dblSourceCost) + dblSourceAddCost
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
dblTotalCost = (dblMulti * dblLength * dblSourceCost) + dblSourceAddCost
End Select
' dblTotalCost =dblTotalCost
End If
'Translate the default values to display values
If strFiltField1 <> "" Then
If pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField1)).Domain IsNot Nothing Then
Dim pDom As IDomain = pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField1)).Domain
If pDom.Type = esriDomainType.esriDTCodedValue Then
strDefVal1 = My.Globals.Functions.GetDomainDisplay(strDefVal1, pDom)
End If
End If
End If
If strFiltField2 <> "" Then
If pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField2)).Domain IsNot Nothing Then
Dim pDom As IDomain = pFeat.Fields.Field(pFeat.Fields.FindField(strFiltField2)).Domain
If pDom.Type = esriDomainType.esriDTCodedValue Then
strDefVal2 = My.Globals.Functions.GetDomainDisplay(strDefVal2, pDom)
End If
End If
End If
loadRecord(pGeo, strSourceLayerNameConfig, strSourceClassName, strSourceLayerID, dblSourceCost, dblSourceAddCost, dblLength, dblTotalCost, strFiltValDisplay1, strFiltValDisplay2, strFiltField1, strFiltField2, pFeat.OID, strDefVal1, strDefVal2, s_cboStrategy.Text, s_cboAction.Text, dblMulti, strNotes)
pGeo = Nothing
pCostRow = Nothing
pFeat = pFCursor.NextFeature
loopCnt = loopCnt + 1
Loop
Marshal.ReleaseComObject(pFCursor)
pFCursor = Nothing
pFeat = Nothing
pSpatQ = Nothing
' pCostQFilt = Nothing
End If ' No Active Cost Records Found
'End If 'No records found in the envelope
End If
End If ' Featurelayer was not found
Next
pStepPro.Step()
pDefRow = pDefCursor.NextRow
Loop
pDefRow = Nothing
Marshal.ReleaseComObject(pDefCursor)
pDefCursor = Nothing
pDefFilt = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools: LoadAssetsByShape - Error costing assets" & vbCrLf & ex.Message)
Finally
If pProDlg IsNot Nothing Then
pProDlg.HideDialog()
Marshal.ReleaseComObject(pProDlg)
End If
pProDlg = Nothing
pTrkCan = Nothing
pStepPro = Nothing
pProDlgFact = Nothing
pProDlg = Nothing
End Try
setProjectCostAndTotal()
My.ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Nothing, My.ArcMap.Document.ActiveView.Extent)
End Sub
Friend Shared Sub Cleargraphics()
Try
If My.ArcMap.Document Is Nothing Then Return
If My.ArcMap.Document.ActiveView Is Nothing Then Return
If My.ArcMap.Document.ActiveView.GraphicsContainer Is Nothing Then Return
My.ArcMap.Document.ActiveView.GraphicsContainer.Reset()
Dim pElem As IElement
Dim pElProp As IElementProperties
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Do Until pElem Is Nothing
pElProp = pElem
If pElProp.CustomProperty IsNot Nothing Then
If pElProp.CustomProperty IsNot DBNull.Value Then
If pElProp.CustomProperty.contains("CIPTools:") Then
My.ArcMap.Document.ActiveView.GraphicsContainer.DeleteElement(pElem)
End If
End If
End If
pElem = My.ArcMap.Document.ActiveView.GraphicsContainer.Next
Loop
My.ArcMap.Document.ActiveView.Refresh()
pElem = Nothing
pElProp = Nothing
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: Cleargraphics" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Function AddGraphicSketch(ByVal Geometry As IGeometry) As Boolean
AddRecordFromGraphic(Geometry, True, s_cboDefLayers.Text)
setProjectCostAndTotal()
End Function
Friend Shared Function GetSketchFeatureName() As String
Return s_cboDefLayers.Text
End Function
Friend Shared Sub setProjectCostAndTotal()
Try
Dim TotCost As Double = 0.0
Dim TotLen As Double = 0.0
Dim TotPnt As Double = 0.0
Dim TotArea As Double = 0.0
For Each pRow As DataGridViewRow In s_dgCIP.Rows
TotCost = TotCost + pRow.Cells("TOTCOST").Value
If pRow.Cells("GeoType").Value.ToString.ToUpper = "POLYLINE" Then
TotLen = TotLen + pRow.Cells("LENGTH").Value
ElseIf pRow.Cells("GeoType").Value.ToString.ToUpper = "POLYGON" Then
TotArea = TotArea + pRow.Cells("LENGTH").Value
ElseIf pRow.Cells("GeoType").Value.ToString.ToUpper = "POINT" Then
TotPnt = TotPnt + 1
End If
Next
s_lblTotalCost.Text = FormatCurrency(TotCost, 2, TriState.True, TriState.True) 'Format(Total, "#,###.00")
s_lblTotLength.Text = Format(TotLen, "#,###.00")
s_lblTotArea.Text = Format(TotArea, "#,###.00")
s_lblTotPnt.Text = Format(TotPnt, "#,###")
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: setProjectCostAndTotal" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub loadRecord(ByVal pGeo As IGeometry, ByVal strSourceLayerNameConfig As String, ByVal strSourceClassName As String, ByVal strSourceLayerID As String, ByVal dblSourceCost As String, _
ByVal dblSourceAddCost As String, ByVal dblLength As Double, ByVal dblTotalCost As String, ByVal strFiltVal1 As String, _
ByVal strFiltVal2 As String, ByVal strFiltFld1 As String, ByVal strFiltFld2 As String, ByVal strOID As String, _
ByVal strDefVal1 As String, ByVal strDefVal2 As String, ByVal strStrategy As String, ByVal strAction As String, ByVal dblMulti As Double, ByVal strNotes As String)
Try
pGeo.Project(My.ArcMap.Document.FocusMap.SpatialReference)
For Each row As DataGridViewRow In s_dgCIP.Rows
Dim pOIDVal As String = row.Cells("OID").Value
If pOIDVal.Contains(":") Then
pOIDVal = row.Cells("OID").Value.ToString.Split(":")(0)
End If
If ((row.Cells("ASSETTYP").Value = strSourceClassName Or row.Cells("ASSETTYP").Value = strSourceLayerNameConfig) And pOIDVal = strOID) Then
Exit Sub
End If
Next
Dim pNewRow As String() = New String() {}
If strDefVal1 = "" Then
strDefVal1 = strFiltVal1
End If
If strDefVal2 = "" Then
strDefVal2 = strFiltVal2
End If
dblLength = Math.Round(dblLength, 2)
dblTotalCost = FormatCurrency(dblTotalCost, 2, TriState.True, TriState.True)
dblSourceAddCost = FormatCurrency(dblSourceAddCost, 2, TriState.True, TriState.True)
dblSourceCost = FormatCurrency(dblSourceCost, 2, TriState.True, TriState.True)
Select Case pGeo.GeometryType
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint
pNewRow = New String() {strSourceLayerNameConfig, strSourceLayerID, strStrategy, strAction, strFiltVal1, strFiltVal2, strDefVal1, strDefVal2, _
dblSourceCost, dblMulti, dblSourceAddCost, dblLength, dblTotalCost, "Point", strFiltFld1, strFiltFld2, strOID, strNotes}
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
pNewRow = New String() {strSourceLayerNameConfig, strSourceLayerID, strStrategy, strAction, strFiltVal1, strFiltVal2, strDefVal1, strDefVal2, _
dblSourceCost, dblMulti, dblSourceAddCost, dblLength, dblTotalCost, "Polygon", strFiltFld1, strFiltFld2, strOID, strNotes}
Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
pNewRow = New String() {strSourceLayerNameConfig, strSourceLayerID, strStrategy, strAction, strFiltVal1, strFiltVal2, strDefVal1, strDefVal2, _
dblSourceCost, dblMulti, dblSourceAddCost, dblLength, dblTotalCost, "Polyline", strFiltFld1, strFiltFld2, strOID, strNotes}
End Select
AddGraphic(pGeo, strSourceLayerNameConfig & ":" & strOID)
s_dgCIP.Rows.Add(pNewRow)
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: loadRecord" & vbCrLf & ex.Message)
Finally
' AddHandler pFrm.RowChanged, AddressOf RowChanged
End Try
End Sub
Friend Shared Function CopyRecord(ByVal RowIdx As Integer) As DataGridViewRow
Try
Dim pIdx As Integer = s_dgCIP.Rows.Add
Dim pNewrow As DataGridViewRow = s_dgCIP.Rows(pIdx)
Dim pOldRow As DataGridViewRow = s_dgCIP.Rows(RowIdx)
For i = 0 To s_dgCIP.ColumnCount - 1
pNewrow.Cells(i).Value = pOldRow.Cells(i).Value
Next
Return pNewrow
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: CopyRecord" & vbCrLf & ex.Message)
Return Nothing
End Try
End Function
Friend Shared Sub setDefLayersToDropdown(ByVal Layers As ArrayList)
Try
If Layers Is Nothing Then
s_cboDefLayers.DataSource = Nothing
s_cboDefLayers.Items.Clear()
Return
End If
If Layers.Count = 0 Then
s_cboDefLayers.DataSource = Nothing
s_cboDefLayers.Items.Clear()
Return
End If
Dim pStrPrev As String = s_cboDefLayers.Text
s_cboDefLayers.DataSource = Layers
s_cboDefLayers.DisplayMember = "getLayerName"
s_cboDefLayers.ValueMember = "getGeoType"
If pStrPrev <> "" Then
If s_cboDefLayers.Items.Contains(pStrPrev) Then
s_cboDefLayers.Text = pStrPrev
End If
End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: setDefLayersToDropdown" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub LoadControlsToDetailForm()
Try
If s_tbCntCIPDetails Is Nothing Then Return
If s_tbCntCIPDetails.Controls.Count = 0 Then
'add controls from the overlview layer
AddControls()
ShuffleControls(False)
End If
'If cboCIPInvTypes.DataSource Is Nothing Then
' Dim pInvTbl As ITable = FindTable(c_CIPInvLayName, m_pMxDoc.FocusMap)
' If pInvTbl IsNot Nothing Then
' If pInvTbl.Fields.FindField(c_CIPInvLayInvTypefield) > 0 Then
' Dim pFld As IField = pInvTbl.Fields.Field(pInvTbl.Fields.FindField(c_CIPInvLayInvTypefield))
' Dim pDom As IDomain = pFld.Domain
' Dim pLst As IList
' If pDom IsNot Nothing Then
' pLst = DomainToList(pDom)
' cboCIPInvTypes.DataSource = pLst
' cboCIPInvTypes.DisplayMember = "getDisplay"
' cboCIPInvTypes.ValueMember = "getValue"
' cboCIPInvTypes.SelectedItem = pFld.DefaultValue
' End If
' pLst = Nothing
' pFld = Nothing
' pDom = Nothing
' End If
' End If
' pInvTbl = Nothing
'End If
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: LoadControlsToDetailForm" & vbCrLf & ex.Message)
End Try
End Sub
Private Shared Sub setStratAction(ByVal strStrat As String, ByVal strAct As String)
Try
If s_cboStrategy.Text = strStrat Then Return
s_cboStrategy.Text = strStrat
s_cboAction.Text = strAct
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: setStratAction" & vbCrLf & ex.Message)
End Try
End Sub
Friend Shared Sub SelectTool(ByVal strTool As CIPTools, ByVal bCheck As Boolean)
Try
If s_btnSelect Is Nothing Then Return
Select Case strTool
Case CIPTools.Sketch
s_btnSketch.Checked = bCheck
s_cboDefLayers.Enabled = Not bCheck
If bCheck Then
setStratAction("Proposed", "Open Cut")
End If
Case CIPTools.SelectAssetsForGrid
s_btnSelectAssets.Checked = bCheck
Case CIPTools.SelectExistingProject
s_btnSelectPrj.Checked = bCheck
Case CIPTools.SelectCostedAsset
s_btnSelect.Checked = bCheck
End Select
Catch ex As Exception
MsgBox("Error in the Costing Tools - CIPProjectWindow: SelectTool" & vbCrLf & ex.Message)
End Try
End Sub
#End Region
#Region "Structures"
Public Class layerAndTypes
Public LayerName As String
Public GeoType As ESRI.ArcGIS.Geometry.esriGeometryType
Public Sub New(ByVal LayerNameVal As String, ByVal GeoTypeVal As ESRI.ArcGIS.Geometry.esriGeometryType)
LayerName = LayerNameVal
GeoType = GeoTypeVal
End Sub
Public Property getLayerName() As String
Get
Return LayerName
End Get
Set(ByVal Value As String)
LayerName = Value
End Set
End Property
Public Property getGeoType() As ESRI.ArcGIS.Geometry.esriGeometryType
Get
Return GeoType
End Get
Set(ByVal Value As ESRI.ArcGIS.Geometry.esriGeometryType)
GeoType = Value
End Set
End Property
End Class
#End Region
#Region "Enums"
Public Enum CIPTools
SelectAssetsForGrid
SelectCostedAsset
SelectExistingProject
Sketch
End Enum
#End Region
Friend Shared ReadOnly Property Exists() As Boolean
Get
Return If((s_dgCIP Is Nothing), False, True)
End Get
End Property
Private m_hook As Object
''' <summary>
''' Host object of the dockable window
''' </summary>
Public Property Hook() As Object
Get
Return m_hook
End Get
Set(ByVal value As Object)
m_hook = value
End Set
End Property
''' <summary>
''' Implementation class of the dockable window add-in. It is responsible for
''' creating and disposing the user interface class for the dockable window.
''' </summary>
Public Class AddinImpl
Inherits ESRI.ArcGIS.Desktop.AddIns.DockableWindow
Private m_windowUI As CostEstimatingWindow
Protected Overrides Function OnCreateChild() As System.IntPtr
m_windowUI = New CostEstimatingWindow(Me.Hook)
Return m_windowUI.Handle
End Function
Protected Overrides Sub Dispose(ByVal Param As Boolean)
If m_windowUI IsNot Nothing Then
m_windowUI.Dispose(Param)
End If
MyBase.Dispose(Param)
End Sub
End Class
Private Sub gpBxCIPCan_Enter(sender As System.Object, e As System.EventArgs) Handles gpBxCIPCan.Enter
End Sub
End Class
|
chinasio/local-government-desktop-addins
|
Project Cost Estimating/CostEstimatingWindow.vb
|
Visual Basic
|
apache-2.0
| 352,384
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.Recommendations
Imports Microsoft.CodeAnalysis.Shared.Extensions.ContextQuery
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
<ExportLanguageService(GetType(IRecommendationService), LanguageNames.VisualBasic), [Shared]>
Friend Class VisualBasicRecommendationService
Inherits AbstractRecommendationService
Protected Overrides Function GetRecommendedSymbolsAtPositionWorker(
workspace As Workspace,
semanticModel As SemanticModel,
position As Integer,
options As OptionSet,
cancellationToken As CancellationToken
) As Tuple(Of IEnumerable(Of ISymbol), AbstractSyntaxContext)
Dim visualBasicSemanticModel = DirectCast(semanticModel, SemanticModel)
Dim context = VisualBasicSyntaxContext.CreateContext(workspace, visualBasicSemanticModel, position, cancellationToken)
Dim filterOutOfScopeLocals = options.GetOption(RecommendationOptions.FilterOutOfScopeLocals, semanticModel.Language)
Dim symbols = GetSymbolsWorker(context, filterOutOfScopeLocals, cancellationToken)
Dim hideAdvancedMembers = options.GetOption(RecommendationOptions.HideAdvancedMembers, semanticModel.Language)
symbols = symbols.FilterToVisibleAndBrowsableSymbols(hideAdvancedMembers, visualBasicSemanticModel.Compilation)
Return Tuple.Create(Of IEnumerable(Of ISymbol), AbstractSyntaxContext)(symbols, context)
End Function
Private Function GetSymbolsWorker(
context As VisualBasicSyntaxContext,
filterOutOfScopeLocals As Boolean,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
If context.SyntaxTree.IsInNonUserCode(context.Position, cancellationToken) OrElse
context.SyntaxTree.IsInSkippedText(context.Position, cancellationToken) Then
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
End If
Dim node = context.TargetToken.Parent
If context.IsRightOfNameSeparator Then
If node.Kind = SyntaxKind.SimpleMemberAccessExpression Then
Return GetSymbolsForMemberAccessExpression(context, DirectCast(node, MemberAccessExpressionSyntax), cancellationToken)
ElseIf node.Kind = SyntaxKind.QualifiedName Then
Return GetSymbolsForQualifiedNameSyntax(context, DirectCast(node, QualifiedNameSyntax), cancellationToken)
End If
ElseIf context.SyntaxTree.IsQueryIntoClauseContext(context.Position, context.TargetToken, cancellationToken) Then
Return GetUnqualifiedSymbolsForQueryIntoContext(context, cancellationToken)
ElseIf context.IsAnyExpressionContext OrElse
context.IsSingleLineStatementContext OrElse
context.IsNameOfContext Then
Return GetUnqualifiedSymbolsForExpressionOrStatementContext(context, filterOutOfScopeLocals, cancellationToken)
ElseIf context.IsTypeContext OrElse context.IsNamespaceContext Then
Return GetUnqualifiedSymbolsForType(context, cancellationToken)
ElseIf context.SyntaxTree.IsLabelContext(context.Position, context.TargetToken, cancellationToken) Then
Return GetUnqualifiedSymbolsForLabelContext(context, cancellationToken)
ElseIf context.SyntaxTree.IsRaiseEventContext(context.Position, context.TargetToken, cancellationToken) Then
Return GetUnqualifiedSymbolsForRaiseEvent(context, cancellationToken)
End If
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
End Function
Private Function GetUnqualifiedSymbolsForQueryIntoContext(
context As VisualBasicSyntaxContext,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
Dim symbols = context.SemanticModel _
.LookupSymbols(context.TargetToken.SpanStart, includeReducedExtensionMethods:=True)
Return symbols.OfType(Of IMethodSymbol)().Where(Function(m) m.IsAggregateFunction())
End Function
Private Function GetUnqualifiedSymbolsForLabelContext(
context As VisualBasicSyntaxContext,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
Return context.SemanticModel _
.LookupLabels(context.TargetToken.SpanStart)
End Function
Private Function GetUnqualifiedSymbolsForRaiseEvent(
context As VisualBasicSyntaxContext,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
Dim containingType = context.SemanticModel.GetEnclosingSymbol(context.Position, cancellationToken).ContainingType
Return context.SemanticModel _
.LookupSymbols(context.Position, container:=containingType) _
.Where(Function(s) s.Kind = SymbolKind.Event AndAlso s.ContainingType Is containingType)
End Function
Private Function GetUnqualifiedSymbolsForType(
context As VisualBasicSyntaxContext,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
Return context.SemanticModel _
.LookupNamespacesAndTypes(context.TargetToken.SpanStart)
End Function
Private Function GetUnqualifiedSymbolsForExpressionOrStatementContext(
context As VisualBasicSyntaxContext,
filterOutOfScopeLocals As Boolean,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
Dim lookupPosition = context.TargetToken.SpanStart
If context.FollowsEndOfStatement Then
lookupPosition = context.Position
End If
Dim symbols As IEnumerable(Of ISymbol) = If(
Not context.IsNameOfContext AndAlso context.TargetToken.Parent.IsInStaticContext(),
context.SemanticModel.LookupStaticMembers(lookupPosition),
context.SemanticModel.LookupSymbols(lookupPosition))
If filterOutOfScopeLocals Then
symbols = symbols.Where(Function(symbol) Not symbol.IsInaccessibleLocal(context.Position))
End If
' Hide backing fields and events
Return symbols.Where(Function(s) FilterEventsAndGeneratedSymbols(Nothing, s))
End Function
Private Function GetSymbolsForQualifiedNameSyntax(
context As VisualBasicSyntaxContext,
node As QualifiedNameSyntax,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
' We're in a name-only context, since if we were an expression we'd be a
' MemberAccessExpressionSyntax. Thus, let's do other namespaces and types.
Dim nameBinding = context.SemanticModel.GetSymbolInfo(node.Left, cancellationToken)
Dim symbol = TryCast(nameBinding.Symbol, INamespaceOrTypeSymbol)
Dim couldBeMergedNamepsace = CouldBeMergedNamespace(nameBinding)
If symbol Is Nothing AndAlso Not couldBeMergedNamepsace Then
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
End If
If context.TargetToken.GetAncestor(Of NamespaceStatementSyntax)() IsNot Nothing Then
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
End If
Dim symbols As IEnumerable(Of ISymbol)
If couldBeMergedNamepsace Then
symbols = nameBinding.CandidateSymbols.OfType(Of INamespaceSymbol)() _
.SelectMany(Function(n) context.SemanticModel.LookupNamespacesAndTypes(node.SpanStart, n))
Else
symbols = context.SemanticModel _
.LookupNamespacesAndTypes(position:=node.SpanStart, container:=symbol)
End If
Dim implementsStatement = TryCast(node.Parent, ImplementsStatementSyntax)
If implementsStatement IsNot Nothing Then
Dim couldContainInterface = Function(s As INamedTypeSymbol) s.TypeKind = TypeKind.Class OrElse s.TypeKind = TypeKind.Module OrElse s.TypeKind = TypeKind.Structure
Dim interfaces = symbols.Where(Function(s) s.Kind = SymbolKind.NamedType AndAlso DirectCast(s, INamedTypeSymbol).TypeKind = TypeKind.Interface).ToList()
Dim otherTypes = symbols.OfType(Of INamedTypeSymbol).Where(Function(s) s.Kind = SymbolKind.NamedType AndAlso couldContainInterface(s) AndAlso
SubclassContainsInterface(s)).ToList()
Return interfaces.Concat(otherTypes)
End If
Return symbols
End Function
Private Function SubclassContainsInterface(symbol As INamedTypeSymbol) As Boolean
Dim nestedTypes = symbol.GetTypeMembers()
For Each type As INamedTypeSymbol In nestedTypes
If type.TypeKind = TypeKind.Interface Then
Return True
End If
If SubclassContainsInterface(type) Then
Return True
End If
Next
Return False
End Function
Private Function GetSymbolsForMemberAccessExpression(
context As VisualBasicSyntaxContext,
node As MemberAccessExpressionSyntax,
cancellationToken As CancellationToken
) As IEnumerable(Of ISymbol)
Dim leftExpression = node.GetExpressionOfMemberAccessExpression()
If leftExpression Is Nothing Then
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
End If
Dim leftHandTypeInfo = context.SemanticModel.GetTypeInfo(leftExpression, cancellationToken)
Dim leftHandBinding = context.SemanticModel.GetSymbolInfo(leftExpression, cancellationToken)
Dim excludeInstance = False
Dim excludeShared = True ' do not show shared members by default
Dim useBaseReferenceAccessibility = False
Dim inNameOfExpression = node.IsParentKind(SyntaxKind.NameOfExpression)
Dim container = DirectCast(leftHandTypeInfo.Type, INamespaceOrTypeSymbol)
If leftHandTypeInfo.Type.IsErrorType AndAlso leftHandBinding.Symbol IsNot Nothing Then
' TODO remove this when 531549 which causes leftHandTypeInfo to be an error type is fixed
container = TryCast(leftHandBinding.Symbol.GetSymbolType(), INamespaceOrTypeSymbol)
End If
Dim couldBeMergedNamespace = False
If leftHandBinding.Symbol IsNot Nothing Then
Dim firstSymbol = leftHandBinding.Symbol
Select Case firstSymbol.Kind
Case SymbolKind.TypeParameter
' 884060: We don't allow invocations off type parameters.
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
Case SymbolKind.NamedType, SymbolKind.Namespace
excludeInstance = True
excludeShared = False
container = DirectCast(firstSymbol, INamespaceOrTypeSymbol)
Case SymbolKind.Alias
excludeInstance = True
excludeShared = False
container = DirectCast(firstSymbol, IAliasSymbol).Target
Case SymbolKind.Parameter
Dim parameter = DirectCast(firstSymbol, IParameterSymbol)
If parameter.IsMe Then
excludeShared = False
End If
' case:
' MyBase.
If parameter.IsMe AndAlso parameter.Type IsNot container Then
useBaseReferenceAccessibility = True
End If
End Select
If inNameOfExpression Then
excludeInstance = False
End If
If container Is Nothing OrElse container.IsType AndAlso DirectCast(container, ITypeSymbol).TypeKind = TypeKind.Enum Then
excludeShared = False ' need to allow shared members for enums
End If
Else
couldBeMergedNamespace = VisualBasicRecommendationService.CouldBeMergedNamespace(leftHandBinding)
End If
If container Is Nothing AndAlso Not couldBeMergedNamespace Then
Return SpecializedCollections.EmptyEnumerable(Of ISymbol)()
End If
Debug.Assert((Not excludeInstance OrElse Not excludeShared) OrElse
(inNameOfExpression AndAlso Not excludeInstance AndAlso Not excludeShared))
Debug.Assert(Not excludeInstance OrElse Not useBaseReferenceAccessibility)
If context.TargetToken.GetPreviousToken().IsKind(SyntaxKind.QuestionToken) Then
Dim type = TryCast(container, INamedTypeSymbol)
If type?.ConstructedFrom.SpecialType = SpecialType.System_Nullable_T Then
container = type.GetTypeArguments().First()
End If
End If
Dim position = node.SpanStart
Dim symbols As IEnumerable(Of ISymbol)
If couldBeMergedNamespace Then
symbols = leftHandBinding.CandidateSymbols.OfType(Of INamespaceSymbol) _
.SelectMany(Function(n) LookupSymbolsInContainer(n, context.SemanticModel, position, excludeInstance))
Else
symbols = If(
useBaseReferenceAccessibility,
context.SemanticModel.LookupBaseMembers(position),
LookupSymbolsInContainer(container, context.SemanticModel, position, excludeInstance)).AsEnumerable()
End If
If excludeShared Then
symbols = symbols.Where(Function(s) Not s.IsShared)
End If
' If the left expression is Me, MyBase or MyClass and we're the first statement of constructor,
' we should filter out the parenting constructor. Otherwise, we should filter out all constructors.
If leftExpression.IsMeMyBaseOrMyClass() AndAlso node.IsFirstStatementInCtor() Then
Dim parentingCtor = GetEnclosingCtor(context.SemanticModel, node, cancellationToken)
Debug.Assert(parentingCtor IsNot Nothing)
symbols = symbols.Where(Function(s) Not s.Equals(parentingCtor)).ToList()
Else
symbols = symbols.Where(Function(s) Not s.IsConstructor()).ToList()
End If
' If the left expression is My.MyForms, we should filter out all non-property symbols
If leftHandBinding.Symbol IsNot Nothing AndAlso
leftHandBinding.Symbol.IsMyFormsProperty(context.SemanticModel.Compilation) Then
symbols = symbols.Where(Function(s) s.Kind = SymbolKind.Property)
End If
' Also filter out operators
symbols = symbols.Where(Function(s) s.Kind <> SymbolKind.Method OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.UserDefinedOperator)
' Filter events and generated members
symbols = symbols.Where(Function(s) FilterEventsAndGeneratedSymbols(node, s))
Return symbols
End Function
Private Shared Function CouldBeMergedNamespace(leftHandBinding As SymbolInfo) As Boolean
Return leftHandBinding.CandidateSymbols.Any() AndAlso leftHandBinding.CandidateSymbols.All(Function(s) s.IsNamespace())
End Function
Private Function LookupSymbolsInContainer(container As INamespaceOrTypeSymbol, semanticModel As SemanticModel, position As Integer, excludeInstance As Boolean) As ImmutableArray(Of ISymbol)
Return If(
excludeInstance,
semanticModel.LookupStaticMembers(position, container),
semanticModel.LookupSymbols(position, container, includeReducedExtensionMethods:=True))
End Function
''' <summary>
''' In MemberAccessExpression Contexts, filter out event symbols, except inside AddRemoveHandler Statements
''' Also, filter out any implicitly declared members generated by event declaration or property declaration
''' </summary>
Private Shared Function FilterEventsAndGeneratedSymbols(node As MemberAccessExpressionSyntax, s As ISymbol) As Boolean
If s.Kind = SymbolKind.Event Then
Return node IsNot Nothing AndAlso node.GetAncestor(Of AddRemoveHandlerStatementSyntax) IsNot Nothing
ElseIf s.Kind = SymbolKind.Field AndAlso s.IsImplicitlyDeclared Then
Dim associatedSymbol = DirectCast(s, IFieldSymbol).AssociatedSymbol
If associatedSymbol IsNot Nothing Then
Return associatedSymbol.Kind <> SymbolKind.Event AndAlso associatedSymbol.Kind <> SymbolKind.Property
End If
ElseIf s.Kind = SymbolKind.NamedType AndAlso s.IsImplicitlyDeclared Then
Return Not TypeOf DirectCast(s, INamedTypeSymbol).AssociatedSymbol Is IEventSymbol
End If
Return True
End Function
Private Function GetEnclosingCtor(
semanticModel As SemanticModel,
node As MemberAccessExpressionSyntax,
cancellationToken As CancellationToken) As IMethodSymbol
Dim symbol = semanticModel.GetEnclosingSymbol(node.SpanStart, cancellationToken)
While symbol IsNot Nothing
Dim method = TryCast(symbol, IMethodSymbol)
If method IsNot Nothing AndAlso method.MethodKind = MethodKind.Constructor Then
Return method
End If
End While
Return Nothing
End Function
End Class
End Namespace
|
DavidKarlas/roslyn
|
src/Workspaces/VisualBasic/Portable/Recommendations/VisualBasicRecommendationService.vb
|
Visual Basic
|
apache-2.0
| 18,758
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis.Editor.UnitTests.AutomaticCompletion
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Editor.Implementation.AutomaticCompletion
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.AutomaticCompletion
Public Class AutomaticInterpolatedStringExpressionCompletionTests
Inherits AbstractAutomaticBraceCompletionTests
<WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)>
Public Sub TestCreation()
Using session = CreateSession("$$")
Assert.NotNull(session)
End Using
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)>
Public Sub TestInvalidLocation_String()
Dim code = <code>Class C
Dim s As String = "$$
End Class</code>
Using session = CreateSession(code)
Assert.Null(session)
End Using
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)>
Public Sub TestInvalidLocation_Comment()
Dim code = <code>Class C
' $$
End Class</code>
Using session = CreateSession(code)
Assert.Null(session)
End Using
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)>
Public Sub TestInvalidLocation_DocComment()
Dim code = <code>Class C
''' $$
End Class</code>
Using session = CreateSession(code)
Assert.Null(session)
End Using
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)>
Public Sub TestAfterDollarSign()
Dim code = <code>Class C
Sub M()
Dim s = $$$
End Sub
End Class</code>
Using session = CreateSession(code)
Assert.NotNull(session)
CheckStart(session.Session)
End Using
End Sub
Friend Overloads Function CreateSession(code As XElement) As Holder
Return CreateSession(code.NormalizedValue())
End Function
Friend Overloads Function CreateSession(code As String) As Holder
Return CreateSession(
TestWorkspace.CreateVisualBasic(code),
BraceCompletionSessionProvider.DoubleQuote.OpenCharacter, BraceCompletionSessionProvider.DoubleQuote.CloseCharacter)
End Function
End Class
End Namespace
|
amcasey/roslyn
|
src/EditorFeatures/VisualBasicTest/AutomaticCompletion/AutomaticInterpolatedStringExpressionCompletionTests.vb
|
Visual Basic
|
apache-2.0
| 2,715
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.ExpressionEvaluator
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
Friend NotInheritable Class LocalDeclarationRewriter
Friend Shared Function Rewrite(compilation As VisualBasicCompilation, container As EENamedTypeSymbol, block As BoundBlock) As BoundBlock
Dim locals = PooledHashSet(Of LocalSymbol).GetInstance()
Dim walker As New LocalDeclarationWalker(locals)
walker.Visit(block)
If locals.Count > 0 Then
Dim syntax = block.Syntax
Dim builder = ArrayBuilder(Of BoundStatement).GetInstance()
For Each local In locals
builder.Add(GenerateCreateVariableStatement(compilation, container, syntax, local))
Next
builder.AddRange(block.Statements)
block = New BoundBlock(syntax, block.StatementListSyntax, block.Locals, builder.ToImmutableAndFree())
End If
locals.Free()
Return block
End Function
' Find all implicitly declared locals.
Private NotInheritable Class LocalDeclarationWalker
Inherits BoundTreeWalker
Private ReadOnly _locals As HashSet(Of LocalSymbol)
Friend Sub New(locals As HashSet(Of LocalSymbol))
_locals = locals
End Sub
Public Overrides Function VisitLocal(node As BoundLocal) As BoundNode
Dim local = node.LocalSymbol
If local.DeclarationKind = LocalDeclarationKind.ImplicitVariable Then
_locals.Add(local)
End If
Return node
End Function
End Class
Private Shared Function GenerateCreateVariableStatement(
compilation As VisualBasicCompilation,
container As EENamedTypeSymbol,
syntax As VisualBasicSyntaxNode,
local As LocalSymbol) As BoundStatement
Dim typeType = compilation.GetWellKnownType(WellKnownType.System_Type)
Dim stringType = compilation.GetSpecialType(SpecialType.System_String)
' CreateVariable(type As Type, name As String)
Dim method = PlaceholderLocalSymbol.GetIntrinsicMethod(compilation, ExpressionCompilerConstants.CreateVariableMethodName)
Dim type = New BoundGetType(syntax, New BoundTypeExpression(syntax, local.Type), typeType)
Dim name = New BoundLiteral(syntax, ConstantValue.Create(local.Name), stringType)
Dim expr = New BoundCall(
syntax,
method,
methodGroupOpt:=Nothing,
receiverOpt:=Nothing,
arguments:=ImmutableArray.Create(Of BoundExpression)(type, name),
constantValueOpt:=Nothing,
suppressObjectClone:=False,
type:=method.ReturnType)
Return New BoundExpressionStatement(syntax, expr).MakeCompilerGenerated()
End Function
End Class
End Namespace
|
wschae/roslyn
|
src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/Rewriters/LocalDeclarationRewriter.vb
|
Visual Basic
|
apache-2.0
| 3,363
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeActions
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Packaging
Imports Microsoft.CodeAnalysis.SymbolSearch
Imports Microsoft.CodeAnalysis.VisualBasic.AddImport
Imports Moq
Imports ProviderData = System.Tuple(Of Microsoft.CodeAnalysis.Packaging.IPackageInstallerService, Microsoft.CodeAnalysis.SymbolSearch.ISymbolSearchService)
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeActions.AddImport
Public Class AddImportNuGetTests
Inherits AbstractAddImportTests
Const NugetOrgSource = "nuget.org"
Private Shared ReadOnly NugetPackageSources As ImmutableArray(Of PackageSource) =
ImmutableArray.Create(New PackageSource(NugetOrgSource, "http://nuget.org"))
Protected Overrides Function CreateWorkspaceFromFile(initialMarkup As String, parameters As TestParameters) As TestWorkspace
Dim workspace = MyBase.CreateWorkspaceFromFile(initialMarkup, parameters)
workspace.Options = workspace.Options.
WithChangedOption(SymbolSearchOptions.SuggestForTypesInNuGetPackages, LanguageNames.VisualBasic, True).
WithChangedOption(SymbolSearchOptions.SuggestForTypesInReferenceAssemblies, LanguageNames.VisualBasic, True)
Return workspace
End Function
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
' This is used by inherited tests to ensure the properties of diagnostic analyzers are correct. It's not
' needed by the tests in this class, but can't throw an exception.
Return (Nothing, Nothing)
End Function
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace, parameters As TestParameters) As (DiagnosticAnalyzer, CodeFixProvider)
Dim data = DirectCast(parameters.fixProviderData, ProviderData)
Return (Nothing, New VisualBasicAddImportCodeFixProvider(data.Item1, data.Item2))
End Function
Protected Overrides Function MassageActions(actions As ImmutableArray(Of CodeAction)) As ImmutableArray(Of CodeAction)
Return FlattenActions(actions)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestSearchPackageSingleName() As Task
' Make a loose mock for the installer service. We don't care what this test
' calls on it.
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.TryInstallPackage(It.IsAny(Of Workspace), It.IsAny(Of DocumentId), It.IsAny(Of String), "NuGetPackage", It.IsAny(Of String), It.IsAny(Of Boolean), It.IsAny(Of CancellationToken))).
Returns(True)
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")))
Await TestInRegularAndScriptAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
"
Imports NuGetNamespace
Class C
Dim n As NuGetType
End Class", fixProviderData:=New ProviderData(installerServiceMock.Object, packageServiceMock.Object))
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestSearchPackageMultipleNames() As Task
' Make a loose mock for the installer service. We don't care what this test
' calls on it.
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.TryInstallPackage(It.IsAny(Of Workspace), It.IsAny(Of DocumentId), It.IsAny(Of String), "NuGetPackage", It.IsAny(Of String), It.IsAny(Of Boolean), It.IsAny(Of CancellationToken))).
Returns(True)
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")))
Await TestInRegularAndScriptAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
"
Imports NS1.NS2
Class C
Dim n As NuGetType
End Class", fixProviderData:=New ProviderData(installerServiceMock.Object, packageServiceMock.Object))
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestFailedInstallDoesNotChangeFile() As Task
' Make a loose mock for the installer service. We don't care what this test
' calls on it.
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.TryInstallPackage(It.IsAny(Of Workspace), It.IsAny(Of DocumentId), It.IsAny(Of String), "NuGetPackage", It.IsAny(Of String), It.IsAny(Of Boolean), It.IsAny(Of CancellationToken))).
Returns(False)
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")))
Await TestInRegularAndScriptAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
"
Class C
Dim n As NuGetType
End Class", fixProviderData:=New ProviderData(installerServiceMock.Object, packageServiceMock.Object))
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestMissingIfPackageAlreadyInstalled() As Task
' Make a loose mock for the installer service. We don't care what this test
' calls on it.
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.IsInstalled(It.IsAny(Of Workspace)(), It.IsAny(Of ProjectId)(), "NuGetPackage")).
Returns(True)
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")))
Await TestMissingInRegularAndScriptAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
New TestParameters(fixProviderData:=New ProviderData(installerServiceMock.Object, packageServiceMock.Object)))
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestOptionsOffered() As Task
' Make a loose mock for the installer service. We don't care what this test
' calls on it.
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.GetInstalledVersions("NuGetPackage")).
Returns(ImmutableArray.Create("1.0", "2.0"))
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NS1", "NS2")))
Dim data = New ProviderData(installerServiceMock.Object, packageServiceMock.Object)
Await TestSmartTagTextAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
String.Format(FeaturesResources.Use_local_version_0, "1.0"),
parameters:=New TestParameters(fixProviderData:=data))
Await TestSmartTagTextAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
String.Format(FeaturesResources.Use_local_version_0, "2.0"),
parameters:=New TestParameters(index:=1, fixProviderData:=data))
Await TestSmartTagTextAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
FeaturesResources.Find_and_install_latest_version,
parameters:=New TestParameters(index:=2, fixProviderData:=data))
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestInstallGetsCalledNoVersion() As Task
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.TryInstallPackage(It.IsAny(Of Workspace), It.IsAny(Of DocumentId), It.IsAny(Of String), "NuGetPackage", Nothing, It.IsAny(Of Boolean), It.IsAny(Of CancellationToken))).
Returns(True)
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")))
Await TestInRegularAndScriptAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
"
Imports NuGetNamespace
Class C
Dim n As NuGetType
End Class", fixProviderData:=New ProviderData(installerServiceMock.Object, packageServiceMock.Object))
installerServiceMock.Verify()
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)>
Public Async Function TestInstallGetsCalledWithVersion() As Task
Dim installerServiceMock = New Mock(Of IPackageInstallerService)(MockBehavior.Loose)
installerServiceMock.Setup(Function(i) i.IsEnabled(It.IsAny(Of ProjectId))).Returns(True)
installerServiceMock.SetupGet(Function(i) i.PackageSources).Returns(NugetPackageSources)
installerServiceMock.Setup(Function(s) s.GetInstalledVersions("NuGetPackage")).
Returns(ImmutableArray.Create("1.0"))
installerServiceMock.Setup(Function(s) s.TryInstallPackage(It.IsAny(Of Workspace), It.IsAny(Of DocumentId), It.IsAny(Of String), "NuGetPackage", "1.0", It.IsAny(Of Boolean), It.IsAny(Of CancellationToken))).
Returns(True)
Dim packageServiceMock = New Mock(Of ISymbolSearchService)()
packageServiceMock.Setup(Function(s) s.FindPackagesWithTypeAsync(NugetOrgSource, "NuGetType", 0, It.IsAny(Of CancellationToken)())).
Returns(CreateSearchResult("NuGetPackage", "NuGetType", CreateNameParts("NuGetNamespace")))
Await TestInRegularAndScriptAsync(
"
Class C
Dim n As [|NuGetType|]
End Class",
"
Imports NuGetNamespace
Class C
Dim n As NuGetType
End Class", fixProviderData:=New ProviderData(installerServiceMock.Object, packageServiceMock.Object))
installerServiceMock.Verify()
End Function
Private Function CreateSearchResult(packageName As String, typeName As String, nameParts As ImmutableArray(Of String)) As Task(Of IList(Of PackageWithTypeResult))
Return CreateSearchResult(New PackageWithTypeResult(
packageName:=packageName,
typeName:=typeName,
version:=Nothing,
rank:=0,
containingNamespaceNames:=nameParts))
End Function
Private Function CreateSearchResult(ParamArray results As PackageWithTypeResult()) As Task(Of IList(Of PackageWithTypeResult))
Return Task.FromResult(Of IList(Of PackageWithTypeResult))(ImmutableArray.Create(results))
End Function
Private Function CreateNameParts(ParamArray parts As String()) As ImmutableArray(Of String)
Return parts.ToImmutableArray()
End Function
End Class
End Namespace
|
OmarTawfik/roslyn
|
src/EditorFeatures/VisualBasicTest/Diagnostics/AddImport/AddImportTests_NuGet.vb
|
Visual Basic
|
apache-2.0
| 13,764
|
Namespace _08_Images
Friend NotInheritable Class Program
''' <summary>
''' The main entry point for the application.
''' </summary>
Private Sub New()
End Sub
<STAThread>
Shared Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New Form1())
End Sub
End Class
End Namespace
|
joergkrause/netrix
|
NetrixDemo/RibbonLib/Samples/VB/08-Images/Program.vb
|
Visual Basic
|
mit
| 365
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> Partial Class frmStockTakeCSV
#Region "Windows Form Designer generated code "
<System.Diagnostics.DebuggerNonUserCode()> Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents picBC As System.Windows.Forms.PictureBox
Public WithEvents chkPic As System.Windows.Forms.CheckBox
Public WithEvents cmdDiff As System.Windows.Forms.Button
Public WithEvents cmdClose As System.Windows.Forms.Button
Public WithEvents picButtons As System.Windows.Forms.Panel
Public WithEvents cmdsearch As System.Windows.Forms.Button
Public WithEvents txtqty As System.Windows.Forms.TextBox
Public WithEvents txtdesc As System.Windows.Forms.TextBox
Public WithEvents txtcode As System.Windows.Forms.TextBox
Public WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Public WithEvents imgBC As System.Windows.Forms.PictureBox
Public WithEvents Label3 As System.Windows.Forms.Label
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmStockTakeCSV))
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
Me.picBC = New System.Windows.Forms.PictureBox
Me.chkPic = New System.Windows.Forms.CheckBox
Me.picButtons = New System.Windows.Forms.Panel
Me.cmdDiff = New System.Windows.Forms.Button
Me.cmdClose = New System.Windows.Forms.Button
Me.cmdsearch = New System.Windows.Forms.Button
Me.txtqty = New System.Windows.Forms.TextBox
Me.txtdesc = New System.Windows.Forms.TextBox
Me.txtcode = New System.Windows.Forms.TextBox
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.imgBC = New System.Windows.Forms.PictureBox
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.picButtons.SuspendLayout()
Me.SuspendLayout()
Me.ToolTip1.Active = True
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Text = "StockTake"
Me.ClientSize = New System.Drawing.Size(570, 390)
Me.Location = New System.Drawing.Point(3, 29)
Me.Icon = CType(resources.GetObject("frmStockTakeCSV.Icon"), System.Drawing.Icon)
Me.KeyPreview = True
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.Control
Me.ControlBox = True
Me.Enabled = True
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.ShowInTaskbar = True
Me.HelpButton = False
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
Me.Name = "frmStockTakeCSV"
Me.picBC.Size = New System.Drawing.Size(265, 300)
Me.picBC.Location = New System.Drawing.Point(576, 472)
Me.picBC.TabIndex = 11
Me.picBC.Visible = False
Me.picBC.Dock = System.Windows.Forms.DockStyle.None
Me.picBC.BackColor = System.Drawing.SystemColors.Control
Me.picBC.CausesValidation = True
Me.picBC.Enabled = True
Me.picBC.ForeColor = System.Drawing.SystemColors.ControlText
Me.picBC.Cursor = System.Windows.Forms.Cursors.Default
Me.picBC.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.picBC.TabStop = True
Me.picBC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.picBC.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.picBC.Name = "picBC"
Me.chkPic.Text = "Show Pictures"
Me.chkPic.Size = New System.Drawing.Size(89, 17)
Me.chkPic.Location = New System.Drawing.Point(472, 360)
Me.chkPic.TabIndex = 10
Me.chkPic.CheckAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.chkPic.FlatStyle = System.Windows.Forms.FlatStyle.Standard
Me.chkPic.BackColor = System.Drawing.SystemColors.Control
Me.chkPic.CausesValidation = True
Me.chkPic.Enabled = True
Me.chkPic.ForeColor = System.Drawing.SystemColors.ControlText
Me.chkPic.Cursor = System.Windows.Forms.Cursors.Default
Me.chkPic.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.chkPic.Appearance = System.Windows.Forms.Appearance.Normal
Me.chkPic.TabStop = True
Me.chkPic.CheckState = System.Windows.Forms.CheckState.Unchecked
Me.chkPic.Visible = True
Me.chkPic.Name = "chkPic"
Me.picButtons.Dock = System.Windows.Forms.DockStyle.Top
Me.picButtons.BackColor = System.Drawing.Color.Blue
Me.picButtons.Size = New System.Drawing.Size(570, 38)
Me.picButtons.Location = New System.Drawing.Point(0, 0)
Me.picButtons.TabIndex = 7
Me.picButtons.TabStop = False
Me.picButtons.CausesValidation = True
Me.picButtons.Enabled = True
Me.picButtons.ForeColor = System.Drawing.SystemColors.ControlText
Me.picButtons.Cursor = System.Windows.Forms.Cursors.Default
Me.picButtons.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.picButtons.Visible = True
Me.picButtons.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.picButtons.Name = "picButtons"
Me.cmdDiff.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdDiff.Text = "Show Difference"
Me.cmdDiff.Size = New System.Drawing.Size(97, 29)
Me.cmdDiff.Location = New System.Drawing.Point(360, 2)
Me.cmdDiff.TabIndex = 12
Me.cmdDiff.TabStop = False
Me.cmdDiff.BackColor = System.Drawing.SystemColors.Control
Me.cmdDiff.CausesValidation = True
Me.cmdDiff.Enabled = True
Me.cmdDiff.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdDiff.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdDiff.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdDiff.Name = "cmdDiff"
Me.cmdClose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdClose.Text = "Save and E&xit"
Me.cmdClose.Size = New System.Drawing.Size(89, 29)
Me.cmdClose.Location = New System.Drawing.Point(472, 2)
Me.cmdClose.TabIndex = 8
Me.cmdClose.TabStop = False
Me.cmdClose.BackColor = System.Drawing.SystemColors.Control
Me.cmdClose.CausesValidation = True
Me.cmdClose.Enabled = True
Me.cmdClose.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdClose.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdClose.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdClose.Name = "cmdClose"
Me.cmdsearch.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdsearch.Text = "&Search"
Me.AcceptButton = Me.cmdsearch
Me.cmdsearch.Size = New System.Drawing.Size(89, 33)
Me.cmdsearch.Location = New System.Drawing.Point(8, 352)
Me.cmdsearch.TabIndex = 3
Me.cmdsearch.BackColor = System.Drawing.SystemColors.Control
Me.cmdsearch.CausesValidation = True
Me.cmdsearch.Enabled = True
Me.cmdsearch.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdsearch.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdsearch.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdsearch.TabStop = True
Me.cmdsearch.Name = "cmdsearch"
Me.txtqty.AutoSize = False
Me.txtqty.Size = New System.Drawing.Size(89, 25)
Me.txtqty.Location = New System.Drawing.Point(472, 48)
Me.txtqty.TabIndex = 2
Me.txtqty.AcceptsReturn = True
Me.txtqty.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
Me.txtqty.BackColor = System.Drawing.SystemColors.Window
Me.txtqty.CausesValidation = True
Me.txtqty.Enabled = True
Me.txtqty.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtqty.HideSelection = True
Me.txtqty.ReadOnly = False
Me.txtqty.Maxlength = 0
Me.txtqty.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtqty.MultiLine = False
Me.txtqty.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtqty.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtqty.TabStop = True
Me.txtqty.Visible = True
Me.txtqty.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtqty.Name = "txtqty"
Me.txtdesc.AutoSize = False
Me.txtdesc.Enabled = False
Me.txtdesc.Size = New System.Drawing.Size(153, 25)
Me.txtdesc.Location = New System.Drawing.Point(272, 48)
Me.txtdesc.TabIndex = 1
Me.txtdesc.AcceptsReturn = True
Me.txtdesc.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
Me.txtdesc.BackColor = System.Drawing.SystemColors.Window
Me.txtdesc.CausesValidation = True
Me.txtdesc.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtdesc.HideSelection = True
Me.txtdesc.ReadOnly = False
Me.txtdesc.Maxlength = 0
Me.txtdesc.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtdesc.MultiLine = False
Me.txtdesc.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtdesc.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtdesc.TabStop = True
Me.txtdesc.Visible = True
Me.txtdesc.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtdesc.Name = "txtdesc"
Me.txtcode.AutoSize = False
Me.txtcode.Size = New System.Drawing.Size(89, 25)
Me.txtcode.Location = New System.Drawing.Point(88, 48)
Me.txtcode.TabIndex = 0
Me.txtcode.AcceptsReturn = True
Me.txtcode.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
Me.txtcode.BackColor = System.Drawing.SystemColors.Window
Me.txtcode.CausesValidation = True
Me.txtcode.Enabled = True
Me.txtcode.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtcode.HideSelection = True
Me.txtcode.ReadOnly = False
Me.txtcode.Maxlength = 0
Me.txtcode.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtcode.MultiLine = False
Me.txtcode.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtcode.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtcode.TabStop = True
Me.txtcode.Visible = True
Me.txtcode.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtcode.Name = "txtcode"
'DataGrid1.OcxState = CType(resources.GetObject("DataGrid1.OcxState"), System.Windows.Forms.AxHost.State)
Me.DataGrid1.Size = New System.Drawing.Size(553, 257)
Me.DataGrid1.Location = New System.Drawing.Point(8, 88)
Me.DataGrid1.TabIndex = 9
Me.DataGrid1.Name = "DataGrid1"
Me.imgBC.Size = New System.Drawing.Size(265, 300)
Me.imgBC.Location = New System.Drawing.Point(568, 48)
Me.imgBC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.imgBC.Visible = False
Me.imgBC.Enabled = True
Me.imgBC.Cursor = System.Windows.Forms.Cursors.Default
Me.imgBC.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.imgBC.Name = "imgBC"
Me.Label3.Text = "Qty"
Me.Label3.Size = New System.Drawing.Size(33, 17)
Me.Label3.Location = New System.Drawing.Point(432, 56)
Me.Label3.TabIndex = 6
Me.Label3.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.Label3.BackColor = System.Drawing.SystemColors.Control
Me.Label3.Enabled = True
Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label3.UseMnemonic = True
Me.Label3.Visible = True
Me.Label3.AutoSize = False
Me.Label3.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label3.Name = "Label3"
Me.Label2.Text = "Description"
Me.Label2.Size = New System.Drawing.Size(81, 25)
Me.Label2.Location = New System.Drawing.Point(184, 56)
Me.Label2.TabIndex = 5
Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Enabled = True
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.UseMnemonic = True
Me.Label2.Visible = True
Me.Label2.AutoSize = False
Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label2.Name = "Label2"
Me.Label1.Text = "Barcode"
Me.Label1.Size = New System.Drawing.Size(81, 25)
Me.Label1.Location = New System.Drawing.Point(8, 56)
Me.Label1.TabIndex = 4
Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Enabled = True
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.UseMnemonic = True
Me.Label1.Visible = True
Me.Label1.AutoSize = False
Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label1.Name = "Label1"
Me.Controls.Add(picBC)
Me.Controls.Add(chkPic)
Me.Controls.Add(picButtons)
Me.Controls.Add(cmdsearch)
Me.Controls.Add(txtqty)
Me.Controls.Add(txtdesc)
Me.Controls.Add(txtcode)
Me.Controls.Add(DataGrid1)
Me.Controls.Add(imgBC)
Me.Controls.Add(Label3)
Me.Controls.Add(Label2)
Me.Controls.Add(Label1)
Me.picButtons.Controls.Add(cmdDiff)
Me.picButtons.Controls.Add(cmdClose)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.picButtons.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
End Class
|
nodoid/PointOfSale
|
VB/4PosBackOffice.NET/frmStockTakeCSV.Designer.vb
|
Visual Basic
|
mit
| 14,187
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> Partial Class frmGRVItemQuick
#Region "Windows Form Designer generated code "
<System.Diagnostics.DebuggerNonUserCode()> Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents txtPrice As System.Windows.Forms.TextBox
Public WithEvents cmdProceed As System.Windows.Forms.Button
Public WithEvents txtDiscountMinus As System.Windows.Forms.TextBox
Public WithEvents txtDiscountPlus As System.Windows.Forms.TextBox
Public WithEvents txtQuantity As System.Windows.Forms.TextBox
Public WithEvents chkBreakPack As System.Windows.Forms.CheckBox
Public WithEvents lblPath As System.Windows.Forms.Label
Public WithEvents _lbl_2 As System.Windows.Forms.Label
Public WithEvents _lbl_1 As System.Windows.Forms.Label
Public WithEvents Label1 As System.Windows.Forms.Label
Public WithEvents _lbl_0 As System.Windows.Forms.Label
Public WithEvents lblName As System.Windows.Forms.Label
'Public WithEvents lbl As Microsoft.VisualBasic.Compatibility.VB6.LabelArray
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmGRVItemQuick))
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
Me.txtPrice = New System.Windows.Forms.TextBox
Me.cmdProceed = New System.Windows.Forms.Button
Me.txtDiscountMinus = New System.Windows.Forms.TextBox
Me.txtDiscountPlus = New System.Windows.Forms.TextBox
Me.txtQuantity = New System.Windows.Forms.TextBox
Me.chkBreakPack = New System.Windows.Forms.CheckBox
Me.lblPath = New System.Windows.Forms.Label
Me._lbl_2 = New System.Windows.Forms.Label
Me._lbl_1 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me._lbl_0 = New System.Windows.Forms.Label
Me.lblName = New System.Windows.Forms.Label
'Me.lbl = New Microsoft.VisualBasic.Compatibility.VB6.LabelArray(components)
Me.SuspendLayout()
Me.ToolTip1.Active = True
'CType(Me.lbl, System.ComponentModel.ISupportInitialize).BeginInit()
Me.ControlBox = False
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.ClientSize = New System.Drawing.Size(313, 213)
Me.Location = New System.Drawing.Point(3, 3)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.Control
Me.Enabled = True
Me.KeyPreview = False
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.HelpButton = False
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
Me.Name = "frmGRVItemQuick"
Me.txtPrice.AutoSize = False
Me.txtPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
Me.txtPrice.Size = New System.Drawing.Size(217, 19)
Me.txtPrice.Location = New System.Drawing.Point(85, 99)
Me.txtPrice.TabIndex = 5
Me.txtPrice.Text = "Text1"
Me.txtPrice.AcceptsReturn = True
Me.txtPrice.BackColor = System.Drawing.SystemColors.Window
Me.txtPrice.CausesValidation = True
Me.txtPrice.Enabled = True
Me.txtPrice.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtPrice.HideSelection = True
Me.txtPrice.ReadOnly = False
Me.txtPrice.Maxlength = 0
Me.txtPrice.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtPrice.MultiLine = False
Me.txtPrice.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtPrice.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtPrice.TabStop = True
Me.txtPrice.Visible = True
Me.txtPrice.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtPrice.Name = "txtPrice"
Me.cmdProceed.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdProceed.Text = "&Proceed"
Me.cmdProceed.Size = New System.Drawing.Size(85, 31)
Me.cmdProceed.Location = New System.Drawing.Point(216, 174)
Me.cmdProceed.TabIndex = 10
Me.cmdProceed.BackColor = System.Drawing.SystemColors.Control
Me.cmdProceed.CausesValidation = True
Me.cmdProceed.Enabled = True
Me.cmdProceed.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdProceed.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdProceed.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdProceed.TabStop = True
Me.cmdProceed.Name = "cmdProceed"
Me.txtDiscountMinus.AutoSize = False
Me.txtDiscountMinus.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
Me.txtDiscountMinus.Size = New System.Drawing.Size(217, 19)
Me.txtDiscountMinus.Location = New System.Drawing.Point(84, 147)
Me.txtDiscountMinus.TabIndex = 9
Me.txtDiscountMinus.Text = "Text1"
Me.txtDiscountMinus.AcceptsReturn = True
Me.txtDiscountMinus.BackColor = System.Drawing.SystemColors.Window
Me.txtDiscountMinus.CausesValidation = True
Me.txtDiscountMinus.Enabled = True
Me.txtDiscountMinus.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtDiscountMinus.HideSelection = True
Me.txtDiscountMinus.ReadOnly = False
Me.txtDiscountMinus.Maxlength = 0
Me.txtDiscountMinus.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtDiscountMinus.MultiLine = False
Me.txtDiscountMinus.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtDiscountMinus.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtDiscountMinus.TabStop = True
Me.txtDiscountMinus.Visible = True
Me.txtDiscountMinus.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtDiscountMinus.Name = "txtDiscountMinus"
Me.txtDiscountPlus.AutoSize = False
Me.txtDiscountPlus.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
Me.txtDiscountPlus.Size = New System.Drawing.Size(217, 19)
Me.txtDiscountPlus.Location = New System.Drawing.Point(84, 126)
Me.txtDiscountPlus.TabIndex = 7
Me.txtDiscountPlus.Text = "Text1"
Me.txtDiscountPlus.AcceptsReturn = True
Me.txtDiscountPlus.BackColor = System.Drawing.SystemColors.Window
Me.txtDiscountPlus.CausesValidation = True
Me.txtDiscountPlus.Enabled = True
Me.txtDiscountPlus.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtDiscountPlus.HideSelection = True
Me.txtDiscountPlus.ReadOnly = False
Me.txtDiscountPlus.Maxlength = 0
Me.txtDiscountPlus.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtDiscountPlus.MultiLine = False
Me.txtDiscountPlus.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtDiscountPlus.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtDiscountPlus.TabStop = True
Me.txtDiscountPlus.Visible = True
Me.txtDiscountPlus.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtDiscountPlus.Name = "txtDiscountPlus"
Me.txtQuantity.AutoSize = False
Me.txtQuantity.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
Me.txtQuantity.Size = New System.Drawing.Size(217, 19)
Me.txtQuantity.Location = New System.Drawing.Point(84, 78)
Me.txtQuantity.TabIndex = 3
Me.txtQuantity.Text = "Text1"
Me.txtQuantity.AcceptsReturn = True
Me.txtQuantity.BackColor = System.Drawing.SystemColors.Window
Me.txtQuantity.CausesValidation = True
Me.txtQuantity.Enabled = True
Me.txtQuantity.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtQuantity.HideSelection = True
Me.txtQuantity.ReadOnly = False
Me.txtQuantity.Maxlength = 0
Me.txtQuantity.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtQuantity.MultiLine = False
Me.txtQuantity.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtQuantity.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtQuantity.TabStop = True
Me.txtQuantity.Visible = True
Me.txtQuantity.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtQuantity.Name = "txtQuantity"
Me.chkBreakPack.Text = "Break Pack"
Me.chkBreakPack.Size = New System.Drawing.Size(286, 16)
Me.chkBreakPack.Location = New System.Drawing.Point(12, 54)
Me.chkBreakPack.TabIndex = 1
Me.chkBreakPack.CheckAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.chkBreakPack.FlatStyle = System.Windows.Forms.FlatStyle.Standard
Me.chkBreakPack.BackColor = System.Drawing.SystemColors.Control
Me.chkBreakPack.CausesValidation = True
Me.chkBreakPack.Enabled = True
Me.chkBreakPack.ForeColor = System.Drawing.SystemColors.ControlText
Me.chkBreakPack.Cursor = System.Windows.Forms.Cursors.Default
Me.chkBreakPack.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.chkBreakPack.Appearance = System.Windows.Forms.Appearance.Normal
Me.chkBreakPack.TabStop = True
Me.chkBreakPack.CheckState = System.Windows.Forms.CheckState.Unchecked
Me.chkBreakPack.Visible = True
Me.chkBreakPack.Name = "chkBreakPack"
Me.lblPath.BackColor = System.Drawing.Color.Blue
Me.lblPath.Text = "GRV Quick Edit"
Me.lblPath.ForeColor = System.Drawing.Color.White
Me.lblPath.Size = New System.Drawing.Size(568, 25)
Me.lblPath.Location = New System.Drawing.Point(0, 0)
Me.lblPath.TabIndex = 11
Me.lblPath.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.lblPath.Enabled = True
Me.lblPath.Cursor = System.Windows.Forms.Cursors.Default
Me.lblPath.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lblPath.UseMnemonic = True
Me.lblPath.Visible = True
Me.lblPath.AutoSize = False
Me.lblPath.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lblPath.Name = "lblPath"
Me._lbl_2.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_2.Text = "Price"
Me._lbl_2.Size = New System.Drawing.Size(24, 13)
Me._lbl_2.Location = New System.Drawing.Point(57, 102)
Me._lbl_2.TabIndex = 4
Me._lbl_2.BackColor = System.Drawing.SystemColors.Control
Me._lbl_2.Enabled = True
Me._lbl_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_2.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_2.UseMnemonic = True
Me._lbl_2.Visible = True
Me._lbl_2.AutoSize = True
Me._lbl_2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_2.Name = "_lbl_2"
Me._lbl_1.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_1.Text = "Surcharges"
Me._lbl_1.Size = New System.Drawing.Size(54, 13)
Me._lbl_1.Location = New System.Drawing.Point(24, 150)
Me._lbl_1.TabIndex = 8
Me._lbl_1.BackColor = System.Drawing.SystemColors.Control
Me._lbl_1.Enabled = True
Me._lbl_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_1.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_1.UseMnemonic = True
Me._lbl_1.Visible = True
Me._lbl_1.AutoSize = True
Me._lbl_1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_1.Name = "_lbl_1"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopRight
Me.Label1.Text = "Discount"
Me.Label1.Size = New System.Drawing.Size(42, 13)
Me.Label1.Location = New System.Drawing.Point(36, 129)
Me.Label1.TabIndex = 6
Me.Label1.BackColor = System.Drawing.SystemColors.Control
Me.Label1.Enabled = True
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label1.UseMnemonic = True
Me.Label1.Visible = True
Me.Label1.AutoSize = True
Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.Label1.Name = "Label1"
Me._lbl_0.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_0.Text = "Quantity"
Me._lbl_0.Size = New System.Drawing.Size(39, 13)
Me._lbl_0.Location = New System.Drawing.Point(41, 81)
Me._lbl_0.TabIndex = 2
Me._lbl_0.BackColor = System.Drawing.SystemColors.Control
Me._lbl_0.Enabled = True
Me._lbl_0.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_0.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_0.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_0.UseMnemonic = True
Me._lbl_0.Visible = True
Me._lbl_0.AutoSize = True
Me._lbl_0.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_0.Name = "_lbl_0"
Me.lblName.Text = "Label1"
Me.lblName.Size = New System.Drawing.Size(289, 16)
Me.lblName.Location = New System.Drawing.Point(12, 33)
Me.lblName.TabIndex = 0
Me.lblName.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.lblName.BackColor = System.Drawing.SystemColors.Control
Me.lblName.Enabled = True
Me.lblName.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblName.Cursor = System.Windows.Forms.Cursors.Default
Me.lblName.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lblName.UseMnemonic = True
Me.lblName.Visible = True
Me.lblName.AutoSize = False
Me.lblName.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.lblName.Name = "lblName"
Me.Controls.Add(txtPrice)
Me.Controls.Add(cmdProceed)
Me.Controls.Add(txtDiscountMinus)
Me.Controls.Add(txtDiscountPlus)
Me.Controls.Add(txtQuantity)
Me.Controls.Add(chkBreakPack)
Me.Controls.Add(lblPath)
Me.Controls.Add(_lbl_2)
Me.Controls.Add(_lbl_1)
Me.Controls.Add(Label1)
Me.Controls.Add(_lbl_0)
Me.Controls.Add(lblName)
'Me.lbl.SetIndex(_lbl_2, CType(2, Short))
'Me.lbl.SetIndex(_lbl_1, CType(1, Short))
'Me.lbl.SetIndex(_lbl_0, CType(0, Short))
'CType(Me.lbl, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
End Class
|
nodoid/PointOfSale
|
VB/4PosBackOffice.NET/frmGRVItemQuick.Designer.vb
|
Visual Basic
|
mit
| 14,479
|
Imports System.ComponentModel
Public Class DynamicPropertyDescriptor
Inherits PropertyDescriptor
Private _Name As String
Private _Category As String
Private _Description As String
Private _PropertyType As System.Type
Private _ConverterTypeName As String
Private _Converter As TypeConverter
Private _Attributes As List(Of Attribute)
Private _GetValueHandler As GetValueHandler
Private _SetValueHandler As SetValueHandler
Private _CanResetValueHandler As CanResetValueHandler
Private _ResetValueHandler As ResetValueHandler
Private _ShouldSerializeValueHandler As ShouldSerializeValueHandler
Private _GetChildPropertiesHandler As GetChildPropertiesHandler
Private _ComponentType As System.Type
Private _BaseDescriptor As PropertyDescriptor
Public Property GetValueHandler() As GetValueHandler
Get
Return _GetValueHandler
End Get
Set(value As GetValueHandler)
_GetValueHandler = value
End Set
End Property
Public Property SetValueHandler() As SetValueHandler
Get
Return _SetValueHandler
End Get
Set(value As SetValueHandler)
_SetValueHandler = value
End Set
End Property
Public Property CanResetValueHandler() As CanResetValueHandler
Get
Return _CanResetValueHandler
End Get
Set(value As CanResetValueHandler)
_CanResetValueHandler = value
End Set
End Property
Public Property ResetValueHandler() As ResetValueHandler
Get
Return _ResetValueHandler
End Get
Set(value As ResetValueHandler)
_ResetValueHandler = value
End Set
End Property
Public Property ShouldSerializeValueHandler() As ShouldSerializeValueHandler
Get
Return _ShouldSerializeValueHandler
End Get
Set(value As ShouldSerializeValueHandler)
_ShouldSerializeValueHandler = value
End Set
End Property
Public Property GetChildPropertiesHandler() As GetChildPropertiesHandler
Get
Return _GetChildPropertiesHandler
End Get
Set(value As GetChildPropertiesHandler)
_GetChildPropertiesHandler = value
End Set
End Property
Public Overrides ReadOnly Property Attributes() As AttributeCollection
Get
If _Attributes IsNot Nothing Then
Dim attributes__1 As New Dictionary(Of Object, Attribute)()
For Each attr As Attribute In AttributeArray
attributes__1(attr.TypeId) = attr
Next
For Each attr As Attribute In _Attributes
If Not attr.IsDefaultAttribute() Then
attributes__1(attr.TypeId) = attr
ElseIf attributes__1.ContainsKey(attr.TypeId) Then
attributes__1.Remove(attr.TypeId)
End If
Dim categoryAttr As CategoryAttribute = TryCast(attr, CategoryAttribute)
If categoryAttr IsNot Nothing Then
_Category = categoryAttr.Category
End If
Dim descriptionAttr As DescriptionAttribute = TryCast(attr, DescriptionAttribute)
If descriptionAttr IsNot Nothing Then
_Description = descriptionAttr.Description
End If
Dim typeConverterAttr As TypeConverterAttribute = TryCast(attr, TypeConverterAttribute)
If typeConverterAttr IsNot Nothing Then
_ConverterTypeName = typeConverterAttr.ConverterTypeName
_Converter = Nothing
End If
Next
Dim newAttributes As Attribute() = New Attribute(attributes__1.Values.Count - 1) {}
attributes__1.Values.CopyTo(newAttributes, 0)
AttributeArray = newAttributes
_Attributes = Nothing
End If
Return MyBase.Attributes
End Get
End Property
Public Overrides ReadOnly Property Category() As String
Get
If _Category IsNot Nothing Then
Return _Category
End If
Return MyBase.Category
End Get
End Property
Public Overrides ReadOnly Property ComponentType() As System.Type
Get
If _ComponentType IsNot Nothing Then
Return _ComponentType
End If
If _BaseDescriptor IsNot Nothing Then
Return _BaseDescriptor.ComponentType
End If
Return Nothing
End Get
End Property
Public Overrides ReadOnly Property Converter() As TypeConverter
Get
If _ConverterTypeName IsNot Nothing Then
If _Converter Is Nothing Then
Dim converterType As System.Type = GetTypeFromName(_ConverterTypeName)
If GetType(TypeConverter).IsAssignableFrom(converterType) Then
_Converter = DirectCast(CreateInstance(converterType), TypeConverter)
End If
End If
If _Converter IsNot Nothing Then
Return _Converter
End If
End If
Return MyBase.Converter
End Get
End Property
Public Overrides ReadOnly Property Description() As String
Get
If _Description IsNot Nothing Then
Return _Description
End If
Return MyBase.Description
End Get
End Property
Public Overrides ReadOnly Property IsReadOnly() As Boolean
Get
Return (ReadOnlyAttribute.Yes.Equals(Attributes(GetType(ReadOnlyAttribute))))
End Get
End Property
Public Overrides ReadOnly Property Name() As String
Get
If _Name IsNot Nothing Then
Return _Name
End If
Return MyBase.Name
End Get
End Property
Public Overrides ReadOnly Property PropertyType() As System.Type
Get
If _PropertyType IsNot Nothing Then
Return _PropertyType
End If
If _BaseDescriptor IsNot Nothing Then
Return _BaseDescriptor.PropertyType
End If
Return Nothing
End Get
End Property
Public Sub New(name As String)
MyBase.New(name, Nothing)
End Sub
Public Sub New(name As String, ParamArray attributes As Attribute())
MyBase.New(name, FilterAttributes(attributes))
End Sub
Public Sub New(baseDescriptor As PropertyDescriptor)
Me.New(baseDescriptor, Nothing)
End Sub
Public Sub New(baseDescriptor As PropertyDescriptor, ParamArray newAttributes As Attribute())
MyBase.New(baseDescriptor, newAttributes)
AttributeArray = FilterAttributes(AttributeArray)
_BaseDescriptor = baseDescriptor
End Sub
#If NOT_USED Then
Public Sub New(name As String, displayName As String)
Me.New(name, displayName, Nothing, Nothing, ReadOnlyAttribute.[Default].IsReadOnly)
End Sub
Public Sub New(name As String, displayName As String, category As String)
Me.New(name, displayName, category, Nothing, ReadOnlyAttribute.[Default].IsReadOnly)
End Sub
Public Sub New(name As String, displayName As String, category As String, description As String)
Me.New(name, displayName, category, description, ReadOnlyAttribute.[Default].IsReadOnly)
End Sub
Public Sub New(name As String, displayName As String, category As String, description As String, isReadOnly As Boolean)
MyBase.New(name, BuildAttributes(displayName, category, description, isReadOnly))
End Sub
#End If
Public Sub SetName(value As String)
If value Is Nothing Then
value = [String].Empty
End If
_Name = value
End Sub
Public Sub SetDisplayName(value As String)
If value Is Nothing Then
value = DisplayNameAttribute.[Default].DisplayName
End If
SetAttribute(New DisplayNameAttribute(value))
End Sub
Public Sub SetCategory(value As String)
If value Is Nothing Then
value = CategoryAttribute.[Default].Category
End If
_Category = value
SetAttribute(New CategoryAttribute(value))
End Sub
Public Sub SetDescription(value As String)
If value Is Nothing Then
value = DescriptionAttribute.[Default].Description
End If
_Description = value
SetAttribute(New DescriptionAttribute(value))
End Sub
Public Sub SetPropertyType(value As System.Type)
If value Is Nothing Then
Throw New ArgumentNullException("value")
End If
_PropertyType = value
End Sub
Public Sub SetDesignTimeOnly(value As Boolean)
SetAttribute(New DesignOnlyAttribute(value))
End Sub
Public Sub SetIsBrowsable(value As Boolean)
SetAttribute(New BrowsableAttribute(value))
End Sub
Public Sub SetIsLocalizable(value As Boolean)
SetAttribute(New LocalizableAttribute(value))
End Sub
Public Sub SetIsReadOnly(value As Boolean)
SetAttribute(New ReadOnlyAttribute(value))
End Sub
Public Sub SetConverterType(value As System.Type)
_ConverterTypeName = If((value IsNot Nothing), value.AssemblyQualifiedName, Nothing)
If _ConverterTypeName IsNot Nothing Then
SetAttribute(New TypeConverterAttribute(value))
Else
SetAttribute(TypeConverterAttribute.[Default])
End If
_Converter = Nothing
End Sub
Public Sub SetAttribute(value As Attribute)
If value Is Nothing Then
Throw New ArgumentNullException("value")
End If
If _Attributes Is Nothing Then
_Attributes = New List(Of Attribute)()
End If
_Attributes.Add(value)
End Sub
Public Sub SetAttributes(ParamArray values As Attribute())
For Each value As Attribute In values
SetAttribute(value)
Next
End Sub
Public Sub SetComponentType(value As System.Type)
_ComponentType = value
End Sub
Public Overrides Function GetValue(component As Object) As Object
If GetValueHandler IsNot Nothing Then
Return GetValueHandler(component)
End If
If _BaseDescriptor IsNot Nothing Then
Return _BaseDescriptor.GetValue(component)
End If
Return Nothing
End Function
Public Overrides Sub SetValue(component As Object, value As Object)
If SetValueHandler IsNot Nothing Then
SetValueHandler.Invoke(component, value)
OnValueChanged(component, EventArgs.Empty)
ElseIf _BaseDescriptor IsNot Nothing Then
_BaseDescriptor.SetValue(component, value)
OnValueChanged(component, EventArgs.Empty)
End If
End Sub
Public Overrides Function CanResetValue(component As Object) As Boolean
If CanResetValueHandler IsNot Nothing Then
Return CanResetValueHandler(component)
End If
If _BaseDescriptor IsNot Nothing Then
Return _BaseDescriptor.CanResetValue(component)
End If
Return (Attributes(GetType(DefaultValueAttribute)) IsNot Nothing)
End Function
Public Overrides Sub ResetValue(component As Object)
If ResetValueHandler IsNot Nothing Then
ResetValueHandler.Invoke(component)
ElseIf _BaseDescriptor IsNot Nothing Then
_BaseDescriptor.ResetValue(component)
Else
Dim attribute As DefaultValueAttribute = TryCast(Attributes(GetType(DefaultValueAttribute)), DefaultValueAttribute)
If attribute IsNot Nothing Then
SetValue(component, attribute.Value)
End If
End If
End Sub
Public Overrides Function ShouldSerializeValue(component As Object) As Boolean
If ShouldSerializeValueHandler IsNot Nothing Then
Return ShouldSerializeValueHandler(component)
End If
If _BaseDescriptor IsNot Nothing Then
Return _BaseDescriptor.ShouldSerializeValue(component)
End If
Dim attribute As DefaultValueAttribute = TryCast(Attributes(GetType(DefaultValueAttribute)), DefaultValueAttribute)
Return (attribute IsNot Nothing AndAlso Not [Object].Equals(GetValue(component), attribute.Value))
End Function
Public Overrides Function GetChildProperties(instance As Object, filter As Attribute()) As PropertyDescriptorCollection
If GetChildPropertiesHandler IsNot Nothing Then
Return GetChildPropertiesHandler(instance, filter)
End If
If _BaseDescriptor IsNot Nothing Then
Return _BaseDescriptor.GetChildProperties(instance, filter)
End If
Return MyBase.GetChildProperties(instance, filter)
End Function
Protected Overrides ReadOnly Property NameHashCode() As Integer
Get
If _Name IsNot Nothing Then
Return _Name.GetHashCode()
End If
Return MyBase.NameHashCode
End Get
End Property
#If NOT_USED Then
Private Shared Function BuildAttributes(displayName As String, category As String, description As String, isReadOnly As Boolean) As Attribute()
Dim attributes As New List(Of Attribute)()
If displayName IsNot Nothing AndAlso displayName <> DisplayNameAttribute.[Default].DisplayName Then
attributes.Add(New DisplayNameAttribute(displayName))
End If
If category IsNot Nothing AndAlso category <> CategoryAttribute.[Default].Category Then
attributes.Add(New CategoryAttribute(category))
End If
If description IsNot Nothing AndAlso description <> DescriptionAttribute.[Default].Description Then
attributes.Add(New DescriptionAttribute(description))
End If
If isReadOnly <> ReadOnlyAttribute.[Default].IsReadOnly Then
attributes.Add(New ReadOnlyAttribute(isReadOnly))
End If
Return attributes.ToArray()
End Function
#End If
Private Shared Function FilterAttributes(attributes As Attribute()) As Attribute()
Dim dictionary As New Dictionary(Of Object, Attribute)()
For Each attribute As Attribute In attributes
If Not attribute.IsDefaultAttribute() Then
dictionary.Add(attribute.TypeId, attribute)
End If
Next
Dim newAttributes As Attribute() = New Attribute(dictionary.Values.Count - 1) {}
dictionary.Values.CopyTo(newAttributes, 0)
Return newAttributes
End Function
End Class
|
nublet/APRBase
|
APRBase.ConnectionDialog/DynamicPropertyDescriptor.vb
|
Visual Basic
|
mit
| 14,777
|
Option Explicit On
Option Strict On
Public Class VariableParser
Inherits DeclarationParser
Public Overrides ReadOnly Property lookAhead As Token
get
Return Token.VARIABLE_KEYWORD
End get
End property
End Class
|
ananse/ananse
|
src/ast/parsers/VariableParser.vb
|
Visual Basic
|
mit
| 254
|
Imports ExcelDna.Integration
Imports ExcelDna.Integration.XlCall
Imports Microsoft.VisualBasic.FileIO
Public Module Functions
<ExcelFunction(Name:="ARRAY.MAP", Description:="Evaluates the given function for arrays of input values. ")>
Function ArrayMapN(
<ExcelArgument(Name:="function", Description:="The function to evaluate - either enter the name without any quotes or brackets (for .xll functions), or as a string (for VBA functions)")>
funcNameOrId As Object,
<ExcelArgument(Description:="The input value(s) for the first argument (row, column or rectangular range) ")>
input1 As Object,
<ExcelArgument(Description:="The input value(s) for the second argument (row, column or rectangular range) ")>
input2 As Object,
<ExcelArgument(Description:="The input value(s) for the third argument (row, column or rectangular range) ")>
input3 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input4 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input5 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input6 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input7 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input8 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input9 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input10 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input11 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input12 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input13 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input14 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input15 As Object,
<ExcelArgument(Description:="The input value(s) for the next argument (row, column or rectangular range) ")>
input16 As Object)
Dim inputs(15) As Object
inputs(0) = input1
inputs(1) = input2
inputs(2) = input3
inputs(3) = input4
inputs(4) = input5
inputs(5) = input6
inputs(6) = input7
inputs(7) = input8
inputs(8) = input9
inputs(9) = input10
inputs(10) = input11
inputs(11) = input12
inputs(12) = input13
inputs(13) = input14
inputs(14) = input15
inputs(15) = input16
Dim evaluate As Func(Of Object(), Object)
Dim lastPresent As Integer ' 0-based index of the last input that is not Missing
For i = inputs.Length - 1 To 0 Step -1
If TypeOf inputs(i) IsNot ExcelMissing Then
lastPresent = i
Exit For
End If
Next
Dim udfIdentifier ' Either a registerId or a string name
If TypeOf funcNameOrId Is Double Then
udfIdentifier = funcNameOrId
ElseIf TypeOf funcNameOrId Is String Then
' First try to get the RegisterId, if it's an .xll UDF
Dim registerId As Object
registerId = Excel(xlfEvaluate, funcNameOrId)
If TypeOf registerId Is Double Then
udfIdentifier = registerId
Else
udfIdentifier = funcNameOrId
End If
Else
' Something we don't understand
Return ExcelError.ExcelErrorValue
End If
evaluate = Function(args)
Dim evalInput(args.Length) As Object
evalInput(0) = udfIdentifier
Array.Copy(args, 0, evalInput, 1, args.Length)
Return Excel(xlUDF, evalInput)
End Function
' An input argument might appear in both of these collections, if it is a non-skinny rectangle
Dim rowInputs As New List(Of Integer)
Dim colInputs As New List(Of Integer)
For i As Integer = 0 To lastPresent
If TypeOf inputs(i) Is Object(,) Then
Dim rows = inputs(i).GetLength(0)
Dim cols = inputs(i).GetLength(1)
If rows > 1 Then
If cols > 1 Then
Return ExcelError.ExcelErrorValue
End If
colInputs.Add(i)
ElseIf cols > 1 Then
rowInputs.Add(i)
End If
End If
Next
Dim numOutRows As Integer
Dim numOutCols As Integer
If colInputs.Count = 0 Then
numOutRows = 1
Else
' TODO: Check that all of the column inputs have the same length
Dim firstColInput As Object(,) = inputs(colInputs(0))
numOutRows = firstColInput.GetLength(0)
End If
If rowInputs.Count = 0 Then
numOutCols = 1
Else
' TODO: Check
Dim firstRowInput As Object(,) = inputs(rowInputs(0))
numOutCols = firstRowInput.GetLength(1)
End If
Dim output(numOutRows - 1, numOutCols - 1) As Object
For i = 0 To numOutRows - 1
For j As Integer = 0 To numOutCols - 1
Dim args(lastPresent) As Object
For index = 0 To lastPresent ' Do this stuff for each arg index
If rowInputs.Contains(index) Then
' inputs(index) is a row
args(index) = inputs(index)(0, j)
ElseIf colInputs.Contains(index) Then
' inputs(index) is a column
args(index) = inputs(index)(i, 0)
Else
' input might still be a 1x1 array, which we want to dereference
If TypeOf inputs(index) Is Object(,) Then
args(index) = inputs(index)(0, 0)
Else
args(index) = inputs(index)
End If
End If
Next
output(i, j) = evaluate(args)
Next
Next
Return output
End Function
#If DEBUG Then
<ExcelFunction(IsHidden:=True)>
Function Describe1(x)
Return x.ToString()
End Function
<ExcelFunction(IsHidden:=True)>
Function Describe2(x, y)
Return x.ToString() & "|" & y.ToString()
End Function
<ExcelFunction(IsHidden:=True)>
Function TestArray()
Return New Object(,) {{"x"}}
End Function
#End If
<ExcelFunction(Name:="ARRAY.FROMFILE", Description:="Reads the contents of a delimited file")>
Function ArrayFromFile(<ExcelArgument("Full path to the file to read")> Path As String,
<ExcelArgument(Name:="[SkipHeader]", Description:="Skips the first line of the file - default False")> skipHeader As Object,
<ExcelArgument(Name:="[Delimiter]", Description:="Sets the delimiter to accept - default ','")> delimiter As Object)
Dim lines As New List(Of String())
Using csvParser As New TextFieldParser(Path)
If TypeOf delimiter Is ExcelMissing Then
csvParser.SetDelimiters(New String() {","})
Else
csvParser.SetDelimiters(New String() {delimiter}) ' TODO: Accept multiple ?
End If
csvParser.CommentTokens = New String() {"#"}
csvParser.HasFieldsEnclosedInQuotes = True
If Not TypeOf skipHeader Is ExcelMissing AndAlso (skipHeader = True OrElse skipHeader = 1) Then
csvParser.ReadLine()
End If
Do While csvParser.EndOfData = False
lines.Add(csvParser.ReadFields())
Loop
End Using
If lines.Count = 0 Then
Return ""
End If
Dim result(lines.Count - 1, lines(0).Length - 1) As Object
For i As Integer = 0 To lines.Count - 1
For j As Integer = 0 To lines(0).Length - 1
result(i, j) = lines(i)(j)
Next j
Next i
Return result
End Function
<ExcelFunction(Name:="ARRAY.SKIPROWS", Description:="Returns the remainder of an array after skipping the first n rows")>
Function ArraySkipRows(<ExcelArgument(AllowReference:=True)> array As Object, rowsToSkip As Integer)
If TypeOf array Is ExcelReference Then
Dim arrayRef As ExcelReference = array
Return New ExcelReference(arrayRef.RowFirst + rowsToSkip, arrayRef.RowLast, arrayRef.ColumnFirst, arrayRef.ColumnLast, arrayRef.SheetId)
ElseIf TypeOf array Is Object(,) Then
Dim arrayIn As Object(,) = array
Dim result(array.GetLength(0) - rowsToSkip - 1, array.GetLength(1) - 1) As Object
For i As Integer = 0 To result.GetLength(0) - rowsToSkip - 1
For j As Integer = 0 To result.GetLength(1) - 1
result(i, j) = arrayIn(i + rowsToSkip, j)
Next j
Next i
Return result
Else
Return array
End If
End Function
<ExcelFunction(Name:="ARRAY.COLUMN", Description:="Returns a specified column from an array")>
Function ArrayColumn(<ExcelArgument(AllowReference:=True)> array As Object, <ExcelArgument("One-based column index to select")> ColIndex As Integer)
If TypeOf array Is ExcelReference Then
Dim arrayRef As ExcelReference = array
Return New ExcelReference(arrayRef.RowFirst, arrayRef.RowLast, arrayRef.ColumnFirst + ColIndex - 1, arrayRef.ColumnFirst + ColIndex - 1, arrayRef.SheetId)
ElseIf TypeOf array Is Object(,) Then
Dim arrayIn As Object(,) = array
Dim result(array.GetLength(0) - 1, 1) As Object
Dim j As Integer = ColIndex - 1
For i As Integer = 0 To result.GetLength(0) - 1
result(i, 0) = arrayIn(i, j)
Next i
Return result
Else
Return array
End If
End Function
<ExcelFunction(IsHidden:=True)>
Function ArrayConcat(input1 As Object, input2 As Object, input3 As Object, input4 As Object)
Return $"{input1} | {input2} | {input3} | {input4}"
End Function
End Module
|
Excel-DNA/Samples
|
ArrayMap/Functions.vb
|
Visual Basic
|
mit
| 11,588
|
Public NotInheritable Class PersonData
Public Property FirstName As [String]
Public Property LastName As [String]
Public Property Age As Int32
End Class
|
soeleman/Program
|
diKoding/XamlMvvmBasic/XamlMvvmBasicVb/PersonData.vb
|
Visual Basic
|
apache-2.0
| 169
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.VbLibrary.My.MySettings
Get
Return Global.VbLibrary.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
adalon/MSBuilder
|
src/Roslyn/Roslyn.Tests/Content/VbLibrary/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 2,924
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Reflection.Metadata
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGen
Friend Partial Class CodeGenerator
' VB has additional, stronger than CLR requirements on whether a reference to an item
' can be taken.
'
' In particular in VB read-only requirements are recursive.
' For example struct fields of readonly local are also considered readonly.
' If one needs to take a reference of such local it is not enough to not write to the
' reference itself. We need to guarantee that through such reference
' nested fields will not be changed too. Otherwise a clone must be created.
'
' On the other hand CLR only cares about shallow readonlyness.
'
' To have enough information in both cases we use 3-state value (unlike C# that just uses bool)
' That specifies the context under which a reference is taken.
Private Enum AddressKind
' reference may be written to
Writeable
' reference itself will not be written to, but may be used to modify fields.
[ReadOnly]
' will not directly or indirectly assign to the reference or to fields.
Immutable
End Enum
''' <summary>
''' Emits address as in &
'''
''' May introduce a temp which it will return. (otherwise returns null)
''' </summary>
Private Function EmitAddress(expression As BoundExpression, addressKind As AddressKind) As LocalDefinition
Dim kind As BoundKind = expression.Kind
Dim tempOpt As LocalDefinition = Nothing
Dim allowedToTakeReference As Boolean = AllowedToTakeRef(expression, addressKind)
If Not allowedToTakeReference Then
' language says expression should not be mutated. Emit address of a clone.
Return EmitAddressOfTempClone(expression)
End If
Select Case kind
Case BoundKind.Local
Dim boundLocal = DirectCast(expression, BoundLocal)
If IsStackLocal(boundLocal.LocalSymbol) Then
Debug.Assert(boundLocal.LocalSymbol.IsByRef) ' only allow byref locals in this context
' do nothing, it should be on the stack
Else
Dim local = GetLocal(boundLocal)
_builder.EmitLocalAddress(local) ' EmitLocalAddress knows about byref locals
End If
Case BoundKind.Dup
Debug.Assert(DirectCast(expression, BoundDup).IsReference, "taking address of a stack value?")
_builder.EmitOpCode(ILOpCode.Dup)
Case BoundKind.ReferenceAssignment
EmitReferenceAssignment(DirectCast(expression, BoundReferenceAssignment), used:=True, needReference:=True)
Case BoundKind.ConditionalAccessReceiverPlaceholder
' do nothing receiver ref must be already pushed
Debug.Assert(Not expression.Type.IsReferenceType)
Debug.Assert(Not expression.Type.IsValueType)
Case BoundKind.ComplexConditionalAccessReceiver
EmitComplexConditionalAccessReceiverAddress(DirectCast(expression, BoundComplexConditionalAccessReceiver))
Case BoundKind.Parameter
EmitParameterAddress(DirectCast(expression, BoundParameter))
Case BoundKind.FieldAccess
tempOpt = EmitFieldAddress(DirectCast(expression, BoundFieldAccess), addressKind)
Case BoundKind.ArrayAccess
EmitArrayElementAddress(DirectCast(expression, BoundArrayAccess), addressKind)
Case BoundKind.MeReference,
BoundKind.MyClassReference
Debug.Assert(expression.Type.IsValueType, "only valuetypes may need a ref to Me/MyClass")
_builder.EmitOpCode(ILOpCode.Ldarg_0)
Case BoundKind.ValueTypeMeReference
_builder.EmitOpCode(ILOpCode.Ldarg_0)
Case BoundKind.MyBaseReference
Debug.Assert(False, "base is always a reference type, why one may need a reference to it?")
Case BoundKind.Parenthesized
' rewriter should take care of Parenthesized
'
' we do not know how to emit address of a parenthesized without context.
' when it is an argument like goo((arg)), it must be cloned,
' in other cases like (receiver).goo() it might not need to be...
'
Debug.Assert(False, "we should not see parenthesized in EmitAddress.")
Case BoundKind.Sequence
tempOpt = EmitSequenceAddress(DirectCast(expression, BoundSequence), addressKind)
Case BoundKind.SequencePointExpression
EmitSequencePointExpressionAddress(DirectCast(expression, BoundSequencePointExpression), addressKind)
Case BoundKind.PseudoVariable
EmitPseudoVariableAddress(DirectCast(expression, BoundPseudoVariable))
Case BoundKind.Call
Dim [call] = DirectCast(expression, BoundCall)
Debug.Assert([call].Method.ReturnsByRef)
EmitCallExpression([call], UseKind.UsedAsAddress)
Case Else
Throw ExceptionUtilities.UnexpectedValue(kind)
End Select
Return tempOpt
End Function
Private Sub EmitPseudoVariableAddress(expression As BoundPseudoVariable)
EmitExpression(expression.EmitExpressions.GetAddress(expression), used:=True)
End Sub
''' <summary>
''' Emits address of a temp.
''' Used in cases where taking address directly is not possible
''' (typically because expression does not have a home)
'''
''' Will introduce a temp which it will return.
''' </summary>
Private Function EmitAddressOfTempClone(expression As BoundExpression) As LocalDefinition
EmitExpression(expression, True)
Dim value = AllocateTemp(expression.Type, expression.Syntax)
_builder.EmitLocalStore(value)
_builder.EmitLocalAddress(value)
Return value
End Function
Private Function EmitSequenceAddress(sequence As BoundSequence, addressKind As AddressKind) As LocalDefinition
Dim hasLocals As Boolean = Not sequence.Locals.IsEmpty
If hasLocals Then
_builder.OpenLocalScope()
For Each local In sequence.Locals
Me.DefineLocal(local, sequence.Syntax)
Next
End If
Me.EmitSideEffects(sequence.SideEffects)
Debug.Assert(sequence.ValueOpt IsNot Nothing)
Dim tempOpt = Me.EmitAddress(sequence.ValueOpt, addressKind)
' when a sequence Is happened to be a byref receiver
' we may need to extend the life time of the target until we are done accessing it
' {.v ; v = Goo(); v}.Bar() // v should be released after Bar() Is over.
Dim doNotRelease As LocalSymbol = Nothing
If (tempOpt Is Nothing) Then
Dim referencedLocal As BoundLocal = DigForLocal(sequence.ValueOpt)
If (referencedLocal IsNot Nothing) Then
doNotRelease = referencedLocal.LocalSymbol
End If
End If
If hasLocals Then
_builder.CloseLocalScope()
For Each local In sequence.Locals
If (local IsNot doNotRelease) Then
FreeLocal(local)
Else
tempOpt = GetLocal(doNotRelease)
End If
Next
End If
Return tempOpt
End Function
Private Function DigForLocal(value As BoundExpression) As BoundLocal
Select Case value.Kind
Case BoundKind.Local
Dim local = DirectCast(value, BoundLocal)
If Not local.LocalSymbol.IsByRef Then
Return local
End If
Case BoundKind.Sequence
Return DigForLocal((DirectCast(value, BoundSequence)).ValueOpt)
Case BoundKind.FieldAccess
Dim fieldAccess = DirectCast(value, BoundFieldAccess)
If Not fieldAccess.FieldSymbol.IsShared Then
Return DigForLocal(fieldAccess.ReceiverOpt)
End If
End Select
Return Nothing
End Function
''' <summary>
''' Checks if expression represents directly or indirectly a value with its own home.
''' In such cases it is possible to get a reference without loading into a temporary.
'''
''' This is a CLR concept which is weaker than VB's IsLValue.
''' For example all locals are homed even if VB may consider some locals read-only.
''' </summary>
Private Function HasHome(expression As BoundExpression) As Boolean
Select Case expression.Kind
Case BoundKind.Sequence
Dim boundSequenceValue = DirectCast(expression, BoundSequence).ValueOpt
Return boundSequenceValue IsNot Nothing AndAlso Me.HasHome(boundSequenceValue)
Case BoundKind.FieldAccess
Return HasHome(DirectCast(expression, BoundFieldAccess))
Case BoundKind.MeReference,
BoundKind.MyBaseReference,
BoundKind.ArrayAccess,
BoundKind.ReferenceAssignment,
BoundKind.Parameter
Return True
Case BoundKind.Local
'Note: in a case if we have a reference in a stack local, we definitely can "obtain" a reference.
' Unlike a case where we have a value.
Dim local = DirectCast(expression, BoundLocal).LocalSymbol
Return Not IsStackLocal(local) OrElse local.IsByRef
Case BoundKind.Call
Dim method = DirectCast(expression, BoundCall).Method
Return method.ReturnsByRef
Case BoundKind.Dup
' For a dupped local we assume that if the dup
' is created for byref local it does have home
Return DirectCast(expression, BoundDup).IsReference
Case BoundKind.ValueTypeMeReference
Return True
End Select
Return False
End Function
''' <summary>
''' Special HasHome for fields. Fields have homes when they are writable.
''' </summary>
Private Function HasHome(fieldAccess As BoundFieldAccess) As Boolean
Dim field = fieldAccess.FieldSymbol
' const fields are literal values with no homes
If field.IsConst AndAlso Not field.IsConstButNotMetadataConstant Then
Return False
End If
If Not field.IsReadOnly Then
Return True
End If
' while readonly fields have home it is not valid to refer to it when not constructing.
If Not TypeSymbol.Equals(field.ContainingType, Me._method.ContainingType, TypeCompareKind.ConsiderEverything) Then
Return False
End If
If field.IsShared Then
Return Me._method.MethodKind = MethodKind.SharedConstructor
Else
Return Me._method.MethodKind = MethodKind.Constructor AndAlso
fieldAccess.ReceiverOpt.Kind = BoundKind.MeReference
End If
End Function
''' <summary>
''' Checks if it is allowed to take a writable reference to expression according to VB rules.
''' </summary>
Private Function AllowedToTakeRef(expression As BoundExpression, addressKind As AddressKind) As Boolean
If expression.Kind = BoundKind.ConditionalAccessReceiverPlaceholder OrElse
expression.Kind = BoundKind.ComplexConditionalAccessReceiver Then
Return addressKind = AddressKind.ReadOnly OrElse addressKind = AddressKind.Immutable
End If
' taking immutable addresses is ok as long as expression has home
If addressKind <> AddressKind.Immutable Then
Select Case expression.Kind
Case BoundKind.Sequence
Dim boundSequenceValue = DirectCast(expression, BoundSequence).ValueOpt
Return boundSequenceValue IsNot Nothing AndAlso Me.AllowedToTakeRef(boundSequenceValue, addressKind)
Case BoundKind.FieldAccess
Return AllowedToTakeRef(DirectCast(expression, BoundFieldAccess), addressKind)
Case BoundKind.Local
' VB has concept of readonly locals. Some constants look like locals too.
Return AllowedToTakeRef(DirectCast(expression, BoundLocal), addressKind)
Case BoundKind.Parameter
' parameters can be readonly (parameters in query lambdas)
' we ignore their read-onlyness for Dev10 compatibility
Return True
Case BoundKind.PseudoVariable
Return True
Case BoundKind.Dup
' If this is a Dup of ByRef local we can use the address directly
Return DirectCast(expression, BoundDup).IsReference
Case BoundKind.MeReference, BoundKind.MyClassReference
' cannot modify Me/MyClass wholesale, but can modify fields
' from within structure methods.
Return addressKind <> CodeGenerator.AddressKind.Writeable
End Select
End If
Return HasHome(expression)
End Function
''' <summary>
''' Checks if it is allowed to take a writable reference to expression according to VB rules.
''' </summary>
Private Function AllowedToTakeRef(boundLocal As BoundLocal, addressKind As AddressKind) As Boolean
Debug.Assert(addressKind <> CodeGenerator.AddressKind.Immutable, "immutable address is always ok")
' TODO: The condition is applicable only when LocalSymbol.IsReadOnly
' cannot write to a readonly local unless explicitly marked as an LValue
If addressKind = CodeGenerator.AddressKind.Writeable AndAlso
boundLocal.LocalSymbol.IsReadOnly AndAlso
Not boundLocal.IsLValue Then
Return False
End If
' cannot take address of homeless local
If Not HasHome(boundLocal) Then
Return False
End If
'TODO: we have to do the following to separate real locals
' from constants.
' ideally we should not see local constants at this point,
' they all should be either true locals (decimal, datetime) or BoundLiterals.
If boundLocal.IsConstant Then
Dim localConstType = boundLocal.Type
If Not localConstType.IsDecimalType AndAlso
Not localConstType.IsDateTimeType Then
' this is not a local. It is a named literal.
Return False
End If
End If
Return True
End Function
''' <summary>
''' Can take a reference.
''' </summary>
Private Function AllowedToTakeRef(fieldAccess As BoundFieldAccess, addressKind As AddressKind) As Boolean
' taking immutable addresses is ok as long as expression has home
If addressKind <> AddressKind.Immutable Then
' If this field itself does not have home it cannot be mutated
If Not HasHome(fieldAccess) Then
Return False
End If
' fields of readonly structs are considered recursively readonly in VB
If fieldAccess.FieldSymbol.ContainingType.IsValueType Then
Dim fieldReceiver = fieldAccess.ReceiverOpt
' even when writing to a field, receiver is accessed as readonly
If fieldReceiver IsNot Nothing AndAlso Not AllowedToTakeRef(fieldReceiver, CodeGenerator.AddressKind.ReadOnly) Then
If Not HasHome(fieldReceiver) Then
' can mutate field since its parent has no home and we will be dealing with a copy
Return True
Else
' this field access is readonly due to language reasons -
' most likely topmost receiver is a readonly local or a runtime const
Return False
End If
End If
End If
End If
Return HasHome(fieldAccess)
End Function
Private Sub EmitArrayElementAddress(arrayAccess As BoundArrayAccess, addressKind As AddressKind)
EmitExpression(arrayAccess.Expression, True)
EmitExpressions(arrayAccess.Indices, True)
Dim elementType As TypeSymbol = arrayAccess.Type
'arrays are covariant, but elements can be written to.
'the flag tells that we do not intend to use the address for writing.
If addressKind <> AddressKind.Writeable AndAlso elementType.IsTypeParameter() Then
_builder.EmitOpCode(ILOpCode.Readonly)
End If
If DirectCast(arrayAccess.Expression.Type, ArrayTypeSymbol).IsSZArray Then
_builder.EmitOpCode(ILOpCode.Ldelema)
EmitSymbolToken(elementType, arrayAccess.Syntax)
Else
_builder.EmitArrayElementAddress(_module.Translate(DirectCast(arrayAccess.Expression.Type, ArrayTypeSymbol)), arrayAccess.Syntax, _diagnostics)
End If
End Sub
Private Function EmitFieldAddress(fieldAccess As BoundFieldAccess, addressKind As AddressKind) As LocalDefinition
Dim field = fieldAccess.FieldSymbol
If fieldAccess.FieldSymbol.IsShared Then
EmitStaticFieldAddress(field, fieldAccess.Syntax)
Return Nothing
Else
Return EmitInstanceFieldAddress(fieldAccess, addressKind)
End If
End Function
Private Sub EmitStaticFieldAddress(field As FieldSymbol, syntaxNode As SyntaxNode)
_builder.EmitOpCode(ILOpCode.Ldsflda)
EmitSymbolToken(field, syntaxNode)
End Sub
Private Sub EmitParameterAddress(parameter As BoundParameter)
Dim slot As Integer = ParameterSlot(parameter)
If Not parameter.ParameterSymbol.IsByRef Then
_builder.EmitLoadArgumentAddrOpcode(slot)
Else
_builder.EmitLoadArgumentOpcode(slot)
End If
End Sub
''' <summary>
''' Emits receiver in a form that allows member accesses ( O or & ). For verifiably
''' reference types it is the actual reference. For generic types it is a address of the
''' receiver with readonly intent. For the value types it is an address of the receiver.
'''
''' isAccessConstrained indicates that receiver is a target of a constrained callvirt
''' in such case it is unnecessary to box a receiver that is typed to a type parameter
'''
''' May introduce a temp which it will return. (otherwise returns null)
''' </summary>
Private Function EmitReceiverRef(receiver As BoundExpression,
isAccessConstrained As Boolean,
addressKind As AddressKind) As LocalDefinition
Dim receiverType = receiver.Type
If IsVerifierReference(receiverType) Then
EmitExpression(receiver, used:=True)
Return Nothing
End If
If receiverType.TypeKind = TypeKind.TypeParameter Then
'[Note: Constraints on a generic parameter only restrict the types that
'the generic parameter may be instantiated with. Verification (see Partition III)
'requires that a field, property or method that a generic parameter is known
'to provide through meeting a constraint, cannot be directly accessed/called
'via the generic parameter unless it is first boxed (see Partition III) or
'the callvirt instruction is prefixed with the constrained. prefix instruction
'(see Partition III). end note]
If isAccessConstrained Then
Return EmitAddress(receiver, AddressKind.ReadOnly)
Else
EmitExpression(receiver, used:=True)
' conditional receivers are already boxed if needed when pushed
If receiver.Kind <> BoundKind.ConditionalAccessReceiverPlaceholder Then
EmitBox(receiverType, receiver.Syntax)
End If
Return Nothing
End If
End If
Debug.Assert(IsVerifierValue(receiverType))
Return EmitAddress(receiver, addressKind)
End Function
''' <summary>
''' May introduce a temp which it will return. (otherwise returns null)
''' </summary>
Private Function EmitInstanceFieldAddress(fieldAccess As BoundFieldAccess, addressKind As AddressKind) As LocalDefinition
Dim field = fieldAccess.FieldSymbol
' writing to a field is considered reading a receiver, unless receiver is a struct and not "Me"
If addressKind = AddressKind.Writeable AndAlso IsMeReceiver(fieldAccess.ReceiverOpt) Then
addressKind = AddressKind.ReadOnly
End If
Dim tempOpt = EmitReceiverRef(fieldAccess.ReceiverOpt, isAccessConstrained:=False, addressKind:=addressKind)
Debug.Assert(HasHome(fieldAccess), "taking a ref of homeless field")
_builder.EmitOpCode(ILOpCode.Ldflda)
EmitSymbolToken(field, fieldAccess.Syntax)
Return tempOpt
End Function
End Class
End Namespace
|
aelij/roslyn
|
src/Compilers/VisualBasic/Portable/CodeGen/EmitAddress.vb
|
Visual Basic
|
apache-2.0
| 23,355
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Editor.Implementation.Outlining
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Outlining
Class EventDeclarationOutliner
Inherits AbstractSyntaxNodeOutliner(Of EventStatementSyntax)
Private Shared Function GetBannerText(eventDeclaration As EventStatementSyntax) As String
Dim builder As New BannerTextBuilder()
For Each modifier In eventDeclaration.Modifiers
builder.Append(modifier.ToString())
builder.Append(" "c)
Next
If Not eventDeclaration.CustomKeyword.Kind = SyntaxKind.None Then
builder.Append(eventDeclaration.CustomKeyword.ToString())
builder.Append(" "c)
End If
builder.Append(eventDeclaration.DeclarationKeyword.ToString())
builder.Append(" "c)
builder.Append(eventDeclaration.Identifier.ToString())
builder.AppendParameterList(eventDeclaration.ParameterList, emptyParentheses:=False)
builder.AppendAsClause(eventDeclaration.AsClause)
builder.AppendImplementsClause(eventDeclaration.ImplementsClause)
builder.Append(" "c)
builder.Append(Ellipsis)
Return builder.ToString()
End Function
Protected Overrides Sub CollectOutliningSpans(eventDeclaration As EventStatementSyntax, spans As List(Of OutliningSpan), cancellationToken As CancellationToken)
VisualBasicOutliningHelpers.CollectCommentsRegions(eventDeclaration, spans)
Dim eventBlock = TryCast(eventDeclaration.Parent, EventBlockSyntax)
If eventBlock IsNot Nothing AndAlso
Not eventBlock.EndEventStatement.IsMissing Then
spans.Add(VisualBasicOutliningHelpers.CreateRegionFromBlock(
eventBlock,
GetBannerText(eventDeclaration),
autoCollapse:=True))
VisualBasicOutliningHelpers.CollectCommentsRegions(eventBlock.EndEventStatement, spans)
End If
End Sub
End Class
End Namespace
|
DavidKarlas/roslyn
|
src/EditorFeatures/VisualBasic/Outlining/Outliners/EventDeclarationOutliner.vb
|
Visual Basic
|
apache-2.0
| 2,394
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.VisualBasic.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Retargeting
Imports MetadataOrDiagnostic = System.Object
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Public NotInheritable Class VisualBasicCompilation
''' <summary>
''' ReferenceManager encapsulates functionality to create an underlying SourceAssemblySymbol
''' (with underlying ModuleSymbols) for Compilation and AssemblySymbols for referenced assemblies
''' (with underlying ModuleSymbols) all properly linked together based on reference resolution
''' between them.
'''
''' ReferenceManager is also responsible for reuse of metadata readers for imported modules and
''' assemblies as well as existing AssemblySymbols for referenced assemblies. In order to do that,
''' it maintains global cache for metadata readers and AssemblySymbols associated with them.
''' The cache uses WeakReferences to refer to the metadata readers and AssemblySymbols to allow
''' memory and resources being reclaimed once they are no longer used. The tricky part about reusing
''' existing AssemblySymbols is to find a set of AssemblySymbols that are created for the referenced
''' assemblies, which (the AssemblySymbols from the set) are linked in a way, consistent with the
''' reference resolution between the referenced assemblies.
'''
''' When existing Compilation is used as a metadata reference, there are scenarios when its underlying
''' SourceAssemblySymbol cannot be used to provide symbols in context of the new Compilation. Consider
''' classic multi-targeting scenario: compilation C1 references v1 of Lib.dll and compilation C2
''' references C1 and v2 of Lib.dll. In this case, SourceAssemblySymbol for C1 is linked to AssemblySymbol
''' for v1 of Lib.dll. However, given the set of references for C2, the same reference for C1 should be
''' resolved against v2 of Lib.dll. In other words, in context of C2, all types from v1 of Lib.dll
''' leaking through C1 (through method signatures, etc.) must be retargeted to the types from v2 of Lib.dll.
''' In this case, ReferenceManager creates a special RetargetingAssemblySymbol for C1, which is responsible
''' for the type retargeting. The RetargetingAssemblySymbols could also be reused for different
''' Compilations, ReferenceManager maintains a cache of RetargetingAssemblySymbols (WeakReferences) for each
''' Compilation.
'''
''' The only public entry point of this class is CreateSourceAssembly() method.
''' </summary>
Friend NotInheritable Class ReferenceManager
Inherits CommonReferenceManager(Of VisualBasicCompilation, AssemblySymbol)
Public Sub New(simpleAssemblyName As String, identityComparer As AssemblyIdentityComparer, observedMetadata As Dictionary(Of MetadataReference, MetadataOrDiagnostic))
MyBase.New(simpleAssemblyName, identityComparer, observedMetadata)
End Sub
Protected Overrides Function GetActualBoundReferencesUsedBy(assemblySymbol As AssemblySymbol) As AssemblySymbol()
Dim refs As New List(Of AssemblySymbol)
For Each [module] In assemblySymbol.Modules
refs.AddRange([module].GetReferencedAssemblySymbols())
Next
For i As Integer = 0 To refs.Count - 1 Step 1
If refs(i).IsMissing Then
refs(i) = Nothing ' Do not expose missing assembly symbols to ReferenceManager.Binder
End If
Next
Return refs.ToArray()
End Function
Protected Overrides Function GetNoPiaResolutionAssemblies(candidateAssembly As AssemblySymbol) As ImmutableArray(Of AssemblySymbol)
If TypeOf candidateAssembly Is SourceAssemblySymbol Then
' This is an optimization, if candidateAssembly links something or explicitly declares local type,
' common reference binder shouldn't reuse this symbol because candidateAssembly won't be in the
' set returned by GetNoPiaResolutionAssemblies(). This also makes things clearer.
Return ImmutableArray(Of AssemblySymbol).Empty
End If
Return candidateAssembly.GetNoPiaResolutionAssemblies()
End Function
Protected Overrides Function IsLinked(candidateAssembly As AssemblySymbol) As Boolean
Return candidateAssembly.IsLinked
End Function
Protected Overrides Function GetCorLibrary(candidateAssembly As AssemblySymbol) As AssemblySymbol
Dim corLibrary As AssemblySymbol = candidateAssembly.CorLibrary
' Do not expose missing assembly symbols to ReferenceManager.Binder
Return If(corLibrary.IsMissing, Nothing, corLibrary)
End Function
Protected Overrides ReadOnly Property MessageProvider As CommonMessageProvider
Get
Return VisualBasic.MessageProvider.Instance
End Get
End Property
Protected Overrides Function CreateAssemblyDataForFile(assembly As PEAssembly,
cachedSymbols As WeakList(Of IAssemblySymbol),
documentationProvider As DocumentationProvider,
sourceAssemblySimpleName As String,
importOptions As MetadataImportOptions,
embedInteropTypes As Boolean) As AssemblyData
Return New AssemblyDataForFile(assembly,
cachedSymbols,
embedInteropTypes,
documentationProvider,
sourceAssemblySimpleName,
importOptions)
End Function
Protected Overrides Function CreateAssemblyDataForCompilation(compilationReference As CompilationReference) As AssemblyData
Dim vbReference = TryCast(compilationReference, VisualBasicCompilationReference)
If vbReference Is Nothing Then
Throw New NotSupportedException(String.Format(VBResources.CantReferenceCompilationFromTypes, compilationReference.GetType(), "Visual Basic"))
End If
Dim result As New AssemblyDataForCompilation(vbReference.Compilation, vbReference.Properties.EmbedInteropTypes)
Debug.Assert(vbReference.Compilation._lazyAssemblySymbol IsNot Nothing)
Return result
End Function
Protected Overrides Function CheckPropertiesConsistency(primaryReference As MetadataReference, duplicateReference As MetadataReference, diagnostics As DiagnosticBag) As Boolean
Return True
End Function
''' <summary>
''' VB allows two weak assembly references of the same simple name be passed to a compilation
''' as long as their versions are different. It ignores culture.
''' </summary>
Protected Overrides Function WeakIdentityPropertiesEquivalent(identity1 As AssemblyIdentity, identity2 As AssemblyIdentity) As Boolean
Return identity1.Version = identity2.Version
End Function
Public Sub CreateSourceAssemblyForCompilation(compilation As VisualBasicCompilation)
' We are reading the Reference Manager state outside of a lock by accessing
' IsBound and HasCircularReference properties.
' Once isBound flag is flipped the state of the manager is available and doesn't change.
'
' If two threads are building SourceAssemblySymbol and the first just updated
' set isBound flag to 1 but not yet set lazySourceAssemblySymbol,
' the second thread may end up reusing the Reference Manager data the first thread calculated.
' That's ok since
' 1) the second thread would produce the same data,
' 2) all results calculated by the second thread will be thrown away since the first thread
' already acquired SymbolCacheAndReferenceManagerStateGuard that is needed to publish the data.
' Given compilation is the first compilation that shares this manager and its symbols are requested.
' Perform full reference resolution and binding.
If Not IsBound AndAlso CreateAndSetSourceAssemblyFullBind(compilation) Then
' we have successfully bound the references for the compilation
ElseIf Not HasCircularReference Then
' Another compilation that shares the manager with the given compilation
' already bound its references and produced tables that we can use to construct
' source assembly symbol faster.
CreateAndSetSourceAssemblyReuseData(compilation)
Else
' We encountered a circular reference while binding the previous compilation.
' This compilation can't share bound references with other compilations. Create a new manager.
' NOTE: The CreateSourceAssemblyFullBind is going to replace compilation's reference manager with newManager.
Dim newManager = New ReferenceManager(Me.SimpleAssemblyName, Me.IdentityComparer, Me.ObservedMetadata)
Dim successful = newManager.CreateAndSetSourceAssemblyFullBind(compilation)
' The new manager isn't shared with any other compilation so there is no other
' thread but the current one could have initialized it.
Debug.Assert(successful)
newManager.AssertBound()
End If
AssertBound()
Debug.Assert(compilation._lazyAssemblySymbol IsNot Nothing)
End Sub
''' <summary>
''' Creates a <see cref="PEAssemblySymbol"/> from specified metadata.
''' </summary>
''' <remarks>
''' Used by EnC to create symbols for emit baseline. The PE symbols are used by <see cref="VisualBasicSymbolMatcher"/>.
'''
''' The assembly references listed in the metadata AssemblyRef table are matched to the resolved references
''' stored on this <see cref="ReferenceManager"/>. Each AssemblyRef is matched against the assembly identities
''' using an exact equality comparison. No unification Or further resolution is performed.
''' </remarks>
Friend Function CreatePEAssemblyForAssemblyMetadata(metadata As AssemblyMetadata, importOptions As MetadataImportOptions) As PEAssemblySymbol
AssertBound()
' If the compilation has a reference from metadata to source assembly we can't share the referenced PE symbols.
Debug.Assert(Not HasCircularReference)
Dim referencedAssembliesByIdentity = New Dictionary(Of AssemblyIdentity, AssemblySymbol)()
For Each symbol In Me.ReferencedAssemblies
referencedAssembliesByIdentity.Add(symbol.Identity, symbol)
Next
Dim assembly = metadata.GetAssembly
Dim peReferences = assembly.AssemblyReferences.SelectAsArray(AddressOf MapAssemblyIdentityToResolvedSymbol, referencedAssembliesByIdentity)
Dim assemblySymbol = New PEAssemblySymbol(assembly, DocumentationProvider.Default, isLinked:=False, importOptions:=importOptions)
Dim unifiedAssemblies = Me.UnifiedAssemblies.WhereAsArray(Function(unified) referencedAssembliesByIdentity.ContainsKey(unified.OriginalReference))
InitializeAssemblyReuseData(assemblySymbol, peReferences, unifiedAssemblies)
If assembly.ContainsNoPiaLocalTypes() Then
assemblySymbol.SetNoPiaResolutionAssemblies(Me.ReferencedAssemblies)
End If
Return assemblySymbol
End Function
Private Shared Function MapAssemblyIdentityToResolvedSymbol(identity As AssemblyIdentity, map As Dictionary(Of AssemblyIdentity, AssemblySymbol)) As AssemblySymbol
Dim symbol As AssemblySymbol = Nothing
If map.TryGetValue(identity, symbol) Then
Return symbol
End If
Return New MissingAssemblySymbol(identity)
End Function
Private Sub CreateAndSetSourceAssemblyReuseData(compilation As VisualBasicCompilation)
AssertBound()
' If the compilation has a reference from metadata to source assembly we can't share the referenced PE symbols.
Debug.Assert(Not HasCircularReference)
Dim moduleName As String = compilation.MakeSourceModuleName()
Dim assemblySymbol = New SourceAssemblySymbol(compilation, Me.SimpleAssemblyName, moduleName, Me.ReferencedModules)
InitializeAssemblyReuseData(assemblySymbol, Me.ReferencedAssemblies, Me.UnifiedAssemblies)
If compilation._lazyAssemblySymbol Is Nothing Then
SyncLock SymbolCacheAndReferenceManagerStateGuard
If compilation._lazyAssemblySymbol Is Nothing Then
compilation._lazyAssemblySymbol = assemblySymbol
Debug.Assert(compilation._referenceManager Is Me)
End If
End SyncLock
End If
End Sub
Private Sub InitializeAssemblyReuseData(assemblySymbol As AssemblySymbol, referencedAssemblies As ImmutableArray(Of AssemblySymbol), unifiedAssemblies As ImmutableArray(Of UnifiedAssembly(Of AssemblySymbol)))
AssertBound()
assemblySymbol.SetCorLibrary(If(Me.CorLibraryOpt, assemblySymbol))
Dim sourceModuleReferences = New ModuleReferences(Of AssemblySymbol)(referencedAssemblies.SelectAsArray(Function(a) a.Identity), referencedAssemblies, unifiedAssemblies)
assemblySymbol.Modules(0).SetReferences(sourceModuleReferences)
Dim assemblyModules = assemblySymbol.Modules
Dim referencedModulesReferences = Me.ReferencedModulesReferences
Debug.Assert(assemblyModules.Length = referencedModulesReferences.Length + 1)
For i = 1 To assemblyModules.Length - 1
assemblyModules(i).SetReferences(referencedModulesReferences(i - 1))
Next
End Sub
' Returns false if another compilation sharing this manager finished binding earlier and we should reuse its results.
Friend Function CreateAndSetSourceAssemblyFullBind(compilation As VisualBasicCompilation) As Boolean
Dim resolutionDiagnostics = DiagnosticBag.GetInstance()
Dim supersedeLowerVersions = compilation.IsSubmission
Dim assemblyReferencesBySimpleName = PooledDictionary(Of String, List(Of ReferencedAssemblyIdentity)).GetInstance()
Try
Dim boundReferenceDirectiveMap As IDictionary(Of ValueTuple(Of String, String), MetadataReference) = Nothing
Dim boundReferenceDirectives As ImmutableArray(Of MetadataReference) = Nothing
Dim referencedAssemblies As ImmutableArray(Of AssemblyData) = Nothing
Dim modules As ImmutableArray(Of PEModule) = Nothing ' To make sure the modules are not collected ahead of time.
Dim explicitReferences As ImmutableArray(Of MetadataReference) = Nothing
Dim referenceMap As ImmutableArray(Of ResolvedReference) = ResolveMetadataReferences(
compilation,
assemblyReferencesBySimpleName,
explicitReferences,
boundReferenceDirectiveMap,
boundReferenceDirectives,
referencedAssemblies,
modules,
resolutionDiagnostics)
Dim assemblyBeingBuiltData As New AssemblyDataForAssemblyBeingBuilt(New AssemblyIdentity(name:=SimpleAssemblyName), referencedAssemblies, modules)
Dim explicitAssemblyData = referencedAssemblies.Insert(0, assemblyBeingBuiltData)
' Let's bind all the references and resolve missing one (if resolver is available)
Dim hasCircularReference As Boolean
Dim corLibraryIndex As Integer
Dim implicitlyResolvedReferences As ImmutableArray(Of MetadataReference) = Nothing
Dim implicitlyResolvedReferenceMap As ImmutableArray(Of ResolvedReference) = Nothing
Dim allAssemblyData As ImmutableArray(Of AssemblyData) = Nothing
Dim bindingResult() As BoundInputAssembly = Bind(compilation,
explicitAssemblyData,
modules,
explicitReferences,
referenceMap,
compilation.Options.MetadataReferenceResolver,
compilation.Options.MetadataImportOptions,
supersedeLowerVersions,
assemblyReferencesBySimpleName,
allAssemblyData,
implicitlyResolvedReferences,
implicitlyResolvedReferenceMap,
resolutionDiagnostics,
hasCircularReference,
corLibraryIndex)
Debug.Assert(bindingResult.Length = allAssemblyData.Length)
Dim references = explicitReferences.AddRange(implicitlyResolvedReferences)
referenceMap = referenceMap.AddRange(implicitlyResolvedReferenceMap)
Dim referencedAssembliesMap As Dictionary(Of MetadataReference, Integer) = Nothing
Dim referencedModulesMap As Dictionary(Of MetadataReference, Integer) = Nothing
Dim aliasesOfReferencedAssemblies As ImmutableArray(Of ImmutableArray(Of String)) = Nothing
BuildReferencedAssembliesAndModulesMaps(
bindingResult,
references,
referenceMap,
modules.Length,
referencedAssemblies.Length,
assemblyReferencesBySimpleName,
supersedeLowerVersions,
referencedAssembliesMap,
referencedModulesMap,
aliasesOfReferencedAssemblies)
' Create AssemblySymbols for assemblies that can't use any existing symbols.
Dim newSymbols As New List(Of Integer)
For i As Integer = 1 To bindingResult.Length - 1 Step 1
If bindingResult(i).AssemblySymbol Is Nothing Then
' symbol hasn't been found in the cache, create a new one
bindingResult(i).AssemblySymbol = DirectCast(allAssemblyData(i), AssemblyDataForMetadataOrCompilation).CreateAssemblySymbol()
newSymbols.Add(i)
End If
Debug.Assert(allAssemblyData(i).IsLinked = bindingResult(i).AssemblySymbol.IsLinked)
Next
Dim assemblySymbol = New SourceAssemblySymbol(compilation, SimpleAssemblyName, compilation.MakeSourceModuleName(), modules)
Dim corLibrary As AssemblySymbol
If corLibraryIndex = 0 Then
corLibrary = assemblySymbol
ElseIf corLibraryIndex > 0 Then
corLibrary = bindingResult(corLibraryIndex).AssemblySymbol
Else
corLibrary = MissingCorLibrarySymbol.Instance
End If
assemblySymbol.SetCorLibrary(corLibrary)
' Setup bound references for newly created AssemblySymbols
' This should be done after we created/found all AssemblySymbols
Dim missingAssemblies As Dictionary(Of AssemblyIdentity, MissingAssemblySymbol) = Nothing
' -1 for assembly being built
Dim totalReferencedAssemblyCount = allAssemblyData.Length - 1
' Setup bound references for newly created SourceAssemblySymbol
Dim moduleReferences As ImmutableArray(Of ModuleReferences(Of AssemblySymbol)) = Nothing
SetupReferencesForSourceAssembly(assemblySymbol,
modules,
totalReferencedAssemblyCount,
bindingResult,
missingAssemblies,
moduleReferences)
If newSymbols.Count > 0 Then
' Only if we detected that a referenced assembly refers to the assembly being built
' we allow the references to get a hold of the assembly being built.
If hasCircularReference Then
bindingResult(0).AssemblySymbol = assemblySymbol
End If
InitializeNewSymbols(newSymbols, assemblySymbol, allAssemblyData, bindingResult, missingAssemblies)
End If
If compilation._lazyAssemblySymbol Is Nothing Then
SyncLock SymbolCacheAndReferenceManagerStateGuard
If compilation._lazyAssemblySymbol Is Nothing Then
If IsBound Then
' Another thread has finished constructing AssemblySymbol for another compilation that shares this manager.
' Drop the results and reuse the symbols that were created for the other compilation.
Return False
End If
UpdateSymbolCacheNoLock(newSymbols, allAssemblyData, bindingResult)
InitializeNoLock(
referencedAssembliesMap,
referencedModulesMap,
boundReferenceDirectiveMap,
boundReferenceDirectives,
ExplicitReferences,
implicitlyResolvedReferences,
hasCircularReference,
resolutionDiagnostics.ToReadOnly(),
If(corLibrary Is assemblySymbol, Nothing, corLibrary),
modules,
moduleReferences,
assemblySymbol.SourceModule.GetReferencedAssemblySymbols(),
aliasesOfReferencedAssemblies,
assemblySymbol.SourceModule.GetUnifiedAssemblies())
' Make sure that the given compilation holds on this instance of reference manager.
Debug.Assert(compilation._referenceManager Is Me OrElse hasCircularReference)
compilation._referenceManager = Me
' Finally, publish the source symbol after all data have been written.
' Once lazyAssemblySymbol is non-null other readers might start reading the data written above.
compilation._lazyAssemblySymbol = assemblySymbol
End If
End SyncLock
End If
Return True
Finally
resolutionDiagnostics.Free()
assemblyReferencesBySimpleName.Free()
End Try
End Function
Private Shared Sub InitializeNewSymbols(newSymbols As List(Of Integer),
assemblySymbol As SourceAssemblySymbol,
assemblies As ImmutableArray(Of AssemblyData),
bindingResult As BoundInputAssembly(),
missingAssemblies As Dictionary(Of AssemblyIdentity, MissingAssemblySymbol))
Debug.Assert(newSymbols.Count > 0)
Dim corLibrary = assemblySymbol.CorLibrary
Debug.Assert(corLibrary IsNot Nothing)
For Each i As Integer In newSymbols
Dim compilationData = TryCast(assemblies(i), AssemblyDataForCompilation)
If compilationData IsNot Nothing Then
SetupReferencesForRetargetingAssembly(bindingResult, i, missingAssemblies, sourceAssemblyDebugOnly:=assemblySymbol)
Else
Dim fileData = DirectCast(assemblies(i), AssemblyDataForFile)
SetupReferencesForFileAssembly(fileData, bindingResult, i, missingAssemblies, sourceAssemblyDebugOnly:=assemblySymbol)
End If
Next
Dim linkedReferencedAssembliesBuilder = ArrayBuilder(Of AssemblySymbol).GetInstance()
' Setup CorLibrary and NoPia stuff for newly created assemblies
For Each i As Integer In newSymbols
If assemblies(i).ContainsNoPiaLocalTypes Then
bindingResult(i).AssemblySymbol.SetNoPiaResolutionAssemblies(
assemblySymbol.Modules(0).GetReferencedAssemblySymbols())
End If
' Setup linked referenced assemblies.
linkedReferencedAssembliesBuilder.Clear()
If assemblies(i).IsLinked Then
linkedReferencedAssembliesBuilder.Add(bindingResult(i).AssemblySymbol)
End If
For Each referenceBinding In bindingResult(i).ReferenceBinding
If referenceBinding.IsBound AndAlso
assemblies(referenceBinding.DefinitionIndex).IsLinked Then
linkedReferencedAssembliesBuilder.Add(
bindingResult(referenceBinding.DefinitionIndex).AssemblySymbol)
End If
Next
If linkedReferencedAssembliesBuilder.Count > 0 Then
linkedReferencedAssembliesBuilder.RemoveDuplicates()
bindingResult(i).AssemblySymbol.SetLinkedReferencedAssemblies(linkedReferencedAssembliesBuilder.ToImmutable())
End If
bindingResult(i).AssemblySymbol.SetCorLibrary(corLibrary)
Next
linkedReferencedAssembliesBuilder.Free()
If missingAssemblies IsNot Nothing Then
For Each missingAssembly In missingAssemblies.Values
missingAssembly.SetCorLibrary(corLibrary)
Next
End If
End Sub
Private Sub UpdateSymbolCacheNoLock(newSymbols As List(Of Integer), assemblies As ImmutableArray(Of AssemblyData), bindingResult As BoundInputAssembly())
' Add new assembly symbols into the cache
For Each i As Integer In newSymbols
Dim compilationData = TryCast(assemblies(i), AssemblyDataForCompilation)
If compilationData IsNot Nothing Then
compilationData.Compilation.CacheRetargetingAssemblySymbolNoLock(bindingResult(i).AssemblySymbol)
Else
Dim fileData = DirectCast(assemblies(i), AssemblyDataForFile)
fileData.CachedSymbols.Add(bindingResult(i).AssemblySymbol)
End If
Next
End Sub
Private Shared Sub SetupReferencesForRetargetingAssembly(
bindingResult() As BoundInputAssembly,
bindingIndex As Integer,
ByRef missingAssemblies As Dictionary(Of AssemblyIdentity, MissingAssemblySymbol),
sourceAssemblyDebugOnly As SourceAssemblySymbol
)
Dim retargetingAssemblySymbol = DirectCast(bindingResult(bindingIndex).AssemblySymbol, Retargeting.RetargetingAssemblySymbol)
Dim modules As ImmutableArray(Of ModuleSymbol) = retargetingAssemblySymbol.Modules
Dim moduleCount = modules.Length
Dim refsUsed As Integer = 0
For j As Integer = 0 To moduleCount - 1 Step 1
Dim referencedAssemblies As ImmutableArray(Of AssemblyIdentity) = retargetingAssemblySymbol.UnderlyingAssembly.Modules(j).GetReferencedAssemblies()
' For source module skip underlying linked references
If j = 0 Then
Dim underlyingReferencedAssemblySymbols As ImmutableArray(Of AssemblySymbol) =
retargetingAssemblySymbol.UnderlyingAssembly.Modules(0).GetReferencedAssemblySymbols()
Dim linkedUnderlyingReferences As Integer = 0
For Each asm As AssemblySymbol In underlyingReferencedAssemblySymbols
If asm.IsLinked Then
linkedUnderlyingReferences += 1
End If
Next
If linkedUnderlyingReferences > 0 Then
Dim filteredReferencedAssemblies As AssemblyIdentity() =
New AssemblyIdentity(referencedAssemblies.Length - linkedUnderlyingReferences - 1) {}
Dim newIndex As Integer = 0
For k As Integer = 0 To underlyingReferencedAssemblySymbols.Length - 1 Step 1
If Not underlyingReferencedAssemblySymbols(k).IsLinked Then
filteredReferencedAssemblies(newIndex) = referencedAssemblies(k)
newIndex += 1
End If
Next
Debug.Assert(newIndex = filteredReferencedAssemblies.Length)
referencedAssemblies = filteredReferencedAssemblies.AsImmutableOrNull()
End If
End If
Dim refsCount As Integer = referencedAssemblies.Length
Dim symbols(refsCount - 1) As AssemblySymbol
Dim unifiedAssemblies As ArrayBuilder(Of UnifiedAssembly(Of AssemblySymbol)) = Nothing
For k As Integer = 0 To refsCount - 1 Step 1
Dim referenceBinding = bindingResult(bindingIndex).ReferenceBinding(refsUsed + k)
If referenceBinding.IsBound Then
symbols(k) = GetAssemblyDefinitionSymbol(bindingResult, referenceBinding, unifiedAssemblies)
Else
symbols(k) = GetOrAddMissingAssemblySymbol(referencedAssemblies(k), missingAssemblies)
End If
Next
Dim moduleReferences As New ModuleReferences(Of AssemblySymbol)(referencedAssemblies, symbols.AsImmutableOrNull(), unifiedAssemblies.AsImmutableOrEmpty())
modules(j).SetReferences(moduleReferences, sourceAssemblyDebugOnly)
refsUsed += refsCount
Next
End Sub
Private Shared Sub SetupReferencesForFileAssembly(
fileData As AssemblyDataForFile,
bindingResult() As BoundInputAssembly,
bindingIndex As Integer,
ByRef missingAssemblies As Dictionary(Of AssemblyIdentity, MissingAssemblySymbol),
sourceAssemblyDebugOnly As SourceAssemblySymbol
)
Dim peAssemblySymbol = DirectCast(bindingResult(bindingIndex).AssemblySymbol, Symbols.Metadata.PE.PEAssemblySymbol)
Dim modules As ImmutableArray(Of ModuleSymbol) = peAssemblySymbol.Modules
Dim moduleCount = modules.Length
Dim refsUsed As Integer = 0
For j As Integer = 0 To moduleCount - 1 Step 1
Dim refsCount As Integer = fileData.Assembly.ModuleReferenceCounts(j)
Dim names(refsCount - 1) As AssemblyIdentity
Dim symbols(refsCount - 1) As AssemblySymbol
fileData.AssemblyReferences.CopyTo(refsUsed, names, 0, refsCount)
Dim unifiedAssemblies As ArrayBuilder(Of UnifiedAssembly(Of AssemblySymbol)) = Nothing
For k As Integer = 0 To refsCount - 1 Step 1
Dim referenceBinding = bindingResult(bindingIndex).ReferenceBinding(refsUsed + k)
If referenceBinding.IsBound Then
symbols(k) = GetAssemblyDefinitionSymbol(bindingResult, referenceBinding, unifiedAssemblies)
Else
symbols(k) = GetOrAddMissingAssemblySymbol(names(k), missingAssemblies)
End If
Next
Dim moduleReferences = New ModuleReferences(Of AssemblySymbol)(names.AsImmutableOrNull(), symbols.AsImmutableOrNull(), unifiedAssemblies.AsImmutableOrEmpty())
modules(j).SetReferences(moduleReferences, sourceAssemblyDebugOnly)
refsUsed += refsCount
Next
End Sub
Private Shared Sub SetupReferencesForSourceAssembly(
sourceAssembly As SourceAssemblySymbol,
modules As ImmutableArray(Of PEModule),
totalReferencedAssemblyCount As Integer,
bindingResult() As BoundInputAssembly,
ByRef missingAssemblies As Dictionary(Of AssemblyIdentity, MissingAssemblySymbol),
ByRef moduleReferences As ImmutableArray(Of ModuleReferences(Of AssemblySymbol))
)
Dim moduleSymbols = sourceAssembly.Modules
Debug.Assert(moduleSymbols.Length = 1 + modules.Length)
Dim moduleReferencesBuilder = If(moduleSymbols.Length > 1, ArrayBuilder(Of ModuleReferences(Of AssemblySymbol)).GetInstance(), Nothing)
Dim refsUsed As Integer = 0
For moduleIndex As Integer = 0 To moduleSymbols.Length - 1 Step 1
Dim refsCount As Integer = If(moduleIndex = 0, totalReferencedAssemblyCount, modules(moduleIndex - 1).ReferencedAssemblies.Length)
Dim identities(refsCount - 1) As AssemblyIdentity
Dim symbols(refsCount - 1) As AssemblySymbol
Dim unifiedAssemblies As ArrayBuilder(Of UnifiedAssembly(Of AssemblySymbol)) = Nothing
For k As Integer = 0 To refsCount - 1 Step 1
Dim boundReference = bindingResult(0).ReferenceBinding(refsUsed + k)
If boundReference.IsBound Then
symbols(k) = GetAssemblyDefinitionSymbol(bindingResult, boundReference, unifiedAssemblies)
Else
symbols(k) = GetOrAddMissingAssemblySymbol(boundReference.ReferenceIdentity, missingAssemblies)
End If
identities(k) = boundReference.ReferenceIdentity
Next
Dim references = New ModuleReferences(Of AssemblySymbol)(identities.AsImmutableOrNull(),
symbols.AsImmutableOrNull(),
unifiedAssemblies.AsImmutableOrEmpty())
If moduleIndex > 0 Then
moduleReferencesBuilder.Add(references)
End If
moduleSymbols(moduleIndex).SetReferences(references, sourceAssembly)
refsUsed += refsCount
Next
moduleReferences = moduleReferencesBuilder.ToImmutableOrEmptyAndFree()
End Sub
Private Shared Function GetAssemblyDefinitionSymbol(bindingResult As BoundInputAssembly(),
referenceBinding As AssemblyReferenceBinding,
ByRef unifiedAssemblies As ArrayBuilder(Of UnifiedAssembly(Of AssemblySymbol))) As AssemblySymbol
Debug.Assert(referenceBinding.IsBound)
Dim assembly = bindingResult(referenceBinding.DefinitionIndex).AssemblySymbol
Debug.Assert(assembly IsNot Nothing)
If referenceBinding.VersionDifference <> 0 Then
If unifiedAssemblies Is Nothing Then
unifiedAssemblies = New ArrayBuilder(Of UnifiedAssembly(Of AssemblySymbol))()
End If
unifiedAssemblies.Add(New UnifiedAssembly(Of AssemblySymbol)(assembly, referenceBinding.ReferenceIdentity))
End If
Return assembly
End Function
Private Shared Function GetOrAddMissingAssemblySymbol(
identity As AssemblyIdentity,
ByRef missingAssemblies As Dictionary(Of AssemblyIdentity, MissingAssemblySymbol)
) As MissingAssemblySymbol
Dim missingAssembly As MissingAssemblySymbol = Nothing
If missingAssemblies Is Nothing Then
missingAssemblies = New Dictionary(Of AssemblyIdentity, MissingAssemblySymbol)()
ElseIf missingAssemblies.TryGetValue(identity, missingAssembly) Then
Return missingAssembly
End If
missingAssembly = New MissingAssemblySymbol(identity)
missingAssemblies.Add(identity, missingAssembly)
Return missingAssembly
End Function
Private MustInherit Class AssemblyDataForMetadataOrCompilation
Inherits AssemblyData
Private _assemblies As List(Of AssemblySymbol)
Private ReadOnly m_Identity As AssemblyIdentity
Private ReadOnly m_ReferencedAssemblies As ImmutableArray(Of AssemblyIdentity)
Private ReadOnly m_EmbedInteropTypes As Boolean
Protected Sub New(identity As AssemblyIdentity,
referencedAssemblies As ImmutableArray(Of AssemblyIdentity),
embedInteropTypes As Boolean)
Debug.Assert(identity IsNot Nothing)
Debug.Assert(Not referencedAssemblies.IsDefault)
m_EmbedInteropTypes = embedInteropTypes
m_Identity = identity
m_ReferencedAssemblies = referencedAssemblies
End Sub
Friend MustOverride Function CreateAssemblySymbol() As AssemblySymbol
Public Overrides ReadOnly Property Identity As AssemblyIdentity
Get
Return m_Identity
End Get
End Property
Public Overrides ReadOnly Property AvailableSymbols As IEnumerable(Of AssemblySymbol)
Get
If (_assemblies Is Nothing) Then
_assemblies = New List(Of AssemblySymbol)()
' This should be done lazy because while we creating
' instances of this type, creation of new SourceAssembly symbols
' might change the set of available AssemblySymbols.
AddAvailableSymbols(_assemblies)
End If
Return _assemblies
End Get
End Property
Protected MustOverride Sub AddAvailableSymbols(assemblies As List(Of AssemblySymbol))
Public Overrides ReadOnly Property AssemblyReferences As ImmutableArray(Of AssemblyIdentity)
Get
Return m_ReferencedAssemblies
End Get
End Property
Public Overrides Function BindAssemblyReferences(assemblies As ImmutableArray(Of AssemblyData), assemblyIdentityComparer As AssemblyIdentityComparer) As AssemblyReferenceBinding()
Return ResolveReferencedAssemblies(m_ReferencedAssemblies, assemblies, definitionStartIndex:=0, assemblyIdentityComparer:=assemblyIdentityComparer)
End Function
Public NotOverridable Overrides ReadOnly Property IsLinked As Boolean
Get
Return m_EmbedInteropTypes
End Get
End Property
End Class
Private NotInheritable Class AssemblyDataForFile
Inherits AssemblyDataForMetadataOrCompilation
Public ReadOnly Assembly As PEAssembly
''' <summary>
''' Guarded by <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>.
''' </summary>
Public ReadOnly CachedSymbols As WeakList(Of IAssemblySymbol)
Public ReadOnly DocumentationProvider As DocumentationProvider
''' <summary>
''' Import options of the compilation being built.
''' </summary>
Private ReadOnly _compilationImportOptions As MetadataImportOptions
' This is the name of the compilation that is being built.
' This should be the assembly name w/o the extension. It is
' used to compute whether or not it is possible that this
' assembly will give friend access to the compilation.
Private ReadOnly _sourceAssemblySimpleName As String
Private _internalsVisibleComputed As Boolean = False
Private _internalsPotentiallyVisibleToCompilation As Boolean = False
Public Sub New(assembly As PEAssembly,
cachedSymbols As WeakList(Of IAssemblySymbol),
embedInteropTypes As Boolean,
documentationProvider As DocumentationProvider,
sourceAssemblySimpleName As String,
compilationImportOptions As MetadataImportOptions)
MyBase.New(assembly.Identity, assembly.AssemblyReferences, embedInteropTypes)
Debug.Assert(documentationProvider IsNot Nothing)
Debug.Assert(cachedSymbols IsNot Nothing)
Me.CachedSymbols = cachedSymbols
Me.Assembly = assembly
Me.DocumentationProvider = documentationProvider
_compilationImportOptions = compilationImportOptions
_sourceAssemblySimpleName = sourceAssemblySimpleName
End Sub
Friend Overrides Function CreateAssemblySymbol() As AssemblySymbol
Return New PEAssemblySymbol(Assembly, DocumentationProvider, IsLinked, EffectiveImportOptions)
End Function
Friend ReadOnly Property InternalsMayBeVisibleToCompilation As Boolean
Get
If Not _internalsVisibleComputed Then
_internalsPotentiallyVisibleToCompilation = InternalsMayBeVisibleToAssemblyBeingCompiled(_sourceAssemblySimpleName, Assembly)
_internalsVisibleComputed = True
End If
Return _internalsPotentiallyVisibleToCompilation
End Get
End Property
Friend ReadOnly Property EffectiveImportOptions As MetadataImportOptions
Get
If InternalsMayBeVisibleToCompilation AndAlso _compilationImportOptions = MetadataImportOptions.Public Then
Return MetadataImportOptions.Internal
End If
Return _compilationImportOptions
End Get
End Property
Protected Overrides Sub AddAvailableSymbols(assemblies As List(Of AssemblySymbol))
Dim internalsMayBeVisibleToCompilation = Me.InternalsMayBeVisibleToCompilation
' accessing cached symbols requires a lock
SyncLock SymbolCacheAndReferenceManagerStateGuard
For Each assemblySymbol In CachedSymbols
Dim peAssembly = TryCast(assemblySymbol, PEAssemblySymbol)
If IsMatchingAssembly(peAssembly) Then
assemblies.Add(peAssembly)
End If
Next
End SyncLock
End Sub
Public Overrides Function IsMatchingAssembly(candidateAssembly As AssemblySymbol) As Boolean
Return IsMatchingAssembly(TryCast(candidateAssembly, PEAssemblySymbol))
End Function
Private Overloads Function IsMatchingAssembly(peAssembly As PEAssemblySymbol) As Boolean
If peAssembly Is Nothing Then
Return False
End If
If peAssembly.Assembly IsNot Me.Assembly Then
Return False
End If
If EffectiveImportOptions <> peAssembly.PrimaryModule.ImportOptions Then
Return False
End If
' TODO (tomat):
' We shouldn't need to compare documentation providers. All symbols in the cachedSymbols list
' should share the same provider - as they share the same metadata.
' Removing the Equals call also avoids calling user code while holding a lock.
If Not peAssembly.DocumentationProvider.Equals(DocumentationProvider) Then
Return False
End If
Return True
End Function
Public Overrides ReadOnly Property ContainsNoPiaLocalTypes() As Boolean
Get
Return Assembly.ContainsNoPiaLocalTypes()
End Get
End Property
Public Overrides ReadOnly Property DeclaresTheObjectClass As Boolean
Get
Return Assembly.DeclaresTheObjectClass
End Get
End Property
Public Overrides ReadOnly Property SourceCompilation As Compilation
Get
Return Nothing
End Get
End Property
End Class
Private NotInheritable Class AssemblyDataForCompilation
Inherits AssemblyDataForMetadataOrCompilation
Public ReadOnly Compilation As VisualBasicCompilation
Public Sub New(compilation As VisualBasicCompilation, embedInteropTypes As Boolean)
MyBase.New(compilation.Assembly.Identity, GetReferencedAssemblies(compilation), embedInteropTypes)
Debug.Assert(compilation IsNot Nothing)
Me.Compilation = compilation
End Sub
Private Shared Function GetReferencedAssemblies(compilation As VisualBasicCompilation) As ImmutableArray(Of AssemblyIdentity)
' Collect information about references
Dim refs = ArrayBuilder(Of AssemblyIdentity).GetInstance()
Dim modules = compilation.Assembly.Modules
' Filter out linked assemblies referenced by the source module.
Dim sourceReferencedAssemblies = modules(0).GetReferencedAssemblies()
Dim sourceReferencedAssemblySymbols = modules(0).GetReferencedAssemblySymbols()
Debug.Assert(sourceReferencedAssemblies.Length = sourceReferencedAssemblySymbols.Length)
For i = 0 To sourceReferencedAssemblies.Length - 1
If Not sourceReferencedAssemblySymbols(i).IsLinked Then
refs.Add(sourceReferencedAssemblies(i))
End If
Next
For i = 1 To modules.Length - 1
refs.AddRange(modules(i).GetReferencedAssemblies())
Next
Return refs.ToImmutableAndFree()
End Function
Friend Overrides Function CreateAssemblySymbol() As AssemblySymbol
Return New RetargetingAssemblySymbol(Compilation.SourceAssembly, IsLinked)
End Function
Protected Overrides Sub AddAvailableSymbols(assemblies As List(Of AssemblySymbol))
assemblies.Add(Compilation.Assembly)
' accessing cached symbols requires a lock
SyncLock SymbolCacheAndReferenceManagerStateGuard
Compilation.AddRetargetingAssemblySymbolsNoLock(assemblies)
End SyncLock
End Sub
Public Overrides Function IsMatchingAssembly(candidateAssembly As AssemblySymbol) As Boolean
Dim retargeting = TryCast(candidateAssembly, RetargetingAssemblySymbol)
Dim asm As AssemblySymbol
If retargeting IsNot Nothing Then
asm = retargeting.UnderlyingAssembly
Else
asm = TryCast(candidateAssembly, SourceAssemblySymbol)
End If
Debug.Assert(TypeOf asm IsNot RetargetingAssemblySymbol)
Return asm Is Compilation.Assembly
End Function
Public Overrides ReadOnly Property ContainsNoPiaLocalTypes As Boolean
Get
Return Compilation.MightContainNoPiaLocalTypes()
End Get
End Property
Public Overrides ReadOnly Property DeclaresTheObjectClass As Boolean
Get
Return Compilation.DeclaresTheObjectClass
End Get
End Property
Public Overrides ReadOnly Property SourceCompilation As Compilation
Get
Return Compilation
End Get
End Property
End Class
''' <summary>
''' For testing purposes only.
''' </summary>
Friend Shared Function IsSourceAssemblySymbolCreated(compilation As VisualBasicCompilation) As Boolean
Return compilation._lazyAssemblySymbol IsNot Nothing
End Function
''' <summary>
''' For testing purposes only.
''' </summary>
Friend Shared Function IsReferenceManagerInitialized(compilation As VisualBasicCompilation) As Boolean
Return compilation._referenceManager.IsBound
End Function
End Class
End Class
End Namespace
|
VPashkov/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb
|
Visual Basic
|
apache-2.0
| 54,113
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Represents a source parameter cloned from another <see cref="SourceParameterSymbol"/> ,
''' when they must share attribute data.
''' </summary>
''' <remarks>
''' For example, parameters on delegate Invoke method are cloned to delegate BeginInvoke, EndInvoke methods.
''' </remarks>
Friend MustInherit Class SourceClonedParameterSymbol
Inherits SourceParameterSymbolBase
Protected ReadOnly _originalParam As SourceParameterSymbolBase
Friend Sub New(originalParam As SourceParameterSymbolBase, newOwner As MethodSymbol, newOrdinal As Integer)
MyBase.New(newOwner, newOrdinal)
Debug.Assert(originalParam IsNot Nothing)
_originalParam = originalParam
End Sub
Public Overrides ReadOnly Property IsImplicitlyDeclared As Boolean
Get
Return True
End Get
End Property
Public Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference)
Get
' Since you can't get from the syntax node that represents the original parameter
' back to this symbol we decided not to return the original syntax node here.
Return ImmutableArray(Of SyntaxReference).Empty
End Get
End Property
#Region "Forwarded"
Public Overrides ReadOnly Property Type As TypeSymbol
Get
Return _originalParam.Type
End Get
End Property
Friend Overrides ReadOnly Property IsMetadataIn As Boolean
Get
Return _originalParam.IsMetadataIn
End Get
End Property
Friend Overrides ReadOnly Property IsMetadataOut As Boolean
Get
Return _originalParam.IsMetadataOut
End Get
End Property
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return _originalParam.Locations
End Get
End Property
Public Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData)
Return _originalParam.GetAttributes()
End Function
Public Overrides ReadOnly Property Name As String
Get
Return _originalParam.Name
End Get
End Property
Public Overrides ReadOnly Property CustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return _originalParam.CustomModifiers
End Get
End Property
Public Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return _originalParam.RefCustomModifiers
End Get
End Property
Friend Overloads Overrides ReadOnly Property ExplicitDefaultConstantValue(inProgress As SymbolsInProgress(Of ParameterSymbol)) As ConstantValue
Get
Return _originalParam.ExplicitDefaultConstantValue(inProgress)
End Get
End Property
Friend Overrides ReadOnly Property HasParamArrayAttribute As Boolean
Get
Return _originalParam.HasParamArrayAttribute
End Get
End Property
Friend Overrides ReadOnly Property HasDefaultValueAttribute As Boolean
Get
Return _originalParam.HasDefaultValueAttribute
End Get
End Property
Public Overrides ReadOnly Property HasExplicitDefaultValue As Boolean
Get
Return _originalParam.HasExplicitDefaultValue
End Get
End Property
Friend Overrides ReadOnly Property HasOptionCompare As Boolean
Get
Return _originalParam.HasOptionCompare
End Get
End Property
Friend Overrides ReadOnly Property IsIDispatchConstant As Boolean
Get
Return _originalParam.IsIDispatchConstant
End Get
End Property
Friend Overrides ReadOnly Property IsIUnknownConstant As Boolean
Get
Return _originalParam.IsIUnknownConstant
End Get
End Property
Public Overrides ReadOnly Property IsByRef As Boolean
Get
Return _originalParam.IsByRef
End Get
End Property
Friend Overrides ReadOnly Property IsExplicitByRef As Boolean
Get
Return _originalParam.IsExplicitByRef
End Get
End Property
Public Overrides ReadOnly Property IsOptional As Boolean
Get
Return _originalParam.IsOptional
End Get
End Property
Public Overrides ReadOnly Property IsParamArray As Boolean
Get
Return _originalParam.IsParamArray
End Get
End Property
Friend Overrides ReadOnly Property MarshallingInformation As MarshalPseudoCustomAttributeData
Get
Return _originalParam.MarshallingInformation
End Get
End Property
#End Region
Friend Overrides Function WithTypeAndCustomModifiers(type As TypeSymbol, customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier)) As ParameterSymbol
Return New SourceClonedParameterSymbolWithCustomModifiers(Me, DirectCast(Me.ContainingSymbol, MethodSymbol), Me.Ordinal, type, customModifiers, refCustomModifiers)
End Function
Friend NotInheritable Class SourceClonedParameterSymbolWithCustomModifiers
Inherits SourceClonedParameterSymbol
Private ReadOnly _type As TypeSymbol
Private ReadOnly _customModifiers As ImmutableArray(Of CustomModifier)
Private ReadOnly _refCustomModifiers As ImmutableArray(Of CustomModifier)
Friend Sub New(
originalParam As SourceClonedParameterSymbol,
newOwner As MethodSymbol,
newOrdinal As Integer,
type As TypeSymbol,
customModifiers As ImmutableArray(Of CustomModifier),
refCustomModifiers As ImmutableArray(Of CustomModifier)
)
MyBase.New(originalParam, newOwner, newOrdinal)
_type = type
_customModifiers = customModifiers.NullToEmpty()
_refCustomModifiers = refCustomModifiers.NullToEmpty()
Debug.Assert(_refCustomModifiers.IsEmpty OrElse IsByRef)
End Sub
Public Overrides ReadOnly Property Type As TypeSymbol
Get
Return _type
End Get
End Property
Public Overrides ReadOnly Property CustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return _customModifiers
End Get
End Property
Public Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return _refCustomModifiers
End Get
End Property
Friend Overrides ReadOnly Property IsCallerLineNumber As Boolean
Get
Return _originalParam.IsCallerLineNumber
End Get
End Property
Friend Overrides ReadOnly Property IsCallerMemberName As Boolean
Get
Return _originalParam.IsCallerMemberName
End Get
End Property
Friend Overrides ReadOnly Property IsCallerFilePath As Boolean
Get
Return _originalParam.IsCallerFilePath
End Get
End Property
Friend Overrides ReadOnly Property CallerArgumentExpressionParameterIndex As Integer
Get
Return _originalParam.CallerArgumentExpressionParameterIndex
End Get
End Property
Friend Overrides Function WithTypeAndCustomModifiers(type As TypeSymbol, customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier)) As ParameterSymbol
Throw ExceptionUtilities.Unreachable
End Function
End Class
End Class
End Namespace
|
sharwell/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/Source/SourceClonedParameterSymbol.vb
|
Visual Basic
|
mit
| 8,768
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class Binder
''' <summary>
''' Used to store the bound field and property initializers and the associated list of
''' bound assignment statements because they are reused for multiple constructors
''' </summary>
Friend Class ProcessedFieldOrPropertyInitializers
Friend ReadOnly BoundInitializers As ImmutableArray(Of BoundInitializer)
''' <summary>
''' Indicate the fact that binding of initializers produced a tree with errors.
''' This property does not indicate whether or not a diagnostic was produced during the
''' binding of the initializers.
''' </summary>
Friend ReadOnly HasAnyErrors As Boolean
Private _LoweredInitializers As ImmutableArray(Of BoundStatement)
Friend Property InitializerStatements As ImmutableArray(Of BoundStatement)
Get
Return _LoweredInitializers
End Get
Set(value As ImmutableArray(Of BoundStatement))
Debug.Assert(value.IsEmpty OrElse Not BoundInitializers.IsEmpty)
_LoweredInitializers = value
End Set
End Property
Friend Shared ReadOnly Empty As ProcessedFieldOrPropertyInitializers =
New ProcessedFieldOrPropertyInitializers(Nothing)
Friend Sub New(boundInitializers As ImmutableArray(Of BoundInitializer))
Me.BoundInitializers = boundInitializers
If Not boundInitializers.IsDefaultOrEmpty Then
For Each initializer In boundInitializers
If initializer.HasErrors Then
HasAnyErrors = True
Exit For
End If
Next
End If
End Sub
Private _analyzed As Boolean = False
Friend Sub EnsureInitializersAnalyzed(constructor As MethodSymbol, diagnostics As DiagnosticBag)
Debug.Assert(constructor IsNot Nothing)
Debug.Assert(constructor.MethodKind = MethodKind.Constructor OrElse constructor.MethodKind = MethodKind.SharedConstructor)
If Not _analyzed Then
If Not Me.BoundInitializers.IsDefaultOrEmpty Then
' Create a dummy block
Dim block As New BoundBlock(Me.BoundInitializers(0).Syntax,
Nothing,
ImmutableArray(Of LocalSymbol).Empty,
StaticCast(Of BoundStatement).From(Me.BoundInitializers))
Analyzer.AnalyzeMethodBody(constructor, block, diagnostics)
DiagnosticsPass.IssueDiagnostics(block, diagnostics, constructor)
End If
_analyzed = True
End If
End Sub
End Class
''' <summary>
''' Binds all field initializers of a <see cref="SourceNamedTypeSymbol"/>.
''' </summary>
''' <param name="symbol">The named type symbol where the field initializers are declared.</param>
''' <param name="scriptCtorOpt">Script constructor or Nothing if not binding top-level statements.</param>
''' <param name="initializers">The initializers itself. For each partial type declaration there is an array of
''' field initializers</param>
''' <param name="processedFieldInitializers">The structure storing the list of processed field initializers.</param>
''' <param name="diagnostics">The diagnostics.</param>
Friend Shared Sub BindFieldAndPropertyInitializers(
symbol As SourceMemberContainerTypeSymbol,
initializers As ImmutableArray(Of ImmutableArray(Of FieldOrPropertyInitializer)),
scriptCtorOpt As MethodSymbol,
ByRef processedFieldInitializers As ProcessedFieldOrPropertyInitializers,
diagnostics As DiagnosticBag
)
Debug.Assert((scriptCtorOpt IsNot Nothing) = symbol.IsScriptClass)
If initializers.IsDefaultOrEmpty Then
Return
End If
Dim moduleSymbol = DirectCast(symbol.ContainingModule, SourceModuleSymbol)
Dim compilation = moduleSymbol.ContainingSourceAssembly.DeclaringCompilation
Dim boundInitializers = ArrayBuilder(Of BoundInitializer).GetInstance()
For i = 0 To initializers.Length - 1
Dim siblingInitializers = initializers(i)
' All sibling initializers share the same parent node and tree
' so we can reuse the parent binder across siblings.
Dim parentBinder As Binder = Nothing
For j = 0 To siblingInitializers.Length - 1
Dim initializer = siblingInitializers(j)
If Not initializer.FieldsOrProperty.IsDefault AndAlso initializer.FieldsOrProperty.First.ContainingType.IsEnumType Then
Continue For
End If
Dim syntaxRef = initializer.Syntax
Dim syntaxTree = syntaxRef.SyntaxTree
Dim initializerNode = DirectCast(syntaxRef.GetSyntax(), VisualBasicSyntaxNode)
If parentBinder Is Nothing Then
' use binder for type, not ctor - no access to ctor parameters
parentBinder = BinderBuilder.CreateBinderForType(moduleSymbol, syntaxTree, symbol)
If scriptCtorOpt IsNot Nothing Then
parentBinder = New TopLevelCodeBinder(scriptCtorOpt, parentBinder)
End If
Else
Debug.Assert(parentBinder.SyntaxTree Is syntaxTree, "sibling initializer array contains initializers from two different syntax trees.")
End If
If initializer.FieldsOrProperty.IsDefault Then
' use the binder of the Script class for global statements
Dim isLast = (i = initializers.Length - 1 AndAlso j = siblingInitializers.Length - 1)
boundInitializers.Add(parentBinder.BindGlobalStatement(DirectCast(initializerNode, StatementSyntax), diagnostics, isLast))
Continue For
End If
Dim firstFieldOrProperty = initializer.FieldsOrProperty.First
Dim initializerBinder = BinderBuilder.CreateBinderForInitializer(parentBinder, firstFieldOrProperty)
If initializerNode.Kind = SyntaxKind.ModifiedIdentifier Then
' Array field with no explicit initializer.
Debug.Assert(initializer.FieldsOrProperty.Length = 1)
Debug.Assert(firstFieldOrProperty.Kind = SymbolKind.Field)
Dim fieldSymbol = DirectCast(firstFieldOrProperty, SourceFieldSymbol)
Debug.Assert(fieldSymbol.HasDeclaredType)
Debug.Assert(fieldSymbol.Type.IsArrayType())
initializerBinder.BindArrayFieldImplicitInitializer(fieldSymbol, boundInitializers, diagnostics)
ElseIf firstFieldOrProperty.Kind = SymbolKind.Field Then
Dim fieldSymbol = DirectCast(firstFieldOrProperty, SourceFieldSymbol)
If fieldSymbol.IsConst Then
' Bind constant to ensure diagnostics are captured,
' only generate a field initializer for decimals and dates, because they can't be compile time
' constant in CLR/IL.
initializerBinder.BindConstFieldInitializer(fieldSymbol,
initializerNode,
boundInitializers)
If fieldSymbol.Type.SpecialType = SpecialType.System_DateTime Then
' report proper diagnostics for System_Runtime_CompilerServices_DateTimeConstantAttribute__ctor if needed
initializerBinder.ReportUseSiteErrorForSynthesizedAttribute(WellKnownMember.System_Runtime_CompilerServices_DateTimeConstantAttribute__ctor,
initializerNode,
diagnostics)
ElseIf fieldSymbol.Type.SpecialType = SpecialType.System_Decimal Then
' report proper diagnostics for System_Runtime_CompilerServices_DecimalConstantAttribute__ctor if needed
initializerBinder.ReportUseSiteErrorForSynthesizedAttribute(WellKnownMember.System_Runtime_CompilerServices_DecimalConstantAttribute__ctor,
initializerNode,
diagnostics)
End If
Else
If fieldSymbol.Type.IsObjectType() AndAlso
initializerBinder.OptionStrict <> VisualBasic.OptionStrict.On AndAlso
fieldSymbol.Syntax IsNot Nothing AndAlso
fieldSymbol.Syntax.Kind = SyntaxKind.ModifiedIdentifier Then
Dim identifier = DirectCast(fieldSymbol.Syntax, ModifiedIdentifierSyntax)
If identifier.Nullable.Node IsNot Nothing AndAlso identifier.Parent IsNot Nothing AndAlso
identifier.Parent.Kind = SyntaxKind.VariableDeclarator AndAlso
DirectCast(identifier.Parent, VariableDeclaratorSyntax).AsClause Is Nothing Then
ReportDiagnostic(diagnostics, identifier, ERRID.ERR_NullableTypeInferenceNotSupported)
End If
End If
initializerBinder.BindFieldInitializer(initializer.FieldsOrProperty,
initializerNode,
boundInitializers,
diagnostics)
End If
Else
Dim propertySymbol = DirectCast(firstFieldOrProperty, PropertySymbol)
initializerBinder.BindPropertyInitializer(propertySymbol,
initializerNode,
boundInitializers,
diagnostics)
End If
Next
Next
processedFieldInitializers = New ProcessedFieldOrPropertyInitializers(
boundInitializers.ToImmutableAndFree())
End Sub
Private Function BindGlobalStatement(statementNode As StatementSyntax, diagnostics As DiagnosticBag, isLast As Boolean) As BoundInitializer
Dim boundStatement As BoundStatement = Me.BindStatement(statementNode, diagnostics)
If Me.Compilation.IsSubmission AndAlso isLast AndAlso boundStatement.Kind = BoundKind.ExpressionStatement AndAlso Not boundStatement.HasErrors Then
Dim submissionReturnType = Me.Compilation.GetSubmissionReturnType()
' insert an implicit conversion to the submission return type (if needed):
Dim expression = (DirectCast(boundStatement, BoundExpressionStatement)).Expression
If expression.Type Is Nothing OrElse expression.Type.SpecialType <> SpecialType.System_Void Then
expression = ApplyImplicitConversion(expression.Syntax, submissionReturnType, expression, diagnostics)
boundStatement = New BoundExpressionStatement(boundStatement.Syntax, expression, expression.HasErrors)
End If
End If
Return New BoundGlobalStatementInitializer(statementNode, boundStatement)
End Function
''' <summary>
''' Bind an initializer for an implicitly allocated array field (for example: Private F(2) As Object).
''' </summary>
Public Sub BindArrayFieldImplicitInitializer(
fieldSymbol As SourceFieldSymbol,
boundInitializers As ArrayBuilder(Of BoundInitializer),
diagnostics As DiagnosticBag)
Debug.Assert(fieldSymbol.Syntax.Kind = SyntaxKind.ModifiedIdentifier)
Debug.Assert(fieldSymbol.Type.Kind = SymbolKind.ArrayType)
Dim syntax = DirectCast(fieldSymbol.Syntax, ModifiedIdentifierSyntax)
Debug.Assert(syntax.ArrayBounds IsNot Nothing)
Dim arraySize = BindArrayBounds(syntax.ArrayBounds, diagnostics)
Dim arrayCreation = New BoundArrayCreation(syntax, arraySize, Nothing, fieldSymbol.Type)
arrayCreation.SetWasCompilerGenerated()
Dim boundReceiver = If(fieldSymbol.IsShared, Nothing, CreateMeReference(syntax, isSynthetic:=True))
Dim boundFieldAccessExpression = New BoundFieldAccess(syntax, boundReceiver, fieldSymbol, True, fieldSymbol.Type)
boundFieldAccessExpression.SetWasCompilerGenerated()
Dim initializer = New BoundFieldOrPropertyInitializer(syntax,
ImmutableArray.Create(Of Symbol)(fieldSymbol),
boundFieldAccessExpression,
arrayCreation)
initializer.SetWasCompilerGenerated()
boundInitializers.Add(initializer)
End Sub
''' <summary>
''' Binds the field initializer. A bound field initializer contains the bound field access and bound init value.
''' </summary>
''' <param name="fieldSymbols">The field symbol.</param>
''' <param name="equalsValueOrAsNewSyntax">The syntax node for the optional initialization.</param>
''' <param name="boundInitializers">The array of bound initializers to add the newly bound ones to.</param>
''' <param name="diagnostics">The diagnostics.</param>
Friend Sub BindFieldInitializer(
fieldSymbols As ImmutableArray(Of Symbol),
equalsValueOrAsNewSyntax As VisualBasicSyntaxNode,
boundInitializers As ArrayBuilder(Of BoundInitializer),
diagnostics As DiagnosticBag,
Optional bindingForSemanticModel As Boolean = False
)
Debug.Assert(Not fieldSymbols.IsEmpty)
Dim firstFieldSymbol = DirectCast(fieldSymbols.First, SourceFieldSymbol)
Debug.Assert(bindingForSemanticModel OrElse Not firstFieldSymbol.IsConst)
Dim boundReceiver = If(firstFieldSymbol.IsShared,
Nothing,
CreateMeReference(firstFieldSymbol.Syntax, isSynthetic:=True))
' Always generate a field access for the first symbol. In cases were we have multiple variables declared we will not
' use it (we don't store it in the bound initializer node), but we still need it for e.g. the data flow analysis
' (stored in the bound lvalue placeholder).
Dim fieldAccess As BoundExpression = New BoundFieldAccess(firstFieldSymbol.Syntax,
boundReceiver,
firstFieldSymbol,
True,
firstFieldSymbol.Type)
fieldAccess.SetWasCompilerGenerated()
Dim asNewVariablePlaceholder As BoundWithLValueExpressionPlaceholder = Nothing
If equalsValueOrAsNewSyntax.Kind = SyntaxKind.AsNewClause Then
' CONSIDER: using a bound field access directly instead of a placeholder for AsNew declarations
' with just one variable
asNewVariablePlaceholder = New BoundWithLValueExpressionPlaceholder(equalsValueOrAsNewSyntax,
firstFieldSymbol.Type)
asNewVariablePlaceholder.SetWasCompilerGenerated()
End If
Dim boundInitExpression As BoundExpression = BindFieldOrPropertyInitializerExpression(equalsValueOrAsNewSyntax,
firstFieldSymbol.Type,
asNewVariablePlaceholder,
diagnostics)
Dim hasErrors = False
' In speculative semantic model scenarios equalsValueOrAsNewSyntax might have no parent.
If equalsValueOrAsNewSyntax.Parent IsNot Nothing Then
Debug.Assert(Me.IsSemanticModelBinder OrElse
fieldSymbols.Length = DirectCast(equalsValueOrAsNewSyntax.Parent, VariableDeclaratorSyntax).Names.Count)
If equalsValueOrAsNewSyntax.Kind() = SyntaxKind.AsNewClause Then
For Each name In DirectCast(equalsValueOrAsNewSyntax.Parent, VariableDeclaratorSyntax).Names
If Not (name.ArrayRankSpecifiers.IsEmpty AndAlso name.ArrayBounds Is Nothing) Then
' Arrays cannot be declared with AsNew syntax
ReportDiagnostic(diagnostics, name, ERRID.ERR_AsNewArray)
hasErrors = True
End If
Next
End If
End If
boundInitializers.Add(New BoundFieldOrPropertyInitializer(
equalsValueOrAsNewSyntax,
fieldSymbols,
If(fieldSymbols.Length = 1, fieldAccess, Nothing),
boundInitExpression,
hasErrors))
End Sub
Friend Sub BindPropertyInitializer(
propertySymbol As PropertySymbol,
initValueOrAsNewNode As VisualBasicSyntaxNode,
boundInitializers As ArrayBuilder(Of BoundInitializer),
diagnostics As DiagnosticBag
)
Dim syntaxNode As VisualBasicSyntaxNode = initValueOrAsNewNode
Dim boundReceiver = If(propertySymbol.IsShared, Nothing, CreateMeReference(syntaxNode, isSynthetic:=True))
' If the property has parameters, BC36759 should have already
' been reported for the auto-implemented property.
Dim hasError = propertySymbol.ParameterCount > 0
Dim boundPropertyOrFieldAccess As BoundExpression
If propertySymbol.IsReadOnly AndAlso propertySymbol.AssociatedField IsNot Nothing Then
' For ReadOnly auto-implemented properties we have to write directly to the backing field.
Debug.Assert(propertySymbol.Type = propertySymbol.AssociatedField.Type)
boundPropertyOrFieldAccess = New BoundFieldAccess(syntaxNode,
boundReceiver,
propertySymbol.AssociatedField,
isLValue:=True,
type:=propertySymbol.Type,
hasErrors:=hasError)
Else
boundPropertyOrFieldAccess = New BoundPropertyAccess(syntaxNode,
propertySymbol,
propertyGroupOpt:=Nothing,
accessKind:=PropertyAccessKind.Set,
isWriteable:=propertySymbol.HasSet,
receiverOpt:=boundReceiver,
arguments:=ImmutableArray(Of BoundExpression).Empty,
hasErrors:=hasError)
End If
boundPropertyOrFieldAccess = BindAssignmentTarget(syntaxNode, boundPropertyOrFieldAccess, diagnostics)
Dim isError As Boolean
boundPropertyOrFieldAccess = AdjustAssignmentTarget(syntaxNode, boundPropertyOrFieldAccess, diagnostics, isError)
boundPropertyOrFieldAccess.SetWasCompilerGenerated()
Dim boundInitExpression = BindFieldOrPropertyInitializerExpression(initValueOrAsNewNode,
propertySymbol.Type,
Nothing,
diagnostics)
boundInitializers.Add(New BoundFieldOrPropertyInitializer(initValueOrAsNewNode,
ImmutableArray.Create(Of Symbol)(propertySymbol),
boundPropertyOrFieldAccess,
boundInitExpression))
End Sub
Private Function BindFieldOrPropertyInitializerExpression(
equalsValueOrAsNewSyntax As VisualBasicSyntaxNode,
targetType As TypeSymbol,
asNewVariablePlaceholderOpt As BoundWithLValueExpressionPlaceholder,
diagnostics As DiagnosticBag
) As BoundExpression
Dim boundInitExpression As BoundExpression = Nothing
Dim fieldInitializerSyntax As VisualBasicSyntaxNode
If equalsValueOrAsNewSyntax.Kind = SyntaxKind.AsNewClause Then
Dim asNew = DirectCast(equalsValueOrAsNewSyntax, AsNewClauseSyntax)
Select Case asNew.NewExpression.Kind
Case SyntaxKind.ObjectCreationExpression
Dim objectCreationExpressionSyntax = DirectCast(asNew.NewExpression, ObjectCreationExpressionSyntax)
boundInitExpression = BindObjectCreationExpression(asNew.NewExpression.Type,
objectCreationExpressionSyntax.ArgumentList,
targetType,
objectCreationExpressionSyntax,
diagnostics,
asNewVariablePlaceholderOpt)
Case SyntaxKind.AnonymousObjectCreationExpression
boundInitExpression = BindAnonymousObjectCreationExpression(
DirectCast(asNew.NewExpression, AnonymousObjectCreationExpressionSyntax), diagnostics)
Case Else
Throw ExceptionUtilities.UnexpectedValue(asNew.NewExpression.Kind)
End Select
fieldInitializerSyntax = asNew
Else
Dim valueSyntax = DirectCast(equalsValueOrAsNewSyntax, EqualsValueSyntax)
fieldInitializerSyntax = valueSyntax.Value
boundInitExpression = BindValue(DirectCast(fieldInitializerSyntax, ExpressionSyntax), diagnostics)
End If
If targetType IsNot Nothing Then
boundInitExpression = ApplyImplicitConversion(boundInitExpression.Syntax,
targetType,
boundInitExpression,
diagnostics)
Else
' Try to reclassify boundInitValue if we still can.
boundInitExpression = MakeRValueAndIgnoreDiagnostics(boundInitExpression)
End If
Return boundInitExpression
End Function
''' <summary>
''' Checks for errors in the constant initialization of a field, and only returns a BoundFieldOrPropertyInitializer for
''' decimals and dates because they aren't compile time constant in CLR. Other data type end up directly in metadata and
''' do not cause a BoundFieldOrPropertyInitializer node.
''' </summary>
''' <param name="fieldSymbol">The field symbol.</param>
''' <param name="equalsValueOrAsNewSyntax">The syntax node for the optional initialization.</param>
''' <param name="boundInitializers">The array of bound initializers to add the newly bound ones to.</param>
Private Sub BindConstFieldInitializer(
fieldSymbol As SourceFieldSymbol,
equalsValueOrAsNewSyntax As VisualBasicSyntaxNode,
boundInitializers As ArrayBuilder(Of BoundInitializer))
Debug.Assert(fieldSymbol.IsConst)
If Not fieldSymbol.IsConstButNotMetadataConstant Then
Return
End If
' Const fields of type Date or Decimal will get initialized in the synthesized shared constructor
' because their value is not regarded as compile time constant by the CLR.
' This will produce sequence points in the shared constructor which is exactly what Dev10 does.
Dim constantValue = fieldSymbol.GetConstantValue(SymbolsInProgress(Of FieldSymbol).Empty)
If constantValue IsNot Nothing Then
Dim meSymbol As ParameterSymbol = Nothing
Dim boundFieldAccessExpr = New BoundFieldAccess(equalsValueOrAsNewSyntax,
Nothing,
fieldSymbol,
True,
fieldSymbol.Type)
boundFieldAccessExpr.SetWasCompilerGenerated()
Dim boundInitValue = New BoundLiteral(equalsValueOrAsNewSyntax,
constantValue,
fieldSymbol.Type)
boundInitializers.Add(New BoundFieldOrPropertyInitializer(equalsValueOrAsNewSyntax,
ImmutableArray.Create(Of Symbol)(fieldSymbol),
boundFieldAccessExpr,
boundInitValue))
End If
End Sub
''' <summary>
''' Binds constant initialization value of the field.
''' </summary>
''' <param name="fieldSymbol">The symbol.</param>
''' <param name="equalsValueOrAsNewSyntax">The initialization syntax.</param>
''' <param name="diagnostics">The diagnostics.</param><returns></returns>
Friend Function BindFieldAndEnumConstantInitializer(
fieldSymbol As FieldSymbol,
equalsValueOrAsNewSyntax As VisualBasicSyntaxNode,
isEnum As Boolean,
diagnostics As DiagnosticBag,
<Out> ByRef constValue As ConstantValue
) As BoundExpression
constValue = Nothing
Dim boundInitValue As BoundExpression = Nothing
Dim initValueDiagnostics = DiagnosticBag.GetInstance
If equalsValueOrAsNewSyntax.Kind = SyntaxKind.EqualsValue Then
Dim equalsValueSyntax As EqualsValueSyntax = DirectCast(equalsValueOrAsNewSyntax, EqualsValueSyntax)
boundInitValue = BindValue(equalsValueSyntax.Value, initValueDiagnostics)
Else
' illegal case, const fields cannot be initialized with AsNew
' all diagnostics here will be ignored because we are just binding for the purpose of storing
' the bound node in a BoundBadNode. The required diagnostics have already been reported in
' SourceFieldSymbol.Type
Dim asNewSyntax = DirectCast(equalsValueOrAsNewSyntax, AsNewClauseSyntax)
Dim ignoredDiagnostics = DiagnosticBag.GetInstance
Dim fieldType = If(fieldSymbol.HasDeclaredType, fieldSymbol.Type, GetSpecialType(SpecialType.System_Object, asNewSyntax, ignoredDiagnostics)) ' prevent recursion if field type is inferred.
Select Case asNewSyntax.NewExpression.Kind
Case SyntaxKind.ObjectCreationExpression
Dim objectCreationExpressionSyntax = DirectCast(asNewSyntax.NewExpression,
ObjectCreationExpressionSyntax)
boundInitValue = BindObjectCreationExpression(asNewSyntax.Type,
objectCreationExpressionSyntax.ArgumentList,
fieldType,
objectCreationExpressionSyntax,
ignoredDiagnostics,
Nothing)
Case SyntaxKind.AnonymousObjectCreationExpression
boundInitValue = BindAnonymousObjectCreationExpression(
DirectCast(asNewSyntax.NewExpression, AnonymousObjectCreationExpressionSyntax), ignoredDiagnostics)
Case Else
Throw ExceptionUtilities.UnexpectedValue(asNewSyntax.NewExpression.Kind)
End Select
boundInitValue = New BoundBadExpression(boundInitValue.Syntax,
LookupResultKind.Empty,
ImmutableArray(Of Symbol).Empty,
ImmutableArray.Create(Of BoundNode)(boundInitValue),
fieldType,
hasErrors:=True)
ignoredDiagnostics.Free()
End If
If Not boundInitValue.HasErrors Then
Dim targetType As TypeSymbol
If fieldSymbol.HasDeclaredType Then
targetType = fieldSymbol.Type
If isEnum Then
targetType = targetType.GetEnumUnderlyingTypeOrSelf
End If
boundInitValue = ApplyImplicitConversion(boundInitValue.Syntax, targetType, boundInitValue, initValueDiagnostics)
Else
targetType = If(boundInitValue.Type, ErrorTypeSymbol.UnknownResultType)
End If
Dim boundInitValueHasErrorsOrConstTypeIsWrong As Boolean =
initValueDiagnostics.HasAnyErrors OrElse fieldSymbol.HasDeclaredType AndAlso Not targetType.IsValidTypeForConstField()
' NOTE: we'll only report ERR_RequiredConstConversion2 ("Conversion from '...' to '.' cannot occur in
' NOTE: a constant expression") and ERR_RequiredConstExpr ("Constant expression is required") in case
' NOTE: the type (if declared) is a valid type for const fields. This is different from Dev10 that sometimes
' NOTE: reported issues and sometimes not
' NOTE: e.g. reports in "const foo as DelegateType = AddressOf methodName" (ERR_ConstAsNonConstant + ERR_RequiredConstExpr)
' NOTE: only type diagnostics for "const s as StructureType = nothing"
If boundInitValueHasErrorsOrConstTypeIsWrong Then
Dim discard = DiagnosticBag.GetInstance
constValue = Me.GetExpressionConstantValueIfAny(boundInitValue, discard, ConstantContext.Default)
discard.Free()
Else
constValue = Me.GetExpressionConstantValueIfAny(boundInitValue, initValueDiagnostics, ConstantContext.Default)
End If
' e.g. the init value of "Public foo as Byte = 2.2" is still considered as constant and therefore a CByte(2)
' is being assigned as the constant value of this field/enum. However in case of Option Strict On there has
' been a diagnostics in the call to ApplyImplicitConversion.
If constValue Is Nothing Then
' set hasErrors to indicate later check not to add more diagnostics.
boundInitValue = BadExpression(boundInitValue.Syntax, boundInitValue, targetType)
End If
End If
diagnostics.AddRange(initValueDiagnostics)
initValueDiagnostics.Free()
Return boundInitValue
End Function
''' <summary>
''' Binds a constant local's value.
''' </summary>
''' <param name="symbol">The local symbol.</param>
''' <param name="type">The local symbol's type. It is passed in because this method is called while the type is being resolved and before it is set.</param>
Friend Function BindLocalConstantInitializer(symbol As LocalSymbol,
type As TypeSymbol,
name As ModifiedIdentifierSyntax,
equalsValueOpt As EqualsValueSyntax,
diagnostics As DiagnosticBag,
<Out> ByRef constValue As ConstantValue) As BoundExpression
constValue = Nothing
Dim valueExpression As BoundExpression = Nothing
If equalsValueOpt IsNot Nothing Then
Dim valueSyntax = equalsValueOpt.Value
If IsBindingImplicitlyTypedLocal(symbol) Then
ReportDiagnostic(diagnostics, name, ERRID.ERR_CircularEvaluation1, symbol)
Return BadExpression(valueSyntax, ErrorTypeSymbol.UnknownResultType)
End If
Dim binder = New LocalInProgressBinder(Me, symbol)
valueExpression = binder.BindValue(valueSyntax, diagnostics)
' When inferring the type, the type is nothing. Only apply conversion if there is a type. If there isn't a type then the
' constant gets the expression type and there is no need to apply a conversion.
If type IsNot Nothing Then
valueExpression = binder.ApplyImplicitConversion(valueSyntax, type, valueExpression, diagnostics)
End If
If Not valueExpression.HasErrors Then
' ExpressionIsConstant is called to report diagnostics at the correct location in the expression.
' Only call ExpressionIsConstant if the expression is good to avoid reporting a bad expression is not
' a constant.
If (valueExpression.Type Is Nothing OrElse Not valueExpression.Type.IsErrorType) Then
constValue = binder.GetExpressionConstantValueIfAny(valueExpression, diagnostics, ConstantContext.Default)
If constValue IsNot Nothing Then
Return valueExpression
End If
End If
' The result is not a constant and is not marked with hasErrors so return a BadExpression.
Return BadExpression(valueSyntax, valueExpression, ErrorTypeSymbol.UnknownResultType)
End If
Else
valueExpression = BadExpression(name, ErrorTypeSymbol.UnknownResultType)
ReportDiagnostic(diagnostics, name, ERRID.ERR_ConstantWithNoValue)
End If
Return valueExpression
End Function
''' <summary>
''' Binds a parameter's default value syntax
''' </summary>
Friend Function BindParameterDefaultValue(
targetType As TypeSymbol,
equalsValueSyntax As EqualsValueSyntax,
diagnostics As DiagnosticBag,
<Out> ByRef constValue As ConstantValue
) As BoundExpression
constValue = Nothing
Dim boundInitValue As BoundExpression = BindValue(equalsValueSyntax.Value, diagnostics)
If Not boundInitValue.HasErrors Then
' Check if the constant can be converted to the parameter type.
If Not targetType.IsErrorType Then
boundInitValue = ApplyImplicitConversion(boundInitValue.Syntax, targetType, boundInitValue, diagnostics)
End If
' Report errors if value is not a constant.
constValue = GetExpressionConstantValueIfAny(boundInitValue, diagnostics, ConstantContext.ParameterDefaultValue)
If constValue Is Nothing Then
boundInitValue = BadExpression(boundInitValue.Syntax, boundInitValue, targetType)
End If
End If
Return boundInitValue
End Function
End Class
End Namespace
|
KashishArora/Roslyn
|
src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb
|
Visual Basic
|
apache-2.0
| 39,056
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18326
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace TestResources.SymbolsTests
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Public Class MultiModule
Private Shared resourceMan As Global.System.Resources.ResourceManager
Private Shared resourceCulture As Global.System.Globalization.CultureInfo
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend Sub New()
MyBase.New
End Sub
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MultiModule", GetType(MultiModule).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Shared Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Consumer() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Consumer", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property mod2() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("mod2", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property mod3() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("mod3", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property MultiModule() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("MultiModule", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
End Class
End Namespace
|
ManishJayaswal/roslyn
|
src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/MultiModule.Designer.vb
|
Visual Basic
|
apache-2.0
| 4,359
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports CompilationCreationTestHelpers
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata.PE
Public Class NoPia
Inherits BasicTestBase
<Fact()>
Public Sub HideLocalTypeDefinitions()
Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences({TestReferences.SymbolsTests.NoPia.LocalTypes1, TestReferences.SymbolsTests.NoPia.LocalTypes2})
Dim localTypes1 = assemblies(0).Modules(0)
Dim localTypes2 = assemblies(1).Modules(0)
Assert.Equal(0, localTypes1.GlobalNamespace.GetMembers("I1").Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetMembers("S1").Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1").GetTypeMembers().Length())
Assert.Equal(0, localTypes2.GlobalNamespace.GetMembers("I1").Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetMembers("S1").Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1").GetTypeMembers().Length())
End Sub
<Fact()>
Public Sub LocalTypeSubstitution1()
Dim assemblies1 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1
})
Dim localTypes1_1 = assemblies1(0)
Dim localTypes2_1 = assemblies1(1)
Dim pia1_1 = assemblies1(2)
Dim varI1 = pia1_1.GlobalNamespace.GetTypeMembers("I1").Single()
Dim varS1 = pia1_1.GlobalNamespace.GetTypeMembers("S1").Single()
Dim varNS1 = pia1_1.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1")
Dim varI2 = varNS1.GetTypeMembers("I2").Single()
Dim varS2 = varNS1.GetTypeMembers("S2").Single()
Dim classLocalTypes1 As NamedTypeSymbol
Dim classLocalTypes2 As NamedTypeSymbol
classLocalTypes1 = localTypes1_1.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_1.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
Dim test1 As MethodSymbol
Dim test2 As MethodSymbol
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
Dim param As ImmutableArray(Of ParameterSymbol)
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies2 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib
})
Dim localTypes1_2 = assemblies2(0)
Dim localTypes2_2 = assemblies2(1)
Assert.NotSame(localTypes1_1, localTypes1_2)
Assert.NotSame(localTypes2_1, localTypes2_2)
Assert.Same(pia1_1, assemblies2(2))
classLocalTypes1 = localTypes1_2.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_2.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies3 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia1
})
Dim localTypes1_3 = assemblies3(0)
Dim localTypes2_3 = assemblies3(1)
Dim pia1_3 = assemblies3(2)
Assert.NotSame(localTypes1_1, localTypes1_3)
Assert.NotSame(localTypes2_1, localTypes2_3)
Assert.NotSame(localTypes1_2, localTypes1_3)
Assert.NotSame(localTypes2_2, localTypes2_3)
Assert.NotSame(pia1_1, pia1_3)
classLocalTypes1 = localTypes1_3.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_3.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Same(pia1_3.GlobalNamespace.GetTypeMembers("I1").Single(), param(0).[Type])
Assert.Same(pia1_3.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1").GetTypeMembers("I2").[Single](), param(1).[Type])
param = test2.Parameters
Dim missing As NoPiaMissingCanonicalTypeSymbol
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
missing = DirectCast(param(0).[Type], NoPiaMissingCanonicalTypeSymbol)
Assert.Same(localTypes2_3, missing.EmbeddingAssembly)
Assert.Null(missing.Guid)
Assert.Equal(varS1.ToTestDisplayString(), missing.FullTypeName)
Assert.Equal("f9c2d51d-4f44-45f0-9eda-c9d599b58257", missing.Scope)
Assert.Equal(varS1.ToTestDisplayString(), missing.Identifier)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies4 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1
})
For i As Integer = 0 To assemblies1.Length - 1 Step 1
Assert.Same(assemblies1(i), assemblies4(i))
Next
Dim assemblies5 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia2,
TestReferences.NetFx.v4_0_21006.mscorlib
})
Dim localTypes1_5 = assemblies5(0)
Dim localTypes2_5 = assemblies5(1)
classLocalTypes1 = localTypes1_5.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_5.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
missing = DirectCast(param(0).[Type], NoPiaMissingCanonicalTypeSymbol)
Assert.Same(localTypes1_5, missing.EmbeddingAssembly)
Assert.Equal("27e3e649-994b-4f58-b3c6-f8089a5f2c01", missing.Guid)
Assert.Equal(varI1.ToTestDisplayString(), missing.FullTypeName)
Assert.Null(missing.Scope)
Assert.Null(missing.Identifier)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies6 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia3,
TestReferences.NetFx.v4_0_21006.mscorlib
})
Dim localTypes1_6 = assemblies6(0)
Dim localTypes2_6 = assemblies6(1)
classLocalTypes1 = localTypes1_6.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_6.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies7 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.NetFx.v4_0_21006.mscorlib
})
Dim localTypes1_7 = assemblies7(0)
Dim localTypes2_7 = assemblies7(1)
classLocalTypes1 = localTypes1_7.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_7.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(TypeKind.[Interface], param(0).[Type].TypeKind)
Assert.Equal(TypeKind.[Interface], param(1).[Type].TypeKind)
Assert.NotEqual(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.NotEqual(SymbolKind.ErrorType, param(1).[Type].Kind)
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies8 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.LocalTypes2,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib
})
Dim localTypes1_8 = assemblies8(0)
Dim localTypes2_8 = assemblies8(1)
Dim pia4_8 = assemblies8(2)
Dim pia1_8 = assemblies8(3)
classLocalTypes1 = localTypes1_8.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_8.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Dim ambiguous As NoPiaAmbiguousCanonicalTypeSymbol
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
ambiguous = DirectCast(param(0).[Type], NoPiaAmbiguousCanonicalTypeSymbol)
Assert.Same(localTypes1_8, ambiguous.EmbeddingAssembly)
Assert.Same(pia4_8.GlobalNamespace.GetTypeMembers("I1").Single(), ambiguous.FirstCandidate)
Assert.Same(pia1_8.GlobalNamespace.GetTypeMembers("I1").Single(), ambiguous.SecondCandidate)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaAmbiguousCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies9 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Library1,
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.NetFx.v4_0_21006.mscorlib
})
Dim library1_9 = assemblies9(0)
Dim localTypes1_9 = assemblies9(1)
Dim assemblies10 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Library1,
TestReferences.SymbolsTests.NoPia.LocalTypes1,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1
})
Dim library1_10 = assemblies10(0)
Dim localTypes1_10 = assemblies10(1)
Assert.NotSame(library1_9, library1_10)
Assert.NotSame(localTypes1_9, localTypes1_10)
GC.KeepAlive(localTypes1_1)
GC.KeepAlive(localTypes2_1)
GC.KeepAlive(pia1_1)
GC.KeepAlive(localTypes1_9)
GC.KeepAlive(library1_9)
End Sub
<Fact()>
Public Sub LocalTypeSubstitution2()
Dim localTypes1Source As String = <text>
public class LocalTypes1
public Sub Test1(x As I1, y As NS1.I2)
End Sub
End Class
</text>.Value
Dim localTypes2Source As String = <text>
public class LocalTypes2
public Sub Test2(x As S1, y As NS1.S2)
End Sub
End Class
</text>.Value
Dim mscorlibRef = TestReferences.NetFx.v4_0_21006.mscorlib
Dim pia1CopyLink = TestReferences.SymbolsTests.NoPia.Pia1Copy.WithEmbedInteropTypes(True)
Dim pia1CopyRef = TestReferences.SymbolsTests.NoPia.Pia1Copy.WithEmbedInteropTypes(False)
' vbc /t:library /vbruntime- LocalTypes1.vb /l:Pia1.dll
Dim localTypes1 = VisualBasicCompilation.Create("LocalTypes1", {Parse(localTypes1Source)}, {pia1CopyLink, mscorlibRef})
Dim localTypes1Asm = localTypes1.Assembly
Dim localTypes2 = VisualBasicCompilation.Create("LocalTypes2", {Parse(localTypes2Source)}, {mscorlibRef, pia1CopyLink})
Dim localTypes2Asm = localTypes2.Assembly
Dim assemblies1 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1,
TestReferences.SymbolsTests.MDTestLib2,
localTypes1,
localTypes2
})
Dim localTypes1_1 = assemblies1(4)
Dim localTypes2_1 = assemblies1(5)
Dim pia1_1 = assemblies1(0)
Assert.NotSame(localTypes1Asm, localTypes1_1)
Assert.Equal(1, localTypes1_1.Modules(0).GetReferencedAssemblies().Length)
Assert.Equal(1, localTypes1_1.Modules(0).GetReferencedAssemblySymbols().Length)
Assert.Same(localTypes1.GetReferencedAssemblySymbol(mscorlibRef), localTypes1_1.Modules(0).GetReferencedAssemblySymbols()(0))
Assert.NotSame(localTypes2Asm, localTypes2_1)
Assert.Equal(1, localTypes2_1.Modules(0).GetReferencedAssemblies().Length)
Assert.Equal(1, localTypes2_1.Modules(0).GetReferencedAssemblySymbols().Length)
Assert.Same(localTypes2.GetReferencedAssemblySymbol(mscorlibRef), localTypes2_1.Modules(0).GetReferencedAssemblySymbols()(0))
Dim varI1 = pia1_1.GlobalNamespace.GetTypeMembers("I1").Single()
Dim varS1 = pia1_1.GlobalNamespace.GetTypeMembers("S1").Single()
Dim varNS1 = pia1_1.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1")
Dim varI2 = varNS1.GetTypeMembers("I2").Single()
Dim varS2 = varNS1.GetTypeMembers("S2").Single()
Dim classLocalTypes1 As NamedTypeSymbol
Dim classLocalTypes2 As NamedTypeSymbol
classLocalTypes1 = localTypes1_1.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_1.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
Dim test1 As MethodSymbol
Dim test2 As MethodSymbol
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
Dim param As ImmutableArray(Of ParameterSymbol)
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies2 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1,
localTypes1,
localTypes2
})
Dim localTypes1_2 = assemblies2(3)
Dim localTypes2_2 = assemblies2(4)
Assert.NotSame(localTypes1_1, localTypes1_2)
Assert.NotSame(localTypes2_1, localTypes2_2)
Assert.Same(pia1_1, assemblies2(0))
classLocalTypes1 = localTypes1_2.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_2.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies3 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
localTypes1,
localTypes2
})
Dim localTypes1_3 = assemblies3(2)
Dim localTypes2_3 = assemblies3(3)
Assert.NotSame(localTypes1_1, localTypes1_3)
Assert.NotSame(localTypes2_1, localTypes2_3)
Assert.NotSame(localTypes1_2, localTypes1_3)
Assert.NotSame(localTypes2_2, localTypes2_3)
Assert.Same(pia1_1, assemblies3(0))
classLocalTypes1 = localTypes1_3.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_3.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies4 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1,
TestReferences.SymbolsTests.MDTestLib2,
localTypes1,
localTypes2
})
For i As Integer = 0 To assemblies1.Length - 1 Step 1
Assert.Same(assemblies1(i), assemblies4(i))
Next
Dim assemblies5 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia2,
TestReferences.NetFx.v4_0_21006.mscorlib,
localTypes1,
localTypes2
})
Dim localTypes1_5 = assemblies5(2)
Dim localTypes2_5 = assemblies5(3)
classLocalTypes1 = localTypes1_5.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_5.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Dim missing As NoPiaMissingCanonicalTypeSymbol
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
missing = DirectCast(param(0).[Type], NoPiaMissingCanonicalTypeSymbol)
Assert.Same(localTypes1_5, missing.EmbeddingAssembly)
Assert.Equal("27e3e649-994b-4f58-b3c6-f8089a5f2c01", missing.Guid)
Assert.Equal(varI1.ToTestDisplayString(), missing.FullTypeName)
Assert.Null(missing.Scope)
Assert.Null(missing.Identifier)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
missing = DirectCast(param(0).[Type], NoPiaMissingCanonicalTypeSymbol)
Assert.Same(localTypes2_5, missing.EmbeddingAssembly)
Assert.Null(missing.Guid)
Assert.Equal(varS1.ToTestDisplayString(), missing.FullTypeName)
Assert.Equal("f9c2d51d-4f44-45f0-9eda-c9d599b58257", missing.Scope)
Assert.Equal(varS1.ToTestDisplayString(), missing.Identifier)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies6 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia3,
TestReferences.NetFx.v4_0_21006.mscorlib,
localTypes1,
localTypes2
})
Dim localTypes1_6 = assemblies6(2)
Dim localTypes2_6 = assemblies6(3)
classLocalTypes1 = localTypes1_6.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_6.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies7 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.NetFx.v4_0_21006.mscorlib,
localTypes1,
localTypes2
})
Dim pia4_7 = assemblies7(0)
Dim localTypes1_7 = assemblies7(2)
Dim localTypes2_7 = assemblies7(3)
classLocalTypes1 = localTypes1_7.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_7.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(TypeKind.[Interface], param(0).[Type].TypeKind)
Assert.Equal(TypeKind.[Interface], param(1).[Type].TypeKind)
Assert.NotEqual(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.NotEqual(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.Same(pia4_7.GlobalNamespace.GetTypeMembers("I1").Single(), param(0).[Type])
Assert.Same(pia4_7, param(1).[Type].ContainingAssembly)
Assert.Equal("NS1.I2", param(1).[Type].ToTestDisplayString())
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies8 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.SymbolsTests.NoPia.Pia1,
TestReferences.NetFx.v4_0_21006.mscorlib,
localTypes1,
localTypes2
})
Dim localTypes1_8 = assemblies8(3)
Dim localTypes2_8 = assemblies8(4)
Dim pia4_8 = assemblies8(0)
Dim pia1_8 = assemblies8(1)
classLocalTypes1 = localTypes1_8.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_8.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Dim ambiguous As NoPiaAmbiguousCanonicalTypeSymbol
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
ambiguous = DirectCast(param(0).[Type], NoPiaAmbiguousCanonicalTypeSymbol)
Assert.Same(localTypes1_8, ambiguous.EmbeddingAssembly)
Assert.Same(pia4_8.GlobalNamespace.GetTypeMembers("I1").Single(), ambiguous.FirstCandidate)
Assert.Same(pia1_8.GlobalNamespace.GetTypeMembers("I1").Single(), ambiguous.SecondCandidate)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaAmbiguousCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies9 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Library1,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.NetFx.v4_0_21006.mscorlib,
localTypes1
})
Dim library1_9 = assemblies9(0)
Dim localTypes1_9 = assemblies9(3)
Assert.Equal("LocalTypes1", localTypes1_9.Identity.Name)
Dim assemblies10 = MetadataTestHelpers.GetSymbolsForReferences(
{
TestReferences.SymbolsTests.NoPia.Library1,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.NetFx.v4_0_21006.mscorlib,
TestReferences.SymbolsTests.MDTestLib1,
localTypes1
})
Dim library1_10 = assemblies10(0)
Dim localTypes1_10 = assemblies10(4)
Assert.Equal("LocalTypes1", localTypes1_10.Identity.Name)
Assert.NotSame(library1_9, library1_10)
Assert.NotSame(localTypes1_9, localTypes1_10)
GC.KeepAlive(localTypes1_1)
GC.KeepAlive(localTypes2_1)
GC.KeepAlive(pia1_1)
GC.KeepAlive(localTypes1_9)
GC.KeepAlive(library1_9)
End Sub
<Fact()>
Public Sub CyclicReference()
Dim mscorlibRef = TestReferences.SymbolsTests.MDTestLib1
Dim cyclic2Ref = TestReferences.SymbolsTests.Cyclic.Cyclic2.dll
Dim piaRef = TestReferences.SymbolsTests.NoPia.Pia1
Dim localTypes1Ref = TestReferences.SymbolsTests.NoPia.LocalTypes1
Dim tc1 = VisualBasicCompilation.Create("Cyclic1", references:={mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref})
Assert.NotNull(tc1.Assembly)
Dim tc2 = VisualBasicCompilation.Create("Cyclic1", references:={mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref})
Assert.NotNull(tc2.Assembly)
Assert.NotSame(tc1.GetReferencedAssemblySymbol(localTypes1Ref), tc2.GetReferencedAssemblySymbol(localTypes1Ref))
GC.KeepAlive(tc1)
GC.KeepAlive(tc2)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes1()
Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences({TestReferences.SymbolsTests.NoPia.LocalTypes3, TestReferences.SymbolsTests.NoPia.Pia1})
Dim asmLocalTypes3 = assemblies(0)
Dim localTypes3 = asmLocalTypes3.GlobalNamespace.GetTypeMembers("LocalTypes3").Single()
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test1").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test2").ReturnType.Kind)
Assert.Equal(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType.Kind)
Dim illegal As NoPiaIllegalGenericInstantiationSymbol = DirectCast(localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType, NoPiaIllegalGenericInstantiationSymbol)
Assert.Equal("C31(Of I1).I31(Of C33)", illegal.UnderlyingSymbol.ToTestDisplayString())
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test4").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test5").ReturnType)
assemblies = MetadataTestHelpers.GetSymbolsForReferences({TestReferences.SymbolsTests.NoPia.LocalTypes3, TestReferences.SymbolsTests.NoPia.Pia1, TestReferences.NetFx.v4_0_21006.mscorlib})
localTypes3 = assemblies(0).GlobalNamespace.GetTypeMembers("LocalTypes3").Single()
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test1").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test2").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test4").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test5").ReturnType)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test6").ReturnType)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes2()
Dim mscorlibRef = TestReferences.NetFx.v4_0_21006.mscorlib
Dim pia5Link = TestReferences.SymbolsTests.NoPia.Pia5.WithEmbedInteropTypes(True)
Dim pia5Ref = TestReferences.SymbolsTests.NoPia.Pia5.WithEmbedInteropTypes(False)
Dim library2Ref = TestReferences.SymbolsTests.NoPia.Library2.WithEmbedInteropTypes(False)
Dim library2Link = TestReferences.SymbolsTests.NoPia.Library2.WithEmbedInteropTypes(True)
Dim pia1Link = TestReferences.SymbolsTests.NoPia.Pia1.WithEmbedInteropTypes(True)
Dim pia1Ref = TestReferences.SymbolsTests.NoPia.Pia1.WithEmbedInteropTypes(False)
Assert.True(pia1Link.Properties.EmbedInteropTypes)
Assert.False(pia1Ref.Properties.EmbedInteropTypes)
Assert.True(pia5Link.Properties.EmbedInteropTypes)
Assert.False(pia5Ref.Properties.EmbedInteropTypes)
Assert.True(library2Link.Properties.EmbedInteropTypes)
Assert.False(library2Ref.Properties.EmbedInteropTypes)
Dim tc1 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, pia5Link})
Dim pia5Asm1 = tc1.GetReferencedAssemblySymbol(pia5Link)
Assert.True(pia5Asm1.IsLinked)
Dim varI5_1 = pia5Asm1.GlobalNamespace.GetTypeMembers("I5").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI5_1.GetMember(Of MethodSymbol)("Foo").ReturnType)
Dim tc2 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, pia5Ref})
Dim pia5Asm2 = tc2.GetReferencedAssemblySymbol(pia5Ref)
Assert.False(pia5Asm2.IsLinked)
Assert.NotSame(pia5Asm1, pia5Asm2)
Dim varI5_2 = pia5Asm2.GlobalNamespace.GetTypeMembers("I5").Single()
Assert.NotEqual(SymbolKind.ErrorType, varI5_2.GetMember(Of MethodSymbol)("Foo").ReturnType.Kind)
Dim tc3 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Link, pia1Ref})
Dim pia5Asm3 = tc3.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm3 = tc3.GetReferencedAssemblySymbol(library2Ref)
Assert.True(pia5Asm3.IsLinked)
Assert.False(library2Asm3.IsLinked)
Assert.Same(pia5Asm1, pia5Asm3)
Dim varI7_3 = library2Asm3.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_3.GetMember(Of MethodSymbol)("Foo").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, varI7_3.GetMember(Of MethodSymbol)("Bar").ReturnType.Kind)
Dim tc4 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Ref, pia1Ref})
Dim pia5Asm4 = tc4.GetReferencedAssemblySymbol(pia5Ref)
Dim library2Asm4 = tc4.GetReferencedAssemblySymbol(library2Ref)
Assert.False(pia5Asm4.IsLinked)
Assert.False(library2Asm4.IsLinked)
Assert.NotSame(pia5Asm3, pia5Asm4)
Assert.Same(pia5Asm2, pia5Asm4)
Assert.NotSame(library2Asm3, library2Asm4)
Dim varI7_4 = library2Asm4.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.NotEqual(SymbolKind.ErrorType, varI7_4.GetMember(Of MethodSymbol)("Foo").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, varI7_4.GetMember(Of MethodSymbol)("Bar").ReturnType.Kind)
Dim tc5 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Link, pia1Link})
Dim pia1Asm5 = tc5.GetReferencedAssemblySymbol(pia1Link)
Dim pia5Asm5 = tc5.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm5 = tc5.GetReferencedAssemblySymbol(library2Ref)
Assert.True(pia1Asm5.IsLinked)
Assert.True(pia5Asm5.IsLinked)
Assert.False(library2Asm5.IsLinked)
Assert.Same(pia5Asm1, pia5Asm5)
Assert.NotSame(library2Asm5, library2Asm3)
Assert.NotSame(library2Asm5, library2Asm4)
Dim varI7_5 = library2Asm5.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_5.GetMember(Of MethodSymbol)("Foo").ReturnType)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_5.GetMember(Of MethodSymbol)("Bar").ReturnType)
Dim tc6 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Link, pia1Ref})
Dim pia1Asm6 = tc6.GetReferencedAssemblySymbol(pia1Ref)
Dim pia5Asm6 = tc6.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm6 = tc6.GetReferencedAssemblySymbol(library2Ref)
Assert.False(pia1Asm6.IsLinked)
Assert.True(pia5Asm6.IsLinked)
Assert.False(library2Asm6.IsLinked)
Assert.Same(pia5Asm1, pia5Asm6)
Assert.Same(library2Asm6, library2Asm3)
Dim tc7 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Link, pia5Link, pia1Ref})
Dim pia5Asm7 = tc7.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm7 = tc7.GetReferencedAssemblySymbol(library2Link)
Assert.True(pia5Asm7.IsLinked)
Assert.True(library2Asm7.IsLinked)
Assert.Same(pia5Asm1, pia5Asm3)
Assert.NotSame(library2Asm7, library2Asm3)
Assert.NotSame(library2Asm7, library2Asm4)
Assert.NotSame(library2Asm7, library2Asm5)
Dim varI7_7 = library2Asm7.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_7.GetMember(Of MethodSymbol)("Foo").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, varI7_7.GetMember(Of MethodSymbol)("Bar").ReturnType.Kind)
GC.KeepAlive(tc1)
GC.KeepAlive(tc2)
GC.KeepAlive(tc3)
GC.KeepAlive(tc4)
GC.KeepAlive(tc5)
GC.KeepAlive(tc6)
GC.KeepAlive(tc7)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes3()
Dim varmscorlibRef = TestReferences.NetFx.v4_0_21006.mscorlib
Dim varALink = TestReferences.SymbolsTests.NoPia.A.WithEmbedInteropTypes(True)
Dim varARef = TestReferences.SymbolsTests.NoPia.A.WithEmbedInteropTypes(False)
Dim varBLink = TestReferences.SymbolsTests.NoPia.B.WithEmbedInteropTypes(True)
Dim varBRef = TestReferences.SymbolsTests.NoPia.B.WithEmbedInteropTypes(False)
Dim varCLink = TestReferences.SymbolsTests.NoPia.C.WithEmbedInteropTypes(True)
Dim varCRef = TestReferences.SymbolsTests.NoPia.C.WithEmbedInteropTypes(False)
Dim varDLink = TestReferences.SymbolsTests.NoPia.D.WithEmbedInteropTypes(True)
Dim varDRef = TestReferences.SymbolsTests.NoPia.D.WithEmbedInteropTypes(False)
Dim tc1 = VisualBasicCompilation.Create("C1", references:={varmscorlibRef, varCRef, varARef, varBLink})
Dim varA1 = tc1.GetReferencedAssemblySymbol(varARef)
Dim varB1 = tc1.GetReferencedAssemblySymbol(varBLink)
Dim varC1 = tc1.GetReferencedAssemblySymbol(varCRef)
Dim tc2 = VisualBasicCompilation.Create("C2", references:={varmscorlibRef, varCRef, varARef, varDRef, varBLink})
Assert.Same(varA1, tc2.GetReferencedAssemblySymbol(varARef))
Assert.Same(varB1, tc2.GetReferencedAssemblySymbol(varBLink))
Assert.Same(varC1, tc2.GetReferencedAssemblySymbol(varCRef))
Dim varD2 = tc2.GetReferencedAssemblySymbol(varDRef)
Dim tc3 = VisualBasicCompilation.Create("C3", references:={varmscorlibRef, varCRef, varBLink})
Assert.Same(varB1, tc3.GetReferencedAssemblySymbol(varBLink))
Assert.True(tc3.GetReferencedAssemblySymbol(varCRef).RepresentsTheSameAssemblyButHasUnresolvedReferencesByComparisonTo(varC1))
Dim tc4 = VisualBasicCompilation.Create("C4", references:={varmscorlibRef, varCRef, varARef, varBRef})
Assert.Same(varA1, tc4.GetReferencedAssemblySymbol(varARef))
Dim varB4 = tc4.GetReferencedAssemblySymbol(varBRef)
Dim varC4 = tc4.GetReferencedAssemblySymbol(varCRef)
Assert.NotSame(varC1, varC4)
Assert.NotSame(varB1, varB4)
Dim tc5 = VisualBasicCompilation.Create("C5", references:={varmscorlibRef, varCRef, varALink, varBLink})
Assert.Same(varB1, tc5.GetReferencedAssemblySymbol(varBLink))
Dim varA5 = tc5.GetReferencedAssemblySymbol(varALink)
Dim varC5 = tc5.GetReferencedAssemblySymbol(varCRef)
Assert.NotSame(varA1, varA5)
Assert.NotSame(varC1, varC5)
Assert.NotSame(varC4, varC5)
Dim tc6 = VisualBasicCompilation.Create("C6", references:={varmscorlibRef, varARef, varBLink, varCLink})
Assert.Same(varA1, tc6.GetReferencedAssemblySymbol(varARef))
Assert.Same(varB1, tc6.GetReferencedAssemblySymbol(varBLink))
Dim varC6 = tc6.GetReferencedAssemblySymbol(varCLink)
Assert.NotSame(varC1, varC6)
Assert.NotSame(varC4, varC6)
Assert.NotSame(varC5, varC6)
Dim tc7 = VisualBasicCompilation.Create("C7", references:={varmscorlibRef, varCRef, varARef})
Assert.Same(varA1, tc7.GetReferencedAssemblySymbol(varARef))
Assert.True(tc7.GetReferencedAssemblySymbol(varCRef).RepresentsTheSameAssemblyButHasUnresolvedReferencesByComparisonTo(varC4))
GC.KeepAlive(tc1)
GC.KeepAlive(tc2)
GC.KeepAlive(tc3)
GC.KeepAlive(tc4)
GC.KeepAlive(tc5)
GC.KeepAlive(tc6)
GC.KeepAlive(tc7)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes4()
Dim localTypes3Source As String = <text>
imports System.Collections.Generic
public class LocalTypes3
public Function Test1() As C31(Of C33).I31(Of C33)
return nothing
End Function
public Function Test2() As C31(Of C33).I31(Of I1)
return nothing
End Function
public Function Test3() As C31(Of I1).I31(Of C33)
return nothing
End Function
public Function Test4() As C31(Of C33).I31(Of I32(Of I1))
return nothing
End Function
public Function Test5() As C31(Of I32(Of I1)).I31(Of C33)
return nothing
End Function
public Function Test6() As List(Of I1)
return nothing
End Function
End Class
public class C31(Of T)
public interface I31(Of S)
End Interface
End Class
public class C32(Of T)
End Class
public interface I32(Of S)
End Interface
public class C33
End Class
</text>.Value
Dim mscorlibRef = TestReferences.NetFx.v4_0_21006.mscorlib
Dim pia1CopyLink = TestReferences.SymbolsTests.NoPia.Pia1Copy.WithEmbedInteropTypes(True)
Dim pia1CopyRef = TestReferences.SymbolsTests.NoPia.Pia1Copy.WithEmbedInteropTypes(False)
' vbc /t:library /vbruntime- LocalTypes3.vb /l:Pia1.dll
Dim varC_LocalTypes3 = VisualBasicCompilation.Create("LocalTypes3", {Parse(localTypes3Source)}, {mscorlibRef, pia1CopyLink})
Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences({TestReferences.SymbolsTests.NoPia.Pia1, varC_LocalTypes3})
Dim asmLocalTypes3 = assemblies(1)
Dim localTypes3 = asmLocalTypes3.GlobalNamespace.GetTypeMembers("LocalTypes3").Single()
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test1").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test2").ReturnType.Kind)
Assert.Equal(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType.Kind)
Dim illegal As NoPiaIllegalGenericInstantiationSymbol = DirectCast(localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType, NoPiaIllegalGenericInstantiationSymbol)
Assert.Equal("C31(Of I1).I31(Of C33)", illegal.UnderlyingSymbol.ToTestDisplayString())
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test4").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test5").ReturnType)
assemblies = MetadataTestHelpers.GetSymbolsForReferences({TestReferences.SymbolsTests.NoPia.Pia1, TestReferences.NetFx.v4_0_21006.mscorlib, varC_LocalTypes3})
localTypes3 = assemblies(2).GlobalNamespace.GetTypeMembers("LocalTypes3").Single()
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test1").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test2").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test4").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test5").ReturnType)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test6").ReturnType)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes5()
Dim pia5Source As String = <text>
imports System.Reflection
imports System.Runtime.CompilerServices
imports System.Runtime.InteropServices
imports System.Collections.Generic
<assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58259")>
<assembly: ImportedFromTypeLib("Pia5.dll")>
<ComImport(), Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c05"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
public interface I5
Function Foo() As List(Of I6)
end interface
<ComImport(), Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c06"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
public interface I6
end interface
</text>.Value
Dim pia1Source As String = <text>
imports System.Reflection
imports System.Runtime.CompilerServices
imports System.Runtime.InteropServices
<assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<assembly: ImportedFromTypeLib("Pia1.dll")>
<ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
public interface I1
void Sub1(x As Integer)
End interface
</text>.Value
Dim library2Source As String = <text>
imports System.Collections.Generic
imports System.Reflection
imports System.Runtime.CompilerServices
imports System.Runtime.InteropServices
<assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58260")>
<assembly: ImportedFromTypeLib("Library2.dll")>
<ComImport(), Guid("27e3e649-994b-4f58-b3c6-f8089a5f2002"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
public interface I7
Function Foo() As List(Of I5)
Function Bar() As List(Of I1)
End interface
</text>.Value
Dim mscorlibRef = TestReferences.NetFx.v4_0_21006.mscorlib
' vbc /t:library /vbruntime- Pia5.vb
Dim varC_Pia5 = VisualBasicCompilation.Create("Pia5", {Parse(pia5Source)}, {mscorlibRef})
Dim pia5Link = New VisualBasicCompilationReference(varC_Pia5, embedInteropTypes:=True)
Dim pia5Ref = New VisualBasicCompilationReference(varC_Pia5, embedInteropTypes:=False)
Assert.True(pia5Link.Properties.EmbedInteropTypes)
Assert.False(pia5Ref.Properties.EmbedInteropTypes)
' vbc /t:library /vbruntime- Pia1.vb
Dim varC_Pia1 = VisualBasicCompilation.Create("Pia1", {Parse(pia1Source)}, {mscorlibRef})
Dim pia1Link = New VisualBasicCompilationReference(varC_Pia1, embedInteropTypes:=True)
Dim pia1Ref = New VisualBasicCompilationReference(varC_Pia1, embedInteropTypes:=False)
Assert.True(pia1Link.Properties.EmbedInteropTypes)
Assert.False(pia1Ref.Properties.EmbedInteropTypes)
' vbc /t:library /vbruntime- /r:Pia1.dll,Pia5.dll Library2.vb
Dim varC_Library2 = VisualBasicCompilation.Create("Library2", {Parse(library2Source)}, {mscorlibRef, pia1Ref, pia5Ref})
Dim library2Ref = New VisualBasicCompilationReference(varC_Library2, embedInteropTypes:=False)
Dim library2Link = New VisualBasicCompilationReference(varC_Library2, embedInteropTypes:=True)
Assert.True(library2Link.Properties.EmbedInteropTypes)
Assert.False(library2Ref.Properties.EmbedInteropTypes)
Dim tc1 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, pia5Link})
Dim pia5Asm1 = tc1.GetReferencedAssemblySymbol(pia5Link)
Assert.True(pia5Asm1.IsLinked)
Dim varI5_1 = pia5Asm1.GlobalNamespace.GetTypeMembers("I5").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI5_1.GetMember(Of MethodSymbol)("Foo").ReturnType)
Dim tc2 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, pia5Ref})
Dim pia5Asm2 = tc2.GetReferencedAssemblySymbol(pia5Ref)
Assert.False(pia5Asm2.IsLinked)
Assert.NotSame(pia5Asm1, pia5Asm2)
Dim varI5_2 = pia5Asm2.GlobalNamespace.GetTypeMembers("I5").Single()
Assert.NotEqual(SymbolKind.ErrorType, varI5_2.GetMember(Of MethodSymbol)("Foo").ReturnType.Kind)
Dim tc3 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Link, pia1Ref})
Dim pia5Asm3 = tc3.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm3 = tc3.GetReferencedAssemblySymbol(library2Ref)
Assert.True(pia5Asm3.IsLinked)
Assert.False(library2Asm3.IsLinked)
Assert.Same(pia5Asm1, pia5Asm3)
Dim varI7_3 = library2Asm3.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_3.GetMember(Of MethodSymbol)("Foo").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, varI7_3.GetMember(Of MethodSymbol)("Bar").ReturnType.Kind)
Dim tc4 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Ref, pia1Ref})
Dim pia5Asm4 = tc4.GetReferencedAssemblySymbol(pia5Ref)
Dim library2Asm4 = tc4.GetReferencedAssemblySymbol(library2Ref)
Assert.False(pia5Asm4.IsLinked)
Assert.False(library2Asm4.IsLinked)
Assert.NotSame(pia5Asm3, pia5Asm4)
Assert.Same(pia5Asm2, pia5Asm4)
Assert.NotSame(library2Asm3, library2Asm4)
Dim varI7_4 = library2Asm4.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.NotEqual(SymbolKind.ErrorType, varI7_4.GetMember(Of MethodSymbol)("Foo").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, varI7_4.GetMember(Of MethodSymbol)("Bar").ReturnType.Kind)
Dim tc5 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Link, pia1Link})
Dim pia1Asm5 = tc5.GetReferencedAssemblySymbol(pia1Link)
Dim pia5Asm5 = tc5.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm5 = tc5.GetReferencedAssemblySymbol(library2Ref)
Assert.True(pia1Asm5.IsLinked)
Assert.True(pia5Asm5.IsLinked)
Assert.False(library2Asm5.IsLinked)
Assert.Same(pia5Asm1, pia5Asm5)
Assert.NotSame(library2Asm5, library2Asm3)
Assert.NotSame(library2Asm5, library2Asm4)
Dim varI7_5 = library2Asm5.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_5.GetMember(Of MethodSymbol)("Foo").ReturnType)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_5.GetMember(Of MethodSymbol)("Bar").ReturnType)
Dim tc6 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Ref, pia5Link, pia1Ref})
Dim pia1Asm6 = tc6.GetReferencedAssemblySymbol(pia1Ref)
Dim pia5Asm6 = tc6.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm6 = tc6.GetReferencedAssemblySymbol(library2Ref)
Assert.False(pia1Asm6.IsLinked)
Assert.True(pia5Asm6.IsLinked)
Assert.False(library2Asm6.IsLinked)
Assert.Same(pia5Asm1, pia5Asm6)
Assert.Same(library2Asm6, library2Asm3)
Dim tc7 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, library2Link, pia5Link, pia1Ref})
Dim pia5Asm7 = tc7.GetReferencedAssemblySymbol(pia5Link)
Dim library2Asm7 = tc7.GetReferencedAssemblySymbol(library2Link)
Assert.True(pia5Asm7.IsLinked)
Assert.True(library2Asm7.IsLinked)
Assert.Same(pia5Asm1, pia5Asm3)
Assert.NotSame(library2Asm7, library2Asm3)
Assert.NotSame(library2Asm7, library2Asm4)
Assert.NotSame(library2Asm7, library2Asm5)
Dim varI7_7 = library2Asm7.GlobalNamespace.GetTypeMembers("I7").Single()
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(varI7_7.GetMember(Of MethodSymbol)("Foo").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, varI7_7.GetMember(Of MethodSymbol)("Bar").ReturnType.Kind)
GC.KeepAlive(tc1)
GC.KeepAlive(tc2)
GC.KeepAlive(tc3)
GC.KeepAlive(tc4)
GC.KeepAlive(tc5)
GC.KeepAlive(tc6)
GC.KeepAlive(tc7)
Dim varI5 = varC_Pia5.SourceModule.GlobalNamespace.GetTypeMembers("I5").Single()
Dim varI5_Foo = varI5.GetMember(Of MethodSymbol)("Foo")
Dim varI6 = varC_Pia5.SourceModule.GlobalNamespace.GetTypeMembers("I6").Single()
Assert.NotEqual(SymbolKind.ErrorType, varI5.Kind)
Assert.NotEqual(SymbolKind.ErrorType, varI6.Kind)
Assert.NotEqual(SymbolKind.ErrorType, varI5_Foo.ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, (DirectCast(varI5_Foo.ReturnType, NamedTypeSymbol)).TypeArguments(0).Kind)
Assert.Equal("System.Collections.Generic.List(Of I6)", varI5_Foo.ReturnType.ToTestDisplayString())
Dim varI7 = varC_Library2.SourceModule.GlobalNamespace.GetTypeMembers("I7").Single()
Dim varI7_Foo = varI7.GetMember(Of MethodSymbol)("Foo")
Dim varI7_Bar = varI7.GetMember(Of MethodSymbol)("Bar")
Assert.NotEqual(SymbolKind.ErrorType, varI7_Foo.ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, (DirectCast(varI7_Foo.ReturnType, NamedTypeSymbol)).TypeArguments(0).Kind)
Assert.Equal("System.Collections.Generic.List(Of I5)", varI7_Foo.ReturnType.ToTestDisplayString())
Assert.NotEqual(SymbolKind.ErrorType, varI7_Bar.ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, (DirectCast(varI7_Bar.ReturnType, NamedTypeSymbol)).TypeArguments(0).Kind)
Assert.Equal("System.Collections.Generic.List(Of I1)", varI7_Bar.ReturnType.ToTestDisplayString())
Dim varI1 = varC_Pia1.SourceModule.GlobalNamespace.GetTypeMembers("I1").Single()
Assert.NotEqual(SymbolKind.ErrorType, varI1.Kind)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes6()
Dim mscorlibRef = TestReferences.NetFx.v4_0_21006.mscorlib
Dim varC_A = VisualBasicCompilation.Create("A", references:={mscorlibRef})
Dim varALink = New VisualBasicCompilationReference(varC_A, embedInteropTypes:=True)
Dim varARef = New VisualBasicCompilationReference(varC_A, embedInteropTypes:=False)
Dim varC_B = VisualBasicCompilation.Create("B", references:={mscorlibRef})
Dim varBLink = New VisualBasicCompilationReference(varC_B, embedInteropTypes:=True)
Dim varBRef = New VisualBasicCompilationReference(varC_B, embedInteropTypes:=False)
Dim varC_C = VisualBasicCompilation.Create("C", references:={mscorlibRef, varARef, varBRef})
Dim varCLink = New VisualBasicCompilationReference(varC_C, embedInteropTypes:=True)
Dim varCRef = New VisualBasicCompilationReference(varC_C, embedInteropTypes:=False)
Dim varC_D = VisualBasicCompilation.Create("D", references:={mscorlibRef})
Dim varDLink = New VisualBasicCompilationReference(varC_D, embedInteropTypes:=True)
Dim varDRef = New VisualBasicCompilationReference(varC_D, embedInteropTypes:=False)
Dim tc1 = VisualBasicCompilation.Create("C1", references:={mscorlibRef, varCRef, varARef, varBLink})
Dim varA1 = tc1.GetReferencedAssemblySymbol(varARef)
Dim varB1 = tc1.GetReferencedAssemblySymbol(varBLink)
Dim varC1 = tc1.GetReferencedAssemblySymbol(varCRef)
Dim tc2 = VisualBasicCompilation.Create("C2", references:={mscorlibRef, varCRef, varARef, varDRef, varBLink})
Assert.Same(varA1, tc2.GetReferencedAssemblySymbol(varARef))
Assert.Same(varB1, tc2.GetReferencedAssemblySymbol(varBLink))
Assert.Same(varC1, tc2.GetReferencedAssemblySymbol(varCRef))
Dim varD2 = tc2.GetReferencedAssemblySymbol(varDRef)
Dim tc3 = VisualBasicCompilation.Create("C3", references:={mscorlibRef, varCRef, varBLink})
Assert.Same(varB1, tc3.GetReferencedAssemblySymbol(varBLink))
Assert.True(tc3.GetReferencedAssemblySymbol(varCRef).RepresentsTheSameAssemblyButHasUnresolvedReferencesByComparisonTo(varC1))
Dim tc4 = VisualBasicCompilation.Create("C4", references:={mscorlibRef, varCRef, varARef, varBRef})
Assert.Same(varA1, tc4.GetReferencedAssemblySymbol(varARef))
Dim varB4 = tc4.GetReferencedAssemblySymbol(varBRef)
Dim varC4 = tc4.GetReferencedAssemblySymbol(varCRef)
Assert.NotSame(varC1, varC4)
Assert.NotSame(varB1, varB4)
Dim tc5 = VisualBasicCompilation.Create("C5", references:={mscorlibRef, varCRef, varALink, varBLink})
Assert.Same(varB1, tc5.GetReferencedAssemblySymbol(varBLink))
Dim varA5 = tc5.GetReferencedAssemblySymbol(varALink)
Dim varC5 = tc5.GetReferencedAssemblySymbol(varCRef)
Assert.NotSame(varA1, varA5)
Assert.NotSame(varC1, varC5)
Assert.NotSame(varC4, varC5)
Dim tc6 = VisualBasicCompilation.Create("C6", references:={mscorlibRef, varARef, varBLink, varCLink})
Assert.Same(varA1, tc6.GetReferencedAssemblySymbol(varARef))
Assert.Same(varB1, tc6.GetReferencedAssemblySymbol(varBLink))
Dim varC6 = tc6.GetReferencedAssemblySymbol(varCLink)
Assert.NotSame(varC1, varC6)
Assert.NotSame(varC4, varC6)
Assert.NotSame(varC5, varC6)
Dim tc7 = VisualBasicCompilation.Create("C7", references:={mscorlibRef, varCRef, varARef})
Assert.Same(varA1, tc7.GetReferencedAssemblySymbol(varARef))
Assert.True(tc7.GetReferencedAssemblySymbol(varCRef).RepresentsTheSameAssemblyButHasUnresolvedReferencesByComparisonTo(varC4))
GC.KeepAlive(tc1)
GC.KeepAlive(tc2)
GC.KeepAlive(tc3)
GC.KeepAlive(tc4)
GC.KeepAlive(tc5)
GC.KeepAlive(tc6)
GC.KeepAlive(tc7)
End Sub
<Fact(), WorkItem(546735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546735")>
Public Sub Bug16689_1()
Dim ilSource =
<![CDATA[
.class interface public abstract auto ansi import I1
{
.custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 66 39 63 32 64 35 31 64 2D 34 66 34 34 // ..$f9c2d51d-4f44
2D 34 35 66 30 2D 39 65 64 61 2D 63 39 64 35 39 // -45f0-9eda-c9d59
39 62 35 38 32 35 37 00 00 ) // 9b58257..
.custom instance void [mscorlib]System.Runtime.InteropServices.TypeIdentifierAttribute::.ctor() = ( 01 00 00 00 )
.method public newslot abstract strict virtual
instance void M1() cil managed
{
} // end of method I1::M1
} // end of class I1
.class public auto ansi Base
extends [mscorlib]System.Object
implements I1
{
.method public specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method Base::.ctor
.method public newslot strict virtual final
instance void M1() cil managed
{
.override I1::M1
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Base::M1
} // end of class Base
]]>
Dim compilationDef =
<compilation name="SimpleTest1">
<file name="a.vb">
Class Derived
Inherits Base
End Class
Class Program
Shared Sub Main()
Dim x as New Derived()
System.Console.WriteLine(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithCustomILSource(compilationDef, ilSource.Value, includeVbRuntime:=True, options:=TestOptions.ReleaseExe)
CompileAndVerify(compilation, expectedOutput:=
<![CDATA[
Derived
]]>)
End Sub
<Fact(), WorkItem(546735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546735")>
Public Sub Bug16689_2()
Dim ilSource =
<![CDATA[
.class interface public abstract auto ansi import I1
{
.custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 66 39 63 32 64 35 31 64 2D 34 66 34 34 // ..$f9c2d51d-4f44
2D 34 35 66 30 2D 39 65 64 61 2D 63 39 64 35 39 // -45f0-9eda-c9d59
39 62 35 38 32 35 37 00 00 ) // 9b58257..
.custom instance void [mscorlib]System.Runtime.InteropServices.TypeIdentifierAttribute::.ctor() = ( 01 00 00 00 )
} // end of class I1
.class interface public abstract auto ansi I2`1<T>
{
.method public newslot abstract strict virtual
instance void M1() cil managed
{
} // end of method I2`1::M1
} // end of class I2`1
.class public auto ansi Base
extends [mscorlib]System.Object
implements class I2`1<class I1>
{
.method public specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method Base::.ctor
.method public newslot strict virtual final
instance void M1() cil managed
{
.override method instance void class I2`1<class I1>::M1()
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Base::M1
} // end of class Base
]]>
Dim compilationDef =
<compilation name="SimpleTest1">
<file name="a.vb">
Class Derived
Inherits Base
End Class
Class Program
Shared Sub Main()
Dim x as New Derived()
System.Console.WriteLine(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithCustomILSource(compilationDef, ilSource.Value, includeVbRuntime:=True, options:=TestOptions.ReleaseExe)
CompileAndVerify(compilation, expectedOutput:=
<![CDATA[
Derived
]]>)
End Sub
<Fact(), WorkItem(546735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546735")>
Public Sub Bug16689_3()
Dim i3Def =
<compilation name="I3">
<file name="a.vb">
Public Interface I3
End Interface
</file>
</compilation>
Dim i3Compilation = CreateCompilationWithMscorlib(i3Def, TestOptions.ReleaseDll)
Dim ilSource =
<![CDATA[
.assembly extern I3{}
.class interface public abstract auto ansi import I1
{
.custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 66 39 63 32 64 35 31 64 2D 34 66 34 34 // ..$f9c2d51d-4f44
2D 34 35 66 30 2D 39 65 64 61 2D 63 39 64 35 39 // -45f0-9eda-c9d59
39 62 35 38 32 35 37 00 00 ) // 9b58257..
.custom instance void [mscorlib]System.Runtime.InteropServices.TypeIdentifierAttribute::.ctor() = ( 01 00 00 00 )
} // end of class I1
.class interface public abstract auto ansi I2`2<T,S>
{
.method public newslot abstract strict virtual
instance void M1() cil managed
{
} // end of method I2`2::M1
} // end of class I2`2
.class public auto ansi Base
extends [mscorlib]System.Object
implements class I2`2<class I1,class [I3]I3>
{
.method public specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method Base::.ctor
.method public newslot strict virtual final
instance void M1() cil managed
{
.override method instance void class I2`2<class I1,class [I3]I3>::M1()
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Base::M1
} // end of class Base
]]>
Dim compilationDef =
<compilation name="SimpleTest1">
<file name="a.vb">
Class Derived
Inherits Base
End Class
Class Program
Shared Sub Main()
Dim x as New Derived()
System.Console.WriteLine(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithCustomILSource(compilationDef, ilSource.Value, includeVbRuntime:=True, options:=TestOptions.ReleaseExe)
CompileAndVerify(compilation,
dependencies:={New ModuleData(i3Compilation.Assembly.Identity,
OutputKind.DynamicallyLinkedLibrary,
i3Compilation.EmitToArray(),
Nothing,
False)},
expectedOutput:=
<![CDATA[
Derived
]]>)
End Sub
End Class
End Namespace
|
mmitche/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Metadata/PE/NoPia.vb
|
Visual Basic
|
apache-2.0
| 68,238
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.EndConstructGeneration
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.VisualStudio.Text
Imports Roslyn.Test.EditorUtilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EndConstructGeneration
Public Class DoLoopTests
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub TestApplyAfterUnmatchedDo()
VerifyStatementEndConstructApplied(
before:={"Class c1",
" Sub foo()",
" Do",
" End Sub",
"End Class"},
beforeCaret:={2, -1},
after:={"Class c1",
" Sub foo()",
" Do",
"",
" Loop",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyNestedDo()
VerifyStatementEndConstructApplied(
before:={"Class c1",
" Sub foo()",
" Do",
" Do",
" Loop",
" End Sub",
"End Class"},
beforeCaret:={3, -1},
after:={"Class c1",
" Sub foo()",
" Do",
" Do",
"",
" Loop",
" Loop",
" End Sub",
"End Class"},
afterCaret:={4, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub DoNotApplyFromPairedDo()
VerifyStatementEndConstructNotApplied(
text:={"Class c1",
"Do",
"Loop",
"End Class"},
caret:={1, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub DoNotApplyFromInsideDo()
VerifyStatementEndConstructNotApplied(
text:={"Class c1",
"Do",
"End Class"},
caret:={1, 1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub DoNotApplyFromDoOutsideMethod()
VerifyStatementEndConstructNotApplied(
text:={"Class c1",
"Do",
"End Class"},
caret:={1, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyDoWhile()
VerifyStatementEndConstructApplied(
before:={"Class C",
"Sub s",
"Do While True",
"End Sub",
"End Class"},
beforeCaret:={2, -1},
after:={"Class C",
"Sub s",
"Do While True",
"",
"Loop",
"End Sub",
"End Class"},
afterCaret:={3, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyNestedDoWhile()
VerifyStatementEndConstructApplied(
before:={"Class C",
" Sub s",
" do While True",
" do While a",
" Loop",
" End Sub",
"End Class"},
beforeCaret:={3, -1},
after:={"Class C",
" Sub s",
" do While True",
" do While a",
"",
" Loop",
" Loop",
" End Sub",
"End Class"},
afterCaret:={4, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyDoUntil()
VerifyStatementEndConstructApplied(
before:={"Class C",
" Sub s",
" do Until true",
" End Sub",
"End Class"},
beforeCaret:={2, -1},
after:={"Class C",
" Sub s",
" do Until true",
"",
" Loop",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyNestedDoUntil()
VerifyStatementEndConstructApplied(
before:={"Class C",
" Sub s",
" do Until True",
" Do Until True",
" Loop",
" End Sub",
"End Class"},
beforeCaret:={3, -1},
after:={"Class C",
" Sub s",
" do Until True",
" Do Until True",
"",
" Loop",
" Loop",
" End Sub",
"End Class"},
afterCaret:={4, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyDoWhileInBrokenSub()
VerifyStatementEndConstructApplied(
before:={"Class C",
" Sub s",
" Do While True",
"End Class"},
beforeCaret:={2, -1},
after:={"Class C",
" Sub s",
" Do While True",
"",
" Loop",
"End Class"},
afterCaret:={3, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyDoUntilInvalidLocation01()
VerifyStatementEndConstructNotApplied(
text:={"Class C",
" Sub s",
" End Sub",
" do Until True",
"End Class"},
caret:={3, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyDoUntilInvalidLocation02()
VerifyStatementEndConstructNotApplied(
text:={"Do"},
caret:={0, -1})
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Sub VerifyDoUntilInvalidLocation03()
VerifyStatementEndConstructNotApplied(
text:={"Class C",
" Sub s",
" End Sub",
" do Until",
"End Class"},
caret:={3, -1})
End Sub
End Class
End Namespace
|
JohnHamby/roslyn
|
src/EditorFeatures/VisualBasicTest/EndConstructGeneration/DoLoopTests.vb
|
Visual Basic
|
apache-2.0
| 8,237
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.TableLayoutPanel2 = New System.Windows.Forms.TableLayoutPanel()
Me.canvas = New System.Windows.Forms.PictureBox()
Me.lblStatus = New System.Windows.Forms.Label()
Me.TableLayoutPanel4 = New System.Windows.Forms.TableLayoutPanel()
Me.btnStart = New System.Windows.Forms.Button()
Me.chkPlayerLight = New System.Windows.Forms.CheckBox()
Me.tmrSimu = New System.Windows.Forms.Timer(Me.components)
Me.mnuCanvas = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.mnuSetPlayer = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuAddNPC = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuAddLight = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuNPC = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.mnuAddReachable = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuAddCollectable = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuAddAvoidable = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuCarryLight = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuAddKey = New System.Windows.Forms.ToolStripMenuItem()
Me.TableLayoutPanel1.SuspendLayout()
Me.TableLayoutPanel2.SuspendLayout()
CType(Me.canvas, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TableLayoutPanel4.SuspendLayout()
Me.mnuCanvas.SuspendLayout()
Me.mnuNPC.SuspendLayout()
Me.SuspendLayout()
'
'TableLayoutPanel1
'
Me.TableLayoutPanel1.ColumnCount = 1
Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.83892!))
Me.TableLayoutPanel1.Controls.Add(Me.TableLayoutPanel2, 0, 1)
Me.TableLayoutPanel1.Controls.Add(Me.lblStatus, 0, 2)
Me.TableLayoutPanel1.Controls.Add(Me.TableLayoutPanel4, 0, 0)
Me.TableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.TableLayoutPanel1.Location = New System.Drawing.Point(0, 0)
Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
Me.TableLayoutPanel1.RowCount = 3
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.12641!))
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 91.87359!))
Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 19.0!))
Me.TableLayoutPanel1.Size = New System.Drawing.Size(614, 415)
Me.TableLayoutPanel1.TabIndex = 0
'
'TableLayoutPanel2
'
Me.TableLayoutPanel2.ColumnCount = 1
Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
Me.TableLayoutPanel2.Controls.Add(Me.canvas, 0, 0)
Me.TableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill
Me.TableLayoutPanel2.Location = New System.Drawing.Point(3, 35)
Me.TableLayoutPanel2.Name = "TableLayoutPanel2"
Me.TableLayoutPanel2.RowCount = 1
Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.TableLayoutPanel2.Size = New System.Drawing.Size(608, 357)
Me.TableLayoutPanel2.TabIndex = 0
'
'canvas
'
Me.canvas.BackColor = System.Drawing.Color.Linen
Me.canvas.Dock = System.Windows.Forms.DockStyle.Fill
Me.canvas.Location = New System.Drawing.Point(3, 3)
Me.canvas.Name = "canvas"
Me.canvas.Size = New System.Drawing.Size(602, 351)
Me.canvas.TabIndex = 1
Me.canvas.TabStop = False
'
'lblStatus
'
Me.lblStatus.AutoSize = True
Me.lblStatus.Location = New System.Drawing.Point(3, 395)
Me.lblStatus.Name = "lblStatus"
Me.lblStatus.Size = New System.Drawing.Size(151, 13)
Me.lblStatus.TabIndex = 1
Me.lblStatus.Text = "Simulator status message label"
'
'TableLayoutPanel4
'
Me.TableLayoutPanel4.BackColor = System.Drawing.SystemColors.Control
Me.TableLayoutPanel4.ColumnCount = 4
Me.TableLayoutPanel4.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571!))
Me.TableLayoutPanel4.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571!))
Me.TableLayoutPanel4.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571!))
Me.TableLayoutPanel4.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571!))
Me.TableLayoutPanel4.Controls.Add(Me.btnStart, 0, 0)
Me.TableLayoutPanel4.Controls.Add(Me.chkPlayerLight, 1, 0)
Me.TableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill
Me.TableLayoutPanel4.Location = New System.Drawing.Point(3, 3)
Me.TableLayoutPanel4.Name = "TableLayoutPanel4"
Me.TableLayoutPanel4.RowCount = 1
Me.TableLayoutPanel4.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.TableLayoutPanel4.Size = New System.Drawing.Size(608, 26)
Me.TableLayoutPanel4.TabIndex = 2
'
'btnStart
'
Me.btnStart.Dock = System.Windows.Forms.DockStyle.Fill
Me.btnStart.Location = New System.Drawing.Point(3, 3)
Me.btnStart.Name = "btnStart"
Me.btnStart.Size = New System.Drawing.Size(146, 20)
Me.btnStart.TabIndex = 0
Me.btnStart.Text = "Start"
Me.btnStart.UseVisualStyleBackColor = True
'
'chkPlayerLight
'
Me.chkPlayerLight.AutoSize = True
Me.chkPlayerLight.Checked = True
Me.chkPlayerLight.CheckState = System.Windows.Forms.CheckState.Checked
Me.chkPlayerLight.Dock = System.Windows.Forms.DockStyle.Fill
Me.chkPlayerLight.Location = New System.Drawing.Point(155, 3)
Me.chkPlayerLight.Name = "chkPlayerLight"
Me.chkPlayerLight.Size = New System.Drawing.Size(146, 20)
Me.chkPlayerLight.TabIndex = 1
Me.chkPlayerLight.Text = "Player Carry Light"
Me.chkPlayerLight.UseVisualStyleBackColor = True
'
'tmrSimu
'
Me.tmrSimu.Interval = 60
'
'mnuCanvas
'
Me.mnuCanvas.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuSetPlayer, Me.mnuAddNPC, Me.mnuAddLight, Me.mnuAddKey})
Me.mnuCanvas.Name = "mnuCanvas"
Me.mnuCanvas.ShowImageMargin = False
Me.mnuCanvas.Size = New System.Drawing.Size(150, 92)
'
'mnuSetPlayer
'
Me.mnuSetPlayer.Name = "mnuSetPlayer"
Me.mnuSetPlayer.Size = New System.Drawing.Size(149, 22)
Me.mnuSetPlayer.Text = "Set Player Location"
'
'mnuAddNPC
'
Me.mnuAddNPC.Name = "mnuAddNPC"
Me.mnuAddNPC.Size = New System.Drawing.Size(149, 22)
Me.mnuAddNPC.Text = "Add NPC"
'
'mnuAddLight
'
Me.mnuAddLight.Name = "mnuAddLight"
Me.mnuAddLight.Size = New System.Drawing.Size(149, 22)
Me.mnuAddLight.Text = "Add Light"
'
'mnuNPC
'
Me.mnuNPC.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuAddReachable, Me.mnuAddCollectable, Me.mnuAddAvoidable, Me.mnuCarryLight})
Me.mnuNPC.Name = "mnuNPC"
Me.mnuNPC.Size = New System.Drawing.Size(159, 114)
'
'mnuAddReachable
'
Me.mnuAddReachable.Name = "mnuAddReachable"
Me.mnuAddReachable.Size = New System.Drawing.Size(158, 22)
Me.mnuAddReachable.Text = "Add Reachable"
'
'mnuAddCollectable
'
Me.mnuAddCollectable.Name = "mnuAddCollectable"
Me.mnuAddCollectable.Size = New System.Drawing.Size(158, 22)
Me.mnuAddCollectable.Text = "Add Collectable"
'
'mnuAddAvoidable
'
Me.mnuAddAvoidable.Name = "mnuAddAvoidable"
Me.mnuAddAvoidable.Size = New System.Drawing.Size(158, 22)
Me.mnuAddAvoidable.Text = "Add Avoidable"
'
'mnuCarryLight
'
Me.mnuCarryLight.Name = "mnuCarryLight"
Me.mnuCarryLight.Size = New System.Drawing.Size(158, 22)
Me.mnuCarryLight.Text = "Carry Light"
'
'mnuAddKey
'
Me.mnuAddKey.Name = "mnuAddKey"
Me.mnuAddKey.Size = New System.Drawing.Size(149, 22)
Me.mnuAddKey.Text = "Add Key(Pickup)"
'
'Form2
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Linen
Me.ClientSize = New System.Drawing.Size(614, 415)
Me.Controls.Add(Me.TableLayoutPanel1)
Me.DoubleBuffered = True
Me.Name = "Form2"
Me.Text = "AI Simulator"
Me.TableLayoutPanel1.ResumeLayout(False)
Me.TableLayoutPanel1.PerformLayout()
Me.TableLayoutPanel2.ResumeLayout(False)
CType(Me.canvas, System.ComponentModel.ISupportInitialize).EndInit()
Me.TableLayoutPanel4.ResumeLayout(False)
Me.TableLayoutPanel4.PerformLayout()
Me.mnuCanvas.ResumeLayout(False)
Me.mnuNPC.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents TableLayoutPanel2 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents canvas As System.Windows.Forms.PictureBox
Friend WithEvents lblStatus As System.Windows.Forms.Label
Friend WithEvents TableLayoutPanel4 As System.Windows.Forms.TableLayoutPanel
Friend WithEvents btnStart As System.Windows.Forms.Button
Friend WithEvents tmrSimu As System.Windows.Forms.Timer
Friend WithEvents mnuCanvas As System.Windows.Forms.ContextMenuStrip
Friend WithEvents mnuSetPlayer As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuAddNPC As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuNPC As System.Windows.Forms.ContextMenuStrip
Friend WithEvents mnuAddReachable As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuAddCollectable As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuAddAvoidable As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuCarryLight As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents chkPlayerLight As System.Windows.Forms.CheckBox
Friend WithEvents mnuAddLight As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuAddKey As System.Windows.Forms.ToolStripMenuItem
End Class
|
thekoushik/Darker-Unknown
|
WindowsApplication3/WindowsApplication3/WindowsApplication3/Form2.Designer.vb
|
Visual Basic
|
mit
| 12,069
|
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.CodeRush.Core
Imports DevExpress.CodeRush.PlugInCore
Imports DevExpress.CodeRush.StructuralParser
Imports System.Text.RegularExpressions
Public Class PlugIn1
Private Const RegExStartsWithHeader As String = "(//|') RefreshTemplate:(.+)"
Private Const RegExStartsWithFooter As String = "(//|') EndRefreshTemplate:(.+)"
'DXCore-generated code...
#Region " InitializePlugIn "
Public Overrides Sub InitializePlugIn()
MyBase.InitializePlugIn()
CreateRefreshTemplate()
'TODO: Add your initialization code here.
End Sub
#End Region
#Region " FinalizePlugIn "
Public Overrides Sub FinalizePlugIn()
'TODO: Add your finalization code here.
MyBase.FinalizePlugIn()
End Sub
#End Region
Public Sub CreateRefreshTemplate()
Dim RefreshTemplate As New DevExpress.CodeRush.Core.CodeProvider(components)
CType(RefreshTemplate, System.ComponentModel.ISupportInitialize).BeginInit()
RefreshTemplate.ProviderName = "RefreshTemplate" ' Should be Unique
RefreshTemplate.DisplayName = "Refresh Template"
AddHandler RefreshTemplate.CheckAvailability, AddressOf RefreshTemplate_CheckAvailability
AddHandler RefreshTemplate.Apply, AddressOf RefreshTemplate_Execute
CType(RefreshTemplate, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Private Sub RefreshTemplate_CheckAvailability(ByVal sender As Object, ByVal ea As CheckContentAvailabilityEventArgs)
Dim HeaderLine As Integer = GetClosestHeaderLine()
Dim FooterLine As Integer = GetClosestFooterLine()
If HeaderLine = -1 OrElse FooterLine = -1 Then
' Either or footer not found in this file.
Exit Sub
End If
If Not HeaderAndFootersMatch(HeaderLine, FooterLine) Then
' Header and footer do not match.
Exit Sub
End If
ea.Available = True
End Sub
Private Function GetClosestHeaderLine() As Integer
' Iterate lines starting on the current one and moving up.
' Look for a comment which starts "RefreshUsing:"
For Line As Integer = CodeRush.Caret.SourcePoint.Line To 1 Step -1
If LineMatchesPattern(Line, RegExStartsWithHeader) Then
Return Line
End If
Next
Return -1
End Function
Private Function GetClosestFooterLine() As Integer
' Iterate lines starting on the current one and moving down.
' Look for a comment which starts "EndRefreshUsing:"
For Line As Integer = CodeRush.Caret.SourcePoint.Line To CodeRush.Documents.ActiveTextDocument.LineCount - 1
If LineMatchesPattern(Line, RegExStartsWithFooter) Then
Return Line
End If
Next
Return -1
End Function
Private Function HeaderAndFootersMatch(ByVal HeaderLine As Integer, ByVal FooterLine As Integer) As Boolean
Dim HeaderTemplate = GetMatchFromLine(HeaderLine, RegExStartsWithHeader, 2)
Dim FooterTemplate = GetMatchFromLine(FooterLine, RegExStartsWithFooter, 2)
Return HeaderTemplate = FooterTemplate
End Function
Private Sub RefreshTemplate_Execute(ByVal Sender As Object, ByVal ea As ApplyContentEventArgs)
Dim HeaderLine As Integer = GetClosestHeaderLine()
Dim FooterLine As Integer = GetClosestFooterLine()
Dim Range As SourceRange = New SourceRange(HeaderLine, 1, FooterLine, CodeRush.Documents.ActiveTextDocument.GetLineLength(FooterLine) + 1)
Dim TemplateName As String = GetMatchFromLine(HeaderLine, RegExStartsWithHeader, 2)
' Wipe Text
CodeRush.Documents.ActiveTextDocument.DeleteText(Range)
' Expand Template
CodeRush.Caret.MoveTo(HeaderLine, 1)
CodeRush.Templates.ExpandTemplate(TemplateName)
End Sub
Private Function GetMatchFromLine(ByVal HeaderLine As Integer, ByVal MatchPattern As String, ByVal GroupIndex As Integer) As String
Dim LineText = CodeRush.Documents.ActiveTextDocument.GetText(HeaderLine)
Dim Match As Match = Regex.Match(LineText, MatchPattern)
Return Match.Groups(GroupIndex).Value
End Function
Private Function LineMatchesPattern(ByVal Line As Integer, ByVal Pattern As String) As Boolean
Return Regex.IsMatch(CodeRush.Documents.ActiveTextDocument.GetText(Line), Pattern)
End Function
End Class
|
RoryBecker/CR_RefreshTemplate
|
CR_RefreshTemplate/PlugIn1.vb
|
Visual Basic
|
mit
| 4,497
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmLettGrSlect
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.lblCourseName = New System.Windows.Forms.Label()
Me.txtCourse = New System.Windows.Forms.TextBox()
Me.lblLetterGrade = New System.Windows.Forms.Label()
Me.txtGrade = New System.Windows.Forms.TextBox()
Me.btnCmd = New System.Windows.Forms.Button()
Me.btnCmdClear = New System.Windows.Forms.Button()
Me.txtDisplay = New System.Windows.Forms.TextBox()
Me.btnExit = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(32, 19)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(341, 24)
Me.Label1.TabIndex = 6
Me.Label1.Text = "Welcome to Letter Grade Calculator"
'
'lblCourseName
'
Me.lblCourseName.AutoSize = True
Me.lblCourseName.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblCourseName.Location = New System.Drawing.Point(32, 77)
Me.lblCourseName.Name = "lblCourseName"
Me.lblCourseName.Size = New System.Drawing.Size(194, 24)
Me.lblCourseName.TabIndex = 9
Me.lblCourseName.Text = "&Enter Course Name"
'
'txtCourse
'
Me.txtCourse.Location = New System.Drawing.Point(242, 82)
Me.txtCourse.Multiline = True
Me.txtCourse.Name = "txtCourse"
Me.txtCourse.Size = New System.Drawing.Size(162, 24)
Me.txtCourse.TabIndex = 10
'
'lblLetterGrade
'
Me.lblLetterGrade.AutoSize = True
Me.lblLetterGrade.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblLetterGrade.Location = New System.Drawing.Point(32, 143)
Me.lblLetterGrade.Name = "lblLetterGrade"
Me.lblLetterGrade.Size = New System.Drawing.Size(204, 24)
Me.lblLetterGrade.TabIndex = 11
Me.lblLetterGrade.Text = "Enter Grade Number"
'
'txtGrade
'
Me.txtGrade.Location = New System.Drawing.Point(242, 143)
Me.txtGrade.Multiline = True
Me.txtGrade.Name = "txtGrade"
Me.txtGrade.Size = New System.Drawing.Size(162, 24)
Me.txtGrade.TabIndex = 12
'
'btnCmd
'
Me.btnCmd.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnCmd.Location = New System.Drawing.Point(41, 191)
Me.btnCmd.Name = "btnCmd"
Me.btnCmd.Size = New System.Drawing.Size(195, 35)
Me.btnCmd.TabIndex = 15
Me.btnCmd.Text = "Calculate Letter"
Me.btnCmd.UseVisualStyleBackColor = True
'
'btnCmdClear
'
Me.btnCmdClear.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnCmdClear.Location = New System.Drawing.Point(242, 191)
Me.btnCmdClear.Name = "btnCmdClear"
Me.btnCmdClear.Size = New System.Drawing.Size(107, 35)
Me.btnCmdClear.TabIndex = 16
Me.btnCmdClear.Text = "Clear"
Me.btnCmdClear.UseVisualStyleBackColor = True
'
'txtDisplay
'
Me.txtDisplay.Location = New System.Drawing.Point(36, 232)
Me.txtDisplay.Multiline = True
Me.txtDisplay.Name = "txtDisplay"
Me.txtDisplay.Size = New System.Drawing.Size(323, 242)
Me.txtDisplay.TabIndex = 17
Me.txtDisplay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'btnExit
'
Me.btnExit.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnExit.Location = New System.Drawing.Point(365, 442)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(58, 32)
Me.btnExit.TabIndex = 18
Me.btnExit.Text = "Exit"
Me.btnExit.UseVisualStyleBackColor = True
'
'frmLettGrSlect
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.SteelBlue
Me.ClientSize = New System.Drawing.Size(424, 499)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.txtDisplay)
Me.Controls.Add(Me.btnCmdClear)
Me.Controls.Add(Me.btnCmd)
Me.Controls.Add(Me.txtGrade)
Me.Controls.Add(Me.lblLetterGrade)
Me.Controls.Add(Me.txtCourse)
Me.Controls.Add(Me.lblCourseName)
Me.Controls.Add(Me.Label1)
Me.Name = "frmLettGrSlect"
Me.Text = "Letter Grade Select Case"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents lblCourseName As System.Windows.Forms.Label
Friend WithEvents txtCourse As System.Windows.Forms.TextBox
Friend WithEvents lblLetterGrade As System.Windows.Forms.Label
Friend WithEvents txtGrade As System.Windows.Forms.TextBox
Friend WithEvents btnCmd As System.Windows.Forms.Button
Friend WithEvents btnCmdClear As System.Windows.Forms.Button
Friend WithEvents txtDisplay As System.Windows.Forms.TextBox
Friend WithEvents btnExit As System.Windows.Forms.Button
End Class
|
miguel2192/CSC-162
|
Rodriguez_LetGrdSelect/Rodriguez_LetGrdSelect/Form1.Designer.vb
|
Visual Basic
|
mit
| 6,745
|
#Region "Imports"
Imports System.IO.Compression
Imports System.IO
Imports System.Net
Imports System.Text.RegularExpressions
#End Region
Module modStrings
#Region "Global Variables"
' These vars are used throughout the app so that I can change them in a single place (here) & it'll change them everywhere.
' This one is mainly here for me so that I can name it just "Peek" for my own computer, & "GeekDrop Peek" for public consumption in order to get my site's name out.
' IMPORTANT NOTE: When changed here, it also changes the actual Registry Key name as well as the Windows Context-menu name.
Public strAppname As String = "GeekDrop Peek"
' Contains the full path of this app + Strings.exe
Public strStringsExePath As String = Application.StartupPath & "\Strings.exe"
' The .txt file we're writing the Strings.exe output to + the path to the local temp folder
Public strTempFileName As String = My.Computer.FileSystem.SpecialDirectories.Temp & "\" & strAppname & ".txt"
' This is the URL to the official Strings web PAGE. Used for scraping the latest version as well as a credit link.
Public strStringsSite As String = "http://technet.microsoft.com/en-us/sysinternals/bb897439.aspx"
' This is the URL to the official Strings FILE. Used for fetching & installing the latest version locally.
Public strStringsFile As String = "http://download.sysinternals.com/files/Strings.zip"
#End Region
Public Sub Run_Strings(strFile As String, Optional strArguments As String = "")
' This function is the first step of 2 to do what this app is meant for.
'
' It takes as a param, a path to a file on the system, runs Strings.exe with it's own params, saves it's output to the system temp folder as a .txt file & waits for it's process to exit.
' Before we proceed, lets make another check that strings.exe is there, JUSt in case the user somehow managed to delete it while the app was already running.
' Unlikely, but just to be a smart programmer ...
If My.Computer.FileSystem.FileExists(strStringsExePath) Then
' This is the default argument's setting for this app, however, I have included the ability to pass different
' arguments to the Strings.exe since it takes all kinds of them, and in the future I may add the ability to let
' user customize it's output if they so choose.
If strArguments.Length = 0 Then strArguments = "-o -q"
' Create the Strings.exe process object
Dim pStrings As New Process()
' Set it to run hidden from user, so it appears smoother.
With pStrings.StartInfo
.RedirectStandardOutput = True
.RedirectStandardError = True
.FileName = strStringsExePath
.Arguments = strArguments & " " & """" & strFile
.UseShellExecute = False
.CreateNoWindow = True
End With
pStrings.Start()
' Save all Strings.exe output to the variable "output"
Dim output As String = pStrings.StandardOutput.ReadToEnd()
' Wait for Strings.exe to finish before we handle it's output
pStrings.WaitForExit()
' Clean it up a bit
output = Add_Spacer(output)
' At this point all kinds of options are available to do with the output, for example, you could:
' Code in options to save the output to clipboard
' Code up an internal viewer so it's all viewed within this app itself, including highlighting options, searches, etc.
' Write the output to a file
' Whatever else could come to mind. In this case, as in the original "Peek" software, we're going to write it to an external file for opening in
' an external text editor.
' Write output to file, never appended, always new.
My.Computer.FileSystem.WriteAllText(strTempFileName, output, False)
End If
End Sub
Public Sub Open_Strings_Result(Optional strViewer As String = "Notepad.exe")
' Opens the result from Strings in a viewer.
'
' Defaults to Notepad, so we don't need a full path for that; if user wants a different viewer (i.e. UltraEdit, Notepad++) they have to pass the full path to it.
' Currently, support for the latter hasn't been added, since good ol' notepad is good enough for me.
' Create the Strings.exe process object
Dim pStrings As New Process()
' Set it to run hidden from user, so it appears smoother.
With pStrings.StartInfo
.RedirectStandardOutput = True
.RedirectStandardError = True
.FileName = strViewer
.Arguments = strTempFileName
.UseShellExecute = False
.CreateNoWindow = True
End With
pStrings.Start()
' Wait for Strings.exe to finish before we handle it's output
pStrings.WaitForExit()
End Sub
Public Sub Download_and_Unpack_Strings()
' Path of this app
Dim strPath As String = Application.StartupPath
Try
' This is here basically to reset the color if we were sent here via the upgrade
With frmMain.tsLabel
.Text = "Downloading Latest Strings.zip ..."
.ForeColor = Color.White
End With
' Download the latest Strings.zip from the official website, using a 60 second timeout, and showing the download GUI (which will probably just flash since it's just a tiny file).
My.Computer.Network.DownloadFile(strStringsFile, strPath & "\Strings.zip", Nothing, Nothing, True, 60000, True)
Catch ex As Exception
frmMain.tsLabel.Text = "Failed Downloading Latest Strings.zip!"
MessageBox.Show(ex.Message, "Error Opening Strings.zip File!", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
' First, make sure Strings.zip exists before we try to unzip it
If FileIO.FileSystem.FileExists(strPath & "\Strings.zip") = True Then
frmMain.tsLabel.Text = "Extracting Strings.exe from Strings.zip ..."
' Extract Strings.exe from the downloaded zip file
ZipFile.ExtractToDirectory(strPath & "\Strings.zip", strPath)
' Double-check that Strings.exe is extracted and there
If FileIO.FileSystem.FileExists(strStringsExePath) = True Then
Try
frmMain.tsLabel.Text = "Cleaning up ..."
' Finally, clean up the dl'd and extracted stuff
FileIO.FileSystem.DeleteFile(strPath & "\Strings.zip")
FileIO.FileSystem.DeleteFile(strPath & "\Eula.txt")
Catch ex As Exception
Debug.Print("Error cleaning up!")
End Try
frmMain.lblState2.Text = "Installed"
frmMain.tsLabel.Text = "Latest Engine has been installed!"
End If
End If
End Try
End Sub
Public Sub Get_Strings_Versions()
' Sub gets, displays the currently installed Strings.exe version from the file itself, then scrapes the Strings website for the latest version info,
' if newer versions found, alert user.
Try
' Get and display the current Strings.exe version
Dim strCurrentVer As String = FileVersionInfo.GetVersionInfo(strStringsExePath).FileMajorPart.ToString & "." & FileVersionInfo.GetVersionInfo(strStringsExePath).FileMinorPart.ToString
With frmMain
.lblState2.Text = "Installed"
.tsLabel.Text = "Engine: v" & strCurrentVer
End With
' Store the current Strings.exe version as a Version object for later comparison
Dim oCurrent As New Version(strCurrentVer)
' Get the latest Strings version from the website
Dim strLatest As String = Scrape_Latest_Version()
' Store the scraped, latest Strings.exe version as a Version object for later comparison
' NOTE: if running the this app for the first time and it's Scrape_Version() check gets blocked by a firewall, the following line coughs up an exception.
Dim oLatest As New Version(strLatest)
' Do the version compare
Dim intCompare As Int32 = oCurrent.CompareTo(oLatest)
If intCompare < 0 Then
With frmMain.tsLabel
.Text = "Newer Engine Available! (v" & strLatest & "). Click here to install it!"
.ForeColor = Color.FromArgb(255, 255, 128)
End With
End If
Catch ex As Exception
Debug.Print(ex.Message)
' Something BAYAD happened, lets just present an empty label
With frmMain.tsLabel
.Text = "Failed getting installed Engine version! Did ya block me with your firewall?"
.ForeColor = Color.DarkRed
End With
End Try
End Sub
Private Function Scrape_Latest_Version() As String
' Fetches the Strings web page, then scrapes it for the latest version, then returns the scraped version as the result
'
' Note: I'm not much of a fan of scraping pages, since it's so easily susceptible to breaking with even the slightes change by the website owner, but
' I don't know of any safer way for this app, as of right now.
'
' TODO: To really tighten up, we SHOULD confirm that the parsed out result really does contain a number. If not, (maybe they changed the page source?)
' then return something we can test against.
'
' <h1>Strings v2.52</h1>
Scrape_Latest_Version = String.Empty
Try
Dim strRequest As WebRequest = WebRequest.Create(strStringsSite)
Dim strResponse As WebResponse = strRequest.GetResponse
Dim rs As StreamReader = New StreamReader(strResponse.GetResponseStream())
Dim strSource As String = rs.ReadToEnd
' Parse out all html to the left of ...
Dim strParse As String = strSource.Substring(0, strSource.IndexOf("</h1>"))
' Now Parse out the version to the right of ...
strParse = strParse.Substring(strParse.IndexOf("<h1>Strings v") + 13)
' Save it
Scrape_Latest_Version = strParse
Catch ex As Exception
Debug.Print(ex.Message)
End Try
Return Scrape_Latest_Version
End Function
Private Function Add_Spacer(strInput As String) As String
' This function adds a space between the semi-colon and the rest of the line, at the beginning of each line. This is a personal preference of mine in order to make it a bit easier
' to read, especially when slimming, as the Strings.exe app itself doesn't add the space, there's no option to do so as a param of it, and I've email the author requesting it
' many versions ago and it's gone ignored.
' Pattern to find: Looks for a minimum of 4 NUMBERS + a semicolon. Strings.exe always has a min of 4 digits (and never hex).
Dim strPattern As String = "([0-9]){4,}:"
' Replace with the matching string plus a single space
Dim strReplacement As String = "$& "
Dim rgx As New Regex(strPattern)
' Replace and return the result
Return rgx.Replace(strInput, strReplacement)
End Function
End Module
|
STaRDoGG/geekdrop-peek
|
GeekDrop Peek/Modules/modStrings.vb
|
Visual Basic
|
apache-2.0
| 11,714
|
Imports System.IO
Public Class MyFileInfo
Public Property Name As String
Public Property LastWriteTime As DateTime
Public Property Url As String
Public Property Length As Long
End Class
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim RadarFilePathBase = "D:\Websites\448cf9624b\www\Radar\"
Dim RadarFullPath = RadarFilePathBase & "cz\2012\04\"
Dim dirInfo As New DirectoryInfo(RadarFullPath)
'label1.Text = dirInfo.FullName
Dim fileList As New List(Of MyFileInfo)
For Each fn As FileInfo In dirInfo.GetFiles("*.gif")
Dim fi As New MyFileInfo
fi.Name = fn.Name
fi.Url = "http://hydrodata.info/radar/cz/2012/04/" + fn.Name
fi.LastWriteTime = fn.LastWriteTime
fi.Length = fn.Length
fileList.Add(fi)
Next
grid1.DataSource = fileList
grid1.DataBind()
End Sub
End Class
|
jirikadlec2/hydrodata
|
hydrodatainfo/lahti_update/WebForm1.aspx.vb
|
Visual Basic
|
bsd-3-clause
| 1,046
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.NetCore.Analyzers.Runtime
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Editing
Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.NetCore.VisualBasic.Analyzers.Runtime
<ExportCodeFixProvider(LanguageNames.VisualBasic), [Shared]>
Public Class BasicUseOrdinalStringComparisonFixer
Inherits UseOrdinalStringComparisonFixerBase
Protected Overrides Function IsInArgumentContext(node As SyntaxNode) As Boolean
Return node.IsKind(SyntaxKind.SimpleArgument) AndAlso
Not DirectCast(node, SimpleArgumentSyntax).IsNamed AndAlso
DirectCast(node, SimpleArgumentSyntax).Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression)
End Function
Protected Overrides Function FixArgument(document As Document, generator As SyntaxGenerator, root As SyntaxNode, argument As SyntaxNode) As Task(Of Document)
Dim memberAccess = TryCast(TryCast(argument, SimpleArgumentSyntax)?.Expression, MemberAccessExpressionSyntax)
If memberAccess IsNot Nothing Then
' preserve the "IgnoreCase" suffix if present
Dim isIgnoreCase = memberAccess.Name.GetText().ToString().EndsWith(UseOrdinalStringComparisonAnalyzer.IgnoreCaseText, StringComparison.Ordinal)
Dim newOrdinalText = If(isIgnoreCase, UseOrdinalStringComparisonAnalyzer.OrdinalIgnoreCaseText, UseOrdinalStringComparisonAnalyzer.OrdinalText)
Dim newIdentifier = generator.IdentifierName(newOrdinalText)
Dim newMemberAccess = memberAccess.WithName(CType(newIdentifier, SimpleNameSyntax)).WithAdditionalAnnotations(Formatter.Annotation)
Dim newRoot = root.ReplaceNode(memberAccess, newMemberAccess)
Return Task.FromResult(document.WithSyntaxRoot(newRoot))
End If
Return Task.FromResult(document)
End Function
Protected Overrides Function IsInIdentifierNameContext(node As SyntaxNode) As Boolean
Return node.IsKind(SyntaxKind.IdentifierName) AndAlso
node?.Parent?.FirstAncestorOrSelf(Of InvocationExpressionSyntax)() IsNot Nothing
End Function
Protected Overrides Async Function FixIdentifierName(document As Document, generator As SyntaxGenerator, root As SyntaxNode, identifier As SyntaxNode, cancellationToken As CancellationToken) As Task(Of Document)
Dim invokeParent = identifier.Parent?.FirstAncestorOrSelf(Of InvocationExpressionSyntax)()
If invokeParent IsNot Nothing Then
Dim model = Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
Dim methodSymbol = TryCast(model.GetSymbolInfo(identifier, cancellationToken).Symbol, IMethodSymbol)
If methodSymbol IsNot Nothing AndAlso CanAddStringComparison(methodSymbol, model) Then
' append a New StringComparison.Ordinal argument
Dim newArg = generator.Argument(CreateOrdinalMemberAccess(generator, model)).
WithAdditionalAnnotations(Formatter.Annotation)
Dim newInvoke = invokeParent.AddArgumentListArguments(CType(newArg, ArgumentSyntax)).WithAdditionalAnnotations(Formatter.Annotation)
Dim newRoot = root.ReplaceNode(invokeParent, newInvoke)
Return document.WithSyntaxRoot(newRoot)
End If
End If
Return document
End Function
End Class
End Namespace
|
mavasani/roslyn-analyzers
|
src/NetAnalyzers/VisualBasic/Microsoft.NetCore.Analyzers/Runtime/BasicUseOrdinalStringComparison.Fixer.vb
|
Visual Basic
|
apache-2.0
| 3,921
|
'-----------------------------------------------------------------------------------
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'-----------------------------------------------------------------------------------
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.1433
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Project1.My.MySettings
Get
Return Global.Project1.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
apache/npanday
|
dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/resource/SampleVBDependency/Project1/My Project/Settings.Designer.vb
|
Visual Basic
|
apache-2.0
| 3,921
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.Declarations
Public Class SubKeywordRecommenderTests
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubInClassDeclarationTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>|</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotInMethodDeclarationTest() As Task
Await VerifyRecommendationsMissingAsync(<MethodBody>|</MethodBody>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotInNamespaceTest() As Task
Await VerifyRecommendationsMissingAsync(<NamespaceDeclaration>|</NamespaceDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubInInterfaceTest() As Task
Await VerifyRecommendationsContainAsync(<InterfaceDeclaration>|</InterfaceDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotInEnumTest() As Task
Await VerifyRecommendationsMissingAsync(<EnumDeclaration>|</EnumDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubInStructureTest() As Task
Await VerifyRecommendationsContainAsync(<StructureDeclaration>|</StructureDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubInModuleTest() As Task
Await VerifyRecommendationsContainAsync(<ModuleDeclaration>|</ModuleDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterPartialTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Partial |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterPublicTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Public |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterProtectedTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Protected |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterFriendTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Friend |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterPrivateTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Private |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterProtectedFriendTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Protected Friend |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterOverloadsTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Overloads |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterOverridableTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Overridable |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterNotOverridableTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>NotOverridable |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterMustOverrideTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>MustOverride |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterMustOverrideOverridesTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>MustOverride Overrides |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterNotOverridableOverridesTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>NotOverridable Overrides |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterConstTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>Const |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterDefaultTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>Default |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterMustInheritTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>MustInherit |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterNotInheritableTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>NotInheritable |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterNarrowingTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>Narrowing |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterWideningTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>Widening |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterReadOnlyTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>ReadOnly |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterWriteOnlyTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>WriteOnly |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubNotAfterCustomTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>Custom |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterSharedTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Shared |</ClassDeclaration>, "Sub")
End Function
<WorkItem(543270, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543270")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubInDelegateCreationTest() As Task
Dim code = <ModuleDeclaration>
Module Program
Sub Main(args As String())
Dim f1 As New Goo2( |
End Sub
Delegate Sub Goo2()
Function Bar2() As Object
Return Nothing
End Function
End Module
</ModuleDeclaration>
Await VerifyRecommendationsContainAsync(code, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterOverridesTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Overrides |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function SubAfterOverridesModifierTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Overrides Public |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function NotAfterExitInFinallyBlockTest() As Task
Dim code =
<ClassDeclaration>
Sub M()
Try
Finally
Exit |
</ClassDeclaration>
Await VerifyRecommendationsMissingAsync(code, "Sub")
End Function
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function NotAfterEolTest() As Task
Await VerifyRecommendationsMissingAsync(
<ClassDeclaration>
Sub M()
Exit
|
</ClassDeclaration>, "Sub")
End Function
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function AfterExplicitLineContinuationTest() As Task
Await VerifyRecommendationsContainAsync(
<ClassDeclaration>
Sub M()
Exit _
|
</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function AfterExplicitLineContinuationTestCommentsAfterLineContinuation() As Task
Await VerifyRecommendationsContainAsync(
<ClassDeclaration>
Sub M()
Exit _ ' Test
|
</ClassDeclaration>, "Sub")
End Function
<WorkItem(547254, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547254")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function AfterAsyncTest() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration>Async |</ClassDeclaration>, "Sub")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function NotAfterIteratorTest() As Task
Await VerifyRecommendationsMissingAsync(<ClassDeclaration>Iterator |</ClassDeclaration>, "Sub")
End Function
<WorkItem(674791, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/674791")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function NotAfterHashTest() As Task
Await VerifyRecommendationsMissingAsync(<File>
Imports System
#|
Module Module1
End Module
</File>, "Sub")
End Function
<WorkItem(20837, "https://github.com/dotnet/roslyn/issues/20837")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Async Function AfterExtensionAttribute() As Task
Await VerifyRecommendationsContainAsync(<ClassDeclaration><Extension> |</ClassDeclaration>, "Sub")
End Function
End Class
End Namespace
|
aelij/roslyn
|
src/EditorFeatures/VisualBasicTest/Recommendations/Declarations/SubKeywordRecommenderTests.vb
|
Visual Basic
|
apache-2.0
| 12,013
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Runtime.InteropServices
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Options
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Partial Public MustInherit Class AbstractCodeElementTests(Of TCodeElement As Class)
Inherits AbstractCodeModelObjectTests(Of TCodeElement)
Protected Overridable ReadOnly Property TargetExternalCodeElements As Boolean
Get
Return False
End Get
End Property
Private Function GetCodeElement(state As CodeModelTestState) As TCodeElement
Dim codeElement = state.GetCodeElementAtCursor(Of TCodeElement)
Return If(codeElement IsNot Nothing AndAlso TargetExternalCodeElements,
codeElement.AsExternal(),
codeElement)
End Function
Protected Overloads Sub TestElement(code As XElement, expected As Action(Of TCodeElement))
Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code))
Dim codeElement = GetCodeElement(state)
Assert.NotNull(codeElement)
expected(codeElement)
' Now close the file and ensure the behavior is still the same
state.VisualStudioWorkspace.CloseDocument(state.Workspace.Documents.Single().Id)
codeElement = GetCodeElement(state)
Assert.NotNull(codeElement)
expected(codeElement)
End Using
End Sub
Friend Overloads Sub TestElement(code As XElement, expected As Action(Of CodeModelTestState, TCodeElement))
Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code))
Dim codeElement = GetCodeElement(state)
Assert.NotNull(codeElement)
expected(state, codeElement)
End Using
End Sub
Private Protected Overloads Async Function TestElementUpdate(
code As XElement, expectedCode As XElement, updater As Action(Of TCodeElement),
Optional options As IDictionary(Of OptionKey2, Object) = Nothing,
Optional editorConfig As String = "") As Task
Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code, editorConfig))
Dim workspace = state.Workspace
If options IsNot Nothing Then
For Each kvp In options
workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options _
.WithChangedOption(kvp.Key, kvp.Value)))
Next
End If
Dim codeElement = GetCodeElement(state)
Assert.NotNull(codeElement)
updater(codeElement)
Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString()
Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim())
End Using
End Function
Friend Overloads Async Function TestElementUpdate(code As XElement, expectedCode As XElement, updater As Action(Of CodeModelTestState, TCodeElement)) As Task
Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code))
Dim codeElement = GetCodeElement(state)
Assert.NotNull(codeElement)
updater(state, codeElement)
Dim text = (Await state.GetDocumentAtCursor().GetTextAsync()).ToString()
Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim())
End Using
End Function
Protected Delegate Sub PartAction(part As EnvDTE.vsCMPart, textPointGetter As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))
Protected Function Part(p As EnvDTE.vsCMPart, action As PartAction) As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))
Return _
Sub(textPointGetter)
action(p, textPointGetter)
End Sub
End Function
Protected Function ThrowsNotImplementedException() As PartAction
Return Sub(part, textPointGetter)
Assert.Throws(Of NotImplementedException)(
Sub()
textPointGetter(part)
End Sub)
End Sub
End Function
Protected Const E_FAIL = &H80004005
Protected Function ThrowsCOMException(errorCode As Integer) As PartAction
Return _
Sub(part, textPointGetter)
Dim exception = Assert.Throws(Of COMException)(
Sub()
textPointGetter(part)
End Sub)
Assert.Equal(errorCode, exception.ErrorCode)
End Sub
End Function
Protected ReadOnly NullTextPoint As PartAction =
Sub(part, textPointGetter)
Dim tp As EnvDTE.TextPoint = Nothing
tp = textPointGetter(part)
Assert.Null(tp)
End Sub
Protected Function TextPoint(Optional line As Integer? = Nothing, Optional lineOffset As Integer? = Nothing, Optional absoluteOffset As Integer? = Nothing, Optional lineLength As Integer? = Nothing) As PartAction
Return _
Sub(part, textPointGetter)
Dim tp As EnvDTE.TextPoint = Nothing
tp = textPointGetter(part)
Assert.NotNull(tp)
If line IsNot Nothing Then
Assert.True(tp.Line = line.Value,
vbCrLf &
"TextPoint.Line was incorrect for " & part.ToString() & "." & vbCrLf &
"Expected: " & line & vbCrLf &
"But was: " & tp.Line)
End If
If lineOffset IsNot Nothing Then
Assert.True(tp.LineCharOffset = lineOffset.Value,
vbCrLf &
"TextPoint.LineCharOffset was incorrect for " & part.ToString() & "." & vbCrLf &
"Expected: " & lineOffset & vbCrLf &
"But was: " & tp.LineCharOffset)
End If
If absoluteOffset IsNot Nothing Then
Assert.True(tp.AbsoluteCharOffset = absoluteOffset.Value,
vbCrLf &
"TextPoint.AbsoluteCharOffset was incorrect for " & part.ToString() & "." & vbCrLf &
"Expected: " & absoluteOffset & vbCrLf &
"But was: " & tp.AbsoluteCharOffset)
End If
If lineLength IsNot Nothing Then
Assert.True(tp.LineLength = lineLength.Value,
vbCrLf &
"TextPoint.LineLength was incorrect for " & part.ToString() & "." & vbCrLf &
"Expected: " & lineLength & vbCrLf &
"But was: " & tp.LineLength)
End If
End Sub
End Function
Protected Friend Delegate Sub SetterAction(Of T)(newValue As T, valueSetter As Action(Of T))
Protected Function NoThrow(Of T)() As SetterAction(Of T)
Return _
Sub(value, valueSetter)
valueSetter(value)
End Sub
End Function
Protected Function ThrowsArgumentException(Of T)() As SetterAction(Of T)
Return _
Sub(value, valueSetter)
Assert.Throws(Of ArgumentException)(
Sub()
valueSetter(value)
End Sub)
End Sub
End Function
Protected Function ThrowsCOMException(Of T)(errorCode As Integer) As SetterAction(Of T)
Return _
Sub(value, valueSetter)
Dim exception = Assert.Throws(Of COMException)(
Sub()
valueSetter(value)
End Sub)
Assert.Equal(errorCode, exception.ErrorCode)
End Sub
End Function
Protected Function ThrowsInvalidOperationException(Of T)() As SetterAction(Of T)
Return _
Sub(value, valueSetter)
Assert.Throws(Of InvalidOperationException)(
Sub()
valueSetter(value)
End Sub)
End Sub
End Function
Protected Function ThrowsNotImplementedException(Of T)() As SetterAction(Of T)
Return _
Sub(value, valueSetter)
Assert.Throws(Of NotImplementedException)(
Sub()
valueSetter(value)
End Sub)
End Sub
End Function
Protected MustOverride Function GetStartPointFunc(codeElement As TCodeElement) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
Protected MustOverride Function GetEndPointFunc(codeElement As TCodeElement) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
Protected MustOverride Function GetFullName(codeElement As TCodeElement) As String
Protected MustOverride Function GetKind(codeElement As TCodeElement) As EnvDTE.vsCMElement
Protected MustOverride Function GetName(codeElement As TCodeElement) As String
Protected MustOverride Function GetNameSetter(codeElement As TCodeElement) As Action(Of String)
Protected Overridable Function GetNamespace(codeElement As TCodeElement) As EnvDTE.CodeNamespace
Throw New NotSupportedException
End Function
Protected Overridable Function GetAccess(codeElement As TCodeElement) As EnvDTE.vsCMAccess
Throw New NotSupportedException
End Function
Protected Overridable Function GetAttributes(codeElement As TCodeElement) As EnvDTE.CodeElements
Throw New NotSupportedException
End Function
Protected Overridable Function GetBases(codeElement As TCodeElement) As EnvDTE.CodeElements
Throw New NotSupportedException
End Function
Protected Overridable Function GetClassKind(codeElement As TCodeElement) As EnvDTE80.vsCMClassKind
Throw New NotSupportedException
End Function
Protected Overridable Function GetComment(codeElement As TCodeElement) As String
Throw New NotSupportedException
End Function
Protected Overridable Function GetCommentSetter(codeElement As TCodeElement) As Action(Of String)
Throw New NotSupportedException
End Function
Protected Overridable Function GetConstKind(codeElement As TCodeElement) As EnvDTE80.vsCMConstKind
Throw New NotSupportedException
End Function
Protected Overridable Function GetDataTypeKind(codeElement As TCodeElement) As EnvDTE80.vsCMDataTypeKind
Throw New NotSupportedException
End Function
Protected Overridable Function GetDocComment(codeElement As TCodeElement) As String
Throw New NotSupportedException
End Function
Protected Overridable Function GetDocCommentSetter(codeElement As TCodeElement) As Action(Of String)
Throw New NotSupportedException
End Function
Protected Overridable Function GetImplementedInterfaces(codeElement As TCodeElement) As EnvDTE.CodeElements
Throw New NotSupportedException
End Function
Protected Overridable Function GetInheritanceKind(codeElement As TCodeElement) As EnvDTE80.vsCMInheritanceKind
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsAbstract(codeElement As TCodeElement) As Boolean
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsDefault(codeElement As TCodeElement) As Boolean
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsGeneric(codeElement As TCodeElement) As Boolean
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsShared(codeElement As TCodeElement) As Boolean
Throw New NotSupportedException
End Function
Protected Overridable Function GetMustImplement(codeElement As TCodeElement) As Boolean
Throw New NotSupportedException
End Function
Protected Overridable Function GetOverrideKind(codeElement As TCodeElement) As EnvDTE80.vsCMOverrideKind
Throw New NotSupportedException
End Function
Protected Overridable Function GetParent(codeElement As TCodeElement) As Object
Throw New NotSupportedException
End Function
Protected Overridable Function GetParts(codeElement As TCodeElement) As EnvDTE.CodeElements
Throw New NotSupportedException
End Function
Protected Overridable Function GetPrototype(codeElement As TCodeElement, flags As EnvDTE.vsCMPrototype) As String
Throw New NotSupportedException
End Function
Protected Overridable Function GetReadWrite(codeElement As TCodeElement) As EnvDTE80.vsCMPropertyKind
Throw New NotSupportedException
End Function
Protected Overridable Overloads Function GetTypeProp(codeElement As TCodeElement) As EnvDTE.CodeTypeRef
Throw New NotSupportedException
End Function
Protected Overridable Function IsDerivedFrom(codeElement As TCodeElement, fullName As String) As Boolean
Throw New NotSupportedException
End Function
Protected Overridable Function AddAttribute(codeElement As TCodeElement, data As AttributeData) As EnvDTE.CodeAttribute
Throw New NotSupportedException
End Function
Protected Overridable Function AddEnumMember(codeElement As TCodeElement, data As EnumMemberData) As EnvDTE.CodeVariable
Throw New NotSupportedException
End Function
Protected Overridable Function AddEvent(codeElement As TCodeElement, data As EventData) As EnvDTE80.CodeEvent
Throw New NotSupportedException
End Function
Protected Overridable Function AddFunction(codeElement As TCodeElement, data As FunctionData) As EnvDTE.CodeFunction
Throw New NotSupportedException
End Function
Protected Overridable Function AddParameter(codeElement As TCodeElement, data As ParameterData) As EnvDTE.CodeParameter
Throw New NotSupportedException
End Function
Protected Overridable Function AddProperty(codeElement As TCodeElement, data As PropertyData) As EnvDTE.CodeProperty
Throw New NotSupportedException
End Function
Protected Overridable Function AddVariable(codeElement As TCodeElement, data As VariableData) As EnvDTE.CodeVariable
Throw New NotSupportedException
End Function
Protected Overridable Function GetAccessSetter(codeElement As TCodeElement) As Action(Of EnvDTE.vsCMAccess)
Throw New NotSupportedException
End Function
Protected Overridable Function GetClassKindSetter(codeElement As TCodeElement) As Action(Of EnvDTE80.vsCMClassKind)
Throw New NotSupportedException
End Function
Protected Overridable Function GetConstKindSetter(codeElement As TCodeElement) As Action(Of EnvDTE80.vsCMConstKind)
Throw New NotSupportedException
End Function
Protected Overridable Function GetDataTypeKindSetter(codeElement As TCodeElement) As Action(Of EnvDTE80.vsCMDataTypeKind)
Throw New NotSupportedException
End Function
Protected Overridable Function GetInheritanceKindSetter(codeElement As TCodeElement) As Action(Of EnvDTE80.vsCMInheritanceKind)
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsAbstractSetter(codeElement As TCodeElement) As Action(Of Boolean)
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsDefaultSetter(codeElement As TCodeElement) As Action(Of Boolean)
Throw New NotSupportedException
End Function
Protected Overridable Function GetIsSharedSetter(codeElement As TCodeElement) As Action(Of Boolean)
Throw New NotSupportedException
End Function
Protected Overridable Function GetMustImplementSetter(codeElement As TCodeElement) As Action(Of Boolean)
Throw New NotSupportedException
End Function
Protected Overridable Function GetOverrideKindSetter(codeElement As TCodeElement) As Action(Of EnvDTE80.vsCMOverrideKind)
Throw New NotSupportedException
End Function
Protected Overridable Function GetTypePropSetter(codeElement As TCodeElement) As Action(Of EnvDTE.CodeTypeRef)
Throw New NotSupportedException
End Function
Protected Overridable Sub RemoveChild(codeElement As TCodeElement, child As Object)
Throw New NotSupportedException
End Sub
Protected Overridable Function GenericNameExtender_GetBaseTypesCount(codeElement As TCodeElement) As Integer
Throw New NotSupportedException
End Function
Protected Overridable Function GenericNameExtender_GetImplementedTypesCount(codeElement As TCodeElement) As Integer
Throw New NotSupportedException
End Function
Protected Overridable Function GenericNameExtender_GetBaseGenericName(codeElement As TCodeElement, index As Integer) As String
Throw New NotSupportedException
End Function
Protected Overridable Function GenericNameExtender_GetImplTypeGenericName(codeElement As TCodeElement, index As Integer) As String
Throw New NotSupportedException
End Function
Protected Overridable Function AddBase(codeElement As TCodeElement, base As Object, position As Object) As EnvDTE.CodeElement
Throw New NotSupportedException
End Function
Protected Overridable Sub RemoveBase(codeElement As TCodeElement, element As Object)
Throw New NotSupportedException
End Sub
Protected Overridable Function AddImplementedInterface(codeElement As TCodeElement, base As Object, position As Object) As EnvDTE.CodeInterface
Throw New NotSupportedException
End Function
Protected Overridable Function GetParameters(codeElement As TCodeElement) As EnvDTE.CodeElements
Throw New NotSupportedException
End Function
Protected Overridable Sub RemoveImplementedInterface(codeElement As TCodeElement, element As Object)
Throw New NotSupportedException
End Sub
''' <summary>
''' This function validates that our Code DOM elements are exporting the proper default interface. That
''' interface dictates what values are returned from methods like <see cref="ComponentModel.TypeDescriptor.GetProperties(Object)"/>.
'''
''' It's not possible for those methods to be called in all environments where we test because it
''' requires type libraries, like EnvDTE, to be manually registered. Testing for the ComDefaultInterface
''' attribute is an indirect way of verifying the same behavior.
''' </summary>
''' <typeparam name="TInterface">The default interface the Code DOM element should be exporting</typeparam>
''' <param name="code">Code to create the Code DOM element</param>
Protected Sub TestPropertyDescriptors(Of TInterface As Class)(code As XElement)
TestElement(code,
Sub(codeElement)
Dim obj = Implementation.Interop.ComAggregate.GetManagedObject(Of Object)(codeElement)
Dim type = obj.GetType()
Dim attributes = type.GetCustomAttributes(GetType(ComDefaultInterfaceAttribute), inherit:=False)
Dim defaultAttribute = CType(attributes.Single(), ComDefaultInterfaceAttribute)
Assert.True(GetType(TInterface).IsEquivalentTo(defaultAttribute.Value))
End Sub)
End Sub
Protected Sub TestGetStartPoint(code As XElement, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)))
TestElement(code,
Sub(codeElement)
Dim textPointGetter = GetStartPointFunc(codeElement)
For Each action In expectedParts
action(textPointGetter)
Next
End Sub)
End Sub
Protected Sub TestGetEndPoint(code As XElement, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)))
TestElement(code,
Sub(codeElement)
Dim textPointGetter = GetEndPointFunc(codeElement)
For Each action In expectedParts
action(textPointGetter)
Next
End Sub)
End Sub
Protected Sub TestAccess(code As XElement, expectedAccess As EnvDTE.vsCMAccess)
TestElement(code,
Sub(codeElement)
Dim access = GetAccess(codeElement)
Assert.Equal(expectedAccess, access)
End Sub)
End Sub
Protected Sub TestAttributes(code As XElement, ParamArray expectedAttributes() As Action(Of Object))
TestElement(code,
Sub(codeElement)
Dim attributes = GetAttributes(codeElement)
Assert.Equal(expectedAttributes.Length, attributes.Count)
For i = 1 To attributes.Count
expectedAttributes(i - 1)(attributes.Item(i))
Next
End Sub)
End Sub
Protected Sub TestBases(code As XElement, ParamArray expectedBases() As Action(Of Object))
TestElement(code,
Sub(codeElement)
Dim bases = GetBases(codeElement)
Assert.Equal(expectedBases.Length, bases.Count)
For i = 1 To bases.Count
expectedBases(i - 1)(bases.Item(i))
Next
End Sub)
End Sub
Protected Overrides Sub TestChildren(code As XElement, ParamArray expectedChildren() As Action(Of Object))
TestElement(code,
Sub(codeElement)
Dim element = CType(codeElement, EnvDTE.CodeElement)
Assert.True(element IsNot Nothing, $"Could not cast {GetType(TCodeElement).FullName} to {GetType(EnvDTE.CodeElement).FullName}.")
Dim children = element.Children
Assert.Equal(expectedChildren.Length, children.Count)
For i = 1 To children.Count
expectedChildren(i - 1)(children.Item(i))
Next
End Sub)
End Sub
Protected Sub TestClassKind(code As XElement, expectedClassKind As EnvDTE80.vsCMClassKind)
TestElement(code,
Sub(codeElement)
Dim classKind = GetClassKind(codeElement)
Assert.Equal(expectedClassKind, classKind)
End Sub)
End Sub
Protected Sub TestComment(code As XElement, expectedComment As String)
TestElement(code,
Sub(codeElement)
Dim comment = GetComment(codeElement)
Assert.Equal(expectedComment, comment)
End Sub)
End Sub
Protected Sub TestConstKind(code As XElement, expectedConstKind As EnvDTE80.vsCMConstKind)
TestElement(code,
Sub(codeElement)
Dim constKind = GetConstKind(codeElement)
Assert.Equal(expectedConstKind, constKind)
End Sub)
End Sub
Protected Sub TestDataTypeKind(code As XElement, expectedDataTypeKind As EnvDTE80.vsCMDataTypeKind)
TestElement(code,
Sub(codeElement)
Dim dataTypeKind = GetDataTypeKind(codeElement)
Assert.Equal(expectedDataTypeKind, dataTypeKind)
End Sub)
End Sub
Protected Sub TestDocComment(code As XElement, expectedDocComment As String)
TestElement(code,
Sub(codeElement)
Dim docComment = GetDocComment(codeElement)
Assert.Equal(expectedDocComment, docComment)
End Sub)
End Sub
Protected Sub TestFullName(code As XElement, expectedFullName As String)
TestElement(code,
Sub(codeElement)
Dim fullName = GetFullName(codeElement)
Assert.Equal(expectedFullName, fullName)
End Sub)
End Sub
Protected Sub TestImplementedInterfaces(code As XElement, ParamArray expectedBases() As Action(Of Object))
TestElement(code,
Sub(codeElement)
Dim implementedInterfaces = GetImplementedInterfaces(codeElement)
Assert.Equal(expectedBases.Length, implementedInterfaces.Count)
For i = 1 To implementedInterfaces.Count
expectedBases(i - 1)(implementedInterfaces.Item(i))
Next
End Sub)
End Sub
Protected Sub TestInheritanceKind(code As XElement, expectedInheritanceKind As EnvDTE80.vsCMInheritanceKind)
TestElement(code,
Sub(codeElement)
Dim inheritanceKind = GetInheritanceKind(codeElement)
Assert.Equal(expectedInheritanceKind, inheritanceKind)
End Sub)
End Sub
Protected Sub TestIsAbstract(code As XElement, expectedValue As Boolean)
TestElement(code,
Sub(codeElement)
Dim value = GetIsAbstract(codeElement)
Assert.Equal(expectedValue, value)
End Sub)
End Sub
Protected Sub TestIsDefault(code As XElement, expectedValue As Boolean)
TestElement(code,
Sub(codeElement)
Dim value = GetIsDefault(codeElement)
Assert.Equal(expectedValue, value)
End Sub)
End Sub
Protected Sub TestIsGeneric(code As XElement, expectedValue As Boolean)
TestElement(code,
Sub(codeElement)
Dim value = GetIsGeneric(codeElement)
Assert.Equal(expectedValue, value)
End Sub)
End Sub
Protected Sub TestIsShared(code As XElement, expectedValue As Boolean)
TestElement(code,
Sub(codeElement)
Dim value = GetIsShared(codeElement)
Assert.Equal(expectedValue, value)
End Sub)
End Sub
Protected Sub TestKind(code As XElement, expectedKind As EnvDTE.vsCMElement)
TestElement(code,
Sub(codeElement)
Dim kind = GetKind(codeElement)
Assert.Equal(expectedKind, kind)
End Sub)
End Sub
Protected Sub TestMustImplement(code As XElement, expectedValue As Boolean)
TestElement(code,
Sub(codeElement)
Dim value = GetMustImplement(codeElement)
Assert.Equal(expectedValue, value)
End Sub)
End Sub
Protected Sub TestName(code As XElement, expectedName As String)
TestElement(code,
Sub(codeElement)
Dim name = GetName(codeElement)
Assert.Equal(expectedName, name)
End Sub)
End Sub
Protected Sub TestOverrideKind(code As XElement, expectedOverrideKind As EnvDTE80.vsCMOverrideKind)
TestElement(code,
Sub(codeElement)
Dim overrideKind = GetOverrideKind(codeElement)
Assert.Equal(expectedOverrideKind, overrideKind)
End Sub)
End Sub
Protected Sub TestParts(code As XElement, expectedPartCount As Integer)
TestElement(code,
Sub(codeElement)
Dim parts = GetParts(codeElement)
' TODO: Test the elements themselves, not just the count (PartialTypeCollection.Item is not fully implemented)
Assert.Equal(expectedPartCount, parts.Count)
End Sub)
End Sub
Protected Sub TestParent(code As XElement, expectedParent As Action(Of Object))
TestElement(code,
Sub(codeElement)
Dim parent = GetParent(codeElement)
expectedParent(parent)
End Sub)
End Sub
Protected Sub TestPrototype(code As XElement, flags As EnvDTE.vsCMPrototype, expectedPrototype As String)
TestElement(code,
Sub(codeElement)
Dim prototype = GetPrototype(codeElement, flags)
Assert.Equal(expectedPrototype, prototype)
End Sub)
End Sub
Protected Sub TestPrototypeThrows(Of TException As Exception)(code As XElement, flags As EnvDTE.vsCMPrototype)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() GetPrototype(codeElement, flags))
End Sub)
End Sub
Protected Sub TestReadWrite(code As XElement, expectedOverrideKind As EnvDTE80.vsCMPropertyKind)
TestElement(code,
Sub(codeElement)
Dim readWrite = GetReadWrite(codeElement)
Assert.Equal(expectedOverrideKind, readWrite)
End Sub)
End Sub
Protected Sub TestIsDerivedFrom(code As XElement, baseFullName As String, expectedIsDerivedFrom As Boolean)
TestElement(code,
Sub(codeElement)
Dim actualIsDerivedFrom = IsDerivedFrom(codeElement, baseFullName)
Assert.Equal(expectedIsDerivedFrom, actualIsDerivedFrom)
End Sub)
End Sub
Protected Sub TestTypeProp(code As XElement, data As CodeTypeRefData)
TestElement(code,
Sub(codeElement)
Dim codeTypeRef = GetTypeProp(codeElement)
TestCodeTypeRef(codeTypeRef, data)
End Sub)
End Sub
Protected Overrides Async Function TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim attribute = AddAttribute(codeElement, data)
Assert.NotNull(attribute)
Assert.Equal(data.Name, attribute.Name)
End Sub)
End Function
Protected Overrides Async Function TestAddEnumMember(code As XElement, expectedCode As XElement, data As EnumMemberData) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim enumMember = AddEnumMember(codeElement, data)
Assert.NotNull(enumMember)
Assert.Equal(data.Name, enumMember.Name)
End Sub)
End Function
Protected Overrides Async Function TestAddEvent(code As XElement, expectedCode As XElement, data As EventData) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim ev = AddEvent(codeElement, data)
Assert.NotNull(ev)
Assert.Equal(data.Name, ev.Name)
End Sub)
End Function
Protected Overrides Async Function TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim func = AddFunction(codeElement, data)
Assert.NotNull(func)
If data.Kind <> EnvDTE.vsCMFunction.vsCMFunctionDestructor Then
Assert.Equal(data.Name, func.Name)
End If
End Sub)
End Function
Protected Overrides Async Function TestAddParameter(code As XElement, expectedCode As XElement, data As ParameterData) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim name = GetName(codeElement)
Dim parameter = AddParameter(codeElement, data)
Assert.NotNull(parameter)
Assert.Equal(data.Name, parameter.Name)
' Verify we haven't screwed up any node keys by checking that we
' can still access the parent element after adding the parameter.
Assert.Equal(name, GetName(codeElement))
End Sub)
End Function
Private Protected Overrides Async Function TestAddProperty(
code As XElement, expectedCode As XElement, data As PropertyData,
Optional options As IDictionary(Of OptionKey2, Object) = Nothing,
Optional editorConfig As String = "") As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim prop = AddProperty(codeElement, data)
Assert.NotNull(prop)
Assert.True(data.GetterName = prop.Name OrElse data.PutterName = prop.Name)
End Sub,
options,
editorConfig)
End Function
Protected Overrides Async Function TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim variable = AddVariable(codeElement, data)
Assert.NotNull(variable)
Assert.Equal(data.Name, variable.Name)
End Sub)
End Function
Protected Overrides Async Function TestRemoveChild(code As XElement, expectedCode As XElement, child As Object) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim name = GetName(codeElement)
RemoveChild(codeElement, child)
' Verify we haven't screwed up any node keys by checking that we
' can still access the parent element after deleting the child.
Assert.Equal(name, GetName(codeElement))
End Sub)
End Function
Protected Async Function TestSetAccess(code As XElement, expectedCode As XElement, access As EnvDTE.vsCMAccess) As Task
Await TestSetAccess(code, expectedCode, access, NoThrow(Of EnvDTE.vsCMAccess)())
End Function
Protected Async Function TestSetAccess(code As XElement, expectedCode As XElement, access As EnvDTE.vsCMAccess, action As SetterAction(Of EnvDTE.vsCMAccess)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim accessSetter = GetAccessSetter(codeElement)
action(access, accessSetter)
End Sub)
End Function
Protected Async Function TestSetClassKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMClassKind) As Task
Await TestSetClassKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMClassKind)())
End Function
Protected Async Function TestSetClassKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMClassKind, action As SetterAction(Of EnvDTE80.vsCMClassKind)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim classKindSetter = GetClassKindSetter(codeElement)
action(kind, classKindSetter)
End Sub)
End Function
Protected Async Function TestSetComment(code As XElement, expectedCode As XElement, value As String) As Task
Await TestSetComment(code, expectedCode, value, NoThrow(Of String)())
End Function
Protected Async Function TestSetComment(code As XElement, expectedCode As XElement, value As String, action As SetterAction(Of String)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim commentSetter = GetCommentSetter(codeElement)
action(value, commentSetter)
End Sub)
End Function
Protected Async Function TestSetConstKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMConstKind) As Task
Await TestSetConstKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMConstKind)())
End Function
Protected Async Function TestSetConstKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMConstKind, action As SetterAction(Of EnvDTE80.vsCMConstKind)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim constKindSetter = GetConstKindSetter(codeElement)
action(kind, constKindSetter)
End Sub)
End Function
Protected Async Function TestSetDataTypeKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMDataTypeKind) As Task
Await TestSetDataTypeKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMDataTypeKind)())
End Function
Protected Async Function TestSetDataTypeKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMDataTypeKind, action As SetterAction(Of EnvDTE80.vsCMDataTypeKind)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim dataTypeKindSetter = GetDataTypeKindSetter(codeElement)
action(kind, dataTypeKindSetter)
End Sub)
End Function
Protected Async Function TestSetDocComment(code As XElement, expectedCode As XElement, value As String) As Task
Await TestSetDocComment(code, expectedCode, value, NoThrow(Of String)())
End Function
Protected Async Function TestSetDocComment(code As XElement, expectedCode As XElement, value As String, action As SetterAction(Of String)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim docCommentSetter = GetDocCommentSetter(codeElement)
action(value, docCommentSetter)
End Sub)
End Function
Protected Async Function TestSetInheritanceKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMInheritanceKind) As Task
Await TestSetInheritanceKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMInheritanceKind)())
End Function
Protected Async Function TestSetInheritanceKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMInheritanceKind, action As SetterAction(Of EnvDTE80.vsCMInheritanceKind)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim inheritanceKindSetter = GetInheritanceKindSetter(codeElement)
action(kind, inheritanceKindSetter)
End Sub)
End Function
Protected Async Function TestSetIsAbstract(code As XElement, expectedCode As XElement, value As Boolean) As Task
Await TestSetIsAbstract(code, expectedCode, value, NoThrow(Of Boolean)())
End Function
Protected Async Function TestSetIsAbstract(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim isAbstractSetter = GetIsAbstractSetter(codeElement)
action(value, isAbstractSetter)
End Sub)
End Function
Protected Async Function TestSetIsDefault(code As XElement, expectedCode As XElement, value As Boolean) As Task
Await TestSetIsDefault(code, expectedCode, value, NoThrow(Of Boolean)())
End Function
Protected Async Function TestSetIsDefault(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim isDefaultSetter = GetIsDefaultSetter(codeElement)
action(value, isDefaultSetter)
End Sub)
End Function
Protected Async Function TestSetIsShared(code As XElement, expectedCode As XElement, value As Boolean) As Task
Await TestSetIsShared(code, expectedCode, value, NoThrow(Of Boolean)())
End Function
Protected Async Function TestSetIsShared(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim isSharedSetter = GetIsSharedSetter(codeElement)
action(value, isSharedSetter)
End Sub)
End Function
Protected Async Function TestSetMustImplement(code As XElement, expectedCode As XElement, value As Boolean) As Task
Await TestSetMustImplement(code, expectedCode, value, NoThrow(Of Boolean)())
End Function
Protected Async Function TestSetMustImplement(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim mustImplementSetter = GetMustImplementSetter(codeElement)
action(value, mustImplementSetter)
End Sub)
End Function
Protected Async Function TestSetOverrideKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMOverrideKind) As Task
Await TestSetOverrideKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMOverrideKind)())
End Function
Protected Async Function TestSetOverrideKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMOverrideKind, action As SetterAction(Of EnvDTE80.vsCMOverrideKind)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim overrideKindSetter = GetOverrideKindSetter(codeElement)
action(kind, overrideKindSetter)
End Sub)
End Function
Protected Async Function TestSetName(code As XElement, expectedCode As XElement, name As String, action As SetterAction(Of String)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim nameSetter = GetNameSetter(codeElement)
action(name, nameSetter)
End Sub)
End Function
Protected Sub TestNamespaceName(code As XElement, name As String)
TestElement(code,
Sub(codeElement)
Dim codeNamespaceElement = GetNamespace(codeElement)
Assert.NotNull(codeNamespaceElement)
Assert.Equal(name, codeNamespaceElement.Name)
End Sub)
End Sub
Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, codeTypeRef As EnvDTE.CodeTypeRef) As Task
Await TestSetTypeProp(code, expectedCode, codeTypeRef, NoThrow(Of EnvDTE.CodeTypeRef)())
End Function
Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, codeTypeRef As EnvDTE.CodeTypeRef, action As SetterAction(Of EnvDTE.CodeTypeRef)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
Dim typePropSetter = GetTypePropSetter(codeElement)
action(codeTypeRef, typePropSetter)
End Sub)
End Function
Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, typeName As String) As Task
Await TestSetTypeProp(code, expectedCode, typeName, NoThrow(Of EnvDTE.CodeTypeRef)())
End Function
Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, typeName As String, action As SetterAction(Of EnvDTE.CodeTypeRef)) As Task
Await TestElementUpdate(code, expectedCode,
Sub(state, codeElement)
Dim codeTypeRef = state.RootCodeModel.CreateCodeTypeRef(typeName)
Dim typePropSetter = GetTypePropSetter(codeElement)
action(codeTypeRef, typePropSetter)
End Sub)
End Function
Protected Sub TestGenericNameExtender_GetBaseTypesCount(code As XElement, expected As Integer)
TestElement(code,
Sub(codeElement)
Assert.Equal(expected, GenericNameExtender_GetBaseTypesCount(codeElement))
End Sub)
End Sub
Protected Sub TestGenericNameExtender_GetImplementedTypesCount(code As XElement, expected As Integer)
TestElement(code,
Sub(codeElement)
Assert.Equal(expected, GenericNameExtender_GetImplementedTypesCount(codeElement))
End Sub)
End Sub
Protected Sub TestGenericNameExtender_GetImplementedTypesCountThrows(Of TException As Exception)(code As XElement)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() GenericNameExtender_GetImplementedTypesCount(codeElement))
End Sub)
End Sub
Protected Sub TestGenericNameExtender_GetBaseGenericName(code As XElement, index As Integer, expected As String)
TestElement(code,
Sub(codeElement)
Assert.Equal(expected, GenericNameExtender_GetBaseGenericName(codeElement, index))
End Sub)
End Sub
Protected Sub TestGenericNameExtender_GetImplTypeGenericName(code As XElement, index As Integer, expected As String)
TestElement(code,
Sub(codeElement)
Assert.Equal(expected, GenericNameExtender_GetImplTypeGenericName(codeElement, index))
End Sub)
End Sub
Protected Sub TestGenericNameExtender_GetImplTypeGenericNameThrows(Of TException As Exception)(code As XElement, index As Integer)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() GenericNameExtender_GetImplTypeGenericName(codeElement, index))
End Sub)
End Sub
Protected Async Function TestAddBase(code As XElement, base As Object, position As Object, expectedCode As XElement) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
AddBase(codeElement, base, position)
End Sub)
End Function
Protected Sub TestAddBaseThrows(Of TException As Exception)(code As XElement, base As Object, position As Object)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() AddBase(codeElement, base, position))
End Sub)
End Sub
Protected Async Function TestRemoveBase(code As XElement, element As Object, expectedCode As XElement) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
RemoveBase(codeElement, element)
End Sub)
End Function
Protected Sub TestRemoveBaseThrows(Of TException As Exception)(code As XElement, element As Object)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() RemoveBase(codeElement, element))
End Sub)
End Sub
Protected Async Function TestAddImplementedInterface(code As XElement, base As Object, position As Object, expectedCode As XElement) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
AddImplementedInterface(codeElement, base, position)
End Sub)
End Function
Protected Sub TestAddImplementedInterfaceThrows(Of TException As Exception)(code As XElement, base As Object, position As Object)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() AddImplementedInterface(codeElement, base, position))
End Sub)
End Sub
Protected Async Function TestRemoveImplementedInterface(code As XElement, element As Object, expectedCode As XElement) As Task
Await TestElementUpdate(code, expectedCode,
Sub(codeElement)
RemoveImplementedInterface(codeElement, element)
End Sub)
End Function
Protected Sub TestRemoveImplementedInterfaceThrows(Of TException As Exception)(code As XElement, element As Object)
TestElement(code,
Sub(codeElement)
Assert.Throws(Of TException)(Sub() RemoveImplementedInterface(codeElement, element))
End Sub)
End Sub
Protected Sub TestAllParameterNames(code As XElement, ParamArray expectedParameterNames() As String)
TestElement(code,
Sub(codeElement)
Dim parameters = GetParameters(codeElement)
Assert.NotNull(parameters)
Assert.Equal(parameters.Count(), expectedParameterNames.Count())
If (expectedParameterNames.Any()) Then
TestAllParameterNamesByIndex(parameters, expectedParameterNames)
TestAllParameterNamesByName(parameters, expectedParameterNames)
End If
End Sub)
End Sub
Private Shared Sub TestAllParameterNamesByName(parameters As EnvDTE.CodeElements, expectedParameterNames() As String)
For index = 0 To expectedParameterNames.Count() - 1
Assert.NotNull(parameters.Item(expectedParameterNames(index)))
Next
End Sub
Private Shared Sub TestAllParameterNamesByIndex(parameters As EnvDTE.CodeElements, expectedParameterNames() As String)
For index = 0 To expectedParameterNames.Count() - 1
' index + 1 for Item because Parameters are not zero indexed
Assert.Equal(expectedParameterNames(index), parameters.Item(index + 1).Name)
Next
End Sub
End Class
End Namespace
|
mavasani/roslyn
|
src/VisualStudio/Core/Test/CodeModel/AbstractCodeElementTests`1.vb
|
Visual Basic
|
mit
| 52,407
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.ExitContinue
Public Class ExitContinueCodeActionTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
Return (Nothing, New IncorrectExitContinueCodeFixProvider())
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKind_Sub() As Task
Dim code =
<File>
Class C
Sub foo()
[|Exit|]
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub foo()
Exit Sub
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKind_While() As Task
Dim code =
<File>
Class C
Sub foo()
While True
[|Exit|]
End While
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub foo()
While True
Exit While
End While
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKind_For() As Task
Dim code =
<File>
Class C
Sub foo()
For x as Integer = 1 to 10
[|Exit|]
Next
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub foo()
For x as Integer = 1 to 10
Exit For
Next
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKind_Do() As Task
Dim code =
<File>
Class C
Sub foo()
Do While True
[|Exit|]
Loop
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub foo()
Do While True
Exit Do
Loop
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitPropNot() As Task
Dim code =
<File>
Class C
Property P as Integer
Get
[|Exit|]
End Get
Set
End Set
End Property
Exit Class
</File>
Dim expected =
<File>
Class C
Property P as Integer
Get
Exit Property
End Get
Set
End Set
End Property
Exit Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKind_Try() As Task
Dim code =
<File>
Class C
Sub Foo()
Try
[|Exit|]
Catch ex As Exception
End Try
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
Try
Exit Try
Catch ex As Exception
End Try
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKind_Function() As Task
Dim code =
<File>
Class C
Function x() as Integer
[|Exit|]
End Function
End Class
</File>
Dim expected =
<File>
Class C
Function x() as Integer
Exit Function
End Function
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitSubOfFunc() As Task
Dim code =
<File>
Class C
Function x() as Integer
[|Exit Sub|]
End Function
End Class
</File>
Dim expected =
<File>
Class C
Function x() as Integer
Exit Function
End Function
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitFuncOfSub() As Task
Dim code =
<File>
Class C
Sub Foo()
[|Exit Function|]
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
Exit Sub
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitDoNotWithinDo() As Task
Dim code =
<File>
Class C
Sub Foo()
While True
[|Exit Do|]
End While
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
While True
Exit While
End While
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitDoNotWithinDo_For() As Task
Dim code =
<File>
Class C
Sub Foo()
For x as Integer = 1 to 10
[|Exit Do|]
Next
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
For x as Integer = 1 to 10
Exit For
Next
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False, index:=0)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitWhileNotWithinWhile() As Task
Dim code =
<File>
Class C
Sub Foo()
Do While True
[|Exit While|]
Loop
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
Do While True
Exit Do
Loop
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitDoNotWithinDo_Try() As Task
Dim code =
<File>
Imports System
Class C
Sub Foo()
Try
[|Exit Do|]
Catch ex As Exception
End Try
End Sub
End Class
</File>
Dim expected =
<File>
Imports System
Class C
Sub Foo()
Try
Exit Try
Catch ex As Exception
End Try
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitTryNotWithinTry() As Task
Dim code =
<File>
Class C
Sub Foo
[|Exit Try|]
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
Exit Sub
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExitChangeToSelect() As Task
Dim code =
<File>
Class C
Sub Foo()
Dim i as Integer = 0
Select Case i
Case 0
[|Exit Do|]
End Select
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
Dim i as Integer = 0
Select Case i
Case 0
Exit Select
End Select
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestContinueDoNotWithinDo() As Task
Dim code =
<File>
Class C
Sub Foo()
Dim i as Integer = 0
Select Case i
Case 0
[|Continue Do|]
End Select
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
Dim i as Integer = 0
Select Case i
Case 0
End Select
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestContinueForNotWithinFor() As Task
Dim code =
<File>
Class C
Sub Foo
Dim i as Integer = 0
Select Case i
Case 0
[|Continue For|]
End Select
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
Dim i as Integer = 0
Select Case i
Case 0
End Select
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestContinueWhileNotWithinWhile() As Task
Dim code =
<File>
Class C
Sub Foo()
Dim i as Integer = 0
Select Case i
Case 0
[|Continue While|]
End Select
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
Dim i as Integer = 0
Select Case i
Case 0
End Select
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedContinueKindWhile() As Task
Dim code =
<File>
Class C
Sub Foo()
While True
[|Continue|]
End While
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo()
While True
Continue While
End While
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedContinueKindFor() As Task
Dim code =
<File>
Class C
Sub Foo
For x as integer = 1 to 10
[|Continue|]
Next
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
For x as integer = 1 to 10
Continue For
Next
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedContinueKindForEach() As Task
Dim code =
<File>
Class C
Sub Foo
For Each x in {1}
[|Continue|]
Next
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
For Each x in {1}
Continue For
Next
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedContinueKindDo() As Task
Dim code =
<File>
Class C
Sub Foo
Do While True
[|Continue|]
Loop
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
Do While True
Continue Do
Loop
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedContinueKindDo_ReplaceFor() As Task
Dim code =
<File>
Class C
Sub Foo
Do While True
[|Continue For|]
Loop
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
Do While True
Continue Do
Loop
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedExitKindDo_UseSub() As Task
Dim code =
<File>
Class C
Sub Foo
Do While True
[|Exit|]
Loop
End Sub
End Class
</File>
Dim expected =
<File>
Class C
Sub Foo
Do While True
Exit Sub
Loop
End Sub
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False, index:=1)
End Function
<WorkItem(547094, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547094")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestDoNotTryToExitFinally() As Task
Dim code =
<File>
Imports System
Class C
Function Foo() As Integer
Try
Catch ex As Exception
Finally
[|Exit|]
End Try
End Function
End Class
</File>
Dim expected =
<File>
Imports System
Class C
Function Foo() As Integer
Try
Catch ex As Exception
Finally
End Try
End Function
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<WorkItem(547110, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547110")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestMissingExitTokenInNonExitableBlock() As Task
Dim code =
<File>
Imports System
Class C
Function Foo() As Integer
Try
If True Then
[|Exit|]
End If
Catch ex As Exception
Finally
End Try
End Function
End Class
</File>
Dim expected =
<File>
Imports System
Class C
Function Foo() As Integer
Try
If True Then
Exit Try
End If
Catch ex As Exception
Finally
End Try
End Function
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<WorkItem(547100, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547100")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestNotInValidCaseElse() As Task
Await TestMissingInRegularAndScriptAsync(
"Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main(args As String())
For Each a In args
Select a
Case Else
[|Exit Select|] ' here
End Select
Next
End Sub
End Module")
End Function
<WorkItem(547099, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547099")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestCollapseDuplicateBlockKinds() As Task
Await TestActionCountAsync(
"Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main(args As String())
Do
Do While True
[|Exit Function|] ' here
Loop
Loop
End Sub
End Module",
3)
End Function
<WorkItem(547092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547092")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestReplaceInvalidTokenExit() As Task
Dim code =
<File>
Imports System
Class C
Function Foo() As Integer
Try
If True Then
[|Exit |]blah
End If
Catch ex As Exception
Finally
End Try
End Function
End Class
</File>
Dim expected =
<File>
Imports System
Class C
Function Foo() As Integer
Try
If True Then
Exit Try
End If
Catch ex As Exception
Finally
End Try
End Function
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<WorkItem(547092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547092")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestReplaceInvalidTokenContinue() As Task
Dim code =
<File>
Imports System
Class C
Function Foo() As Integer
Do
[|Continue |]blah
Loop
End Function
End Class
</File>
Dim expected =
<File>
Imports System
Class C
Function Foo() As Integer
Do
Continue Do
Loop
End Function
End Class
</File>
Await TestAsync(code, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedActionDescriptions1() As Task
Dim code =
<File>
Class C
Sub foo()
[|Exit Function|]
End Sub
End Class
</File>
Await TestExactActionSetOfferedAsync(code.ConvertTestSourceTag(), {String.Format(FeaturesResources.Change_0_to_1, "Function", "Sub"), String.Format(VBFeaturesResources.Delete_the_0_statement1, "Exit Function")})
End Function
<WorkItem(531354, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531354")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsCorrectExitContinue)>
Public Async Function TestExpectedActionDescriptions2() As Task
Dim code =
<File>
Class C
Sub foo()
[|Exit |]
End Sub
End Class
</File>
Await TestExactActionSetOfferedAsync(code.ConvertTestSourceTag(), {String.Format(VBFeaturesResources.Insert_0, "Sub"), String.Format(VBFeaturesResources.Delete_the_0_statement1, "Exit")})
End Function
End Class
End Namespace
|
amcasey/roslyn
|
src/EditorFeatures/VisualBasicTest/Diagnostics/ExitContinue/ExitContinueCodeActionTests.vb
|
Visual Basic
|
apache-2.0
| 19,448
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading.Tasks
Imports Microsoft.VisualStudio.GraphModel
Imports Microsoft.VisualStudio.LanguageServices.Implementation.Progression
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Progression
Public Class ImplementsGraphQueryTests
<Fact, Trait(Traits.Feature, Traits.Features.Progression)>
Public Async Function TestClassImplementsInterface1() As Task
Using testState = ProgressionTestState.Create(
<Workspace>
<Project Language="C#" CommonReferences="true" FilePath="Z:\Project.csproj">
<Document FilePath="Z:\Project.cs">
class $$C : System.IDisposable { }
</Document>
</Project>
</Workspace>)
Dim inputGraph = await testState.GetGraphWithMarkedSymbolNodeAsync()
Dim outputContext = Await testState.GetGraphContextAfterQuery(inputGraph, New ImplementsGraphQuery(), GraphContextDirection.Target)
AssertSimplifiedGraphIs(
outputContext.Graph,
<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="(@1 Type=C)" Category="CodeSchema_Class" CodeSchemaProperty_IsInternal="True" CommonLabel="C" Icon="Microsoft.VisualStudio.Class.Internal" Label="C"/>
<Node Id="(@2 Namespace=System Type=IDisposable)" Category="CodeSchema_Interface" CodeSchemaProperty_IsAbstract="True" CodeSchemaProperty_IsPublic="True" CommonLabel="IDisposable" Icon="Microsoft.VisualStudio.Interface.Public" Label="IDisposable"/>
</Nodes>
<Links>
<Link Source="(@1 Type=C)" Target="(@2 Namespace=System Type=IDisposable)" Category="Implements"/>
</Links>
<IdentifierAliases>
<Alias n="1" Uri="Assembly=file:///Z:/CSharpAssembly1.dll"/>
<Alias n="2" Uri="Assembly=file:///Z:/FxReferenceAssembliesUri"/>
</IdentifierAliases>
</DirectedGraph>)
End Using
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Progression)>
Public Async Function TestMethodImplementsInterfaceMethod1() As Task
Using testState = ProgressionTestState.Create(
<Workspace>
<Project Language="C#" CommonReferences="true" FilePath="Z:\Project.csproj">
<Document FilePath="Z:\Project.cs">
using System;
class Foo : IComparable
{
public int $$CompareTo(object obj)
{
throw new NotImplementedException();
}
}
</Document>
</Project>
</Workspace>)
Dim inputGraph = Await testState.GetGraphWithMarkedSymbolNodeAsync()
Dim outputContext = Await testState.GetGraphContextAfterQuery(inputGraph, New ImplementsGraphQuery(), GraphContextDirection.Target)
AssertSimplifiedGraphIs(
outputContext.Graph,
<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="(@1 Type=Foo Member=(Name=CompareTo OverloadingParameters=[(@2 Namespace=System Type=Object)]))" Category="CodeSchema_Method" CodeSchemaProperty_IsPublic="True" CommonLabel="CompareTo" Icon="Microsoft.VisualStudio.Method.Public" Label="CompareTo"/>
<Node Id="(@2 Namespace=System Type=IComparable Member=(Name=CompareTo OverloadingParameters=[(@2 Namespace=System Type=Object)]))" Category="CodeSchema_Method" CodeSchemaProperty_IsAbstract="True" CodeSchemaProperty_IsPublic="True" CommonLabel="CompareTo" Icon="Microsoft.VisualStudio.Method.Public" Label="CompareTo"/>
</Nodes>
<Links>
<Link Source="(@1 Type=Foo Member=(Name=CompareTo OverloadingParameters=[(@2 Namespace=System Type=Object)]))" Target="(@2 Namespace=System Type=IComparable Member=(Name=CompareTo OverloadingParameters=[(@2 Namespace=System Type=Object)]))" Category="Implements"/>
</Links>
<IdentifierAliases>
<Alias n="1" Uri="Assembly=file:///Z:/CSharpAssembly1.dll"/>
<Alias n="2" Uri="Assembly=file:///Z:/FxReferenceAssembliesUri"/>
</IdentifierAliases>
</DirectedGraph>)
End Using
End Function
End Class
End Namespace
|
weltkante/roslyn
|
src/VisualStudio/Core/Test/Progression/ImplementsGraphQueryTests.vb
|
Visual Basic
|
apache-2.0
| 4,990
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
Public Class ForLoopBlockHighlighterTests
Inherits AbstractVisualBasicKeywordHighlighterTests
Friend Overrides Function GetHighlighterType() As Type
Return GetType(ForLoopBlockHighlighter)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForLoop1() As Task
Await TestAsync(<Text>
Class C
Sub M()
{|Cursor:[|For|]|} i = 2 [|To|] 10 [|Step|] 2
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForLoop2() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] i = 2 {|Cursor:[|To|]|} 10 [|Step|] 2
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForLoop3() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] i = 2 [|To|] 10 {|Cursor:[|Step|]|} 2
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForLoop5() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] i = 2 [|To|] 10 [|Step|] 2
If DateTime.Now.Ticks Mod 2 = 0 Then
{|Cursor:[|Exit For|]|}
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForLoop6() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] i = 2 [|To|] 10 [|Step|] 2
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
{|Cursor:[|Continue For|]|}
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForLoop4() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] i = 2 [|To|] 10 [|Step|] 2
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
{|Cursor:[|Next|]|}
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForEachLoop1() As Task
Await TestAsync(<Text>
Class C
Sub M()
{|Cursor:[|For Each|]|} x [|In|] a
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForEachLoop2() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For Each|] x {|Cursor:[|In|]|} a
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForEachLoop3() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For Each|] x [|In|] a
If DateTime.Now.Ticks Mod 2 = 0 Then
{|Cursor:[|Exit For|]|}
Else
[|Continue For|]
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForEachLoop4() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For Each|] x [|In|] a
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
{|Cursor:[|Continue For|]|}
End If
[|Next|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForEachLoop5() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For Each|] x [|In|] a
If DateTime.Now.Ticks Mod 2 = 0 Then
[|Exit For|]
Else
[|Continue For|]
End If
{|Cursor:[|Next|]|}
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(541628, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541628"), WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop1() As Task
Await TestAsync(<Text>
Class C
Sub M()
{|Cursor:[|For|]|} i = 1 [|To|] 10
For j = 1 To 10 Step 2
[|Next|] j, i
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop2() As Task
Await TestAsync(<Text>
Class C
Sub M()
For i = 1 To 10
{|Cursor:[|For|]|} j = 1 [|To|] 10 [|Step|] 2
[|Next|] j, i
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(541628, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541628"), WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop3() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] i = 1 [|To|] 10
For j = 1 To 10 Step 2
[|{|Cursor:Next|}|] j, i
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForMatchesNextWithSingleElementIdentifierList() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|{|Cursor:For|}|] a = 1 [|To|] 2
[|Next|] a
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForMatchesCorrectNextWithSingleElementIdentifierList() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] a = 1 [|To|] 2
[|{|Cursor:Next|}|] a
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForMatchesNextOfCorrectSinglyNestedFor() As Task
' Outer for blocks closed by a Next <identifier list> must go through their children for
' blocks to find the one that closes it (always the last such nested for block if found
' at the first nested level)
Await TestAsync(<Text>
Class C
Sub M()
[|{|Cursor:For|}|] a = 1 [|To|] 2
For b = 1 To 2
Next
For b = 1 To 2
[|Next|] b, a
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForMatchesNextAtCorrectNestingLevel() As Task
Await TestAsync(<Text>
Class C
Sub M()For a = 1 To 2
For b = 1 To 2
[|{|Cursor:For|}|] c = 1 [|To|] 2
For d = 1 To 2
For e = 1 To 2
For f = 1 To 2
Next f, e
[|Next|] d, c
Next b, a
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForMatchesNextOfCorrectDoublyNestedFor() As Task
' Outer for blocks closed by a Next <identifier list> must go through their children,
' grandchildren, etc. for blocks to find the one that closes it (always the last nested
' block in the last nested block (... etc.) if ever found)
Await TestAsync(<Text>
Class C
Sub M()
[|{|Cursor:For|}|] a = 1 [|To|] 2
For b = 1 To 2
Next
For b = 1 To 2
For c = 1 To 2
For d = 1 To 2
Next d, c
For c = 1 To 2
[|Next|] c, b, a
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForNotMatchesNextOfIncorrectNestedFor() As Task
' Outer for blocks without a Next should not match the Next of a nested for block unless
' the next block actually closes the outer for.
Await TestAsync(<Text>
Class C
Sub M()
[|{|Cursor:For|}|] a = 1 [|To|] 2
For b = 1 To 2
Next
For b = 1 To 2
Next b
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_NextMatchesCorrectForIgnoringLoopIdentifierNames() As Task
' The choice of For loop to highlight based on a Next <identifier list> statement should
' be based on structure, not identifier name matches.
Await TestAsync(<Text>
Class C
Sub M()
[|For|] a = 0 [|To|] 2
For b = 0 To 3
[|{|Cursor:Next|}|] z, y
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_ForMatchesCorrectNextIgnoringLoopIdentifierNames() As Task
' The choice of Next <identifier list> to highlight statement should be based on
' structure, not identifier name matches.
Await TestAsync(<Text>
Class C
Sub M()
[|For|] a = 0 [|To|] 2
For b = 0 To 3
[|{|Cursor:Next|}|] z, y
End Sub
End Class</Text>)
End Function
<Fact, WorkItem(544961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544961"), Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestForNestedLoop_NextMatchesOutermostForIfNextClosesMoreForsThanExist() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|For|] a = 1 [|To|] 2
For b = 1 To 2
[|{|Cursor:Next|}|] z, b, a
End Sub
End Class</Text>)
End Function
End Class
End Namespace
|
physhi/roslyn
|
src/EditorFeatures/VisualBasicTest/KeywordHighlighting/ForLoopBlockHighlighterTests.vb
|
Visual Basic
|
apache-2.0
| 11,152
|
Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim objConfigurations As SolidEdgeAssembly.Configurations = Nothing
Dim objConfiguration As SolidEdgeAssembly.Configuration = Nothing
Dim sConfigName As String
Dim aConfigList(1) As Object
Dim objMissing As Object
Try
OleMessageFilter.Register()
' Start Solid Edge
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objAssemblyDocument = objApplication.ActiveDocument
objConfigurations = objAssemblyDocument.Configurations
sConfigName = "NewConfig"
objMissing = System.Reflection.Missing.Value
aConfigList(0) = "1"
aConfigList(1) = "2"
' Create new derived configuration.
objConfiguration = objConfigurations.AddDerivedConfig(aConfigList.Length, 0, 0, aConfigList, objMissing, objMissing, sConfigName)
' Apply new configuration.
objConfiguration.Apply()
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgeAssembly.Configurations.AddDerivedConfig.vb
|
Visual Basic
|
mit
| 1,405
|
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Telerik.Reporting
Imports Telerik.Reporting.Drawing
Partial Public Class RegistroVentas
Inherits Telerik.Reporting.Report
Public Sub New()
InitializeComponent()
End Sub
End Class
|
crackper/SistFoncreagro
|
SistFoncreagro.Report/RegistroVentas.vb
|
Visual Basic
|
mit
| 289
|
Imports Microsoft.VisualBasic
Imports System.IO
Imports System.Drawing
Imports Aspose.Cells
Namespace Articles
Public Class CopyRangeStyleOnly
Public Shared Sub Run()
' ExStart:1
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
' Instantiate a new Workbook.
Dim workbook As New Workbook()
' Get the first Worksheet Cells.
Dim cells As Global.Aspose.Cells.Cells = workbook.Worksheets(0).Cells
' Fill some sample data into the cells.
For i As Integer = 0 To 49
For j As Integer = 0 To 9
cells(i, j).PutValue(i.ToString() & "," & j.ToString())
Next j
Next i
' Create a range (A1:D3).
Dim range As Range = cells.CreateRange("A1", "D3")
' Create a style object.
Dim style As Style
style = workbook.CreateStyle()
' Specify the font attribute.
style.Font.Name = "Calibri"
' Specify the shading color.
style.ForegroundColor = Color.Yellow
style.Pattern = BackgroundType.Solid
' Specify the border attributes.
style.Borders(BorderType.TopBorder).LineStyle = CellBorderType.Thin
style.Borders(BorderType.TopBorder).Color = Color.Blue
style.Borders(BorderType.BottomBorder).LineStyle = CellBorderType.Thin
style.Borders(BorderType.BottomBorder).Color = Color.Blue
style.Borders(BorderType.LeftBorder).LineStyle = CellBorderType.Thin
style.Borders(BorderType.LeftBorder).Color = Color.Blue
style.Borders(BorderType.RightBorder).LineStyle = CellBorderType.Thin
style.Borders(BorderType.RightBorder).Color = Color.Blue
' Create the styleflag object.
Dim flag1 As New StyleFlag()
' Implement font attribute
flag1.FontName = True
' Implement the shading / fill color.
flag1.CellShading = True
' Implment border attributes.
flag1.Borders = True
' Set the Range style.
range.ApplyStyle(style, flag1)
' Create a second range (C10:E13).
Dim range2 As Range = cells.CreateRange("C10", "E13")
' Copy the range style only.
range2.CopyStyle(range)
' Save the excel file.
workbook.Save(dataDir & "output.xls")
' ExEnd:1
End Sub
End Class
End Namespace
|
maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/VisualBasic/Articles/CopyRangeStyleOnly.vb
|
Visual Basic
|
mit
| 2,665
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.HspiSample.MySettings
Get
Return Global.HspiSample.MySettings.Default
End Get
End Property
End Module
End Namespace
|
alexdresko/HSPI
|
Templates/HspiSample/Settings1.Designer.vb
|
Visual Basic
|
mit
| 2,794
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FormHexEncode
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.tbStart = New System.Windows.Forms.TextBox()
Me.tbSrc = New System.Windows.Forms.RichTextBox()
Me.wbDst = New System.Windows.Forms.WebBrowser()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 28)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(73, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Start Address:"
'
'tbStart
'
Me.tbStart.Location = New System.Drawing.Point(91, 25)
Me.tbStart.Name = "tbStart"
Me.tbStart.Size = New System.Drawing.Size(83, 20)
Me.tbStart.TabIndex = 1
'
'tbSrc
'
Me.tbSrc.Location = New System.Drawing.Point(12, 51)
Me.tbSrc.Name = "tbSrc"
Me.tbSrc.Size = New System.Drawing.Size(538, 141)
Me.tbSrc.TabIndex = 2
Me.tbSrc.Text = ""
'
'wbDst
'
Me.wbDst.IsWebBrowserContextMenuEnabled = False
Me.wbDst.Location = New System.Drawing.Point(15, 204)
Me.wbDst.MinimumSize = New System.Drawing.Size(20, 20)
Me.wbDst.Name = "wbDst"
Me.wbDst.Size = New System.Drawing.Size(534, 209)
Me.wbDst.TabIndex = 3
'
'FormHexEncode
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(562, 425)
Me.Controls.Add(Me.wbDst)
Me.Controls.Add(Me.tbSrc)
Me.Controls.Add(Me.tbStart)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.Name = "FormHexEncode"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Hex Encoder"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents tbStart As System.Windows.Forms.TextBox
Friend WithEvents tbSrc As System.Windows.Forms.RichTextBox
Friend WithEvents wbDst As System.Windows.Forms.WebBrowser
End Class
|
gudduarnav/ArnavPrograms
|
Project.MCA/Intel 8085 Simulator/Intel8085Sim/Intel8085Sim/FormHexEncode.Designer.vb
|
Visual Basic
|
mit
| 3,211
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMain
Inherits DevComponents.DotNetBar.Office2007Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.fswMain = New System.IO.FileSystemWatcher()
Me.UpdateWorker = New System.ComponentModel.BackgroundWorker()
Me.CacheWorker = New System.ComponentModel.BackgroundWorker()
Me.tlpMain = New nublet.Base.Controls.DBTableLayoutPanel(Me.components)
Me.lblSource = New DevComponents.DotNetBar.LabelX()
Me.lblDestination = New DevComponents.DotNetBar.LabelX()
Me.lblDeleteBlizzard = New DevComponents.DotNetBar.LabelX()
Me.lblClearCache = New DevComponents.DotNetBar.LabelX()
Me.chkClearCache = New DevComponents.DotNetBar.Controls.CheckBoxX()
Me.chkDeleteBlizzard = New DevComponents.DotNetBar.Controls.CheckBoxX()
Me.txtSource = New DevComponents.DotNetBar.Controls.TextBoxX()
Me.txtDestination = New DevComponents.DotNetBar.Controls.TextBoxX()
Me.lrMain = New nublet.Base.Controls.ListResults()
Me.tlpButtons = New nublet.Base.Controls.DBTableLayoutPanel(Me.components)
Me.btnProcess = New DevComponents.DotNetBar.ButtonX()
Me.btnClose = New DevComponents.DotNetBar.ButtonX()
Me.btnClear = New DevComponents.DotNetBar.ButtonX()
Me.btnCopy = New DevComponents.DotNetBar.ButtonX()
Me.txtCacheFolders = New DevComponents.DotNetBar.Controls.TextBoxX()
Me.lvCacheFolders = New DevComponents.DotNetBar.Controls.ListViewEx()
Me.chPath = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.lblCacheFolders = New DevComponents.DotNetBar.LabelX()
CType(Me.fswMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tlpMain.SuspendLayout()
Me.tlpButtons.SuspendLayout()
Me.SuspendLayout()
'
'fswMain
'
Me.fswMain.EnableRaisingEvents = True
Me.fswMain.IncludeSubdirectories = True
Me.fswMain.SynchronizingObject = Me
'
'UpdateWorker
'
'
'CacheWorker
'
'
'tlpMain
'
Me.tlpMain.ColumnCount = 7
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 125.0!))
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 6.0!))
Me.tlpMain.Controls.Add(Me.lblSource, 1, 1)
Me.tlpMain.Controls.Add(Me.lblDestination, 1, 2)
Me.tlpMain.Controls.Add(Me.lblDeleteBlizzard, 1, 4)
Me.tlpMain.Controls.Add(Me.lblClearCache, 1, 5)
Me.tlpMain.Controls.Add(Me.chkClearCache, 3, 5)
Me.tlpMain.Controls.Add(Me.chkDeleteBlizzard, 3, 4)
Me.tlpMain.Controls.Add(Me.txtSource, 3, 1)
Me.tlpMain.Controls.Add(Me.txtDestination, 3, 2)
Me.tlpMain.Controls.Add(Me.lrMain, 1, 9)
Me.tlpMain.Controls.Add(Me.tlpButtons, 1, 11)
Me.tlpMain.Controls.Add(Me.txtCacheFolders, 3, 7)
Me.tlpMain.Controls.Add(Me.lvCacheFolders, 5, 1)
Me.tlpMain.Controls.Add(Me.lblCacheFolders, 1, 7)
Me.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.tlpMain.Location = New System.Drawing.Point(0, 0)
Me.tlpMain.Margin = New System.Windows.Forms.Padding(0)
Me.tlpMain.Name = "tlpMain"
Me.tlpMain.RowCount = 13
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0!))
Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpMain.Size = New System.Drawing.Size(656, 445)
Me.tlpMain.TabIndex = 0
'
'lblSource
'
'
'
'
Me.lblSource.BackgroundStyle.Class = ""
Me.lblSource.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.lblSource.Dock = System.Windows.Forms.DockStyle.Fill
Me.lblSource.Location = New System.Drawing.Point(5, 5)
Me.lblSource.Margin = New System.Windows.Forms.Padding(0)
Me.lblSource.Name = "lblSource"
Me.lblSource.Size = New System.Drawing.Size(125, 23)
Me.lblSource.TabIndex = 0
Me.lblSource.Text = "Source AddOns"
'
'lblDestination
'
'
'
'
Me.lblDestination.BackgroundStyle.Class = ""
Me.lblDestination.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.lblDestination.Dock = System.Windows.Forms.DockStyle.Fill
Me.lblDestination.Location = New System.Drawing.Point(5, 28)
Me.lblDestination.Margin = New System.Windows.Forms.Padding(0)
Me.lblDestination.Name = "lblDestination"
Me.lblDestination.Size = New System.Drawing.Size(125, 23)
Me.lblDestination.TabIndex = 1
Me.lblDestination.Text = "Destination AddOns"
'
'lblDeleteBlizzard
'
'
'
'
Me.lblDeleteBlizzard.BackgroundStyle.Class = ""
Me.lblDeleteBlizzard.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.lblDeleteBlizzard.Dock = System.Windows.Forms.DockStyle.Fill
Me.lblDeleteBlizzard.Location = New System.Drawing.Point(5, 56)
Me.lblDeleteBlizzard.Margin = New System.Windows.Forms.Padding(0)
Me.lblDeleteBlizzard.Name = "lblDeleteBlizzard"
Me.lblDeleteBlizzard.Size = New System.Drawing.Size(125, 23)
Me.lblDeleteBlizzard.TabIndex = 2
Me.lblDeleteBlizzard.Text = "Delete Blizzard AddOns"
'
'lblClearCache
'
'
'
'
Me.lblClearCache.BackgroundStyle.Class = ""
Me.lblClearCache.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.lblClearCache.Dock = System.Windows.Forms.DockStyle.Fill
Me.lblClearCache.Location = New System.Drawing.Point(5, 79)
Me.lblClearCache.Margin = New System.Windows.Forms.Padding(0)
Me.lblClearCache.Name = "lblClearCache"
Me.lblClearCache.Size = New System.Drawing.Size(125, 23)
Me.lblClearCache.TabIndex = 3
Me.lblClearCache.Text = "Clear Cache"
'
'chkClearCache
'
'
'
'
Me.chkClearCache.BackgroundStyle.Class = ""
Me.chkClearCache.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.chkClearCache.Dock = System.Windows.Forms.DockStyle.Fill
Me.chkClearCache.Location = New System.Drawing.Point(135, 79)
Me.chkClearCache.Margin = New System.Windows.Forms.Padding(0)
Me.chkClearCache.Name = "chkClearCache"
Me.chkClearCache.Size = New System.Drawing.Size(255, 23)
Me.chkClearCache.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.chkClearCache.TabIndex = 4
'
'chkDeleteBlizzard
'
'
'
'
Me.chkDeleteBlizzard.BackgroundStyle.Class = ""
Me.chkDeleteBlizzard.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.chkDeleteBlizzard.Dock = System.Windows.Forms.DockStyle.Fill
Me.chkDeleteBlizzard.Location = New System.Drawing.Point(135, 56)
Me.chkDeleteBlizzard.Margin = New System.Windows.Forms.Padding(0)
Me.chkDeleteBlizzard.Name = "chkDeleteBlizzard"
Me.chkDeleteBlizzard.Size = New System.Drawing.Size(255, 23)
Me.chkDeleteBlizzard.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.chkDeleteBlizzard.TabIndex = 5
'
'txtSource
'
'
'
'
Me.txtSource.Border.Class = "TextBoxBorder"
Me.txtSource.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.txtSource.ButtonCustom.Visible = True
Me.txtSource.Dock = System.Windows.Forms.DockStyle.Fill
Me.txtSource.Location = New System.Drawing.Point(135, 5)
Me.txtSource.Margin = New System.Windows.Forms.Padding(0)
Me.txtSource.Name = "txtSource"
Me.txtSource.Size = New System.Drawing.Size(255, 20)
Me.txtSource.TabIndex = 6
'
'txtDestination
'
'
'
'
Me.txtDestination.Border.Class = "TextBoxBorder"
Me.txtDestination.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.txtDestination.ButtonCustom.Visible = True
Me.txtDestination.Dock = System.Windows.Forms.DockStyle.Fill
Me.txtDestination.Location = New System.Drawing.Point(135, 28)
Me.txtDestination.Margin = New System.Windows.Forms.Padding(0)
Me.txtDestination.Name = "txtDestination"
Me.txtDestination.Size = New System.Drawing.Size(255, 20)
Me.txtDestination.TabIndex = 7
'
'lrMain
'
Me.lrMain.BackColor = System.Drawing.Color.Transparent
Me.tlpMain.SetColumnSpan(Me.lrMain, 5)
Me.lrMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.lrMain.Indent = 0
Me.lrMain.Location = New System.Drawing.Point(5, 135)
Me.lrMain.Margin = New System.Windows.Forms.Padding(0)
Me.lrMain.Name = "lrMain"
Me.lrMain.Size = New System.Drawing.Size(645, 270)
Me.lrMain.TabIndex = 8
'
'tlpButtons
'
Me.tlpButtons.ColumnCount = 9
Me.tlpMain.SetColumnSpan(Me.tlpButtons, 5)
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 5.0!))
Me.tlpButtons.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80.0!))
Me.tlpButtons.Controls.Add(Me.btnProcess, 6, 0)
Me.tlpButtons.Controls.Add(Me.btnClose, 8, 0)
Me.tlpButtons.Controls.Add(Me.btnClear, 0, 0)
Me.tlpButtons.Controls.Add(Me.btnCopy, 2, 0)
Me.tlpButtons.Dock = System.Windows.Forms.DockStyle.Fill
Me.tlpButtons.Location = New System.Drawing.Point(5, 410)
Me.tlpButtons.Margin = New System.Windows.Forms.Padding(0)
Me.tlpButtons.Name = "tlpButtons"
Me.tlpButtons.RowCount = 1
Me.tlpButtons.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!))
Me.tlpButtons.Size = New System.Drawing.Size(645, 30)
Me.tlpButtons.TabIndex = 9
'
'btnProcess
'
Me.btnProcess.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.btnProcess.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground
Me.btnProcess.Dock = System.Windows.Forms.DockStyle.Fill
Me.btnProcess.Location = New System.Drawing.Point(480, 0)
Me.btnProcess.Margin = New System.Windows.Forms.Padding(0)
Me.btnProcess.Name = "btnProcess"
Me.btnProcess.Size = New System.Drawing.Size(80, 30)
Me.btnProcess.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.btnProcess.TabIndex = 1
Me.btnProcess.Text = "Process"
'
'btnClose
'
Me.btnClose.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.btnClose.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground
Me.btnClose.Dock = System.Windows.Forms.DockStyle.Fill
Me.btnClose.Location = New System.Drawing.Point(565, 0)
Me.btnClose.Margin = New System.Windows.Forms.Padding(0)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(80, 30)
Me.btnClose.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.btnClose.TabIndex = 2
Me.btnClose.Text = "Close"
'
'btnClear
'
Me.btnClear.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.btnClear.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground
Me.btnClear.Dock = System.Windows.Forms.DockStyle.Fill
Me.btnClear.Location = New System.Drawing.Point(0, 0)
Me.btnClear.Margin = New System.Windows.Forms.Padding(0)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(80, 30)
Me.btnClear.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.btnClear.TabIndex = 3
Me.btnClear.Text = "Clear"
'
'btnCopy
'
Me.btnCopy.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.btnCopy.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground
Me.btnCopy.Dock = System.Windows.Forms.DockStyle.Fill
Me.btnCopy.Location = New System.Drawing.Point(85, 0)
Me.btnCopy.Margin = New System.Windows.Forms.Padding(0)
Me.btnCopy.Name = "btnCopy"
Me.btnCopy.Size = New System.Drawing.Size(80, 30)
Me.btnCopy.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.btnCopy.TabIndex = 4
Me.btnCopy.Text = "Copy"
'
'txtCacheFolders
'
'
'
'
Me.txtCacheFolders.Border.Class = "TextBoxBorder"
Me.txtCacheFolders.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.txtCacheFolders.ButtonCustom.Visible = True
Me.txtCacheFolders.ButtonCustom2.Text = "+"
Me.txtCacheFolders.ButtonCustom2.Visible = True
Me.txtCacheFolders.Dock = System.Windows.Forms.DockStyle.Fill
Me.txtCacheFolders.Location = New System.Drawing.Point(135, 107)
Me.txtCacheFolders.Margin = New System.Windows.Forms.Padding(0)
Me.txtCacheFolders.Name = "txtCacheFolders"
Me.txtCacheFolders.Size = New System.Drawing.Size(255, 20)
Me.txtCacheFolders.TabIndex = 10
'
'lvCacheFolders
'
'
'
'
Me.lvCacheFolders.Border.Class = "ListViewBorder"
Me.lvCacheFolders.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.lvCacheFolders.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.chPath})
Me.lvCacheFolders.Dock = System.Windows.Forms.DockStyle.Fill
Me.lvCacheFolders.FullRowSelect = True
Me.lvCacheFolders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None
Me.lvCacheFolders.Location = New System.Drawing.Point(395, 5)
Me.lvCacheFolders.Margin = New System.Windows.Forms.Padding(0)
Me.lvCacheFolders.MultiSelect = False
Me.lvCacheFolders.Name = "lvCacheFolders"
Me.tlpMain.SetRowSpan(Me.lvCacheFolders, 7)
Me.lvCacheFolders.Size = New System.Drawing.Size(255, 125)
Me.lvCacheFolders.TabIndex = 11
Me.lvCacheFolders.UseCompatibleStateImageBehavior = False
Me.lvCacheFolders.View = System.Windows.Forms.View.Details
'
'chPath
'
Me.chPath.Text = "Path"
'
'lblCacheFolders
'
'
'
'
Me.lblCacheFolders.BackgroundStyle.Class = ""
Me.lblCacheFolders.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square
Me.lblCacheFolders.Dock = System.Windows.Forms.DockStyle.Fill
Me.lblCacheFolders.Location = New System.Drawing.Point(5, 107)
Me.lblCacheFolders.Margin = New System.Windows.Forms.Padding(0)
Me.lblCacheFolders.Name = "lblCacheFolders"
Me.lblCacheFolders.Size = New System.Drawing.Size(125, 23)
Me.lblCacheFolders.TabIndex = 12
Me.lblCacheFolders.Text = "Cache Folders"
'
'frmMain
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(656, 445)
Me.Controls.Add(Me.tlpMain)
Me.DoubleBuffered = True
Me.Name = "frmMain"
Me.Text = "WoW Cache Watcher"
CType(Me.fswMain, System.ComponentModel.ISupportInitialize).EndInit()
Me.tlpMain.ResumeLayout(False)
Me.tlpButtons.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Private WithEvents tlpMain As nublet.Base.Controls.DBTableLayoutPanel
Private WithEvents lblSource As DevComponents.DotNetBar.LabelX
Private WithEvents lblDestination As DevComponents.DotNetBar.LabelX
Private WithEvents lblDeleteBlizzard As DevComponents.DotNetBar.LabelX
Private WithEvents lblClearCache As DevComponents.DotNetBar.LabelX
Private WithEvents chkClearCache As DevComponents.DotNetBar.Controls.CheckBoxX
Private WithEvents chkDeleteBlizzard As DevComponents.DotNetBar.Controls.CheckBoxX
Private WithEvents txtSource As DevComponents.DotNetBar.Controls.TextBoxX
Private WithEvents txtDestination As DevComponents.DotNetBar.Controls.TextBoxX
Private WithEvents lrMain As nublet.Base.Controls.ListResults
Private WithEvents tlpButtons As nublet.Base.Controls.DBTableLayoutPanel
Private WithEvents btnProcess As DevComponents.DotNetBar.ButtonX
Private WithEvents btnClose As DevComponents.DotNetBar.ButtonX
Private WithEvents fswMain As System.IO.FileSystemWatcher
Private WithEvents UpdateWorker As System.ComponentModel.BackgroundWorker
Private WithEvents CacheWorker As System.ComponentModel.BackgroundWorker
Private WithEvents lvCacheFolders As DevComponents.DotNetBar.Controls.ListViewEx
Private WithEvents chPath As System.Windows.Forms.ColumnHeader
Private WithEvents btnClear As DevComponents.DotNetBar.ButtonX
Private WithEvents btnCopy As DevComponents.DotNetBar.ButtonX
Private WithEvents txtCacheFolders As DevComponents.DotNetBar.Controls.TextBoxX
Private WithEvents lblCacheFolders As DevComponents.DotNetBar.LabelX
End Class
|
nublet/CacheWatcher
|
frmMain.Designer.vb
|
Visual Basic
|
mit
| 21,399
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.Formularios_Saavedra.formMain
End Sub
End Class
End Namespace
|
MontiQt/SaavedraSystem
|
Formularios Saavedra/My Project/Application.Designer.vb
|
Visual Basic
|
mit
| 1,467
|
Option Infer On
Imports System
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim partDocument As SolidEdgePart.PartDocument = Nothing
Dim models As SolidEdgePart.Models = Nothing
Dim model As SolidEdgePart.Model = Nothing
Dim body As SolidEdgeGeometry.Body = Nothing
Dim faces As SolidEdgeGeometry.Faces = Nothing
Dim face As SolidEdgeGeometry.Face = Nothing
Dim loops As SolidEdgeGeometry.Loops = Nothing
Dim [loop] As SolidEdgeGeometry.Loop = Nothing
Dim edgeUses As SolidEdgeGeometry.EdgeUses = Nothing
Dim edgeUse As SolidEdgeGeometry.EdgeUse = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
partDocument = TryCast(application.ActiveDocument, SolidEdgePart.PartDocument)
If partDocument IsNot Nothing Then
models = partDocument.Models
model = models.Item(1)
body = CType(model.Body, SolidEdgeGeometry.Body)
Dim FaceType = SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll
faces = CType(body.Faces(FaceType), SolidEdgeGeometry.Faces)
For i As Integer = 1 To faces.Count
face = CType(faces.Item(i), SolidEdgeGeometry.Face)
loops = CType(face.Loops, SolidEdgeGeometry.Loops)
For j As Integer = 1 To loops.Count
[loop] = CType(loops.Item(j), SolidEdgeGeometry.Loop)
edgeUses = CType([loop].EdgeUses, SolidEdgeGeometry.EdgeUses)
For k As Integer = 1 To edgeUses.Count
edgeUse = CType(edgeUses.Item(k), SolidEdgeGeometry.EdgeUse)
Dim geometry = edgeUse.Geometry
Next k
Next j
Next i
End If
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgeGeometry.EdgeUse.Geometry.vb
|
Visual Basic
|
mit
| 2,701
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.ExpressionEvaluator
Imports Microsoft.CodeAnalysis.ExpressionEvaluator.UnitTests
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.VisualStudio.Debugger.Evaluation
Imports Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation
Imports Roslyn.Test.Utilities
Imports Xunit
Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.UnitTests
Public Class LocalsTests
Inherits ExpressionCompilerTestBase
<Fact>
Public Sub NoLocals()
Const source =
"Class C
Shared Sub M()
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.NotNull(assembly)
Assert.Equal(0, assembly.Count)
Assert.Equal(0, locals.Count)
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub Locals()
Const source =
"Class C
Sub M(a As Integer())
Dim b As String
a(1) += 1
SyncLock New C()
#ExternalSource(""test"", 999)
Dim c As Integer = 3
b = a(c).ToString()
#End ExternalSource
End SyncLock
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M", atLineNumber:=999)
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.NotNull(assembly)
Assert.NotEqual(0, assembly.Count)
Assert.Equal(4, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (String V_0, //b
Integer& V_1,
Object V_2,
Boolean V_3,
Integer V_4) //c
IL_0000: ldarg.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "a", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (String V_0, //b
Integer& V_1,
Object V_2,
Boolean V_3,
Integer V_4) //c
IL_0000: ldarg.1
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "b", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (String V_0, //b
Integer& V_1,
Object V_2,
Boolean V_3,
Integer V_4) //c
IL_0000: ldloc.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(3), "<>m3", "c", expectedILOpt:=
"{
// Code size 3 (0x3)
.maxstack 1
.locals init (String V_0, //b
Integer& V_1,
Object V_2,
Boolean V_3,
Integer V_4) //c
IL_0000: ldloc.s V_4
IL_0002: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub LocalsAndPseudoVariables()
Const source =
"Class C
Sub M(o As Object)
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim aliases = ImmutableArray.Create(
ExceptionAlias(GetType(System.IO.IOException)),
ReturnValueAlias(2, GetType(String)),
ReturnValueAlias(),
ObjectIdAlias(2, GetType(Boolean)),
VariableAlias("o", "C"))
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim diagnostics = DiagnosticBag.GetInstance()
Dim testData = New CompilationTestData()
context.CompileGetLocals(
locals,
argumentsOnly:=True,
aliases:=aliases,
diagnostics:=diagnostics,
typeName:=typeName,
testData:=testData)
Assert.Equal(1, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "o")
locals.Clear()
testData = New CompilationTestData()
context.CompileGetLocals(
locals,
argumentsOnly:=False,
aliases:=aliases,
diagnostics:=diagnostics,
typeName:=typeName,
testData:=testData)
Assert.Equal(6, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "$exception", "Error", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 11 (0xb)
.maxstack 1
IL_0000: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetException() As System.Exception""
IL_0005: castclass ""System.IO.IOException""
IL_000a: ret
}")
' $ReturnValue is suppressed since it always matches the last $ReturnValueN
VerifyLocal(testData, typeName, locals(1), "<>m1", "$ReturnValue2", "Method M2 returned", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldc.i4.2
IL_0001: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetReturnValue(Integer) As Object""
IL_0006: castclass ""String""
IL_000b: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "$2", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 16 (0x10)
.maxstack 1
IL_0000: ldstr ""$2""
IL_0005: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetObjectByAlias(String) As Object""
IL_000a: unbox.any ""Boolean""
IL_000f: ret
}")
VerifyLocal(testData, typeName, locals(3), "<>m3", "o", expectedILOpt:=
"{
// Code size 16 (0x10)
.maxstack 1
IL_0000: ldstr ""o""
IL_0005: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetObjectByAlias(String) As Object""
IL_000a: castclass ""C""
IL_000f: ret
}")
VerifyLocal(testData, typeName, locals(4), "<>m4", "Me", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(5), "<>m5", "o", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ret
}")
locals.Free()
' Confirm that the Watch window is unaffected by the filtering in the Locals window.
Dim errorString As String = Nothing
context.CompileExpression("$ReturnValue", DkmEvaluationFlags.TreatAsExpression, aliases, errorString)
Assert.Null(errorString)
End Sub)
End Sub
''' <summary>
''' No local signature (debugging a .dmp with no heap). Local
''' names are known but types are not so the locals are dropped.
''' Expressions that do not involve locals can be evaluated however.
''' </summary>
<Fact>
Public Sub NoLocalSignature()
Const source =
"Class C
Sub M(a As Integer())
Dim b As String
a(1) += 1
SyncLock New C()
#ExternalSource(""test"", 999)
Dim c As Integer = 3
b = a(c).ToString()
#End ExternalSource
End SyncLock
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp, references:=Nothing, includeLocalSignatures:=False, includeIntrinsicAssembly:=True, validator:=
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M", atLineNumber:=999)
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "a", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ret
}")
locals.Free()
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("b", errorMessage, testData, DebuggerDiagnosticFormatter.Instance)
Assert.Equal(errorMessage, "error BC30451: 'b' is not declared. It may be inaccessible due to its protection level.")
testData = New CompilationTestData()
context.CompileExpression("a(1)", errorMessage, testData)
testData.GetMethodData("<>x.<>m0").VerifyIL(
"{
// Code size 4 (0x4)
.maxstack 2
IL_0000: ldarg.1
IL_0001: ldc.i4.1
IL_0002: ldelem.i4
IL_0003: ret
}")
End Sub)
End Sub
<Fact>
Public Sub [Me]()
Const source = "
Class C
Sub M([Me] As Object)
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}
")
' Dev11 shows "Me" in the Locals window and "[Me]" in the Autos window.
VerifyLocal(testData, typeName, locals(1), "<>m1", "[Me]", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ret
}
")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub ArgumentsOnly()
Const source = "
Class C
Sub M(Of T)(x As T)
Dim y As Object = x
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=True, typeName:=typeName, testData:=testData)
Assert.Equal(1, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0(Of T)", "x", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (Object V_0) //y
IL_0000: ldarg.1
IL_0001: ret
}",
expectedGeneric:=True)
locals.Free()
End Sub)
End Sub
''' <summary>
''' Compiler-generated locals should be ignored.
''' </summary>
<Fact>
Public Sub CompilerGeneratedLocals()
Const source = "
Class C
Shared Function F(args As Object()) As Boolean
If args Is Nothing Then
Return True
End If
For Each o In args
#ExternalSource(""test"", 999)
System.Console.WriteLine() ' Force non-hidden sequence point
#End ExternalSource
Next
DirectCast(Function() args(0), System.Func(Of Object))()
Return False
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.F", atLineNumber:=999)
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(3, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "args", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__1-0 V_0, //$VB$Closure_0
Boolean V_1, //F
Boolean V_2,
Object() V_3,
Integer V_4,
Object V_5, //o
Boolean V_6)
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__1-0.$VB$Local_args As Object()""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "F", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (C._Closure$__1-0 V_0, //$VB$Closure_0
Boolean V_1, //F
Boolean V_2,
Object() V_3,
Integer V_4,
Object V_5, //o
Boolean V_6)
IL_0000: ldloc.1
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "o", expectedILOpt:=
"{
// Code size 3 (0x3)
.maxstack 1
.locals init (C._Closure$__1-0 V_0, //$VB$Closure_0
Boolean V_1, //F
Boolean V_2,
Object() V_3,
Integer V_4,
Object V_5, //o
Boolean V_6)
IL_0000: ldloc.s V_5
IL_0002: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub Constants()
Const source = "
Class C
Const x As Integer = 2
Shared Function F(w As Integer) As Integer
#ExternalSource(""test"", 888)
System.Console.WriteLine() ' Force non-hidden sequence point
#End ExternalSource
Const y As Integer = 3
Const v As Object = Nothing
If v Is Nothing orelse w < 2 Then
Const z As String = ""str""
#ExternalSource(""test"", 999)
Dim u As String = z
w += z.Length
#End ExternalSource
End If
Return w + x + y
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.F", atLineNumber:=888)
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(4, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "w")
VerifyLocal(testData, typeName, locals(1), "<>m1", "F")
VerifyLocal(testData, typeName, locals(2), "<>m2", "y", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //F
Boolean V_1,
String V_2)
IL_0000: ldc.i4.3
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(3), "<>m3", "v", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //F
Boolean V_1,
String V_2)
IL_0000: ldnull
IL_0001: ret
}
")
context = CreateMethodContext(runtime, methodName:="C.F", atLineNumber:=999) ' Changed this (was Nothing)
testData = New CompilationTestData()
locals.Clear()
typeName = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(6, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "w")
VerifyLocal(testData, typeName, locals(1), "<>m1", "F")
VerifyLocal(testData, typeName, locals(2), "<>m2", "u")
VerifyLocal(testData, typeName, locals(3), "<>m3", "y", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult)
VerifyLocal(testData, typeName, locals(4), "<>m4", "v", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult)
VerifyLocal(testData, typeName, locals(5), "<>m5", "z", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 6 (0x6)
.maxstack 1
.locals init (Integer V_0, //F
Boolean V_1,
String V_2) //u
IL_0000: ldstr ""str""
IL_0005: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub ConstantEnum()
Const source =
"Enum E
A
B
End Enum
Class C
Shared Sub M(x As E)
Const y = E.B
End Sub
Shared Sub Main()
M(E.A)
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugExe)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
Dim method = DirectCast(testData.GetMethodData("<>x.<>m0").Method, MethodSymbol)
Assert.Equal(method.Parameters(0).Type, method.ReturnType)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ret
}")
method = DirectCast(testData.GetMethodData("<>x.<>m1").Method, MethodSymbol)
Assert.Equal(method.Parameters(0).Type, method.ReturnType)
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldc.i4.1
IL_0001: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub ConstantEnumAndTypeParameter()
Const source =
"Class C(Of T)
Enum E
A
End Enum
Friend Shared Sub M(Of U As T)()
Const x As C(Of T).E = E.A
Const y As C(Of U).E = Nothing
End Sub
End Class
Class P
Shared Sub Main()
C(Of Object).M(Of String)()
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugExe)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
VerifyLocal(testData, "<>x(Of T)", locals(0), "<>m0(Of U)", "x", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedGeneric:=True, expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldc.i4.0
IL_0001: ret
}")
VerifyLocal(testData, "<>x(Of T)", locals(1), "<>m1(Of U)", "y", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedGeneric:=True, expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldc.i4.0
IL_0001: ret
}")
VerifyLocal(testData, "<>x(Of T)", locals(2), "<>m2(Of U)", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedGeneric:=True, expectedILOpt:=
"{
// Code size 6 (0x6)
.maxstack 1
IL_0000: newobj ""Sub <>c__TypeVariables(Of T, U)..ctor()""
IL_0005: ret
}")
Assert.Equal(3, locals.Count)
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub CapturedLocalsOutsideLambda()
Const source = "
Imports System
Class C
Shared Sub F(f As Func(Of Object))
End Sub
Sub M(x As C)
Dim y As New C()
F(Function() If(x, If(y, Me)))
If x IsNot Nothing
#ExternalSource(""test"", 999)
Dim z = 6
Dim w = 7
F(Function() If(y, DirectCast(w, Object)))
#End ExternalSource
End If
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.M", atLineNumber:=999)
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(5, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Boolean V_1,
C._Closure$__2-1 V_2, //$VB$Closure_1
Integer V_3) //z
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__2-0.$VB$Me As C""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "x", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Boolean V_1,
C._Closure$__2-1 V_2, //$VB$Closure_1
Integer V_3) //z
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__2-0.$VB$Local_x As C""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "z", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Boolean V_1,
C._Closure$__2-1 V_2, //$VB$Closure_1
Integer V_3) //z
IL_0000: ldloc.3
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(3), "<>m3", "y", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Boolean V_1,
C._Closure$__2-1 V_2, //$VB$Closure_1
Integer V_3) //z
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__2-0.$VB$Local_y As C""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(4), "<>m4", "w", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Boolean V_1,
C._Closure$__2-1 V_2, //$VB$Closure_1
Integer V_3) //z
IL_0000: ldloc.2
IL_0001: ldfld ""C._Closure$__2-1.$VB$Local_w As Integer""
IL_0006: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub CapturedLocalsInsideLambda()
Const source = "
Imports System
Class C
Shared Sub F(ff As Func(Of Object, Object))
ff(Nothing)
End Sub
Sub M()
Dim x As New Object()
F(Function(_1)
Dim y As New Object()
F(Function(_2) y)
Return If(x, Me)
End Function)
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C._Closure$__2-0._Lambda$__1")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(locals.Count, 2)
VerifyLocal(testData, typeName, locals(0), "<>m0", "_2", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (Object V_0)
IL_0000: ldarg.1
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Object V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__2-0.$VB$Local_y As Object""
IL_0006: ret
}")
context = CreateMethodContext(runtime, methodName:="C._Closure$__2-1._Lambda$__0")
testData = New CompilationTestData()
locals.Clear()
typeName = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(locals.Count, 4)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Object V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__2-1.$VB$Me As C""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "_1", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Object V_1)
IL_0000: ldarg.1
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "x", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Object V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__2-1.$VB$Local_x As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(3), "<>m3", "y", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__2-0 V_0, //$VB$Closure_0
Object V_1)
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__2-0.$VB$Local_y As Object""
IL_0006: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub CapturedLocalInNestedLambda()
Const source =
"Imports System
Class C
Shared Sub M()
End Sub
Shared Sub F(a As Action)
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim testData As New CompilationTestData()
Dim errorMessage As String = Nothing
context.CompileExpression(
"F(Sub()
Dim x As Integer
Dim y As New Func(Of Integer)(Function() x)
y.Invoke()
End Sub)",
errorMessage,
testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(
"{
// Code size 42 (0x2a)
.maxstack 2
IL_0000: ldsfld ""<>x._Closure$__.$I0-0 As System.Action""
IL_0005: brfalse.s IL_000e
IL_0007: ldsfld ""<>x._Closure$__.$I0-0 As System.Action""
IL_000c: br.s IL_0024
IL_000e: ldsfld ""<>x._Closure$__.$I As <>x._Closure$__""
IL_0013: ldftn ""Sub <>x._Closure$__._Lambda$__0-0()""
IL_0019: newobj ""Sub System.Action..ctor(Object, System.IntPtr)""
IL_001e: dup
IL_001f: stsfld ""<>x._Closure$__.$I0-0 As System.Action""
IL_0024: call ""Sub C.F(System.Action)""
IL_0029: ret
}")
End Sub)
End Sub
<Fact>
Public Sub NestedLambdas()
Const source = "
Imports System
Class C
Shared Sub Main()
Dim f As Func(Of Object, Object, Object, Object, Func(Of Object, Object, Object, Func(Of Object, Object, Func(Of Object, Object)))) =
Function(x1, x2, x3, x4)
If x1 Is Nothing Then Return Nothing
Return Function(y1, y2, y3)
If If(y1, x2) Is Nothing Then Return Nothing
Return Function(z1, z2)
If If(z1, If(y2, x3)) Is Nothing Then Return Nothing
Return Function(w1)
If If(z2, If(y3, x4)) Is Nothing Then Return Nothing
Return w1
End Function
End Function
End Function
End Function
f(1, 2, 3, 4)(5, 6, 7)(8, 9)(10)
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C._Closure$__._Lambda$__1-0")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(locals.Count, 4)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x1")
VerifyLocal(testData, typeName, locals(1), "<>m1", "x2", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__1-0 V_0, //$VB$Closure_0
System.Func(Of Object, Object, Object, System.Func(Of Object, Object, System.Func(Of Object, Object))) V_1,
Boolean V_2)
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__1-0.$VB$Local_x2 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "x3")
VerifyLocal(testData, typeName, locals(3), "<>m3", "x4")
context = CreateMethodContext(runtime, methodName:="C._Closure$__1-0._Lambda$__1")
testData = New CompilationTestData()
locals.Clear()
typeName = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(locals.Count, 6)
VerifyLocal(testData, typeName, locals(0), "<>m0", "y1")
VerifyLocal(testData, typeName, locals(1), "<>m1", "y2", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__1-1 V_0, //$VB$Closure_0
System.Func(Of Object, Object, System.Func(Of Object, Object)) V_1,
Boolean V_2)
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__1-1.$VB$Local_y2 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "y3")
VerifyLocal(testData, typeName, locals(3), "<>m3", "x2")
VerifyLocal(testData, typeName, locals(4), "<>m4", "x3", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__1-1 V_0, //$VB$Closure_0
System.Func(Of Object, Object, System.Func(Of Object, Object)) V_1,
Boolean V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-0.$VB$Local_x3 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(5), "<>m5", "x4")
context = CreateMethodContext(runtime, methodName:="C._Closure$__1-1._Lambda$__2")
testData = New CompilationTestData()
locals.Clear()
typeName = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(locals.Count, 7)
VerifyLocal(testData, typeName, locals(0), "<>m0", "z1")
VerifyLocal(testData, typeName, locals(1), "<>m1", "z2", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (C._Closure$__1-2 V_0, //$VB$Closure_0
System.Func(Of Object, Object) V_1,
Boolean V_2)
IL_0000: ldloc.0
IL_0001: ldfld ""C._Closure$__1-2.$VB$Local_z2 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "y2")
VerifyLocal(testData, typeName, locals(3), "<>m3", "y3")
VerifyLocal(testData, typeName, locals(4), "<>m4", "x2")
VerifyLocal(testData, typeName, locals(5), "<>m5", "x3", expectedILOpt:=
"{
// Code size 12 (0xc)
.maxstack 1
.locals init (C._Closure$__1-2 V_0, //$VB$Closure_0
System.Func(Of Object, Object) V_1,
Boolean V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-1.$VB$NonLocal_$VB$Closure_2 As C._Closure$__1-0""
IL_0006: ldfld ""C._Closure$__1-0.$VB$Local_x3 As Object""
IL_000b: ret
}")
VerifyLocal(testData, typeName, locals(6), "<>m6", "x4")
context = CreateMethodContext(runtime, methodName:="C._Closure$__1-2._Lambda$__3")
testData = New CompilationTestData()
locals.Clear()
typeName = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(locals.Count, 7)
VerifyLocal(testData, typeName, locals(0), "<>m0", "w1")
VerifyLocal(testData, typeName, locals(1), "<>m1", "z2", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Object V_0,
Boolean V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-2.$VB$Local_z2 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "y2")
VerifyLocal(testData, typeName, locals(3), "<>m3", "y3")
VerifyLocal(testData, typeName, locals(4), "<>m4", "x2")
VerifyLocal(testData, typeName, locals(5), "<>m5", "x3")
VerifyLocal(testData, typeName, locals(6), "<>m6", "x4", expectedILOpt:=
"{
// Code size 17 (0x11)
.maxstack 1
.locals init (Object V_0,
Boolean V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-2.$VB$NonLocal_$VB$Closure_3 As C._Closure$__1-1""
IL_0006: ldfld ""C._Closure$__1-1.$VB$NonLocal_$VB$Closure_2 As C._Closure$__1-0""
IL_000b: ldfld ""C._Closure$__1-0.$VB$Local_x4 As Object""
IL_0010: ret
}")
locals.Free()
End Sub)
End Sub
''' <summary>
''' Should not include "Me" inside display class instance method if
''' "Me" is not captured.
''' </summary>
<Fact>
Public Sub NoMeInsideDisplayClassInstanceMethod()
Const source = "
Imports System
Class C
Sub M(Of T As Class)(x As T)
Dim f As Func(Of Object, Func(Of T, Object)) = Function(y) _
Function(z)
return If(x, If(DirectCast(y, Object), z))
End Function
f(2)(x)
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C._Closure$__1-0._Lambda$__0")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(3, locals.Count)
VerifyLocal(testData, "<>x(Of $CLS0)", locals(0), "<>m0", "y")
VerifyLocal(testData, "<>x(Of $CLS0)", locals(1), "<>m1", "x")
VerifyLocal(testData, "<>x(Of $CLS0)", locals(2), "<>m2", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult)
context = CreateMethodContext(runtime, methodName:="C._Closure$__1-1._Lambda$__1")
testData = New CompilationTestData()
locals.Clear()
typeName = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(4, locals.Count)
VerifyLocal(testData, "<>x(Of $CLS0)", locals(0), "<>m0", "z")
VerifyLocal(testData, "<>x(Of $CLS0)", locals(1), "<>m1", "y")
VerifyLocal(testData, "<>x(Of $CLS0)", locals(2), "<>m2", "x")
VerifyLocal(testData, "<>x(Of $CLS0)", locals(3), "<>m3", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult)
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub GenericMethod()
Const source = "
Class A (Of T)
Structure B(Of U, V)
Sub M(Of W)(o As A(Of U).B(Of V, Object)())
Dim t1 As T = Nothing
Dim u1 As U = Nothing
Dim w1 As W = Nothing
End Sub
End Structure
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="A.B.M")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(6, locals.Count)
VerifyLocal(testData, "<>x(Of T, U, V)", locals(0), "<>m0(Of W)", "Me", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (T V_0, //t1
U V_1, //u1
W V_2) //w1
IL_0000: ldarg.0
IL_0001: ldobj ""A(Of T).B(Of U, V)""
IL_0006: ret
}",
expectedGeneric:=True)
Dim method = DirectCast(testData.GetMethodData("<>x(Of T, U, V).<>m0(Of W)").Method, MethodSymbol)
Dim containingType = method.ContainingType
Dim containingTypeTypeParameters = containingType.TypeParameters
Dim typeParameterT As TypeParameterSymbol = containingTypeTypeParameters(0)
Dim typeParameterU As TypeParameterSymbol = containingTypeTypeParameters(1)
Dim typeParameterV As TypeParameterSymbol = containingTypeTypeParameters(2)
Dim returnType = DirectCast(method.ReturnType, NamedTypeSymbol)
Assert.Equal(typeParameterU, returnType.TypeArguments(0))
Assert.Equal(typeParameterV, returnType.TypeArguments(1))
returnType = returnType.ContainingType
Assert.Equal(typeParameterT, returnType.TypeArguments(0))
VerifyLocal(testData, "<>x(Of T, U, V)", locals(1), "<>m1(Of W)", "o", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (T V_0, //t1
U V_1, //u1
W V_2) //w1
IL_0000: ldarg.1
IL_0001: ret
}",
expectedGeneric:=True)
method = DirectCast(testData.GetMethodData("<>x(Of T, U, V).<>m1(Of W)").Method, MethodSymbol)
' method.ReturnType: A(Of U).B(Of V, object)()
returnType = DirectCast(DirectCast(method.ReturnType, ArrayTypeSymbol).ElementType, NamedTypeSymbol)
Assert.Equal(typeParameterV, returnType.TypeArguments(0))
returnType = returnType.ContainingType
Assert.Equal(typeParameterU, returnType.TypeArguments(0))
VerifyLocal(testData, "<>x(Of T, U, V)", locals(2), "<>m2(Of W)", "t1", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (T V_0, //t1
U V_1, //u1
W V_2) //w1
IL_0000: ldloc.0
IL_0001: ret
}",
expectedGeneric:=True)
method = DirectCast(testData.GetMethodData("<>x(Of T, U, V).<>m2(Of W)").Method, MethodSymbol)
Assert.Equal(typeParameterT, method.ReturnType)
VerifyLocal(testData, "<>x(Of T, U, V)", locals(3), "<>m3(Of W)", "u1", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (T V_0, //t1
U V_1, //u1
W V_2) //w1
IL_0000: ldloc.1
IL_0001: ret
}",
expectedGeneric:=True)
method = DirectCast(testData.GetMethodData("<>x(Of T, U, V).<>m3(Of W)").Method, MethodSymbol)
Assert.Equal(typeParameterU, method.ReturnType)
VerifyLocal(testData, "<>x(Of T, U, V)", locals(4), "<>m4(Of W)", "w1", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (T V_0, //t1
U V_1, //u1
W V_2) //w1
IL_0000: ldloc.2
IL_0001: ret
}",
expectedGeneric:=True)
method = DirectCast(testData.GetMethodData("<>x(Of T, U, V).<>m4(Of W)").Method, MethodSymbol)
Assert.Equal(method.TypeParameters.Single(), method.ReturnType)
VerifyLocal(testData, "<>x(Of T, U, V)", locals(5), "<>m5(Of W)", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 6 (0x6)
.maxstack 1
.locals init (T V_0, //t1
U V_1, //u1
W V_2) //w1
IL_0000: newobj ""Sub <>c__TypeVariables(Of T, U, V, W)..ctor()""
IL_0005: ret
}",
expectedGeneric:=True)
method = DirectCast(testData.GetMethodData("<>x(Of T, U, V).<>m5(Of W)").Method, MethodSymbol)
returnType = DirectCast(method.ReturnType, NamedTypeSymbol)
Assert.Equal(typeParameterT, returnType.TypeArguments(0))
Assert.Equal(typeParameterU, returnType.TypeArguments(1))
Assert.Equal(typeParameterV, returnType.TypeArguments(2))
Assert.Equal(method.TypeParameters.Single(), returnType.TypeArguments(3))
' Verify <>c__TypeVariables types was emitted (#976772)
Using metadata = ModuleMetadata.CreateFromImage(ImmutableArray.CreateRange(assembly))
Dim reader = metadata.MetadataReader
Dim typeDef = reader.GetTypeDef("<>c__TypeVariables")
reader.CheckTypeParameters(typeDef.GetGenericParameters(), "T", "U", "V", "W")
End Using
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub GenericLambda()
Const source = "
Imports System
Class C(Of T As Class)
Shared Sub M(Of U)(t1 As T)
Dim u1 As U = Nothing
Dim f As Func(Of Object) = Function() If(t1, DirectCast(u1, Object))
f()
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C._Closure$__1-0._Lambda$__0")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(3, locals.Count)
' NOTE: $CLS0 does not appear in the UI.
VerifyLocal(testData, "<>x(Of T, $CLS0)", locals(0), "<>m0", "t1")
VerifyLocal(testData, "<>x(Of T, $CLS0)", locals(1), "<>m1", "u1", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Object V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""C(Of T)._Closure$__1-0(Of $CLS0).$VB$Local_u1 As $CLS0""
IL_0006: ret
}")
VerifyLocal(testData, "<>x(Of T, $CLS0)", locals(2), "<>m2", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 6 (0x6)
.maxstack 1
.locals init (Object V_0)
IL_0000: newobj ""Sub <>c__TypeVariables(Of T, $CLS0)..ctor()""
IL_0005: ret
}")
Dim method = DirectCast(testData.GetMethodData("<>x(Of T, $CLS0).<>m1").Method, MethodSymbol)
Dim containingType = method.ContainingType
Assert.Equal(containingType.TypeParameters(1), method.ReturnType)
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub Iterator_InstanceMethod()
Const source = "
Imports System.Collections
Class C
Private ReadOnly _c As Object()
Friend Sub New(c As Object())
_c = c
End Sub
Friend Iterator Function F() As IEnumerable
For Each o In _c
#ExternalSource(""test"", 999)
Yield o
#End ExternalSource
Next
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_2_F.MoveNext", atLineNumber:=999)
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1,
Boolean V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_F.$VB$Me As C""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "o", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1,
Boolean V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_F.$VB$ResumableLocal_o$2 As Object""
IL_0006: ret
}")
locals.Free()
End Sub)
End Sub
<Fact()>
Public Sub Iterator_StaticMethod_Generic()
Const source = "
Imports System.Collections.Generic
Class C
Friend Shared Iterator Function F(Of T)(o As T()) As IEnumerable(Of T)
For i = 1 To o.Length
#ExternalSource(""test"", 999)
Dim t1 As T = Nothing
Yield t1
Yield o(i)
#End ExternalSource
Next
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_1_F.MoveNext", atLineNumber:=999)
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(4, locals.Count)
VerifyLocal(testData, "<>x(Of T)", locals(0), "<>m0", "o", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_1_F(Of T).$VB$Local_o As T()""
IL_0006: ret
}")
VerifyLocal(testData, "<>x(Of T)", locals(1), "<>m1", "i", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_1_F(Of T).$VB$ResumableLocal_i$1 As Integer""
IL_0006: ret
}")
VerifyLocal(testData, "<>x(Of T)", locals(2), "<>m2", "t1", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_1_F(Of T).$VB$ResumableLocal_t1$2 As T""
IL_0006: ret
}
")
VerifyLocal(testData, "<>x(Of T)", locals(3), "<>m3", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 6 (0x6)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1)
IL_0000: newobj ""Sub <>c__TypeVariables(Of T)..ctor()""
IL_0005: ret
}")
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1002672, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1002672")>
Public Sub Async_InstanceMethod_Generic()
Const source = "
Imports System.Threading.Tasks
Structure S(Of T As Class)
Private x As T
Friend Async Function F(Of U As Class)(y As u) As Task(Of Object)
Dim z As T = Nothing
Return If(Me.x, If(DirectCast(y, Object), z))
End Function
End Structure
"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="S.VB$StateMachine_2_F.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(4, locals.Count)
VerifyLocal(testData, "<>x(Of T, U)", locals(0), "<>m0", "Me", expectedILOpt:="
{
// Code size 7 (0x7)
.maxstack 1
.locals init (Object V_0,
Integer V_1,
System.Threading.Tasks.Task(Of Object) V_2,
T V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""S(Of T).VB$StateMachine_2_F(Of U).$VB$Me As S(Of T)""
IL_0006: ret
}
")
VerifyLocal(testData, "<>x(Of T, U)", locals(1), "<>m1", "y", expectedILOpt:="
{
// Code size 7 (0x7)
.maxstack 1
.locals init (Object V_0,
Integer V_1,
System.Threading.Tasks.Task(Of Object) V_2,
T V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""S(Of T).VB$StateMachine_2_F(Of U).$VB$Local_y As U""
IL_0006: ret
}
")
VerifyLocal(testData, "<>x(Of T, U)", locals(2), "<>m2", "z", expectedILOpt:="
{
// Code size 7 (0x7)
.maxstack 1
.locals init (Object V_0,
Integer V_1,
System.Threading.Tasks.Task(Of Object) V_2,
T V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""S(Of T).VB$StateMachine_2_F(Of U).$VB$ResumableLocal_z$0 As T""
IL_0006: ret
}
")
VerifyLocal(testData, "<>x(Of T, U)", locals(3), "<>m3", "<>TypeVariables", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:="
{
// Code size 6 (0x6)
.maxstack 1
.locals init (Object V_0,
Integer V_1,
System.Threading.Tasks.Task(Of Object) V_2,
T V_3,
System.Exception V_4)
IL_0000: newobj ""Sub <>c__TypeVariables(Of T, U)..ctor()""
IL_0005: ret
}
")
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1002672, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1002672")>
Public Sub Async_StaticMethod()
Const source = "
Imports System.Threading.Tasks
Class C
Shared Async Function F(o As Object) As Task(Of Object)
Return o
End Function
Shared Async Function M(x As Object) As task
Dim y = Await F(x)
Await F(y)
End Function
End Class
"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_2_M.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:="
{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Runtime.CompilerServices.TaskAwaiter(Of Object) V_1,
C.VB$StateMachine_2_M V_2,
Object V_3,
System.Runtime.CompilerServices.TaskAwaiter(Of Object) V_4,
System.Exception V_5)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_M.$VB$Local_x As Object""
IL_0006: ret
}
")
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:="
{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Runtime.CompilerServices.TaskAwaiter(Of Object) V_1,
C.VB$StateMachine_2_M V_2,
Object V_3,
System.Runtime.CompilerServices.TaskAwaiter(Of Object) V_4,
System.Exception V_5)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_M.$VB$ResumableLocal_y$0 As Object""
IL_0006: ret
}
")
locals.Free()
End Sub)
End Sub
<WorkItem(995976, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/995976")>
<WorkItem(997613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/997613")>
<WorkItem(1002672, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1002672")>
<WorkItem(1085911, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1085911")>
<WorkItem(12219, "https://github.com/dotnet/roslyn/issues/12219")>
<Fact>
Public Sub AsyncAndLambda()
Const source =
"Imports System
Imports System.Threading.Tasks
Class C
Shared Async Function F() As Task
End Function
Shared Sub G(a As Action)
a()
End Sub
Shared Async Function M(x As Integer) As Task(Of Integer)
Dim y = x + 1
Await F()
G(Sub()
x = x + 2
y = y + 2
End Sub)
x = x + y
Return x
End Function
End Class"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_3_M.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=
"{
// Code size 12 (0xc)
.maxstack 1
.locals init (Integer V_0,
Integer V_1,
System.Threading.Tasks.Task(Of Integer) V_2,
System.Runtime.CompilerServices.TaskAwaiter V_3,
C.VB$StateMachine_3_M V_4,
System.Exception V_5)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_3_M.$VB$ResumableLocal_$VB$Closure_$0 As C._Closure$__3-0""
IL_0006: ldfld ""C._Closure$__3-0.$VB$Local_x As Integer""
IL_000b: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=
"{
// Code size 12 (0xc)
.maxstack 1
.locals init (Integer V_0,
Integer V_1,
System.Threading.Tasks.Task(Of Integer) V_2,
System.Runtime.CompilerServices.TaskAwaiter V_3,
C.VB$StateMachine_3_M V_4,
System.Exception V_5)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_3_M.$VB$ResumableLocal_$VB$Closure_$0 As C._Closure$__3-0""
IL_0006: ldfld ""C._Closure$__3-0.$VB$Local_y As Integer""
IL_000b: ret
}")
locals.Free()
End Sub)
End Sub
<WorkItem(2240, "https://github.com/dotnet/roslyn/issues/2240")>
<Fact>
Public Sub AsyncLambda()
Const source =
"Imports System
Imports System.Threading.Tasks
Class C
Shared Sub M()
Dim f As Func(Of Integer, Task) = Async Function (x)
Dim y = 42
End Function
End Sub
End Class"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C._Closure$__.VB$StateMachine___Lambda$__1-0.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Threading.Tasks.Task V_1,
System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__.VB$StateMachine___Lambda$__1-0.$VB$Local_x As Integer""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Threading.Tasks.Task V_1,
System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__.VB$StateMachine___Lambda$__1-0.$VB$ResumableLocal_y$0 As Integer""
IL_0006: ret
}")
locals.Free()
End Sub)
End Sub
<WorkItem(996571, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/996571")>
<Fact>
Public Sub MissingReference()
Const source0 =
"Public Class A
End Class
Public Structure B
End Structure"
Const source1 =
"Class C
Shared Sub M(a As A, b As B, c As C)
End Sub
End Class"
Dim comp0 = CreateCompilationWithMscorlib({source0}, options:=TestOptions.DebugDll, assemblyName:="Test")
Dim comp1 = CreateCompilationWithMscorlib({source1}, options:=TestOptions.DebugDll, references:={comp0.EmitToImageReference()}, assemblyName:="Test")
' no reference to compilation0
WithRuntimeInstance(comp1, {MscorlibRef},
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData, expectedDiagnostics:=
{
Diagnostic(ERRID.ERR_TypeRefResolutionError3, "a").WithArguments("A", "Test.dll").WithLocation(1, 1)
})
Assert.Equal(0, locals.Count)
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub AssignmentToLockLocal()
Const source = "
Class C
Sub M(o As Object)
SyncLock(o)
#ExternalSource(""test"", 999)
Dim x As Integer = 1
#End ExternalSource
End SyncLock
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.M", atLineNumber:=999)
Dim errorMessage As String = Nothing
Dim testData As New CompilationTestData()
context.CompileAssignment("o", "Nothing", errorMessage, testData, DebuggerDiagnosticFormatter.Instance)
Assert.Null(errorMessage) ' In regular code, there would be an error about modifying a lock local.
testData.GetMethodData("<>x.<>m0").VerifyIL(
"{
// Code size 4 (0x4)
.maxstack 1
.locals init (Object V_0,
Boolean V_1,
Integer V_2) //x
IL_0000: ldnull
IL_0001: starg.s V_1
IL_0003: ret
}")
End Sub)
End Sub
<WorkItem(1015887, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1015887")>
<Fact>
Public Sub LocalDateConstant()
Const source = "
Class C
Shared Sub M()
Const d = #2010/01/02#
Dim dt As New System.DateTime(2010, 1, 2) ' It's easier to figure out the signature to pass if this is here.
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim errorMessage As String = Nothing
context.CompileAssignment("d", "Nothing", errorMessage, formatter:=DebuggerDiagnosticFormatter.Instance)
Assert.Equal("error BC30074: Constant cannot be the target of an assignment.", errorMessage)
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim testData As New CompilationTestData()
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "dt", expectedILOpt:=
"{
// Code size 2 (0x2)
.maxstack 1
.locals init (Date V_0) //dt
IL_0000: ldloc.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "d", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 15 (0xf)
.maxstack 1
.locals init (Date V_0) //dt
IL_0000: ldc.i8 0x8cc5955a94ec000
IL_0009: newobj ""Sub Date..ctor(Long)""
IL_000e: ret
}")
locals.Free()
End Sub)
End Sub
<WorkItem(1015887, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1015887")>
<Fact>
Public Sub LocalDecimalConstant()
Const source = "
Class C
Shared Sub M()
Const d As Decimal = 1.5D
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim errorMessage As String = Nothing
context.CompileAssignment("d", "Nothing", errorMessage, formatter:=DebuggerDiagnosticFormatter.Instance)
Assert.Equal("error BC30074: Constant cannot be the target of an assignment.", errorMessage)
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim testData As New CompilationTestData()
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(1, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "d", expectedFlags:=DkmClrCompilationResultFlags.ReadOnlyResult, expectedILOpt:=
"{
// Code size 12 (0xc)
.maxstack 5
IL_0000: ldc.i4.s 15
IL_0002: ldc.i4.0
IL_0003: ldc.i4.0
IL_0004: ldc.i4.0
IL_0005: ldc.i4.1
IL_0006: newobj ""Sub Decimal..ctor(Integer, Integer, Integer, Boolean, Byte)""
IL_000b: ret
}")
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1022165, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1022165"), WorkItem(1028883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1028883"), WorkItem(1034204, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1034204")>
Public Sub KeywordIdentifiers()
Const source = "
Class C
Sub M([Nothing] As Integer)
Dim [Me] = 1
Dim [True] = ""t""c
Dim [Namespace] = ""NS""
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.M")
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.NotNull(assembly)
Assert.NotEqual(assembly.Count, 0)
Assert.Equal(locals.Count, 5)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //Me
Char V_1, //True
String V_2) //Namespace
IL_0000: ldarg.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "[Nothing]", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //Me
Char V_1, //True
String V_2) //Namespace
IL_0000: ldarg.1
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(2), "<>m2", "[Me]", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //Me
Char V_1, //True
String V_2) //Namespace
IL_0000: ldloc.0
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(3), "<>m3", "[True]", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //Me
Char V_1, //True
String V_2) //Namespace
IL_0000: ldloc.1
IL_0001: ret
}")
VerifyLocal(testData, typeName, locals(4), "<>m4", "[Namespace]", expectedILOpt:="
{
// Code size 2 (0x2)
.maxstack 1
.locals init (Integer V_0, //Me
Char V_1, //True
String V_2) //Namespace
IL_0000: ldloc.2
IL_0001: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub ExtensionIterator()
Const source = "
Module M
<System.Runtime.CompilerServices.Extension>
Iterator Function F(x As Integer) As System.Collections.IEnumerable
Yield x
End Function
End Module
"
Const expectedIL = "
{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""M.VB$StateMachine_0_F.$VB$Local_x As Integer""
IL_0006: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "M.VB$StateMachine_0_F.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.NotNull(assembly)
Assert.NotEqual(0, assembly.Count)
Assert.Equal(1, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=expectedIL)
Assert.Equal(SpecialType.System_Int32, testData.GetMethodData(typeName & ".<>m0").Method.ReturnType.SpecialType)
locals.Free()
testData = New CompilationTestData()
Dim errorMessage As String = Nothing
context.CompileExpression("x", errorMessage, testData)
Assert.Null(errorMessage)
Dim methodData = testData.GetMethodData("<>x.<>m0")
methodData.VerifyIL(expectedIL)
Assert.Equal(SpecialType.System_Int32, methodData.Method.ReturnType.SpecialType)
End Sub)
End Sub
<WorkItem(1014763, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1014763")>
<Fact>
Public Sub TypeVariablesTypeParameterNames()
Const source = "
Imports System.Collections.Generic
Class C
Iterator Shared Function I(Of T)() As IEnumerable(Of T)
Yield Nothing
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.VB$StateMachine_1_I.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.NotNull(assembly)
Assert.NotEqual(0, assembly.Count)
Dim local = locals.Single()
Assert.Equal("<>TypeVariables", local.LocalName)
Assert.Equal("<>m0", local.MethodName)
Dim method = testData.GetMethodData("<>x(Of T).<>m0").Method
Dim typeVariablesType = DirectCast(method.ReturnType, NamedTypeSymbol)
Assert.Equal("T", typeVariablesType.TypeParameters.Single().Name)
Assert.Equal("T", typeVariablesType.TypeArguments.Single().Name)
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1063254, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1063254")>
Public Sub OverloadedIteratorDifferentParameterTypes_ArgumentsOnly()
Dim source = "
Imports System.Collections.Generic
Class C
Iterator Function M1(x As Integer, y As Integer) As IEnumerable(Of Integer)
Dim local = 0
Yield local
End Function
Iterator Function M1(x As Integer, y As Single) As IEnumerable(Of Single)
Dim local = 0.0F
Yield local
End Function
Shared Iterator Function M2(x As Integer, y As Single) As IEnumerable(Of Single)
Dim local = 0.0F
Yield local
End Function
Shared Iterator Function M2(Of T)(x As Integer, y As T) As IEnumerable(Of T)
Dim local As T = Nothing
Yield local
End Function
Shared Iterator Function M2(x As Integer, y As Integer) As IEnumerable(Of Integer)
Dim local = 0
Yield local
End Function
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim displayClassName As String
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
Dim ilTemplate = "
{{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C.{1}.$VB$Local_{2} As {0}""
IL_0006: ret
}}"
' M1(Integer, Integer)
displayClassName = "VB$StateMachine_1_M1"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "y"))
locals.Clear()
' M1(Integer, Single)
displayClassName = "VB$StateMachine_2_M1"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "Single", displayClassName, "y"))
locals.Clear()
' M2(Integer, Single)
displayClassName = "VB$StateMachine_3_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "Single", displayClassName, "y"))
locals.Clear()
' M2(Integer, T)
displayClassName = "VB$StateMachine_4_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
typeName += "(Of T)"
displayClassName += "(Of T)"
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "T", displayClassName, "y"))
locals.Clear()
' M2(Integer, Integer)
displayClassName = "VB$StateMachine_5_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "Integer", displayClassName, "y"))
locals.Clear()
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1063254, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1063254")>
Public Sub OverloadedAsyncDifferentParameterTypes_ArgumentsOnly()
Dim source = "
Imports System.Threading.Tasks
Class C
Async Function M1(x As Integer) As Task(Of Integer)
Dim local = 0
Return local
End Function
Async Function M1(x As Integer, y As Single) As Task(Of Single)
Dim local = 0.0F
Return local
End Function
Shared Async Function M2(x As Integer, y As Single) As Task(Of Single)
Dim local = 0.0F
return local
End Function
Shared Async Function M2(Of T)(x As T) As Task(Of T)
Dim local As T = Nothing
Return local
End Function
Shared Async Function M2(x As Integer) As Task(Of Integer)
Dim local = 0
Return local
End Function
End Class"
Dim comp = CreateCompilationWithReferences({VisualBasicSyntaxTree.ParseText(source)}, {MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim displayClassName As String
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
Dim ilTemplate = "
{{
// Code size 7 (0x7)
.maxstack 1
.locals init ({0} V_0,
Integer V_1,
System.Threading.Tasks.Task(Of {0}) V_2,
System.Exception V_3)
IL_0000: ldarg.0
IL_0001: ldfld ""C.{2}.$VB$Local_{3} As {1}""
IL_0006: ret
}}"
' M1(Integer)
displayClassName = "VB$StateMachine_1_M1"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", "Integer", displayClassName, "x"))
locals.Clear()
' M1(Integer, Single)
displayClassName = "VB$StateMachine_2_M1"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Single", "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "Single", "Single", displayClassName, "y"))
locals.Clear()
' M2(Integer, Single)
displayClassName = "VB$StateMachine_3_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Single", "Integer", displayClassName, "x"))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(ilTemplate, "Single", "Single", displayClassName, "y"))
locals.Clear()
' M2(T)
displayClassName = "VB$StateMachine_4_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of T)", locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "T", "T", displayClassName + "(Of T)", "x"))
locals.Clear()
' M2(Integer)
displayClassName = "VB$StateMachine_5_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(ilTemplate, "Integer", "Integer", displayClassName, "x"))
locals.Clear()
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1063254, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1063254")>
Public Sub MultipleLambdasDifferentParameterNames_ArgumentsOnly()
Dim source = "
Imports System
Class C
Sub M1(x As Integer)
Dim a As Action(Of Integer) = Sub(y) x.ToString()
Dim f As Func(Of Integer, Integer) = Function(z) x
End Sub
Shared Sub M2(Of T)(x As Integer)
Dim a As Action(Of Integer) = Sub(y) y.ToString()
Dim f As Func(Of Integer, Integer) = Function(z) z
Dim g As Func(Of T, T) = Function(ti) ti
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim displayClassName As String
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
Dim voidRetILTemplate = "
{{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.{0}
IL_0001: ret
}}"
Dim funcILTemplate = "
{{
// Code size 2 (0x2)
.maxstack 1
.locals init ({0} V_0)
IL_0000: ldarg.{1}
IL_0001: ret
}}"
' Sub(y) x.ToString()
displayClassName = "_Closure$__1-0"
GetLocals(runtime, "C." + displayClassName + "._Lambda$__0", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "y", expectedILOpt:=String.Format(voidRetILTemplate, 1))
locals.Clear()
' Function(z) x
displayClassName = "_Closure$__1-0"
GetLocals(runtime, "C." + displayClassName + "._Lambda$__1", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "z", expectedILOpt:=String.Format(funcILTemplate, "Integer", 1))
locals.Clear()
' Sub(y) y.ToString()
displayClassName = "_Closure$__2"
GetLocals(runtime, "C." + displayClassName + "._Lambda$__2-0", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of $CLS0)", locals(0), "<>m0", "y", expectedILOpt:=String.Format(voidRetILTemplate, 1))
locals.Clear()
' Function(z) z
displayClassName = "_Closure$__2"
GetLocals(runtime, "C." + displayClassName + "._Lambda$__2-1", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of $CLS0)", locals(0), "<>m0", "z", expectedILOpt:=String.Format(funcILTemplate, "Integer", 1))
locals.Clear()
' Function(ti) ti
displayClassName = "_Closure$__2"
GetLocals(runtime, "C." + displayClassName + "._Lambda$__2-2", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of $CLS0)", locals(0), "<>m0", "ti", expectedILOpt:=String.Format(funcILTemplate, "$CLS0", 1))
locals.Clear()
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1063254, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1063254")>
Public Sub OverloadedRegularMethodDifferentParameterTypes_ArgumentsOnly()
Dim source = "
Class C
Sub M1(x As Integer, y As Integer)
Dim local = 0
End Sub
Function M1(x As Integer, y As String) As String
Dim local As String = Nothing
return local
End Function
Shared Sub M2(x As Integer, y As String)
Dim local As String = Nothing
End Sub
Shared Function M2(Of T)(x As Integer, y As T) As T
Dim local As T = Nothing
Return local
End Function
Shared Function M2(x As Integer, ByRef y As Integer) As Integer
Dim local As Integer = 0
Return local
End Function
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
Dim voidRetILTemplate = "
{{
// Code size 2 (0x2)
.maxstack 1
.locals init ({0} V_0) //local
IL_0000: ldarg.{1}
IL_0001: ret
}}"
Dim funcILTemplate = "
{{
// Code size 2 (0x2)
.maxstack 1
.locals init ({0} V_0, {1}
{0} V_1) //local
IL_0000: ldarg.{2}
IL_0001: ret
}}"
Dim refParamILTemplate = "
{{
// Code size 3 (0x3)
.maxstack 1
.locals init ({0} V_0, {1}
{0} V_1) //local
IL_0000: ldarg.{2}
IL_0001: ldind.i4
IL_0002: ret
}}"
' M1(Integer, Integer)
GetLocals(runtime, "C.M1(Int32,Int32)", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(voidRetILTemplate, "Integer", 1))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(voidRetILTemplate, "Integer", 2))
locals.Clear()
' M1(Integer, String)
GetLocals(runtime, "C.M1(Int32,String)", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(funcILTemplate, "String", "//M1", 1))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(funcILTemplate, "String", "//M1", 2))
locals.Clear()
' M2(Integer, String)
GetLocals(runtime, "C.M2(Int32,String)", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(voidRetILTemplate, "String", 0))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(voidRetILTemplate, "String", 1))
locals.Clear()
' M2(Integer, T)
GetLocals(runtime, "C.M2(Int32,T)", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0(Of T)", "x", expectedILOpt:=String.Format(funcILTemplate, "T", "//M2", 0), expectedGeneric:=True)
VerifyLocal(testData, typeName, locals(1), "<>m1(Of T)", "y", expectedILOpt:=String.Format(funcILTemplate, "T", "//M2", 1), expectedGeneric:=True)
locals.Clear()
' M2(Integer, Integer)
GetLocals(runtime, "C.M2(Int32,Int32)", argumentsOnly:=True, locals:=locals, count:=2, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=String.Format(funcILTemplate, "Integer", "//M2", 0))
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=String.Format(refParamILTemplate, "Integer", "//M2", 1))
locals.Clear()
locals.Free()
End Sub)
End Sub
<Fact, WorkItem(1063254, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1063254")>
Public Sub MultipleMethodsLocalConflictsWithParameterName_ArgumentsOnly()
Dim source = "
Imports System.Collections.Generic
Imports System.Threading.Tasks
Class C(Of T)
Iterator Function M1() As IEnumerable(Of Integer)
Dim x = 0
Yield x
End Function
Iterator Function M1(x As Integer) As IEnumerable(Of Integer)
Yield x
End Function
Iterator Function M2(x As Integer) As IEnumerable(Of Integer)
Yield x
End Function
Iterator Function M2() As IEnumerable(Of Integer)
Dim x = 0
Yield x
End Function
Shared Async Function M3() As Task(Of T)
Dim x As T = Nothing
return x
End Function
Shared Async Function M3(x As T) As Task(Of T)
Return x
End Function
Shared Async Function M4(x As T) As Task(Of T)
Return x
End Function
Shared Async Function M4() As Task(Of T)
Dim x As T = Nothing
Return x
End Function
End Class"
Dim comp = CreateCompilationWithReferences({VisualBasicSyntaxTree.ParseText(source)}, {MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim displayClassName As String
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
Dim iteratorILTemplate = "
{{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
{0} V_1)
IL_0000: ldarg.0
IL_0001: ldfld ""C(Of T).{1}.$VB$Local_{2} As {0}""
IL_0006: ret
}}"
Dim asyncILTemplate = "
{{
// Code size 7 (0x7)
.maxstack 1
.locals init ({0} V_0,
Integer V_1,
System.Threading.Tasks.Task(Of {0}) V_2,
System.Exception V_3)
IL_0000: ldarg.0
IL_0001: ldfld ""C(Of T).{1}.$VB$Local_{2} As {0}""
IL_0006: ret
}}"
' M1()
displayClassName = "VB$StateMachine_1_M1"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=0, typeName:=typeName, testData:=testData)
locals.Clear()
' M1(Integer)
displayClassName = "VB$StateMachine_2_M1"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of T)", locals(0), "<>m0", "x", expectedILOpt:=String.Format(iteratorILTemplate, "Integer", displayClassName, "x"))
locals.Clear()
' M2(Integer)
displayClassName = "VB$StateMachine_3_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of T)", locals(0), "<>m0", "x", expectedILOpt:=String.Format(iteratorILTemplate, "Integer", displayClassName, "x"))
locals.Clear()
' M2()
displayClassName = "VB$StateMachine_4_M2"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=0, typeName:=typeName, testData:=testData)
locals.Clear()
' M3()
displayClassName = "VB$StateMachine_5_M3"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=0, typeName:=typeName, testData:=testData)
locals.Clear()
' M3(Integer)
displayClassName = "VB$StateMachine_6_M3"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of T)", locals(0), "<>m0", "x", expectedILOpt:=String.Format(asyncILTemplate, "T", displayClassName, "x"))
locals.Clear()
' M4(Integer)
displayClassName = "VB$StateMachine_7_M4"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName + "(Of T)", locals(0), "<>m0", "x", expectedILOpt:=String.Format(asyncILTemplate, "T", displayClassName, "x"))
locals.Clear()
' M4()
displayClassName = "VB$StateMachine_8_M4"
GetLocals(runtime, "C." + displayClassName + ".MoveNext", argumentsOnly:=True, locals:=locals, count:=0, typeName:=typeName, testData:=testData)
locals.Clear()
locals.Free()
End Sub)
End Sub
<WorkItem(1115044, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1115044")>
<Fact>
Public Sub CaseSensitivity()
Const source = "
Class C
Shared Sub M(p As Integer)
Dim s As String
End Sub
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim errorMessage As String = Nothing
Dim testData As CompilationTestData
testData = New CompilationTestData()
context.CompileExpression("P", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL("
{
// Code size 2 (0x2)
.maxstack 1
.locals init (String V_0) //s
IL_0000: ldarg.0
IL_0001: ret
}
")
testData = New CompilationTestData()
context.CompileExpression("S", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL("
{
// Code size 2 (0x2)
.maxstack 1
.locals init (String V_0) //s
IL_0000: ldloc.0
IL_0001: ret
}
")
End Sub)
End Sub
<WorkItem(1115030, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1115030")>
<Fact>
Public Sub CatchInAsyncStateMachine()
Const source =
"Imports System
Imports System.Threading.Tasks
Class C
Shared Function F() As Object
Throw New ArgumentException()
End Function
Shared Async Function M() As Task
Dim o As Object
Try
o = F()
Catch e As Exception
#ExternalSource(""test"", 999)
o = e
#End ExternalSource
End Try
End Function
End Class"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_2_M.MoveNext", atLineNumber:=999)
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "o", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Exception V_1,
System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_M.$VB$ResumableLocal_o$0 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "e", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Exception V_1,
System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_M.$VB$ResumableLocal_e$1 As System.Exception""
IL_0006: ret
}")
locals.Free()
End Sub)
End Sub
<WorkItem(1115030, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1115030")>
<Fact>
Public Sub CatchInIteratorStateMachine()
Const source =
"Imports System
Imports System.Collections
Class C
Shared Function F() As Object
Throw New ArgumentException()
End Function
Shared Iterator Function M() As IEnumerable
Dim o As Object
Try
o = F()
Catch e As Exception
#ExternalSource(""test"", 999)
o = e
#End ExternalSource
End Try
Yield o
End Function
End Class"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_2_M.MoveNext", atLineNumber:=999)
Dim testData = New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "o", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1,
System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_M.$VB$ResumableLocal_o$0 As Object""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "e", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Boolean V_0,
Integer V_1,
System.Exception V_2)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_2_M.$VB$ResumableLocal_e$1 As System.Exception""
IL_0006: ret
}")
locals.Free()
End Sub)
End Sub
<Fact>
Public Sub DuplicateEditorBrowsableAttributes()
Const libSource = "
Namespace System.ComponentModel
Public Enum EditorBrowsableState
Always = 0
Never = 1
Advanced = 2
End Enum
<AttributeUsage(AttributeTargets.All)>
Friend NotInheritable Class EditorBrowsableAttribute
Inherits Attribute
Public Sub New(state As EditorBrowsableState)
End Sub
End Class
End Namespace
"
Const source = "
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Class C
Sub M()
End Sub
End Class
"
Dim libRef = CreateCompilationWithMscorlib({libSource}, options:=TestOptions.DebugDll).EmitToImageReference()
Dim comp = CreateCompilationWithReferences({VisualBasicSyntaxTree.ParseText(source)}, {MscorlibRef, SystemRef}, TestOptions.DebugDll)
' Referencing SystemCoreRef and SystemXmlLinqRef will cause Microsoft.VisualBasic.Embedded to be compiled
' and it depends on EditorBrowsableAttribute.
WithRuntimeInstance(comp, {MscorlibRef, SystemRef, SystemCoreRef, SystemXmlLinqRef, libRef},
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, "C.M", argumentsOnly:=False, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
Assert.Equal("Me", locals.Single().LocalName)
locals.Free()
End Sub)
End Sub
<WorkItem(2089, "https://github.com/dotnet/roslyn/issues/2089")>
<Fact>
Public Sub MultipleMeFields()
Const source =
"Imports System
Imports System.Threading.Tasks
Class C
Async Shared Function F(a As Action) As Task
a()
End Function
Sub G(s As String)
End Sub
Async Sub M()
Dim s As String = Nothing
Await F(Sub() G(s))
End Sub
End Class"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_3_M.MoveNext")
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me", expectedILOpt:=
"{
// Code size 7 (0x7)
.maxstack 1
.locals init (Integer V_0,
System.Runtime.CompilerServices.TaskAwaiter V_1,
C.VB$StateMachine_3_M V_2,
System.Exception V_3)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_3_M.$VB$Me As C""
IL_0006: ret
}")
VerifyLocal(testData, typeName, locals(1), "<>m1", "s", expectedILOpt:=
"{
// Code size 12 (0xc)
.maxstack 1
.locals init (Integer V_0,
System.Runtime.CompilerServices.TaskAwaiter V_1,
C.VB$StateMachine_3_M V_2,
System.Exception V_3)
IL_0000: ldarg.0
IL_0001: ldfld ""C.VB$StateMachine_3_M.$VB$ResumableLocal_$VB$Closure_$0 As C._Closure$__3-0""
IL_0006: ldfld ""C._Closure$__3-0.$VB$Local_s As String""
IL_000b: ret
}")
locals.Free()
End Sub)
End Sub
<WorkItem(2336, "https://github.com/dotnet/roslyn/issues/2336")>
<Fact>
Public Sub LocalsOnAsyncEndSub()
Const source = "
Imports System
Imports System.Threading.Tasks
Class C
Async Sub M()
Dim s As String = Nothing
#ExternalSource(""test"", 999)
End Sub
#End ExternalSource
End Class
"
Dim comp = CreateCompilationWithReferences(
MakeSources(source),
{MscorlibRef_v4_0_30316_17626, MsvbRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929},
TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, methodName:="C.VB$StateMachine_1_M.MoveNext", atLineNumber:=999)
Dim testData As New CompilationTestData()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=typeName, testData:=testData)
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "Me")
VerifyLocal(testData, typeName, locals(1), "<>m1", "s")
locals.Free()
End Sub)
End Sub
<WorkItem(1139013, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1139013")>
<Fact>
Public Sub TransparentIdentifiers_FromParameter()
Const source = "
Imports System.Linq
Class C
Sub M(args As String())
Dim concat =
From x In args
Let y = x.ToString()
Let z = x.GetHashCode()
Select x & y & z
End Sub
End Class
"
Const methodName = "C._Closure$__._Lambda$__1-2"
Const zIL = "
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ldfld ""VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer).$z As Integer""
IL_0006: ret
}
"
Const xIL = "
{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ldfld ""VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer).$$VB$It As VB$AnonymousType_0(Of String, String)""
IL_0006: ldfld ""VB$AnonymousType_0(Of String, String).$x As String""
IL_000b: ret
}
"
Const yIL = "
{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ldfld ""VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer).$$VB$It As VB$AnonymousType_0(Of String, String)""
IL_0006: ldfld ""VB$AnonymousType_0(Of String, String).$y As String""
IL_000b: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, methodName, argumentsOnly:=False, locals:=locals, count:=3, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "z", expectedILOpt:=zIL)
VerifyLocal(testData, typeName, locals(1), "<>m1", "x", expectedILOpt:=xIL)
VerifyLocal(testData, typeName, locals(2), "<>m2", "y", expectedILOpt:=yIL)
locals.Free()
Dim context = CreateMethodContext(runtime, methodName)
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("z", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(zIL)
testData = New CompilationTestData()
context.CompileExpression("x", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(xIL)
testData = New CompilationTestData()
context.CompileExpression("y", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(yIL)
End Sub)
End Sub
<WorkItem(1139013, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1139013")>
<Fact>
Public Sub TransparentIdentifiers_FromDisplayClassField()
Const source = "
Imports System.Linq
Class C
Sub M(args As String())
Dim concat =
From x In args
Let y = x.ToString()
Let z = x.GetHashCode()
Select x.Select(Function(c) y & z)
End Sub
End Class
"
Const methodName = "C._Closure$__1-0._Lambda$__3"
Const cIL = "
{
// Code size 2 (0x2)
.maxstack 1
.locals init (String V_0)
IL_0000: ldarg.1
IL_0001: ret
}
"
Const zIL = "
{
// Code size 12 (0xc)
.maxstack 1
.locals init (String V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-0.$VB$Local_$VB$It As VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer)""
IL_0006: ldfld ""VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer).$z As Integer""
IL_000b: ret
}
"
Const xIL = "
{
// Code size 17 (0x11)
.maxstack 1
.locals init (String V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-0.$VB$Local_$VB$It As VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer)""
IL_0006: ldfld ""VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer).$$VB$It As VB$AnonymousType_0(Of String, String)""
IL_000b: ldfld ""VB$AnonymousType_0(Of String, String).$x As String""
IL_0010: ret
}
"
Const yIL = "
{
// Code size 17 (0x11)
.maxstack 1
.locals init (String V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""C._Closure$__1-0.$VB$Local_$VB$It As VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer)""
IL_0006: ldfld ""VB$AnonymousType_1(Of VB$AnonymousType_0(Of String, String), Integer).$$VB$It As VB$AnonymousType_0(Of String, String)""
IL_000b: ldfld ""VB$AnonymousType_0(Of String, String).$y As String""
IL_0010: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, methodName, argumentsOnly:=False, locals:=locals, count:=4, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "c", expectedILOpt:=cIL)
VerifyLocal(testData, typeName, locals(1), "<>m1", "z", expectedILOpt:=zIL)
VerifyLocal(testData, typeName, locals(2), "<>m2", "x", expectedILOpt:=xIL)
VerifyLocal(testData, typeName, locals(3), "<>m3", "y", expectedILOpt:=yIL)
locals.Free()
Dim context = CreateMethodContext(runtime, methodName)
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("c", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(cIL)
testData = New CompilationTestData()
context.CompileExpression("z", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(zIL)
testData = New CompilationTestData()
context.CompileExpression("x", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(xIL)
testData = New CompilationTestData()
context.CompileExpression("y", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(yIL)
End Sub)
End Sub
<WorkItem(1139013, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1139013")>
<Fact>
Public Sub TransparentIdentifiers_It1()
Const source = "
Imports System.Linq
Class C
Sub M(args As String())
Dim concat =
From x In args, y In args
From z In args
Select x & y & z
End Sub
End Class
"
Const methodName = "C._Closure$__._Lambda$__1-3"
Const zIL = "
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.2
IL_0001: ret
}
"
Const xIL = "
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ldfld ""VB$AnonymousType_0(Of String, String).$x As String""
IL_0006: ret
}
"
Const yIL = "
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ldfld ""VB$AnonymousType_0(Of String, String).$y As String""
IL_0006: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, methodName, argumentsOnly:=False, locals:=locals, count:=3, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "z", expectedILOpt:=zIL)
VerifyLocal(testData, typeName, locals(1), "<>m1", "x", expectedILOpt:=xIL)
VerifyLocal(testData, typeName, locals(2), "<>m2", "y", expectedILOpt:=yIL)
locals.Free()
Dim context = CreateMethodContext(runtime, methodName)
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("z", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(zIL)
testData = New CompilationTestData()
context.CompileExpression("x", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(xIL)
testData = New CompilationTestData()
context.CompileExpression("y", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(yIL)
End Sub)
End Sub
<WorkItem(1139013, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1139013")>
<Fact>
Public Sub TransparentIdentifiers_It2()
Const source = "
Imports System.Linq
Class C
Sub M(nums As Integer())
Dim q = From x In nums
Join y In nums
Join z In nums
On z Equals y
On x Equals y And z Equals x
End Sub
End Class
"
Const methodName = "C._Closure$__._Lambda$__1-5"
Const xIL = "
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ret
}
"
Const yIL = "
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.2
IL_0001: ldfld ""VB$AnonymousType_1(Of Integer, Integer).$y As Integer""
IL_0006: ret
}
"
Const zIL = "
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.2
IL_0001: ldfld ""VB$AnonymousType_1(Of Integer, Integer).$z As Integer""
IL_0006: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, methodName, argumentsOnly:=False, locals:=locals, count:=3, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=xIL)
VerifyLocal(testData, typeName, locals(1), "<>m1", "y", expectedILOpt:=yIL)
VerifyLocal(testData, typeName, locals(2), "<>m2", "z", expectedILOpt:=zIL)
locals.Free()
Dim context = CreateMethodContext(runtime, methodName)
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("x", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(xIL)
testData = New CompilationTestData()
context.CompileExpression("y", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(yIL)
testData = New CompilationTestData()
context.CompileExpression("z", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(zIL)
End Sub)
End Sub
<WorkItem(1139013, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1139013")>
<Fact>
Public Sub TransparentIdentifiers_ItAnonymous()
Const source = "
Imports System.Linq
Class C
Sub M(args As String())
Dim concat =
From x In args
Group y = x.GetHashCode() By x
Into s = Sum(y + 3)
End Sub
End Class
"
Const methodName = "C._Closure$__._Lambda$__1-2"
Const xIL = "
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, methodName, argumentsOnly:=False, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x", expectedILOpt:=xIL)
locals.Free()
Dim context = CreateMethodContext(runtime, methodName)
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("x", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(xIL)
End Sub)
End Sub
<WorkItem(3236, "https://github.com/dotnet/roslyn/pull/3236")>
<Fact>
Public Sub AnonymousTypeParameter()
Const source = "
Imports System.Linq
Class C
Shared Sub Main(args As String())
Dim anonymousTypes =
From a In args
Select New With {.Value = a, .Length = a.Length}
Dim values =
From t In anonymousTypes
Select t.Value
End Sub
End Class
"
Const methodName = "C._Closure$__._Lambda$__1-1"
Const xIL = "
{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.1
IL_0001: ret
}
"
Dim comp = CreateCompilationWithMscorlib({source}, {SystemCoreRef, MsvbRef}, TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim typeName As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim testData As CompilationTestData = Nothing
GetLocals(runtime, methodName, argumentsOnly:=False, locals:=locals, count:=1, typeName:=typeName, testData:=testData)
VerifyLocal(testData, typeName, locals(0), "<>m0", "t", expectedILOpt:=xIL)
locals.Free()
Dim context = CreateMethodContext(runtime, methodName)
Dim errorMessage As String = Nothing
testData = New CompilationTestData()
context.CompileExpression("t", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(xIL)
End Sub)
End Sub
<WorkItem(955, "https://github.com/aspnet/Home/issues/955")>
<Fact>
Public Sub ConstantWithErrorType()
Const source = "
Module Module1
Sub Main()
Const a = 1
End Sub
End Module"
Dim comp = CreateCompilationWithMscorlib({source}, {MsvbRef}, options:=TestOptions.DebugExe)
WithRuntimeInstance(comp,
Sub(runtime)
Dim badConst = New MockSymUnmanagedConstant(
"a",
1,
Function(bufferLength As Integer, ByRef count As Integer, name() As Byte)
count = 0
Return HResult.E_NOTIMPL
End Function)
Dim debugInfo = New MethodDebugInfoBytes.Builder(constants:={badConst}).Build()
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
GetLocals(runtime, "Module1.Main", debugInfo, locals, count:=0)
locals.Free()
End Sub)
End Sub
<WorkItem(298297, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=298297")>
<Fact>
Public Sub OrderOfArguments_ArgumentsOnly()
Const source = "
Imports System.Collections.Generic
Class C
Iterator Shared Function F(y As Object, x As Object) As IEnumerable(Of Object)
Yield x
#ExternalSource(""test"", 999)
DummySequencePoint()
#End ExternalSource
Yield y
End Function
Shared Sub DummySequencePoint()
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, {MsvbRef}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context As EvaluationContext
context = CreateMethodContext(runtime, "C.VB$StateMachine_1_F.MoveNext", atLineNumber:=999)
Dim unused As String = Nothing
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
context.CompileGetLocals(locals, argumentsOnly:=True, typeName:=unused, testData:=Nothing)
Assert.Equal(2, locals.Count)
' The order must confirm the order of the arguments in the method signature.
Dim typeName As String = Nothing
Dim testData As CompilationTestData = Nothing
Assert.Equal("y", locals(0).LocalName)
Assert.Equal("x", locals(1).LocalName)
locals.Free()
End Sub)
End Sub
''' <summary>
''' CompileGetLocals should skip locals with errors.
''' </summary>
<WorkItem(535899, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=535899")>
<Fact>
Public Sub SkipPseudoVariablesWithUseSiteErrors()
Const source =
"Class C
Shared Sub M(x As Object)
Dim y As Object
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
WithRuntimeInstance(comp,
Sub(runtime)
Dim context = CreateMethodContext(runtime, "C.M")
Dim aliases = ImmutableArray.Create(ReturnValueAlias(1, "UnknownType, UnknownAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"))
Dim locals = ArrayBuilder(Of LocalAndMethod).GetInstance()
Dim typeName As String = Nothing
Dim diagnostics = DiagnosticBag.GetInstance()
Dim testData = New CompilationTestData()
context.CompileGetLocals(
locals,
argumentsOnly:=False,
aliases:=aliases,
diagnostics:=diagnostics,
typeName:=typeName,
testData:=testData)
diagnostics.Verify()
diagnostics.Free()
Assert.Equal(2, locals.Count)
VerifyLocal(testData, typeName, locals(0), "<>m0", "x")
VerifyLocal(testData, typeName, locals(1), "<>m1", "y")
locals.Free()
End Sub)
End Sub
Private Shared Sub GetLocals(runtime As RuntimeInstance, methodName As String, argumentsOnly As Boolean, locals As ArrayBuilder(Of LocalAndMethod), count As Integer, ByRef typeName As String, ByRef testData As CompilationTestData)
Dim context = CreateMethodContext(runtime, methodName)
testData = New CompilationTestData()
Dim assembly = context.CompileGetLocals(locals, argumentsOnly, typeName, testData)
Assert.NotNull(assembly)
If count = 0 Then
Assert.Equal(0, assembly.Count)
Else
Assert.InRange(assembly.Count, 0, Integer.MaxValue)
End If
Assert.Equal(count, locals.Count)
End Sub
Private Shared Sub GetLocals(runtime As RuntimeInstance, methodName As String, debugInfo As MethodDebugInfoBytes, locals As ArrayBuilder(Of LocalAndMethod), count As Integer)
Dim blocks As ImmutableArray(Of MetadataBlock) = Nothing
Dim moduleVersionId As Guid = Nothing
Dim methodToken = 0
Dim localSignatureToken = 0
GetContextState(runtime, methodName, blocks, moduleVersionId, symReader:=Nothing, methodOrTypeToken:=methodToken, localSignatureToken:=localSignatureToken)
Dim symReader = New MockSymUnmanagedReader(
New Dictionary(Of Integer, MethodDebugInfoBytes)() From
{
{methodToken, debugInfo}
}.ToImmutableDictionary())
Dim context = EvaluationContext.CreateMethodContext(
Nothing,
blocks,
MakeDummyLazyAssemblyReaders(),
symReader,
moduleVersionId,
methodToken,
methodVersion:=1,
ilOffset:=0,
localSignatureToken:=localSignatureToken)
Dim assembly = context.CompileGetLocals(locals, argumentsOnly:=False, typeName:=Nothing, testData:=Nothing)
Assert.NotNull(assembly)
If count = 0 Then
Assert.Equal(0, assembly.Count)
Else
Assert.InRange(assembly.Count, 0, Integer.MaxValue)
End If
Assert.Equal(count, locals.Count)
End Sub
End Class
End Namespace
|
orthoxerox/roslyn
|
src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb
|
Visual Basic
|
apache-2.0
| 132,252
|
'------------------------------------------------------------------------------
' <auto-generated>
' Этот код создан программой.
' Исполняемая версия:4.0.30319.34003
'
' Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
' повторной генерации кода.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'Этот класс создан автоматически классом StronglyTypedResourceBuilder
'с помощью такого средства, как ResGen или Visual Studio.
'Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
'с параметром /str или перестройте свой проект VS.
'''<summary>
''' Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Bwl.Translator.One.CodeTest.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Перезаписывает свойство CurrentUICulture текущего потока для всех
''' обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
Lifemotion/Bwl.Translator.One
|
Bwl.Translator.One.CodeTest/My Project/Resources.Designer.vb
|
Visual Basic
|
apache-2.0
| 3,378
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace XmlDocumentationComments.Analyzers
''' <summary>
''' RS0010: Avoid using cref tags with a prefix
''' </summary>
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Public NotInheritable Class BasicAvoidUsingCrefTagsWithAPrefixAnalyzer
Inherits AvoidUsingCrefTagsWithAPrefixAnalyzer
End Class
End Namespace
|
mattwar/roslyn-analyzers
|
src/XmlDocumentationComments.Analyzers/VisualBasic/BasicAvoidUsingCrefTagsWithAPrefix.vb
|
Visual Basic
|
apache-2.0
| 676
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.