Class TypeSystemUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.typesystem.util.TypeSystemUtil
-
public class TypeSystemUtil extends Object
Common methods for all implementation ofITypeSystem
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TypeSystemUtil.IfPosition
Specifications ofTypeSystemUtil.TreeStatementPosition
for "if" statementstatic class
TypeSystemUtil.LoopPosition
Detects parts of tree statement ("for", "for each", "while") in BSL modulestatic class
TypeSystemUtil.TreeStatementPosition
Special abstract class for detected parts of tree statement ("if", "try", "for", "for each", "while") in BSL modulestatic class
TypeSystemUtil.TryPosition
Specifications ofTypeSystemUtil.TreeStatementPosition
for "try" statementstatic class
TypeSystemUtil.TypeStateDiscarder
Contents methods for discarding changes made byITypeSystem
-
Constructor Summary
Constructors Constructor Description TypeSystemUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addCollectionElementTypesToState(Iterable<TypeItem> collectionTypes, VariableTreeTypeState state)
Add collection element types toVariableTreeTypeState
static Collection<TypeItem>
computeCommentTypes(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode, org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormatComment)
ComputesTypeItem
s described in comment after Built-In language model object in the same line.static Collection<TypeItem>
computeCommentTypes(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormatComment)
ComputesTypeItem
s described in comment after Built-In language model object in the same line.static ExtendedCollectionType
createExtendedArrayType(List<TypeItem> collectionTypes, IEObjectProvider provider, org.eclipse.emf.ecore.EObject context)
CreatesExtendedCollectionType
as Array type with concrete collection element typesstatic void
discardTypeState(BslResource resource, Module module, TypeSystemMode mode)
Discards changes made byITypeSystem
static <T extends org.eclipse.emf.ecore.EObject>
List<T>filterInnerObject(Collection<Object> allObjects, Class<T> clazz)
Filters objects by their typestatic <T extends org.eclipse.emf.ecore.EObject>
List<T>findAllInnerObjectByClassifier(List<org.eclipse.emf.ecore.EObject> allContent, org.eclipse.emf.ecore.EClass eClass, Class<T> clazz)
Find objects by their class an eClassstatic Environments
getActualEnvironments(org.eclipse.emf.ecore.EObject eObject, IBslOwnerComputerService ownerComputerService)
Find actualEnvironments
for objectstatic Collection<Variable>
getAllVariableForBlock(Block block)
Gets all variable forBlock
static Collection<TypeItem>
getCollectionElementTypes(Iterable<TypeItem> types, org.eclipse.emf.ecore.EObject context)
Gets all collection element typesstatic List<String>
getCommentAfterObject(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode, boolean oldFormatComment)
Provides theList
of inlined comments for semantic element.static VariableTypeStateProvider
getOrInitVariableProvider(Variable variable, TypeSystemMode mode)
Gets provider for variable
If provider doesn't exist, create itstatic void
installInitTypeUserMethodParam(Method method, TypeSystemMode mode)
Computes final state forMethod
parametersstatic void
installInitTypeUserMethodParam(Module module, TypeSystemMode mode)
Computes final state forMethod
parametersstatic void
installTypeStateForMethodParamByDefValue(Method method, TypesComputer computerTypes, IVariableTypeStateFactory creator, Deque<VariableTreeTypeState> allComputedState, TypeSystemMode mode)
Installs states of parameters having default value
-
-
-
Method Detail
-
installInitTypeUserMethodParam
public static void installInitTypeUserMethodParam(Module module, TypeSystemMode mode)
Computes final state forMethod
parameters- Parameters:
module
- processing module, can't benull
mode
- currentTypeSystemMode
, cannot benull
-
installInitTypeUserMethodParam
public static void installInitTypeUserMethodParam(Method method, TypeSystemMode mode)
Computes final state forMethod
parameters- Parameters:
method
- processing method, can't benull
mode
- currentTypeSystemMode
, cannot benull
-
installTypeStateForMethodParamByDefValue
public static void installTypeStateForMethodParamByDefValue(Method method, TypesComputer computerTypes, IVariableTypeStateFactory creator, Deque<VariableTreeTypeState> allComputedState, TypeSystemMode mode)
Installs states of parameters having default value- Parameters:
method
- processingMethod
computerTypes
-TypesComputer
creator
-IVariableTypeStateFactory
allComputedState
- list for accumulation of all computed state, can't benull
-
discardTypeState
public static void discardTypeState(BslResource resource, Module module, TypeSystemMode mode)
Discards changes made byITypeSystem
- Parameters:
resource
- actualBslResource
, can't benull
module
- actualModule
, can't benull
mode
- currentTypeSystemMode
, cannot benull
-
getAllVariableForBlock
public static Collection<Variable> getAllVariableForBlock(Block block)
Gets all variable forBlock
- Parameters:
block
- part of BSL model- Returns:
- list of
Variable
-
findAllInnerObjectByClassifier
public static <T extends org.eclipse.emf.ecore.EObject> List<T> findAllInnerObjectByClassifier(List<org.eclipse.emf.ecore.EObject> allContent, org.eclipse.emf.ecore.EClass eClass, Class<T> clazz)
Find objects by their class an eClass- Parameters:
allContent
- all processing objectseClass
-EClass
clazz
-Class
- Returns:
- list of needed EObjects
-
filterInnerObject
public static <T extends org.eclipse.emf.ecore.EObject> List<T> filterInnerObject(Collection<Object> allObjects, Class<T> clazz)
Filters objects by their type- Parameters:
allObjects
-clazz
- type of needed objects- Returns:
- list of needed objects
-
getActualEnvironments
public static Environments getActualEnvironments(org.eclipse.emf.ecore.EObject eObject, IBslOwnerComputerService ownerComputerService)
Find actualEnvironments
for object- Parameters:
eObject
- processing object, can't benull
ownerComputerService
- actualIBslOwnerComputerService
, can't benull
- Returns:
- found
Environments
, nevernull
-
getOrInitVariableProvider
public static VariableTypeStateProvider getOrInitVariableProvider(Variable variable, TypeSystemMode mode)
Gets provider for variable
If provider doesn't exist, create it- Parameters:
variable
-Variable
variable from Bsl Modulemode
- currentTypeSystemMode
, cannot benull
- Returns:
VariableTypeStateProvider
, nevernull
-
addCollectionElementTypesToState
public static void addCollectionElementTypesToState(Iterable<TypeItem> collectionTypes, VariableTreeTypeState state)
Add collection element types toVariableTreeTypeState
- Parameters:
collectionTypes
- types of the collection, can't benull
state
- changingVariableTreeTypeState
, can't benull
-
getCollectionElementTypes
public static Collection<TypeItem> getCollectionElementTypes(Iterable<TypeItem> types, org.eclipse.emf.ecore.EObject context)
Gets all collection element types- Parameters:
types
- types for getting collection element types, cannot benull
context
- contextEObject
for resolving types, cannot benull
-
createExtendedArrayType
public static ExtendedCollectionType createExtendedArrayType(List<TypeItem> collectionTypes, IEObjectProvider provider, org.eclipse.emf.ecore.EObject context)
CreatesExtendedCollectionType
as Array type with concrete collection element types- Parameters:
collectionTypes
- types for array element, cannot benull
provider
- specialIEObjectProvider
for getting proxyTypeItem
by name, cannot benull
context
-EObject
for resolvingTypeItem
, cannot benull
- Returns:
- created
ExtendedCollectionType
as Array type with concrete collection element types, nevernull
-
computeCommentTypes
public static Collection<TypeItem> computeCommentTypes(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormatComment)
ComputesTypeItem
s described in comment after Built-In language model object in the same line. Code examples:-
Procedure example() ... someVariable = someFunction(); //TypeName - description ... EndProcedure
-
... Var someModuleVariable; Var moduleVariableWithTypes; //TypeName - description ...
- Parameters:
expressionBeforeComment
- Built-In language model object for find comment after it in the same line, cannot benull
typeScope
- actualTypeItem
sIScope
, cannot benull
scopeProvider
- actualIScopeProvider
for getting platform and configuration objects for comment content, cannot benull
qualifiedNameConverter
- actualIQualifiedNameConverter
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
for read comment content, cannot benull
oldFormatComment
-true
if comment in old format,false
in new format- Returns:
- collection of
TypeItem
s described in comment, nevernull
-
-
computeCommentTypes
public static Collection<TypeItem> computeCommentTypes(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode, org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormatComment)
ComputesTypeItem
s described in comment after Built-In language model object in the same line. Code examples:-
Procedure example() ... someVariable = someFunction(); //TypeName - description ... EndProcedure
-
... Var someModuleVariable; Var moduleVariableWithTypes; //TypeName - description ...
- Parameters:
expressionBeforeComment
- Built-In language model object for find comment after it in the same line, cannot benull
blockNode
-INode
ofBlock
which containsexpressionBeforeComment
, cannot benull
typeScope
- actualTypeItem
sIScope
, cannot benull
scopeProvider
- actualIScopeProvider
for getting platform and configuration objects for comment content, cannot benull
qualifiedNameConverter
- actualIQualifiedNameConverter
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
for read comment content, cannot benull
oldFormatComment
-true
if comment in old format,false
in new format- Returns:
- collection of
TypeItem
s described in comment, nevernull
-
-
getCommentAfterObject
public static List<String> getCommentAfterObject(org.eclipse.emf.ecore.EObject expressionBeforeComment, org.eclipse.xtext.nodemodel.INode blockNode, boolean oldFormatComment)
Provides theList
of inlined comments for semantic element.- Parameters:
expressionBeforeComment
- the element for which the inlined comment is being taken, cannot benull
blockNode
- the parent node for element, cannot benull
oldFormatComment
-true
if comment in old format,false
in new format- Returns:
- the
List
of inlined comments, can benull
-
-