Class StaticExpressionValueComputer
java.lang.Object
com._1c.g5.v8.dt.internal.bsl.resource.StaticExpressionValueComputer
- All Implemented Interfaces:
IStaticExpressionValueComputer
The computer allow to get various types of string static content from code.
This computer supports only simple binary operations and variable assignments, so it returns only single
and statically computed string content.
In case of cycles or some variable computing logic of string concatenation this computer should brake
and return
null
.-
Constructor Summary
ConstructorsConstructorDescriptionStaticExpressionValueComputer
(TypesComputer typesComputer) Instantiates a new static expression value computer. -
Method Summary
Modifier and TypeMethodDescriptionGets the all statements in current scope: method or module statements.protected List<IStringLiteralTextProvider>
Gets the list of string content for operator style creator of array.protected List<IStringLiteralTextProvider>
Gets the list of string content for static feature accessgetArrayOfStrings
(org.eclipse.emf.ecore.EObject expression) Gets the list of string content for the expression that isArray
in 1C code with adding strings to the array.protected BooleanLiteral
getBooleanContent
(Function function) Gets the boolean content for the function return value.protected BooleanLiteral
Gets the boolean content of the invocation function.protected BooleanLiteral
Gets the boolean content for the static feature access by last variable simple statement.getBooleanContent
(org.eclipse.emf.ecore.EObject expression) Gets the boolean literal from the code.protected org.eclipse.xtext.util.Pair<Double,
Collection<NumberLiteral>> Gets the number content and it's source number literals for the binary expression: PLUS, MINUS, MULITPLY, DIVIDE and MODULOprotected org.eclipse.xtext.util.Pair<Double,
Collection<NumberLiteral>> getNumberContent
(Function function) Gets the number content and source literals for the local function.protected org.eclipse.xtext.util.Pair<Double,
Collection<NumberLiteral>> Gets the number content and source literals for the local invocation of the function.protected org.eclipse.xtext.util.Pair<Double,
Collection<NumberLiteral>> Gets the number content and it's source number literals for the static feature access.org.eclipse.xtext.util.Pair<Double,
Collection<NumberLiteral>> getNumberContent
(org.eclipse.emf.ecore.EObject expression) Gets the number content from the code.getStringContent
(org.eclipse.emf.ecore.EObject expression) Gets the static string content of the expression.protected IStringLiteralTextProvider
Gets the computed string content for binary expression.protected IStringLiteralTextProvider
getStringExpressionContent
(Function function) Gets the string expression content by the function return value if content is static.protected IStringLiteralTextProvider
Gets the string expression content.protected IStringLiteralTextProvider
Gets the expression string content for static feature access.protected Map<String,
org.eclipse.xtext.util.Pair<IStringLiteralTextProvider, IStringLiteralTextProvider>> Gets the structure expression string content for operator style creator of new structure.protected Map<String,
org.eclipse.xtext.util.Pair<IStringLiteralTextProvider, IStringLiteralTextProvider>> Gets the structure expression string content for static feature access of the structure.Map<String,
org.eclipse.xtext.util.Pair<IStringLiteralTextProvider, IStringLiteralTextProvider>> getStructureOfStrings
(org.eclipse.emf.ecore.EObject expression) Gets the 1C structure (akaMap<String, String>
) with string content in keys and values for the given expression.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com._1c.g5.v8.dt.bsl.common.IStaticExpressionValueComputer
getStructureOfStringsContent
-
Constructor Details
-
StaticExpressionValueComputer
Instantiates a new static expression value computer.- Parameters:
typesComputer
- the types computer, cannot benull
.
-
-
Method Details
-
getStringContent
Description copied from interface:IStaticExpressionValueComputer
Gets the static string content of the expression.- Specified by:
getStringContent
in interfaceIStaticExpressionValueComputer
- Parameters:
expression
- the expression, may benull
.- Returns:
- the expression string content and its source string literals, can return
null
Returnsnull
if the expression isnull
or computing logic of content is not static (variable result), untyped code and etc.
-
getStructureOfStrings
public Map<String,org.eclipse.xtext.util.Pair<IStringLiteralTextProvider, getStructureOfStringsIStringLiteralTextProvider>> (org.eclipse.emf.ecore.EObject expression) Description copied from interface:IStaticExpressionValueComputer
Gets the 1C structure (akaMap<String, String>
) with string content in keys and values for the given expression. This method computes all insertion of to the structure in current method.- Specified by:
getStructureOfStrings
in interfaceIStaticExpressionValueComputer
- Parameters:
expression
- the expression, may benull
.- Returns:
- the structure expression string content, where map entry key is structure key and map entry value is
a pair of key string literal text provider and 1C structure value string literal text provider,
which may be
null
. Cannot returnnull
.
-
getArrayOfStrings
Description copied from interface:IStaticExpressionValueComputer
Gets the list of string content for the expression that isArray
in 1C code with adding strings to the array.- Specified by:
getArrayOfStrings
in interfaceIStaticExpressionValueComputer
- Parameters:
expression
- the expression, may benull
.- Returns:
- the list of string content, cannot return
null
.
-
getBooleanContent
Description copied from interface:IStaticExpressionValueComputer
Gets the boolean literal from the code.- Specified by:
getBooleanContent
in interfaceIStaticExpressionValueComputer
- Parameters:
expression
- the expression, may benull
.- Returns:
- the boolean literal or returns
null
if cannot be computed due different reasons, including dynamic or variable result, untyped code and etc.
-
getNumberContent
public org.eclipse.xtext.util.Pair<Double,Collection<NumberLiteral>> getNumberContent(org.eclipse.emf.ecore.EObject expression) Description copied from interface:IStaticExpressionValueComputer
Gets the number content from the code.- Specified by:
getNumberContent
in interfaceIStaticExpressionValueComputer
- Parameters:
expression
- the expression, may benull
.- Returns:
- the resulting number of all arithmetical operations of each
NumberLiteral
from the code and all number literals computing this value, or returnsnull
if static value cannot be computed due different resons including dynamic or variable result, untyped code and etc.
-
getStringExpressionContent
Gets the expression string content for static feature access.- Parameters:
fa
- the static feature access, cannot benull
.- Returns:
- the expression string content provider, can return
null
.
-
getStringExpressionContent
Gets the computed string content for binary expression.- Parameters:
bo
- the binary expression, cannot benull
.- Returns:
- the expression string content and source string literals, can return
null
.
-
getStringExpressionContent
Gets the string expression content.- Parameters:
inv
- the invocation, may benull
.- Returns:
- the string expression content and source string literals, can return
null
.
-
getStringExpressionContent
Gets the string expression content by the function return value if content is static.- Parameters:
function
- the function, may benull
.- Returns:
- the string expression content and source string literals, can return
null
.
-
getStructureExpressionContent
protected Map<String,org.eclipse.xtext.util.Pair<IStringLiteralTextProvider, getStructureExpressionContentIStringLiteralTextProvider>> (OperatorStyleCreator osc) Gets the structure expression string content for operator style creator of new structure.- Parameters:
osc
- the operator style creator of new structure, cannot benull
.- Returns:
- the structure expression string content, where map entry key is structure key and map entry value is
triple of string literal of the structure key, structure string value for this key and string literal of the
structure value, cannot return
null
.
-
getStructureExpressionContent
protected Map<String,org.eclipse.xtext.util.Pair<IStringLiteralTextProvider, getStructureExpressionContentIStringLiteralTextProvider>> (StaticFeatureAccess fa) Gets the structure expression string content for static feature access of the structure.- Parameters:
fa
- the static feature access, cannot benull
.- Returns:
- the structure expression string content, where map entry key is structure key and map entry value is
triple of string literal of the structure key, structure string value for this key and string literal of the
structure value, cannot return
null
.
-
getArrayExpressionContent
Gets the list of string content for operator style creator of array.- Parameters:
osc
- the operator style creator of array, cannot benull
.- Returns:
- the list of string content, cannot return
null
.
-
getArrayExpressionContent
Gets the list of string content for static feature access- Parameters:
fa
- the static feature access, cannot benull
.- Returns:
- the list of string content providers, cannot return
null
.
-
getAllStatementsBefore
Gets the all statements in current scope: method or module statements. All statements should be before theStaticFeatureAccess
.- Parameters:
fa
- the static feature access, cannot benull
.- Returns:
- the all statements, cannot return
null
.
-
getBooleanContent
Gets the boolean content for the static feature access by last variable simple statement.- Parameters:
fa
- the static feature access, cannot benull
.- Returns:
- the boolean content, can return
null
if cannot compute boolean.
-
getBooleanContent
Gets the boolean content of the invocation function.- Parameters:
inv
- the invocation, cannot benull
.- Returns:
- the boolean content, can return
null
if cannot compute boolean.
-
getBooleanContent
Gets the boolean content for the function return value.- Parameters:
function
- the function, cannot benull
.- Returns:
- the boolean content, can return
null
if cannot compute boolean.
-
getNumberContent
protected org.eclipse.xtext.util.Pair<Double,Collection<NumberLiteral>> getNumberContent(StaticFeatureAccess fa) Gets the number content and it's source number literals for the static feature access.- Parameters:
fa
- the static feature access, cannot benull
.- Returns:
- the number content and collection of source literals, may return
null
if cannot compute the value.
-
getNumberContent
protected org.eclipse.xtext.util.Pair<Double,Collection<NumberLiteral>> getNumberContent(BinaryExpression bo) Gets the number content and it's source number literals for the binary expression: PLUS, MINUS, MULITPLY, DIVIDE and MODULO- Parameters:
bo
- the binary expression, cannot benull
.- Returns:
- the number content and collection of source literals, may return
null
if cannot be computed.
-
getNumberContent
protected org.eclipse.xtext.util.Pair<Double,Collection<NumberLiteral>> getNumberContent(Invocation inv) Gets the number content and source literals for the local invocation of the function.- Parameters:
inv
- the invocation, may not benull
.- Returns:
- the number content and collection of source literals, may return
null
if cannot be computed.
-
getNumberContent
protected org.eclipse.xtext.util.Pair<Double,Collection<NumberLiteral>> getNumberContent(Function function) Gets the number content and source literals for the local function.- Parameters:
function
- the function, may not benull
.- Returns:
- the number content and collection of source literals, may return
null
if cannot be computed.
-