Example usage for org.eclipse.jdt.internal.compiler.ast FieldDeclaration generateCode

List of usage examples for org.eclipse.jdt.internal.compiler.ast FieldDeclaration generateCode

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast FieldDeclaration generateCode.

Prototype

@Override
public void generateCode(BlockScope currentScope, CodeStream codeStream) 

Source Link

Document

Code generation for a field declaration: standard assignment to a field

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.RoleInitializationMethod.java

License:Open Source License

/**
 * During generateCode this is invoked right before generating the return opcode.
 *///from w w w. j  av  a  2  s .c om
protected void endOfMethodHook(ClassFile classfile) {
    // basically taken from ConstructorDeclaration.internalGenerateCode
    TypeDeclaration declaringType = this.scope.classScope().referenceContext;
    // generate user field initialization
    if (declaringType.fields != null) {
        for (int i = 0, max = declaringType.fields.length; i < max; i++) {
            FieldDeclaration fieldDecl;
            if (!(fieldDecl = declaringType.fields[i]).isStatic()) {
                fieldDecl.generateCode(this.scope, classfile.codeStream);
            }
        }
    }
}