use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Omit_Value method checkEquality.
@Override
public /**
* {@inheritDoc}
*/
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = other.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
return getValuetype().equals(last.getValuetype());
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Real_Value method checkEquality.
@Override
public /**
* {@inheritDoc}
*/
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = other.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
return Value_type.REAL_VALUE.equals(last.getValuetype()) && Double.compare(value, ((Real_Value) last).getValue()) == 0;
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Value method canGenerateSingleExpression.
@Override
public /**
* {@inheritDoc}
*/
boolean canGenerateSingleExpression() {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
referenceChain.release();
if (last != this && last.canGenerateSingleExpression() && last.getMyScope().getModuleScope() == myScope.getModuleScope()) {
return true;
}
return reference.hasSingleExpression();
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Value method generateCodeInit.
@Override
public /**
* {@inheritDoc}
*/
StringBuilder generateCodeInit(final JavaGenData aData, final StringBuilder source, final String name) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
referenceChain.release();
if (last == this) {
final ExpressionStruct expression = new ExpressionStruct();
expression.expression.append(name);
expression.expression.append(".assign(");
reference.generateConstRef(aData, expression);
expression.expression.append(")");
expression.mergeExpression(source);
return source;
}
// the code generation is based on the referred value
if (last.canGenerateSingleExpression() && myScope.getModuleScope() == last.getMyScope().getModuleScope()) {
// simple substitution for in-line values within the same module
source.append(MessageFormat.format("{0}.assign({1});\n", name, last.generateSingleExpression(aData)));
} else {
// TODO might need initialization see needs_init_precede
// TODO Value.cc:generate_code_init_refd
source.append(MessageFormat.format("{0}.assign({1});\n", name, last.getGenNameOwn(myScope)));
}
return source;
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Referenced_Value method returnsNative.
// FIXME comment
public boolean returnsNative() {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), referenceChain);
referenceChain.release();
if (last != null && last != this) {
return last.returnsNative();
}
return false;
}
Aggregations