Package gnu.expr
Class ClassExp
- All Implemented Interfaces:
gnu.kawa.format.Printable
,Named
,SourceLocator
,SourceLocator
,Locator
- Direct Known Subclasses:
ObjectExp
-
Nested Class Summary
Nested classes/interfaces inherited from class gnu.expr.LambdaExp
LambdaExp.Closure
Nested classes/interfaces inherited from interface gnu.text.SourceLocator
SourceLocator.Simple
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
An artificial method named"$clinit$"
for evaluating static initializations.static final int
An artificial method named"$finit$"
for evaluating non-static initializations.static final int
static final int
static final int
True if the resulting class(es) are *not* member/inner classes.int
Index in supers array of class we extend, or -1.List of base classes and implemented interfaces.Fields inherited from class gnu.expr.LambdaExp
ALLOW_OTHER_KEYWORDS, applyToConsumer, ATTEMPT_INLINE, body, CLOSURE_ENV_NAME, closureEnvField, firstChild, HAS_NONTRIVIAL_DEFAULT, HAS_NONTRIVIAL_PATTERN, IN_EXPWALKER, inlineHome, keywords, max_args, min_args, nameDecl, NEXT_AVAIL_FLAG, nextSibling, NO_FIELD, opt_args, OVERLOADABLE_FIELD, PASSES_TAILCALLS, PUBLIC_METHOD, returnContinuation, returnType, SEQUENCE_RESULT, staticLinkField
Fields inherited from class gnu.expr.Expression
applyMethodExpression, flags, noExpressions, type, VALIDATED
Fields inherited from class gnu.mapping.Procedure
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
Fields inherited from class gnu.mapping.PropertySet
nameKey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Type
The ClassType generated for this class.void
compile
(Compilation comp, Target target) compileMembers
(Compilation comp) void
compilePushClass
(Compilation comp, Target target) compileSetField
(Compilation comp) void
createFields
(Compilation comp) Create a Field in the instanceClass for each declared field.void
declareParts
(Compilation comp) protected Method
findMethodForBridge
(String mname, Type[] ptypes, Type rtype) Finds a like-named method suitable for bridging the given arg/return types (i.e.final void
generateBridgeMethod
(Compilation comp, Method src_method, Type[] bridge_arg_types, Type bridge_return_type) Given an existing method and a desired bridge method signature, generates an appropriate bridge method.getClassName
(Compilation comp) The ClassType generated for this class.protected ClassType
Return the ClassType of the Procedure this is being compiled into.final boolean
boolean
True if we should make a pair of an interface and a class.boolean
isSimple()
protected boolean
void
print
(gnu.kawa.io.OutPort out) void
setClassType
(ClassType type) void
setTypes
(Compilation comp) static String
slotToMethodName
(String prefix, String sname) Mangle a "slot" name to a get- or set- method name.protected <R,
D> R visit
(ExpVisitor<R, D> visitor, D d) protected <R,
D> void visitChildren
(ExpVisitor<R, D> visitor, D d) Methods inherited from class gnu.expr.LambdaExp
addParameter, allocChildClasses, allocFrame, apply, capture, checkForInitCall, compileBody, compileEnd, declareClosureEnv, declareThis, generateApplyMethods, getBodyFirstExpression, getCallConvention, getCaller, getCanRead, getExpClassName, getHeapFrameType, getImportsLexVars, getInlineOnly, getMainMethod, getMethod, getNeedsClosureEnv, getNeedsStaticLink, getOwningLambda, getProperty, getReturnType, incomingArgs, inlinedInCallerOrCheckMethodOnly, inlinedInCheckMethod, isClassMethod, isHandlingTailCalls, isModuleBody, isNative, loadHeapFrame, maybeSetReturnType, outerLambda, outerLambdaNotInline, outerLambdaOrCaller, pushChild, restArgType, reverseChildList, setCallConvention, setCanRead, setClassMethod, setCoercedReturnType, setCoercedReturnValue, setExceptions, setImportsLexVars, setImportsLexVars, setInlineOnly, setInlineOnly, setNeedsStaticLink, setNeedsStaticLink, setProperty, setReturnType, setType, side_effects, toString, usingCallContext, validateApply, variable_args, visitChildrenOnly, visitProperties
Methods inherited from class gnu.expr.ScopeExp
add, add, addDeclaration, addDeclaration, addDeclaration, clearCallList, countDecls, currentLambda, currentModule, duplicateDeclarationError, firstDecl, getDefine, getNoDefine, getOuter, getVarScope, isClassGenerated, lastDecl, lookup, lookup, nestedIn, nesting, popScope, remove, remove, replaceFollowing, setIndexes, setOuter, topLevel
Methods inherited from class gnu.expr.Expression
applyMethodExpression, checkLiteralKeyword, compile, compile, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getEndColumn, getEndLine, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getStartColumn, getStartLine, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, maybeSetLine, neverReturns, numArgs, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLine, setLocation, setType, valueIfConstant
Methods inherited from class gnu.mapping.Procedure
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
Methods inherited from class gnu.mapping.PropertySet
getName, getSymbol, removeProperty, setName, setProperty, setSymbol
-
Field Details
-
IS_ABSTRACT
public static final int IS_ABSTRACT- See Also:
-
INTERFACE_SPECIFIED
public static final int INTERFACE_SPECIFIED- See Also:
-
CLASS_SPECIFIED
public static final int CLASS_SPECIFIED- See Also:
-
HAS_SUBCLASS
public static final int HAS_SUBCLASS- See Also:
-
IS_PACKAGE_MEMBER
public static final int IS_PACKAGE_MEMBERTrue if the resulting class(es) are *not* member/inner classes.- See Also:
-
classNameSpecifier
-
supers
List of base classes and implemented interfaces. -
superClassIndex
public int superClassIndexIndex in supers array of class we extend, or -1. -
initMethod
An artificial method named"$finit$"
for evaluating non-static initializations. All constructors need to call this. -
clinitMethod
An artificial method named"$clinit$"
for evaluating static initializations.
-
-
Constructor Details
-
ClassExp
-
-
Method Details
-
isSimple
public boolean isSimple() -
isAbstract
public final boolean isAbstract()- Overrides:
isAbstract
in classLambdaExp
-
isMakingClassPair
public boolean isMakingClassPair()True if we should make a pair of an interface and a class. -
calculateType
The ClassType generated for this class. Note difference fromgetClassType
: The value of aClassExp
(viewed as an expression) is a class/type object, sogetType
returns the type of a type.- Overrides:
calculateType
in classLambdaExp
-
getClassType
The ClassType generated for this class.- Overrides:
getClassType
in classLambdaExp
-
setClassType
-
mustCompile
protected boolean mustCompile()- Overrides:
mustCompile
in classLambdaExp
-
compile
-
compilePushClass
-
getCompiledClassType
Description copied from class:LambdaExp
Return the ClassType of the Procedure this is being compiled into.- Overrides:
getCompiledClassType
in classLambdaExp
-
createFields
Create a Field in the instanceClass for each declared field. This allows name SlotGet.lookupMember (used in Translator.rewrite when looking for a binding for a symbol) to return a match. Note that if we later (in setTypes) create a pair-type, then the field will be replaced by a getter/setter pair. Later yet (in declareParts): We set the types of the Field or getter/setter pair. We should create tentative Methods for methods in the same manner, but that is is a project for another day. -
setTypes
-
getClassName
-
declareParts
-
compileMembers
-
findMethodForBridge
Finds a like-named method suitable for bridging the given arg/return types (i.e. a method whose arg types and return types are subclasses of those given here. -
generateBridgeMethod
public final void generateBridgeMethod(Compilation comp, Method src_method, Type[] bridge_arg_types, Type bridge_return_type) Given an existing method and a desired bridge method signature, generates an appropriate bridge method. -
visit
-
visitChildren
- Overrides:
visitChildren
in classLambdaExp
-
print
public void print(gnu.kawa.io.OutPort out) -
compileSetField
- Overrides:
compileSetField
in classLambdaExp
-
slotToMethodName
Mangle a "slot" name to a get- or set- method name.- Parameters:
prefix
- either "get" or "set" or "add"sname
- a "slot" (property) name. This is mangled if needed.
-
addMethod
-