Skip to content
Snippets Groups Projects
Commit aa98a969 authored by balaskoa's avatar balaskoa
Browse files

Merge github.com:eclipse/titan.EclipsePlug-ins

parents 48a3eee1 117b88cd
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,8 @@ import org.eclipse.titan.designer.preferences.PreferenceConstants;
* The Def_Template class represents TTCN3 template definitions.
*
* @author Kristof Szabados
* */
* @author Arpad Lovassy
*/
public final class Def_Template extends Definition implements IParameterisedAssignment {
private static final String FULLNAMEPART1 = ".<type>";
private static final String FULLNAMEPART2 = ".<formal_parameter_list>";
......@@ -114,15 +115,28 @@ public final class Def_Template extends Definition implements IParameterisedAssi
*/
private CompilationTimeStamp recursiveDerivationChecked;
private NamedBridgeScope bridgeScope = null;
public Def_Template(final TemplateRestriction.Restriction_type templateRestriction, final Identifier identifier, final Type type,
final FormalParameterList formalParList, final Reference derivedReference, final TTCN3Template body) {
/**
* true, if and only if @lazy modifier is used before the definition
* NOTE: currently there is no restriction of using @lazy modifier here,
* so no check is needed
*/
private boolean mIsLazy;
public Def_Template( final TemplateRestriction.Restriction_type templateRestriction,
final Identifier identifier,
final Type type,
final FormalParameterList formalParList,
final Reference derivedReference,
final TTCN3Template body,
final boolean aIsLazy ) {
super(identifier);
this.templateRestriction = templateRestriction;
this.type = type;
this.formalParList = formalParList;
this.derivedReference = derivedReference;
this.body = body;
mIsLazy = aIsLazy;
if (type != null) {
type.setFullNameParent(this);
......@@ -824,4 +838,11 @@ public final class Def_Template extends Definition implements IParameterisedAssi
}
return true;
}
/**
* @return true, if and only if @lazy modifier is used before the definition
*/
public boolean isLazy() {
return mIsLazy;
}
}
......@@ -47,7 +47,8 @@ import org.eclipse.titan.designer.productUtilities.ProductConstants;
* The Def_Var class represents TTCN3 variable definitions.
*
* @author Kristof Szabados
* */
* @author Arpad Lovassy
*/
public final class Def_Var extends Definition {
private static final String FULLNAMEPART1 = ".<type>";
private static final String FULLNAMEPART2 = ".<initial_value>";
......@@ -61,10 +62,18 @@ public final class Def_Var extends Definition {
private boolean wasAssigned;
public Def_Var(final Identifier identifier, final Type type, final Value initialValue) {
/**
* true, if and only if @lazy modifier is used before the definition
* NOTE: currently there is no restriction of using @lazy modifier here,
* so no check is needed
*/
private boolean mIsLazy;
public Def_Var( final Identifier identifier, final Type type, final Value initialValue, final boolean aIsLazy ) {
super(identifier);
this.type = type;
this.initialValue = initialValue;
mIsLazy = aIsLazy;
if (type != null) {
type.setFullNameParent(this);
......@@ -419,4 +428,11 @@ public final class Def_Var extends Definition {
public boolean getWritten() {
return wasAssigned;
}
/**
* @return true, if and only if @lazy modifier is used before the definition
*/
public boolean isLazy() {
return mIsLazy;
}
}
......@@ -28,7 +28,8 @@ import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
* The Statement class represents a try-catch statement.
*
* @author Kristof Szabados
* */
* @author Arpad Lovassy
*/
public class TryCatch_Statement extends Statement {
private static final String FULLNAMEPART1 = ".try";
......@@ -53,7 +54,7 @@ public class TryCatch_Statement extends Statement {
catchSurroundingBlock.setLocation(exceptionIdentifier.getLocation());
final Type strType = new CharString_Type();
strType.setLocation(exceptionIdentifier.getLocation());
final Def_Var strDefinition = new Def_Var(exceptionIdentifier,strType,null);
final Def_Var strDefinition = new Def_Var( exceptionIdentifier, strType, null, false );
strDefinition.setLocation(exceptionIdentifier.getLocation());
final Statement strStatement = new Definition_Statement(strDefinition);
strStatement.setLocation(exceptionIdentifier.getLocation());
......
......@@ -1850,7 +1850,6 @@ pr_TemplateDef returns[Def_Template def_template]
Template_definition_helper helper = new Template_definition_helper();
Reference derivedReference = null;
TemplateBody body = null;
//TODO: handle lazy
boolean isLazy = false;
}:
( col = pr_TemplateKeyword
......@@ -1863,7 +1862,8 @@ pr_TemplateDef returns[Def_Template def_template]
)
{
if(helper.identifier != null && helper.type != null && $b.body != null) {
$def_template = new Def_Template(templateRestriction, helper.identifier, helper.type, helper.formalParList, derivedReference, $b.body.getTemplate());
$def_template = new Def_Template( templateRestriction, helper.identifier, helper.type, helper.formalParList,
derivedReference, $b.body.getTemplate(), isLazy );
$def_template.setLocation(getLocation( $col.start, $b.stop));
$def_template.setCommentLocation(lexer.getLastCommentLocation());
}
......@@ -4145,7 +4145,6 @@ pr_VarInstance returns[List<Definition> definitions]
$definitions = new ArrayList<Definition>();
List<Identifier> identifiers = null;
TemplateRestriction.Restriction_type templateRestriction = TemplateRestriction.Restriction_type.TR_NONE;
//TODO: handle lazy
boolean isLazy = false;
}:
( col = pr_VarKeyword
......@@ -4156,7 +4155,7 @@ pr_VarInstance returns[List<Definition> definitions]
|
( lf = pr_LazyOrFuzzyModifier { isLazy = $lf.isLazy; } )?
t2 = pr_Type
pr_VarList[ $definitions, $t2.type ]
pr_VarList[ $definitions, $t2.type, isLazy ]
)
)
{
......@@ -4207,14 +4206,14 @@ pr_SingleTempVarInstance [List<Definition> definitions, Type type, TemplateRestr
};
pr_VarList[List<Definition> definitions, Type type]:
( d = pr_SingleVarInstance[type] { if($d.definition != null) { $definitions.add($d.definition); } }
pr_VarList[List<Definition> definitions, Type type, boolean isLazy]:
( d = pr_SingleVarInstance[type, isLazy] { if($d.definition != null) { $definitions.add($d.definition); } }
( pr_Comma
d = pr_SingleVarInstance[type] { if($d.definition != null) { $definitions.add($d.definition); } }
d = pr_SingleVarInstance[type, isLazy] { if($d.definition != null) { $definitions.add($d.definition); } }
)*
);
pr_SingleVarInstance[Type type] returns[Def_Var definition]
pr_SingleVarInstance[Type type, boolean isLazy] returns[Def_Var definition]
@init {
$definition = null;
Value value = null;
......@@ -4235,7 +4234,7 @@ pr_SingleVarInstance[Type type] returns[Def_Var definition]
type2.setLocation(getLocation( $d.start, $d.stop));
}
}
$definition = new Def_Var($i.identifier, type2, value);
$definition = new Def_Var( $i.identifier, type2, value, $isLazy );
$definition.setLocation(getLocation( $start, getStopToken()));
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment