Commit c5142ab0 authored by Miklos Magyari's avatar Miklos Magyari

OOP: minimal Class_Type implementation to support basic instantiation

Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent dac59fbf
......@@ -135,8 +135,9 @@ type class SubClass4 extends SuperBaseClass {
}
}
// basic instantiation
testcase tc_basicSyntax() runs on CT {
// var MinimalClass v_minimalClass := MinimalClass.create;
var MinimalClass vl_minimalClass := MinimalClass.create;
}
control {
......
......@@ -99,6 +99,8 @@ public interface IType extends IGovernor, IIdentifierContainer, IVisitableNode,
TYPE_COMPONENT,
/** port (TTCN-3). */
TYPE_PORT,
/** class (TTCN-3 extension) */
TYPE_CLASS,
/** anytype (TTCN-3). */
TYPE_ANYTYPE,
......
/******************************************************************************
* Copyright (c) 2000-2021 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
******************************************************************************/
/**
* class type (TTCN-3 extension)
*
* @author Miklos Magyari
*/
package org.eclipse.titan.designer.AST.TTCN3.types;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.IType;
import org.eclipse.titan.designer.AST.ITypeWithComponents;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Reference;
import org.eclipse.titan.designer.AST.Type;
import org.eclipse.titan.designer.AST.TypeCompatibilityInfo;
import org.eclipse.titan.designer.AST.TypeCompatibilityInfo.Chain;
import org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type;
import org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
public final class Class_Type extends Type implements ITypeWithComponents {
private final Identifier identifier;
public Class_Type(final Identifier identifier) {
this.identifier = identifier;
}
@Override
public Type_type getTypetype() {
return Type_type.TYPE_CLASS;
}
@Override
/** {@inheritDoc} */
public Type_type getTypetypeTtcn3() {
if (isErroneous) {
return Type_type.TYPE_UNDEFINED;
}
return getTypetype();
}
@Override
public String getOutlineIcon() {
// TODO Auto-generated method stub
return null;
}
@Override
public Identifier getComponentIdentifierByName(Identifier identifier) {
// TODO Auto-generated method stub
return null;
}
@Override
public IType getFieldType(CompilationTimeStamp timestamp, Reference reference, int actualSubReference,
Expected_Value_type expectedIndex, IReferenceChain refChain, boolean interruptIfOptional) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean checkThisTemplate(CompilationTimeStamp timestamp, ITTCN3Template template, boolean isModified,
boolean implicitOmit, Assignment lhs) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isCompatible(CompilationTimeStamp timestamp, IType otherType, TypeCompatibilityInfo info,
Chain leftChain, Chain rightChain) {
// TODO Auto-generated method stub
return false;
}
@Override
public String getTypename() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean generatesOwnClass(JavaGenData aData, StringBuilder source) {
// TODO Auto-generated method stub
return false;
}
@Override
public void generateCode(JavaGenData aData, StringBuilder source) {
// TODO Auto-generated method stub
}
@Override
public String getGenNameValue(JavaGenData aData, StringBuilder source) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getGenNameTemplate(JavaGenData aData, StringBuilder source) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getGenNameTypeDescriptor(JavaGenData aData, StringBuilder source) {
// TODO Auto-generated method stub
return null;
}
}
\ No newline at end of file
......@@ -715,7 +715,7 @@ pr_StructuredTypeDef returns[Def_Type def_type]
| t9 = pr_FunctionTypeDef { $def_type = $t9.def_type; }
| t10 = pr_AltstepTypeDef { $def_type = $t10.def_type; }
| t11 = pr_TestcaseTypeDef { $def_type = $t11.def_type; }
| t12 = pr_ClassTypeDef { }
| t12 = pr_ClassTypeDef { $def_type = $t12.def_type; }
);
pr_RecordDef returns[Def_Type def_type]
......@@ -8945,8 +8945,9 @@ pr_KeywordLessGlobalModuleId returns [Reference reference]
)
);
pr_ClassTypeDef
pr_ClassTypeDef returns[Def_Type def_type]
@init {
$def_type = null;
Configuration_Helper runsonHelper = new Configuration_Helper();
Configuration_Helper mtcHelper = new Configuration_Helper();
Configuration_Helper systemspecHelper = new Configuration_Helper();
......@@ -8964,7 +8965,13 @@ pr_ClassTypeDef
pr_EndChar
fd = pr_FinallyDef
)
;
{
if ($i.identifier != null) {
Type type = new Class_Type($i.identifier);
type.setLocation(getLocation($start, getLastVisibleToken()));
$def_type = new Def_Type($i.identifier, type);
}
};
pr_ClassKeyword:
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment