From 812b6ca69730ab8bfcff19b13dcd6f866c849b76 Mon Sep 17 00:00:00 2001
From: axelcl
Date: Mon, 3 Oct 2005 11:37:07 +0000
Subject: [PATCH 1/1] Refactored packagename to net.sourceforge.phpdt.internal.compiler.ast
---
.../phpdt/core/dom/CompilationUnit.java | 193 ++--
.../phpdt/internal/compiler/ASTVisitor.java | 128 +-
.../compiler/AbstractSyntaxTreeVisitorAdapter.java | 136 +-
.../phpdt/internal/compiler/Compiler.java | 4 +-
.../internal/compiler/DocumentElementParser.java | 2 +-
.../compiler/IAbstractSyntaxTreeVisitor.java | 136 +-
.../internal/compiler/SourceElementParser.java | 28 +-
.../internal/compiler/ast/AND_AND_Expression.java | 309 ++++
.../phpdt/internal/compiler/ast/ASTNode.java | 315 ++++
.../compiler/ast/AbstractMethodDeclaration.java | 442 +++++
.../compiler/ast/AbstractVariableDeclaration.java | 61 +
.../compiler/ast/AllocationExpression.java | 302 ++++
.../ast/AnonymousLocalTypeDeclaration.java | 177 ++
.../phpdt/internal/compiler/ast/Argument.java | 96 ++
.../compiler/ast/ArrayAllocationExpression.java | 201 +++
.../internal/compiler/ast/ArrayInitializer.java | 218 +++
.../compiler/ast/ArrayQualifiedTypeReference.java | 57 +
.../internal/compiler/ast/ArrayReference.java | 200 +++
.../internal/compiler/ast/ArrayTypeReference.java | 57 +
.../internal/compiler/ast/AssertStatement.java | 194 +++
.../phpdt/internal/compiler/ast/Assignment.java | 177 ++
.../internal/compiler/ast/BinaryExpression.java | 1754 ++++++++++++++++++++
.../phpdt/internal/compiler/ast/Block.java | 179 ++
.../internal/compiler/ast/BranchStatement.java | 72 +
.../internal/compiler/ast/BreakStatement.java | 103 ++
.../phpdt/internal/compiler/ast/CaseStatement.java | 111 ++
.../internal/compiler/ast/CastExpression.java | 313 ++++
.../phpdt/internal/compiler/ast/Clinit.java | 261 +++
.../compiler/ast/CompilationUnitDeclaration.java | 347 ++++
.../internal/compiler/ast/CompoundAssignment.java | 146 ++
.../compiler/ast/ConditionalExpression.java | 427 +++++
.../compiler/ast/ConstructorDeclaration.java | 447 +++++
.../internal/compiler/ast/ContinueStatement.java | 108 ++
.../phpdt/internal/compiler/ast/DefaultCase.java | 91 +
.../phpdt/internal/compiler/ast/DoStatement.java | 206 +++
.../phpdt/internal/compiler/ast/DoubleLiteral.java | 72 +
.../internal/compiler/ast/EmptyStatement.java | 47 +
.../internal/compiler/ast/EqualExpression.java | 560 +++++++
.../compiler/ast/ExplicitConstructorCall.java | 345 ++++
.../phpdt/internal/compiler/ast/Expression.java | 506 ++++++
.../compiler/ast/ExtendedStringLiteral.java | 83 +
.../phpdt/internal/compiler/ast/FalseLiteral.java | 67 +
.../internal/compiler/ast/FieldDeclaration.java | 235 +++
.../internal/compiler/ast/FieldReference.java | 557 +++++++
.../phpdt/internal/compiler/ast/FloatLiteral.java | 85 +
.../phpdt/internal/compiler/ast/ForStatement.java | 384 +++++
.../phpdt/internal/compiler/ast/IfStatement.java | 290 ++++
.../compiler/ast/ImplicitDocTypeReference.java | 66 +
.../internal/compiler/ast/ImportReference.java | 117 ++
.../phpdt/internal/compiler/ast/Initializer.java | 117 ++
.../compiler/ast/InnerTypeDeclaration.java | 20 +
.../compiler/ast/InstanceOfExpression.java | 258 +++
.../phpdt/internal/compiler/ast/IntLiteral.java | 150 ++
.../internal/compiler/ast/IntLiteralMinValue.java | 28 +
.../ast/JavadocArrayQualifiedTypeReference.java | 42 +
.../ast/JavadocArraySingleTypeReference.java | 40 +
.../ast/JavadocQualifiedTypeReference.java | 93 +
.../compiler/ast/JavadocReturnStatement.java | 51 +
.../compiler/ast/JavadocSingleTypeReference.java | 93 +
.../internal/compiler/ast/LabeledStatement.java | 139 ++
.../phpdt/internal/compiler/ast/Literal.java | 51 +
.../internal/compiler/ast/LocalDeclaration.java | 228 +++
.../compiler/ast/LocalTypeDeclaration.java | 67 +
.../phpdt/internal/compiler/ast/LongLiteral.java | 143 ++
.../internal/compiler/ast/LongLiteralMinValue.java | 28 +
.../phpdt/internal/compiler/ast/MagicLiteral.java | 31 +
.../compiler/ast/MemberTypeDeclaration.java | 66 +
.../phpdt/internal/compiler/ast/MessageSend.java | 312 ++++
.../internal/compiler/ast/MethodDeclaration.java | 158 ++
.../phpdt/internal/compiler/ast/NameReference.java | 69 +
.../phpdt/internal/compiler/ast/NullLiteral.java | 59 +
.../phpdt/internal/compiler/ast/NumberLiteral.java | 32 +
.../internal/compiler/ast/OR_OR_Expression.java | 305 ++++
.../internal/compiler/ast/OperatorExpression.java | 1571 ++++++++++++++++++
.../phpdt/internal/compiler/ast/OperatorIds.java | 43 +
.../internal/compiler/ast/PostfixExpression.java | 76 +
.../internal/compiler/ast/PrefixExpression.java | 60 +
.../ast/QualifiedAllocationExpression.java | 350 ++++
.../compiler/ast/QualifiedNameReference.java | 807 +++++++++
.../compiler/ast/QualifiedSuperReference.java | 64 +
.../compiler/ast/QualifiedThisReference.java | 118 ++
.../compiler/ast/QualifiedTypeReference.java | 73 +
.../phpdt/internal/compiler/ast/Reference.java | 71 +
.../internal/compiler/ast/ReturnStatement.java | 265 +++
.../internal/compiler/ast/SingleNameReference.java | 677 ++++++++
.../internal/compiler/ast/SingleTypeReference.java | 73 +
.../phpdt/internal/compiler/ast/Statement.java | 75 +
.../phpdt/internal/compiler/ast/StringLiteral.java | 147 ++
.../internal/compiler/ast/StringLiteralDQ.java | 65 +
.../internal/compiler/ast/StringLiteralSQ.java | 65 +
.../internal/compiler/ast/SuperReference.java | 58 +
.../internal/compiler/ast/SwitchStatement.java | 343 ++++
.../phpdt/internal/compiler/ast/ThisReference.java | 127 ++
.../internal/compiler/ast/ThrowStatement.java | 82 +
.../phpdt/internal/compiler/ast/TrueLiteral.java | 69 +
.../phpdt/internal/compiler/ast/TryStatement.java | 566 +++++++
.../internal/compiler/ast/TypeDeclaration.java | 1089 ++++++++++++
.../phpdt/internal/compiler/ast/TypeReference.java | 111 ++
.../internal/compiler/ast/UnaryExpression.java | 300 ++++
.../internal/compiler/ast/WhileStatement.java | 268 +++
.../flow/ExceptionHandlingFlowContext.java | 2 +-
.../internal/compiler/flow/FinallyFlowContext.java | 4 +-
.../phpdt/internal/compiler/flow/FlowContext.java | 8 +-
.../phpdt/internal/compiler/flow/FlowInfo.java | 2 +-
.../compiler/flow/InitializationFlowContext.java | 2 +-
.../compiler/flow/InsideSubRoutineFlowContext.java | 2 +-
.../internal/compiler/flow/LabelFlowContext.java | 2 +-
.../internal/compiler/flow/LoopingFlowContext.java | 4 +-
.../internal/compiler/flow/SwitchFlowContext.java | 2 +-
.../phpdt/internal/compiler/impl/Constant.java | 2 +-
.../compiler/lookup/BinaryTypeBinding.java | 2 +-
.../phpdt/internal/compiler/lookup/BlockScope.java | 6 +-
.../phpdt/internal/compiler/lookup/ClassScope.java | 10 +-
.../compiler/lookup/CompilationUnitScope.java | 6 +-
.../internal/compiler/lookup/FieldBinding.java | 2 +-
.../internal/compiler/lookup/ImportBinding.java | 2 +-
.../internal/compiler/lookup/LocalTypeBinding.java | 2 +-
.../compiler/lookup/LocalVariableBinding.java | 2 +-
.../compiler/lookup/LookupEnvironment.java | 2 +-
.../internal/compiler/lookup/MethodBinding.java | 4 +-
.../internal/compiler/lookup/MethodScope.java | 10 +-
.../internal/compiler/lookup/MethodVerifier.java | 4 +-
.../phpdt/internal/compiler/lookup/Scope.java | 8 +-
.../compiler/lookup/SourceTypeBinding.java | 16 +-
.../lookup/SyntheticAccessMethodBinding.java | 4 +-
.../phpdt/internal/compiler/parser/NLSLine.java | 2 +-
.../phpdt/internal/compiler/parser/Parser.java | 54 +-
.../internal/compiler/parser/RecoveredElement.java | 6 +-
.../phpdt/internal/compiler/parser/Scanner.java | 35 +-
.../compiler/parser/SourceTypeConverter.java | 28 +-
.../phpdt/internal/compiler/parser/UnitParser.java | 14 +-
.../internal/compiler/parser/VariableInfo.java | 2 +-
.../internal/compiler/problem/ProblemReporter.java | 80 +-
.../phpdt/internal/core/CompilationUnit.java | 2 +-
.../core/CompilationUnitProblemFinder.java | 2 +-
.../core/ReconcileWorkingCopyOperation.java | 2 +-
.../phpdt/internal/core/util/ASTNodeFinder.java | 12 +-
.../internal/core/util/CommentRecorderParser.java | 2 +-
.../sourceforge/phpdt/internal/core/util/Util.java | 2 +-
.../internal/compiler/ast/AND_AND_Expression.java | 309 ----
.../phpeclipse/internal/compiler/ast/ASTNode.java | 315 ----
.../compiler/ast/AbstractMethodDeclaration.java | 442 -----
.../compiler/ast/AbstractVariableDeclaration.java | 61 -
.../compiler/ast/AllocationExpression.java | 302 ----
.../ast/AnonymousLocalTypeDeclaration.java | 177 --
.../phpeclipse/internal/compiler/ast/Argument.java | 96 --
.../compiler/ast/ArrayAllocationExpression.java | 201 ---
.../internal/compiler/ast/ArrayInitializer.java | 218 ---
.../compiler/ast/ArrayQualifiedTypeReference.java | 57 -
.../internal/compiler/ast/ArrayReference.java | 200 ---
.../internal/compiler/ast/ArrayTypeReference.java | 57 -
.../internal/compiler/ast/AssertStatement.java | 194 ---
.../internal/compiler/ast/Assignment.java | 177 --
.../internal/compiler/ast/BinaryExpression.java | 1754 --------------------
.../phpeclipse/internal/compiler/ast/Block.java | 179 --
.../internal/compiler/ast/BranchStatement.java | 72 -
.../internal/compiler/ast/BreakStatement.java | 103 --
.../internal/compiler/ast/CaseStatement.java | 111 --
.../internal/compiler/ast/CastExpression.java | 313 ----
.../phpeclipse/internal/compiler/ast/Clinit.java | 261 ---
.../compiler/ast/CompilationUnitDeclaration.java | 347 ----
.../internal/compiler/ast/CompoundAssignment.java | 146 --
.../compiler/ast/ConditionalExpression.java | 427 -----
.../compiler/ast/ConstructorDeclaration.java | 447 -----
.../internal/compiler/ast/ContinueStatement.java | 108 --
.../internal/compiler/ast/DefaultCase.java | 91 -
.../internal/compiler/ast/DoStatement.java | 206 ---
.../internal/compiler/ast/DoubleLiteral.java | 72 -
.../internal/compiler/ast/EmptyStatement.java | 47 -
.../internal/compiler/ast/EqualExpression.java | 560 -------
.../compiler/ast/ExplicitConstructorCall.java | 345 ----
.../internal/compiler/ast/Expression.java | 506 ------
.../compiler/ast/ExtendedStringLiteral.java | 83 -
.../internal/compiler/ast/FalseLiteral.java | 67 -
.../internal/compiler/ast/FieldDeclaration.java | 235 ---
.../internal/compiler/ast/FieldReference.java | 557 -------
.../internal/compiler/ast/FloatLiteral.java | 85 -
.../internal/compiler/ast/ForStatement.java | 384 -----
.../internal/compiler/ast/IfStatement.java | 290 ----
.../compiler/ast/ImplicitDocTypeReference.java | 66 -
.../internal/compiler/ast/ImportReference.java | 117 --
.../internal/compiler/ast/Initializer.java | 117 --
.../compiler/ast/InnerTypeDeclaration.java | 20 -
.../compiler/ast/InstanceOfExpression.java | 258 ---
.../internal/compiler/ast/IntLiteral.java | 150 --
.../internal/compiler/ast/IntLiteralMinValue.java | 28 -
.../ast/JavadocArrayQualifiedTypeReference.java | 42 -
.../ast/JavadocArraySingleTypeReference.java | 40 -
.../ast/JavadocQualifiedTypeReference.java | 93 -
.../compiler/ast/JavadocReturnStatement.java | 51 -
.../compiler/ast/JavadocSingleTypeReference.java | 93 -
.../internal/compiler/ast/LabeledStatement.java | 139 --
.../phpeclipse/internal/compiler/ast/Literal.java | 51 -
.../internal/compiler/ast/LocalDeclaration.java | 228 ---
.../compiler/ast/LocalTypeDeclaration.java | 67 -
.../internal/compiler/ast/LongLiteral.java | 143 --
.../internal/compiler/ast/LongLiteralMinValue.java | 28 -
.../internal/compiler/ast/MagicLiteral.java | 31 -
.../compiler/ast/MemberTypeDeclaration.java | 66 -
.../internal/compiler/ast/MessageSend.java | 312 ----
.../internal/compiler/ast/MethodDeclaration.java | 158 --
.../internal/compiler/ast/NameReference.java | 69 -
.../internal/compiler/ast/NullLiteral.java | 59 -
.../internal/compiler/ast/NumberLiteral.java | 32 -
.../internal/compiler/ast/OR_OR_Expression.java | 305 ----
.../internal/compiler/ast/OperatorExpression.java | 1571 ------------------
.../internal/compiler/ast/OperatorIds.java | 43 -
.../internal/compiler/ast/PostfixExpression.java | 76 -
.../internal/compiler/ast/PrefixExpression.java | 60 -
.../ast/QualifiedAllocationExpression.java | 350 ----
.../compiler/ast/QualifiedNameReference.java | 807 ---------
.../compiler/ast/QualifiedSuperReference.java | 64 -
.../compiler/ast/QualifiedThisReference.java | 118 --
.../compiler/ast/QualifiedTypeReference.java | 73 -
.../internal/compiler/ast/Reference.java | 71 -
.../internal/compiler/ast/ReturnStatement.java | 265 ---
.../internal/compiler/ast/SingleNameReference.java | 677 --------
.../internal/compiler/ast/SingleTypeReference.java | 73 -
.../internal/compiler/ast/Statement.java | 75 -
.../internal/compiler/ast/StringLiteral.java | 147 --
.../internal/compiler/ast/StringLiteralDQ.java | 65 -
.../internal/compiler/ast/StringLiteralSQ.java | 65 -
.../internal/compiler/ast/SuperReference.java | 58 -
.../internal/compiler/ast/SwitchStatement.java | 343 ----
.../internal/compiler/ast/ThisReference.java | 127 --
.../internal/compiler/ast/ThrowStatement.java | 82 -
.../internal/compiler/ast/TrueLiteral.java | 69 -
.../internal/compiler/ast/TryStatement.java | 566 -------
.../internal/compiler/ast/TypeDeclaration.java | 1089 ------------
.../internal/compiler/ast/TypeReference.java | 111 --
.../internal/compiler/ast/UnaryExpression.java | 300 ----
.../internal/compiler/ast/WhileStatement.java | 268 ---
.../phpeditor/php/PHPCompletionProcessor.java | 417 +++---
233 files changed, 21658 insertions(+), 21695 deletions(-)
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstructorDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ContinueStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DefaultCase.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoubleLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EmptyStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EqualExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExplicitConstructorCall.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Expression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExtendedStringLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FloatLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImplicitDocTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImportReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Initializer.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InnerTypeDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InstanceOfExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteralMinValue.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArraySingleTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocReturnStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocSingleTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LabeledStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalTypeDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteralMinValue.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MagicLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MemberTypeDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MessageSend.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NameReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OR_OR_Expression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedAllocationExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedNameReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedSuperReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedThisReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Reference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ReturnStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleNameReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleTypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Statement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralDQ.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralSQ.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SuperReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThisReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TryStatement.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeDeclaration.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeReference.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/UnaryExpression.java
create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/WhileStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AND_AND_Expression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ASTNode.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractMethodDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractVariableDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AllocationExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Argument.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayAllocationExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayInitializer.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayQualifiedTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AssertStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Assignment.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BinaryExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Block.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BranchStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BreakStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CaseStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CastExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Clinit.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompilationUnitDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompoundAssignment.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConditionalExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConstructorDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ContinueStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DefaultCase.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoubleLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EmptyStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EqualExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExplicitConstructorCall.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Expression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExtendedStringLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FalseLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FloatLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ForStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IfStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImplicitDocTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImportReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Initializer.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InnerTypeDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InstanceOfExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteralMinValue.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArraySingleTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocQualifiedTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocReturnStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocSingleTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LabeledStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Literal.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalTypeDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteralMinValue.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MagicLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MemberTypeDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MessageSend.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MethodDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NameReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NullLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NumberLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OR_OR_Expression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorIds.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PostfixExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PrefixExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedAllocationExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedNameReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedSuperReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedThisReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Reference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ReturnStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleNameReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleTypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Statement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SuperReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SwitchStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThisReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThrowStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TrueLiteral.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TryStatement.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeDeclaration.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeReference.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/UnaryExpression.java
delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/WhileStatement.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
index f7a2352..5570ff9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
@@ -1,16 +1,15 @@
+package net.sourceforge.phpdt.core.dom;
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package net.sourceforge.phpdt.core.dom;
-
/**
* Java compilation unit AST node type. This is the type of the root of an AST.
@@ -33,43 +32,43 @@ package net.sourceforge.phpdt.core.dom;
* { ImportDeclaration }
* { TypeDeclaration | EnumDeclaration | AnnotationTypeDeclaration | ; }
*
- *
+ *
* @since 2.0
*/
-public class CompilationUnit {
+public class CompilationUnit {
// /**
// * The "package" structural property of this node type.
-// *
+// *
// * @since 3.0
// */
-// public static final ChildPropertyDescriptor PACKAGE_PROPERTY =
+// public static final ChildPropertyDescriptor PACKAGE_PROPERTY =
// new ChildPropertyDescriptor(CompilationUnit.class, "package", PackageDeclaration.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
-//
+//
// /**
// * The "imports" structural property of this node type.
-// *
+// *
// * @since 3.0
// */
// public static final ChildListPropertyDescriptor IMPORTS_PROPERTY =
// new ChildListPropertyDescriptor(CompilationUnit.class, "imports", ImportDeclaration.class, NO_CYCLE_RISK); //$NON-NLS-1$
-//
+//
// /**
// * The "types" structural property of this node type.
-// *
+// *
// * @since 3.0
// */
// public static final ChildListPropertyDescriptor TYPES_PROPERTY =
// new ChildListPropertyDescriptor(CompilationUnit.class, "types", AbstractTypeDeclaration.class, CYCLE_RISK); //$NON-NLS-1$
-//
+//
// /**
-// * A list of property descriptors (element type:
+// * A list of property descriptors (element type:
// * {@link StructuralPropertyDescriptor}),
// * or null if uninitialized.
// * @since 3.0
// */
// private static final List PROPERTY_DESCRIPTORS;
-//
+//
// static {
// createPropertyList(CompilationUnit.class);
// addProperty(PACKAGE_PROPERTY);
@@ -81,18 +80,18 @@ public class CompilationUnit {
// /**
// * Returns a list of structural property descriptors for this node type.
// * Clients must not modify the result.
-// *
+// *
// * @param apiLevel the API level; one of the
// * AST.JLS*
constants
//
-// * @return a list of property descriptors (element type:
+// * @return a list of property descriptors (element type:
// * {@link StructuralPropertyDescriptor})
// * @since 3.0
// */
// public static List propertyDescriptors(int apiLevel) {
// return PROPERTY_DESCRIPTORS;
// }
-//
+//
// /**
// * The comment table, or null
if none; initially
// * null
. This array is the storage underlying
@@ -100,39 +99,39 @@ public class CompilationUnit {
// * @since 3.0
// */
// Comment[] optionalCommentTable = null;
-//
+//
// /**
-// * The comment list (element type: Comment
,
+// * The comment list (element type: Comment
,
// * or null
if none; initially null
.
// * @since 3.0
// */
// private List optionalCommentList = null;
-//
+//
// /**
// * The package declaration, or null
if none; initially
// * null
.
// */
// private PackageDeclaration optionalPackageDeclaration = null;
-//
+//
// /**
-// * The list of import declarations in textual order order;
+// * The list of import declarations in textual order order;
// * initially none (elementType: ImportDeclaration
).
// */
// private ASTNode.NodeList imports =
// new ASTNode.NodeList(IMPORTS_PROPERTY);
-//
+//
// /**
-// * The list of type declarations in textual order order;
+// * The list of type declarations in textual order order;
// * initially none (elementType: AbstractTypeDeclaration
)
// */
// private ASTNode.NodeList types =
// new ASTNode.NodeList(TYPES_PROPERTY);
-//
+//
// /**
// * Line end table. If lineEndTable[i] == p
then the
-// * line number i+1
ends at character position
+// * line number i+1
ends at character position
// * p
. Except for the last line, the positions are that
-// * of the last character of the line delimiter.
+// * of the last character of the line delimiter.
// * For example, the source string A\nB\nC
has
// * line end table {1, 3} (if \n is one character).
// */
@@ -152,27 +151,27 @@ public class CompilationUnit {
// * Messages reported by the compiler during parsing or name resolution.
// */
// private Message[] messages;
-//
+//
// /**
// * Problems reported by the compiler during parsing or name resolution.
// */
// private IProblem[] problems = EMPTY_PROBLEMS;
-//
+//
// /**
-// * The comment mapper, or null
in none;
+// * The comment mapper, or null
in none;
// * initially null
.
// * @since 3.0
// */
// private DefaultCommentMapper commentMapper = null;
-//
+//
// /**
// * Sets the line end table for this compilation unit.
-// * If lineEndTable[i] == p
then line number i+1
-// * ends at character position p
. Except for the last line, the
+// * If lineEndTable[i] == p
then line number i+1
+// * ends at character position p
. Except for the last line, the
// * positions are that of (the last character of) the line delimiter.
// * For example, the source string A\nB\nC
has
// * line end table {1, 3, 4}.
-// *
+// *
// * @param lineEndtable the line end table
// */
// void setLineEndTable(int[] lineEndTable) {
@@ -190,11 +189,11 @@ public class CompilationUnit {
// * The compilation unit initially has no package declaration, no
// * import declarations, and no type declarations.
// *
-// * N.B. This constructor is package-private; all subclasses must be
-// * declared in the same package; clients are unable to declare
+// * N.B. This constructor is package-private; all subclasses must be
+// * declared in the same package; clients are unable to declare
// * additional subclasses.
// *
-// *
+// *
// * @param ast the AST that is to own this node
// */
// CompilationUnit(AST ast) {
@@ -208,7 +207,7 @@ public class CompilationUnit {
// final List internalStructuralPropertiesForType(int apiLevel) {
// return propertyDescriptors(apiLevel);
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -224,7 +223,7 @@ public class CompilationUnit {
// // allow default implementation to flag the error
// return super.internalGetSetChildProperty(property, get, child);
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -238,7 +237,7 @@ public class CompilationUnit {
// // allow default implementation to flag the error
// return super.internalGetChildListProperty(property);
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -281,23 +280,23 @@ public class CompilationUnit {
// }
// visitor.endVisit(this);
// }
-//
+//
// /**
-// * Returns the node for the package declaration of this compilation
-// * unit, or null
if this compilation unit is in the
+// * Returns the node for the package declaration of this compilation
+// * unit, or null
if this compilation unit is in the
// * default package.
-// *
+// *
// * @return the package declaration node, or null
if none
-// */
+// */
// public PackageDeclaration getPackage() {
// return this.optionalPackageDeclaration;
// }
-//
+//
// /**
-// * Sets or clears the package declaration of this compilation unit
+// * Sets or clears the package declaration of this compilation unit
// * node to the given package declaration node.
-// *
-// * @param pkgDecl the new package declaration node, or
+// *
+// * @param pkgDecl the new package declaration node, or
// * null
if this compilation unit does not have a package
// * declaration (that is in the default package)
// * @exception IllegalArgumentException if:
@@ -305,7 +304,7 @@ public class CompilationUnit {
// * the node belongs to a different AST
// * the node already has a parent
// *
-// */
+// */
// public void setPackage(PackageDeclaration pkgDecl) {
// ASTNode oldChild = this.optionalPackageDeclaration;
// preReplaceChild(oldChild, pkgDecl, PACKAGE_PROPERTY);
@@ -314,34 +313,34 @@ public class CompilationUnit {
// }
//
// /**
-// * Returns the live list of nodes for the import declarations of this
+// * Returns the live list of nodes for the import declarations of this
// * compilation unit, in order of appearance.
-// *
+// *
// * @return the live list of import declaration nodes
// * (elementType: ImportDeclaration
)
-// */
+// */
// public List imports() {
// return this.imports;
// }
-//
+//
// /**
-// * Returns the live list of nodes for the top-level type declarations of this
+// * Returns the live list of nodes for the top-level type declarations of this
// * compilation unit, in order of appearance.
// *
// * Note that in JLS3, the types may include both enum declarations
// * and annotation type declarations introduced in J2SE 1.5.
// * For JLS2, the elements are always TypeDeclaration
.
// *
-// *
+// *
// * @return the live list of top-level type declaration
// * nodes (elementType: AbstractTypeDeclaration
)
-// */
+// */
// public List types() {
// return this.types;
// }
//
// /**
-// * Finds the corresponding AST node in the given compilation unit from
+// * Finds the corresponding AST node in the given compilation unit from
// * which the given binding originated. Returns null
if the
// * binding does not correspond to any node in this compilation unit.
// * This method always returns null
if bindings were not requested
@@ -356,11 +355,11 @@ public class CompilationUnit {
// * AnonymousClassDeclaration
(for anonymous classes)
// * primitive type - none
// * array type - none
-// * field - a VariableDeclarationFragment
in a
+// * field - a VariableDeclarationFragment
in a
// * FieldDeclaration
// * local variable - a SingleVariableDeclaration
, or
-// * a VariableDeclarationFragment
in a
-// * VariableDeclarationStatement
or
+// * a VariableDeclarationFragment
in a
+// * VariableDeclarationStatement
or
// * VariableDeclarationExpression
// * method - a MethodDeclaration
// * constructor - a MethodDeclaration
@@ -377,7 +376,7 @@ public class CompilationUnit {
// * Use findDeclaringNode(binding.getKey())
when the binding comes
// * from a different AST.
// *
-// *
+// *
// * @param binding the binding
// * @return the corresponding node where the given binding is declared,
// * or null
if the binding does not correspond to a node in this
@@ -389,7 +388,7 @@ public class CompilationUnit {
// }
//
// /**
-// * Finds the corresponding AST node in the given compilation unit from
+// * Finds the corresponding AST node in the given compilation unit from
// * which the binding with the given key originated. Returns
// * null
if the corresponding node cannot be determined.
// * This method always returns null
if bindings were not requested
@@ -404,11 +403,11 @@ public class CompilationUnit {
// * AnonymousClassDeclaration
(for anonymous classes)
// * primitive type - none
// * array type - none
-// * field - a VariableDeclarationFragment
in a
+// * field - a VariableDeclarationFragment
in a
// * FieldDeclaration
// * local variable - a SingleVariableDeclaration
, or
-// * a VariableDeclarationFragment
in a
-// * VariableDeclarationStatement
or
+// * a VariableDeclarationFragment
in a
+// * VariableDeclarationStatement
or
// * VariableDeclarationExpression
// * method - a MethodDeclaration
// * constructor - a MethodDeclaration
@@ -423,7 +422,7 @@ public class CompilationUnit {
// * there may be no keys for finding the declaring node for local variables,
// * local or anonymous classes, etc.
// *
-// *
+// *
// * @param key the binding key, or null
// * @return the corresponding node where a binding with the given
// * key is declared, or null
if the key is null
@@ -435,10 +434,10 @@ public class CompilationUnit {
// public ASTNode findDeclaringNode(String key) {
// return this.ast.getBindingResolver().findDeclaringNode(key);
// }
-//
+//
// /**
// * Returns the internal comment mapper.
-// *
+// *
// * @return the comment mapper, or null
if none.
// * @since 3.0
// */
@@ -449,7 +448,7 @@ public class CompilationUnit {
// /**
// * Initializes the internal comment mapper with the given
// * scanner.
-// *
+// *
// * @param scanner the scanner
// * @since 3.0
// */
@@ -463,7 +462,7 @@ public class CompilationUnit {
// * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
// * the extended source range may include comments and whitespace
// * immediately before or after the normal source range for the node.
-// *
+// *
// * @param node the node
// * @return the 0-based character index, or -1
// * if no source position information is recorded for this node
@@ -483,7 +482,7 @@ public class CompilationUnit {
// * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
// * the extended source range may include comments and whitespace
// * immediately before or after the normal source range for the node.
-// *
+// *
// * @param node the node
// * @return a (possibly 0) length, or 0
// * if no source position information is recorded for this node
@@ -497,10 +496,10 @@ public class CompilationUnit {
// return this.commentMapper.getExtendedLength(node);
// }
// }
-//
+//
// /**
// * Returns the line number corresponding to the given source character
-// * position in the original source string. The initial line of the
+// * position in the original source string. The initial line of the
// * compilation unit is numbered 1, and each line extends through the
// * last character of the end-of-line delimiter. The very last line extends
// * through the end of the source string and has no line delimiter.
@@ -509,7 +508,7 @@ public class CompilationUnit {
// * Returns 1 for a character position that does not correspond to any
// * source line, or if no line number information is available for this
// * compilation unit.
-// *
+// *
// * @param position a 0-based character position, possibly
// * negative or out of range
// * @return the 1-based line number, or 1
if the character
@@ -542,7 +541,7 @@ public class CompilationUnit {
// }
// // assert lineEndTable[low] < position <= lineEndTable[hi]
// // && low == 0 && hi == length - 1 && low < hi
-//
+//
// // binary search line end table
// while (true) {
// // invariant lineEndTable[low] < position <= lineEndTable[hi]
@@ -571,8 +570,8 @@ public class CompilationUnit {
// }
//
// /**
-// * Returns the list of messages reported by the compiler during the parsing
-// * or the type checking of this compilation unit. This list might be a subset of
+// * Returns the list of messages reported by the compiler during the parsing
+// * or the type checking of this compilation unit. This list might be a subset of
// * errors detected and reported by a Java compiler.
// *
// * This list of messages is suitable for simple clients that do little
@@ -612,7 +611,7 @@ public class CompilationUnit {
// * Simple clients that do little more than log the messages or display
// * them to the user should probably call getMessages
instead.
// *
-// *
+// *
// * @return the list of detailed problem objects, possibly empty
// * @see #getMessages()
// * @see ASTParser
@@ -625,7 +624,7 @@ public class CompilationUnit {
// /**
// * Sets the array of problems reported by the compiler during the parsing or
// * name resolution of this compilation unit.
-// *
+// *
// * @param problems the list of problems
// */
// void setProblems(IProblem[] problems) {
@@ -634,14 +633,14 @@ public class CompilationUnit {
// }
// this.problems = problems;
// }
-//
+//
// /**
// * Returns a list of the comments encountered while parsing
// * this compilation unit.
// *
// * Since the Java language allows comments to appear most anywhere
// * in the source text, it is problematic to locate comments in relation
-// * to the structure of an AST. The one exception is doc comments
+// * to the structure of an AST. The one exception is doc comments
// * which, by convention, immediately precede type, field, and
// * method declarations; these comments are located in the AST
// * by {@link BodyDeclaration#getJavadoc BodyDeclaration.getJavadoc}.
@@ -649,7 +648,7 @@ public class CompilationUnit {
// * is provided for clients that need to find the source ranges of
// * all comments in the original source string. It includes entries
// * for comments of all kinds (line, block, and doc), arranged in order
-// * of increasing source position.
+// * of increasing source position.
// *
// * Note on comment parenting: The {@link ASTNode#getParent() getParent()}
// * of a doc comment associated with a body declaration is the body
@@ -660,7 +659,7 @@ public class CompilationUnit {
// * However, for other comment nodes, {@link ASTNode#getParent() getParent()}
// * will return null
, and {@link ASTNode#getRoot() getRoot()}
// * will return the comment node itself, indicating that these comment nodes
-// * are not directly connected to the AST for the compilation unit. The
+// * are not directly connected to the AST for the compilation unit. The
// * {@link Comment#getAlternateRoot Comment.getAlternateRoot}
// * method provides a way to navigate from a comment to its compilation
// * unit.
@@ -675,7 +674,7 @@ public class CompilationUnit {
// *
// * Clients cannot modify the resulting list.
// *
-// *
+// *
// * @return an unmodifiable list of comments in increasing order of source
// * start position, or null
if comment information
// * for this compilation unit is not available
@@ -685,11 +684,11 @@ public class CompilationUnit {
// public List getCommentList() {
// return this.optionalCommentList;
// }
-//
+//
// /**
// * Sets the list of the comments encountered while parsing
// * this compilation unit.
-// *
+// *
// * @param commentTable a list of comments in increasing order
// * of source start position, or null
if comment
// * information for this compilation unit is not available
@@ -725,8 +724,8 @@ public class CompilationUnit {
// this.optionalCommentList = Collections.unmodifiableList(commentList);
// }
// }
-//
-//
+//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -743,7 +742,7 @@ public class CompilationUnit {
// }
// buffer.append("]"); //$NON-NLS-1$
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -758,7 +757,7 @@ public class CompilationUnit {
// // ignore the space taken up by optionalCommentList
// return size;
// }
-//
+//
// /* (omit javadoc for this method)
// * Method declared on ASTNode.
// */
@@ -780,7 +779,7 @@ public class CompilationUnit {
// }
// return size;
// }
-//
+//
// /**
// * Enables the recording of changes to this compilation
// * unit and its descendents. The compilation unit must have
@@ -789,18 +788,18 @@ public class CompilationUnit {
// * arbitrary changes to the subtree rooted at this compilation
// * unit are recorded internally. Once the modification has
// * been completed, call rewrite
to get an object
-// * representing the corresponding edits to the original
+// * representing the corresponding edits to the original
// * source code string.
// *
// * @exception IllegalArgumentException if this compilation unit is
-// * marked as unmodifiable, or if this compilation unit has already
+// * marked as unmodifiable, or if this compilation unit has already
// * been tampered with, or recording has already been enabled
// * @since 3.0
// */
// public void recordModifications() {
// getAST().recordModifications(this);
// }
-//
+//
// /**
// * Converts all modifications recorded for this compilation
// * unit into an object representing the corresponding text
@@ -821,7 +820,7 @@ public class CompilationUnit {
// * accurately reflect the net cumulative affect of all those
// * changes.
// *
-// *
+// *
// * @param document original document containing source code
// * for this compilation unit
// * @param options the table of formatter options
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
index 55769aa..cdf1f49 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
@@ -11,74 +11,74 @@
package net.sourceforge.phpdt.internal.compiler;
import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.AND_AND_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.AllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayInitializer;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayQualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.AssertStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.Assignment;
+import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Block;
+import net.sourceforge.phpdt.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CaseStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
+import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ContinueStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.DoStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.DoubleLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpdt.internal.compiler.ast.ExtendedStringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
+import net.sourceforge.phpdt.internal.compiler.ast.FloatLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.ForStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
+import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.PostfixExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.PrefixExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedSuperReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayInitializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayQualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EmptyStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExtendedStringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FalseLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FloatLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ForStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Initializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LabeledStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LongLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MessageSend;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NullLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.PostfixExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.PrefixExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedSuperReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.WhileStatement;
/**
* A visitor for iterating through the parse tree.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
index a0bcea4..8be0b3f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
@@ -11,78 +11,78 @@
package net.sourceforge.phpdt.internal.compiler;
import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.AND_AND_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.AllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayInitializer;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayQualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.AssertStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.Assignment;
+import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Block;
+import net.sourceforge.phpdt.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CaseStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
+import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ContinueStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase;
+import net.sourceforge.phpdt.internal.compiler.ast.DoStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.DoubleLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpdt.internal.compiler.ast.ExtendedStringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
+import net.sourceforge.phpdt.internal.compiler.ast.FloatLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.ForStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
+import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.MemberTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.PostfixExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.PrefixExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedSuperReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayInitializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayQualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DefaultCase;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EmptyStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExtendedStringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FalseLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FloatLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ForStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Initializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LabeledStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LongLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MemberTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MessageSend;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NullLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.PostfixExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.PrefixExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedSuperReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.WhileStatement;
/**
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
index f4bc83e..a360dae 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
@@ -14,6 +14,8 @@ import java.io.StringWriter;
import java.util.Map;
import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryType;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
@@ -28,8 +30,6 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
import net.sourceforge.phpdt.internal.compiler.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
public class Compiler implements ITypeRequestor, ProblemSeverities {
public UnitParser parser;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
index 488e618..80da79e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
@@ -8,12 +8,12 @@
package net.sourceforge.phpdt.internal.compiler;
import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
/*
* A document element parser extracts structural information from a piece of source, providing detailed source positions info.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
index 6d921c2..be48825 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
@@ -11,78 +11,78 @@
package net.sourceforge.phpdt.internal.compiler;
import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.AND_AND_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.AllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayInitializer;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayQualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.AssertStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.Assignment;
+import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Block;
+import net.sourceforge.phpdt.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CaseStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
+import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ContinueStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase;
+import net.sourceforge.phpdt.internal.compiler.ast.DoStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.DoubleLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpdt.internal.compiler.ast.ExtendedStringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
+import net.sourceforge.phpdt.internal.compiler.ast.FloatLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.ForStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
+import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.MemberTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.PostfixExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.PrefixExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedSuperReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayInitializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayQualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DefaultCase;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DoStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DoubleLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EmptyStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExtendedStringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FalseLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FloatLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ForStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Initializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LabeledStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LongLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MemberTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MessageSend;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NullLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.PostfixExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.PrefixExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedSuperReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SuperReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SwitchStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TrueLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.WhileStatement;
/**
* A visitor interface for interating through the parse tree.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
index d1087b2..b7dda3f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
@@ -14,6 +14,20 @@ import java.util.ArrayList;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.IProblem;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.NameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.env.ISourceType;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
@@ -23,20 +37,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.core.util.CommentRecorderParser;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
/**
* A source element parser extracts structural and reference information
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java
new file mode 100644
index 0000000..ea4128a
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+//dedicated treatment for the &&
+public class AND_AND_Expression extends BinaryExpression {
+
+ int rightInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public AND_AND_Expression(Expression left, Expression right, int operator) {
+ super(left, right, operator);
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ Constant cst = this.left.optimizedBooleanConstant();
+ boolean isLeftOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isLeftOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ if (isLeftOptimizedTrue) {
+ // TRUE && anything
+ // need to be careful of scenario:
+ // (x && y) && !z, if passing the left info to the right, it would be swapped by the !
+ FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ mergedInfo = right.analyseCode(currentScope, flowContext, mergedInfo);
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ FlowInfo leftInfo = left.analyseCode(currentScope, flowContext, flowInfo);
+ // need to be careful of scenario:
+ // (x && y) && !z, if passing the left info to the right, it would be swapped by the !
+ FlowInfo rightInfo = leftInfo.initsWhenTrue().unconditionalInits().copy();
+ rightInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(rightInfo);
+
+ int previousMode = rightInfo.reachMode();
+ if (isLeftOptimizedFalse){
+ rightInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ rightInfo = right.analyseCode(currentScope, flowContext, rightInfo);
+ FlowInfo trueMergedInfo = rightInfo.initsWhenTrue().copy();
+ rightInfo.setReachMode(previousMode); // reset after trueMergedInfo got extracted
+
+ FlowInfo mergedInfo =
+ FlowInfo.conditional(
+ trueMergedInfo,
+ leftInfo.initsWhenFalse().copy().unconditionalInits().mergedWith(
+ rightInfo.initsWhenFalse().copy().unconditionalInits()));
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ /**
+ * Code generation for a binary operation
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// Label falseLabel, endLabel;
+// if (constant != Constant.NotAConstant) {
+// // inlined value
+// if (valueRequired)
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// bits |= OnlyValueRequiredMASK;
+// generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// /* improving code gen for such a case: boolean b = i < 0 && false
+// * since the label has never been used, we have the inlined value on the stack. */
+// if (falseLabel.hasForwardReferences()) {
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// } else {
+// falseLabel.place();
+// }
+// }
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+
+ /**
+ * Boolean operator code generation
+ * Optimized operations are: &&
+ */
+// public void generateOptimizedBoolean(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// if (constant != Constant.NotAConstant) {
+// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+// return;
+// }
+// Constant condConst;
+// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // && x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// } else {
+// // && x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_0();
+// } else {
+// if (falseLabel != null) {
+// // implicit falling through the TRUE case
+// codeStream.goto_(falseLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// return;
+// }
+// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // x &&
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// } else {
+// // x &&
+// Label internalTrueLabel = new Label(codeStream);
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// internalTrueLabel, // will be false in the end
+// null,
+// false);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// internalTrueLabel.place();
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_0();
+// } else {
+// if (falseLabel != null) {
+// // implicit falling through the TRUE case
+// codeStream.goto_(falseLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// return;
+// }
+// // default case
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// Label internalFalseLabel = new Label(codeStream);
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// internalFalseLabel,
+// true);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// null,
+// valueRequired);
+// internalFalseLabel.place();
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// left.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, true);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// falseLabel,
+// valueRequired);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// }
+
+ public boolean isCompactableOperation() {
+ return false;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ left.traverse(visitor, scope);
+ right.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java
new file mode 100644
index 0000000..7c429a6
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypes;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.CompilerModifiers;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeIds;
+
+
+public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConstants, TypeIds {
+
+ public int sourceStart, sourceEnd;
+
+ //some global provision for the hierarchy
+ public final static Constant NotAConstant = Constant.NotAConstant;
+
+ // storage for internal flags (32 bits) BIT USAGE
+ public final static int Bit1 = 0x1; // return type (operators) | name reference kind (name ref) | add assertion (type decl)
+ public final static int Bit2 = 0x2; // return type (operators) | name reference kind (name ref) | has local type (type, method, field decl)
+ public final static int Bit3 = 0x4; // return type (operators) | name reference kind (name ref) | implicit this (this ref)
+ public final static int Bit4 = 0x8; // return type (operators) | first assignment to local (local decl)
+ public final static int Bit5 = 0x10; // value for return (binary expression) |
+ public final static int Bit6 = 0x20; // depth (name ref, msg) | only value required (binary expression)
+ public final static int Bit7 = 0x40; // depth (name ref, msg) | operator (operators)
+ public final static int Bit8 = 0x80; // depth (name ref, msg) | operator (operators)
+ public final static int Bit9 = 0x100; // depth (name ref, msg) | operator (operators)
+ public final static int Bit10= 0x200; // depth (name ref, msg) | operator (operators)
+ public final static int Bit11 = 0x400; // depth (name ref, msg) | operator (operators)
+ public final static int Bit12 = 0x800; // depth (name ref, msg) | operator (operators)
+ public final static int Bit13 = 0x1000; // depth (name ref, msg)
+ public final static int Bit14 = 0x2000; // assigned (reference lhs)
+ public final static int Bit15 = 0x4000;
+ public final static int Bit16 = 0x8000;
+ public final static int Bit17 = 0x10000;
+ public final static int Bit18 = 0x20000;
+ public final static int Bit19 = 0x40000;
+ public final static int Bit20 = 0x80000;
+ public final static int Bit21 = 0x100000;
+ public final static int Bit22 = 0x200000; // parenthesis count (expression)
+ public final static int Bit23 = 0x400000; // parenthesis count (expression)
+ public final static int Bit24 = 0x800000; // parenthesis count (expression)
+ public final static int Bit25 = 0x1000000; // parenthesis count (expression)
+ public final static int Bit26 = 0x2000000; // parenthesis count (expression)
+ public final static int Bit27 = 0x4000000; // parenthesis count (expression)
+ public final static int Bit28 = 0x8000000; // parenthesis count (expression)
+ public final static int Bit29 = 0x10000000; // parenthesis count (expression)
+ public final static int Bit30 = 0x20000000; // assignment with no effect (assignment)
+ public final static int Bit31 = 0x40000000; // local declaration reachable (local decl)
+ public final static int Bit32 = 0x80000000; // reachable (statement)
+
+ public int bits = IsReachableMASK; // reachable by default
+
+ // for operators
+ public static final int ReturnTypeIDMASK = Bit1|Bit2|Bit3|Bit4;
+ public static final int OperatorSHIFT = 6; // Bit7 -> Bit12
+ public static final int OperatorMASK = Bit7|Bit8|Bit9|Bit10|Bit11|Bit12; // 6 bits for operator ID
+
+ // for binary expressions
+ public static final int ValueForReturnMASK = Bit5;
+ public static final int OnlyValueRequiredMASK = Bit6;
+
+ // for name references
+ public static final int RestrictiveFlagMASK = Bit1|Bit2|Bit3;
+ public static final int FirstAssignmentToLocalMASK = Bit4;
+
+ // for this reference
+ public static final int IsImplicitThisMask = Bit3;
+
+ // for single name references
+ public static final int DepthSHIFT = 5; // Bit6 -> Bit13
+ public static final int DepthMASK = Bit6|Bit7|Bit8|Bit9|Bit10|Bit11|Bit12|Bit13; // 8 bits for actual depth value (max. 255)
+
+ // for statements
+ public static final int IsReachableMASK = Bit32;
+ public static final int IsLocalDeclarationReachableMASK = Bit31;
+
+ // for type declaration
+ public static final int AddAssertionMASK = Bit1;
+ public static final int IsMemberTypeMASK = Bit11; // local member do not know it is local at parse time (need to look at binding)
+
+ // for type, method and field declarations
+ public static final int HasLocalTypeMASK = Bit2; // cannot conflict with AddAssertionMASK
+
+ // for expression
+ public static final int ParenthesizedSHIFT = 21; // Bit22 -> Bit29
+ public static final int ParenthesizedMASK = Bit22|Bit23|Bit24|Bit25|Bit26|Bit27|Bit28|Bit29; // 8 bits for parenthesis count value (max. 255)
+
+ // for assignment
+ public static final int IsAssignmentWithNoEffectMASK = Bit30;
+
+ // for references on lhs of assignment (set only for true assignments, as opposed to compound ones)
+ public static final int IsStrictlyAssignedMASK = Bit14;
+ public static final int IsCompoundAssignedMASK = Bit17; // set only for compound assignments, as opposed to other ones
+
+ // for empty statement
+ public static final int IsUsefulEmptyStatementMASK = Bit1;
+
+ // for block and method declaration
+ public static final int UndocumentedEmptyBlockMASK = Bit4;
+
+ // for compilation unit
+ public static final int HasAllMethodBodies = Bit5;
+
+ // for references in Javadoc comments
+ public static final int InsideJavadoc = Bit16;
+
+ // for if statement
+ public static final int IsElseIfStatement = Bit30;
+
+ public ASTNode() {
+
+ super();
+ }
+
+ public boolean cannotReturn() {
+ return false;
+ }
+
+ public ASTNode concreteStatement() {
+ return this;
+ }
+
+ /* Answer true if the field use is considered deprecated.
+ * An access in the same compilation unit is allowed.
+ */
+ public final boolean isFieldUseDeprecated(FieldBinding field, Scope scope) {
+
+ if (field.isPrivate() && !scope.isDefinedInField(field)) {
+ // ignore cases where field is used from within inside itself
+ field.modifiers |= AccPrivateUsed;
+ }
+
+ if (!field.isViewedAsDeprecated()) return false;
+
+ // inside same unit - no report
+ if (scope.isDefinedInSameUnit(field.declaringClass)) return false;
+
+ // if context is deprecated, may avoid reporting
+// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
+ return true;
+ }
+
+ public boolean isImplicitThis() {
+
+ return false;
+ }
+
+ /* Answer true if the method use is considered deprecated.
+ * An access in the same compilation unit is allowed.
+ */
+ public final boolean isMethodUseDeprecated(MethodBinding method, Scope scope) {
+
+ if (method.isPrivate() && !scope.isDefinedInMethod(method)) {
+ // ignore cases where method is used from within inside itself (e.g. direct recursions)
+ method.modifiers |= AccPrivateUsed;
+ }
+
+ if (!method.isViewedAsDeprecated()) return false;
+
+ // inside same unit - no report
+ if (scope.isDefinedInSameUnit(method.declaringClass)) return false;
+
+ // if context is deprecated, may avoid reporting
+// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
+ return true;
+ }
+
+ public boolean isSuper() {
+
+ return false;
+ }
+
+ public boolean isThis() {
+
+ return false;
+ }
+
+ /* Answer true if the type use is considered deprecated.
+ * An access in the same compilation unit is allowed.
+ */
+ public final boolean isTypeUseDeprecated(TypeBinding type, Scope scope) {
+
+ if (type.isArrayType())
+ type = ((ArrayBinding) type).leafComponentType;
+ if (type.isBaseType())
+ return false;
+
+ ReferenceBinding refType = (ReferenceBinding) type;
+
+ if (refType.isPrivate() && !scope.isDefinedInType(refType)) {
+ // ignore cases where type is used from within inside itself
+ refType.modifiers |= AccPrivateUsed;
+ }
+
+ if (!refType.isViewedAsDeprecated()) return false;
+
+ // inside same unit - no report
+ if (scope.isDefinedInSameUnit(refType)) return false;
+
+ // if context is deprecated, may avoid reporting
+// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
+ return true;
+ }
+
+ public static String modifiersString(int modifiers) {
+
+ String s = ""; //$NON-NLS-1$
+ if ((modifiers & AccPublic) != 0)
+ s = s + "public "; //$NON-NLS-1$
+ if ((modifiers & AccPrivate) != 0)
+ s = s + "private "; //$NON-NLS-1$
+ if ((modifiers & AccProtected) != 0)
+ s = s + "protected "; //$NON-NLS-1$
+ if ((modifiers & AccStatic) != 0)
+ s = s + "static "; //$NON-NLS-1$
+ if ((modifiers & AccFinal) != 0)
+ s = s + "final "; //$NON-NLS-1$
+// if ((modifiers & AccSynchronized) != 0)
+// s = s + "synchronized "; //$NON-NLS-1$
+// if ((modifiers & AccVolatile) != 0)
+// s = s + "volatile "; //$NON-NLS-1$
+// if ((modifiers & AccTransient) != 0)
+// s = s + "transient "; //$NON-NLS-1$
+// if ((modifiers & AccNative) != 0)
+// s = s + "native "; //$NON-NLS-1$
+ if ((modifiers & AccAbstract) != 0)
+ s = s + "abstract "; //$NON-NLS-1$
+ return s;
+ }
+
+ public abstract StringBuffer print(int indent, StringBuffer output);
+
+ public static StringBuffer printIndent(int indent, StringBuffer output) {
+
+ for (int i = indent; i > 0; i--) output.append(" "); //$NON-NLS-1$
+ return output;
+ }
+
+ public static StringBuffer printModifiers(int modifiers, StringBuffer output) {
+
+ if ((modifiers & AccPublic) != 0)
+ output.append("public "); //$NON-NLS-1$
+ if ((modifiers & AccPrivate) != 0)
+ output.append("private "); //$NON-NLS-1$
+ if ((modifiers & AccProtected) != 0)
+ output.append("protected "); //$NON-NLS-1$
+ if ((modifiers & AccStatic) != 0)
+ output.append("static "); //$NON-NLS-1$
+ if ((modifiers & AccFinal) != 0)
+ output.append("final "); //$NON-NLS-1$
+// if ((modifiers & AccSynchronized) != 0)
+// output.append("synchronized "); //$NON-NLS-1$
+// if ((modifiers & AccVolatile) != 0)
+// output.append("volatile "); //$NON-NLS-1$
+// if ((modifiers & AccTransient) != 0)
+// output.append("transient "); //$NON-NLS-1$
+// if ((modifiers & AccNative) != 0)
+// output.append("native "); //$NON-NLS-1$
+ if ((modifiers & AccAbstract) != 0)
+ output.append("abstract "); //$NON-NLS-1$
+ return output;
+ }
+ /**
+ * @deprecated - use field instead
+ */
+ public int sourceEnd() {
+ return sourceEnd;
+ }
+
+ /**
+ * @deprecated - use field instead
+ */
+ public int sourceStart() {
+ return sourceStart;
+ }
+
+ public static String tabString(int tab) {
+
+ String s = ""; //$NON-NLS-1$
+ for (int i = tab; i > 0; i--)
+ s = s + " "; //$NON-NLS-1$
+ return s;
+ }
+
+ public String toString() {
+
+ return toString(0);
+ }
+
+ public String toString(int tab) {
+
+ return "****" + super.toString() + "****"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java
new file mode 100644
index 0000000..9c001cc
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -0,0 +1,442 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
+import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
+import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
+
+
+public abstract class AbstractMethodDeclaration
+ extends ASTNode
+ implements ProblemSeverities, ReferenceContext {
+
+ public MethodScope scope;
+ //it is not relevent for constructor but it helps to have the name of the constructor here
+ //which is always the name of the class.....parsing do extra work to fill it up while it do not have to....
+ public char[] selector;
+ public int declarationSourceStart;
+ public int declarationSourceEnd;
+ public int modifiers;
+ public int modifiersSourceStart;
+ public Argument[] arguments;
+ public TypeReference[] thrownExceptions;
+ public Statement[] statements;
+ public int explicitDeclarations;
+ public MethodBinding binding;
+ public boolean ignoreFurtherInvestigation = false;
+ public boolean needFreeReturn = false;
+
+ public int bodyStart;
+ public int bodyEnd = -1;
+ public CompilationResult compilationResult;
+
+ AbstractMethodDeclaration(CompilationResult compilationResult){
+ this.compilationResult = compilationResult;
+ }
+
+ /*
+ * We cause the compilation task to abort to a given extent.
+ */
+ public void abort(int abortLevel) {
+
+ if (scope == null) {
+ throw new AbortCompilation(); // cannot do better
+ }
+
+ CompilationResult compilationResult =
+ scope.referenceCompilationUnit().compilationResult;
+
+ switch (abortLevel) {
+ case AbortCompilation :
+ throw new AbortCompilation(compilationResult);
+ case AbortCompilationUnit :
+ throw new AbortCompilationUnit(compilationResult);
+ case AbortType :
+ throw new AbortType(compilationResult);
+ default :
+ throw new AbortMethod(compilationResult);
+ }
+ }
+
+ public abstract void analyseCode(ClassScope scope, InitializationFlowContext initializationContext, FlowInfo info);
+
+ /**
+ * Bind and add argument's binding into the scope of the method
+ */
+ public void bindArguments() {
+
+ if (arguments != null) {
+ // by default arguments in abstract/native methods are considered to be used (no complaint is expected)
+ boolean used = binding == null || binding.isAbstract();// || binding.isNative();
+
+ int length = arguments.length;
+ for (int i = 0; i < length; i++) {
+ TypeBinding argType = binding == null ? null : binding.parameters[i];
+ arguments[i].bind(scope, argType, used);
+ }
+ }
+ }
+
+ /**
+ * Record the thrown exception type bindings in the corresponding type references.
+ */
+ public void bindThrownExceptions() {
+
+ if (this.thrownExceptions != null
+ && this.binding != null
+ && this.binding.thrownExceptions != null) {
+ int thrownExceptionLength = this.thrownExceptions.length;
+ int length = this.binding.thrownExceptions.length;
+ if (length == thrownExceptionLength) {
+ for (int i = 0; i < length; i++) {
+ this.thrownExceptions[i].resolvedType = this.binding.thrownExceptions[i];
+ }
+ } else {
+ int bindingIndex = 0;
+ for (int i = 0; i < thrownExceptionLength && bindingIndex < length; i++) {
+ TypeReference thrownException = this.thrownExceptions[i];
+ ReferenceBinding thrownExceptionBinding = this.binding.thrownExceptions[bindingIndex];
+ char[][] bindingCompoundName = thrownExceptionBinding.compoundName;
+ if (thrownException instanceof SingleTypeReference) {
+ // single type reference
+ int lengthName = bindingCompoundName.length;
+ char[] thrownExceptionTypeName = thrownException.getTypeName()[0];
+ if (CharOperation.equals(thrownExceptionTypeName, bindingCompoundName[lengthName - 1])) {
+ thrownException.resolvedType = thrownExceptionBinding;
+ bindingIndex++;
+ }
+ } else {
+ // qualified type reference
+ if (CharOperation.equals(thrownException.getTypeName(), bindingCompoundName)) {
+ thrownException.resolvedType = thrownExceptionBinding;
+ bindingIndex++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public CompilationResult compilationResult() {
+
+ return this.compilationResult;
+ }
+
+ /**
+ * Bytecode generation for a method
+ */
+// public void generateCode(ClassScope classScope, ClassFile classFile) {
+//
+// int problemResetPC = 0;
+// classFile.codeStream.wideMode = false; // reset wideMode to false
+// if (ignoreFurtherInvestigation) {
+// // method is known to have errors, dump a problem method
+// if (this.binding == null)
+// return; // handle methods with invalid signature or duplicates
+// int problemsLength;
+// IProblem[] problems =
+// scope.referenceCompilationUnit().compilationResult.getProblems();
+// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+// classFile.addProblemMethod(this, binding, problemsCopy);
+// return;
+// }
+// // regular code generation
+// try {
+// problemResetPC = classFile.contentsOffset;
+// this.generateCode(classFile);
+// } catch (AbortMethod e) {
+// // a fatal error was detected during code generation, need to restart code gen if possible
+// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
+// // a branch target required a goto_w, restart code gen in wide mode.
+// try {
+// this.traverse(new ResetStateForCodeGenerationVisitor(), classScope);
+// classFile.contentsOffset = problemResetPC;
+// classFile.methodCount--;
+// classFile.codeStream.wideMode = true; // request wide mode
+// this.generateCode(classFile); // restart method generation
+// } catch (AbortMethod e2) {
+// int problemsLength;
+// IProblem[] problems =
+// scope.referenceCompilationUnit().compilationResult.getAllProblems();
+// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+// classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
+// }
+// } else {
+// // produce a problem method accounting for this fatal error
+// int problemsLength;
+// IProblem[] problems =
+// scope.referenceCompilationUnit().compilationResult.getAllProblems();
+// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+// classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
+// }
+// }
+// }
+//
+// private void generateCode(ClassFile classFile) {
+//
+// classFile.generateMethodInfoHeader(binding);
+// int methodAttributeOffset = classFile.contentsOffset;
+// int attributeNumber = classFile.generateMethodInfoAttribute(binding);
+// if ((!binding.isNative()) && (!binding.isAbstract())) {
+// int codeAttributeOffset = classFile.contentsOffset;
+// classFile.generateCodeAttributeHeader();
+// CodeStream codeStream = classFile.codeStream;
+// codeStream.reset(this, classFile);
+// // initialize local positions
+// this.scope.computeLocalVariablePositions(binding.isStatic() ? 0 : 1, codeStream);
+//
+// // arguments initialization for local variable debug attributes
+// if (arguments != null) {
+// for (int i = 0, max = arguments.length; i < max; i++) {
+// LocalVariableBinding argBinding;
+// codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
+// argBinding.recordInitializationStartPC(0);
+// }
+// }
+// if (statements != null) {
+// for (int i = 0, max = statements.length; i < max; i++)
+// statements[i].generateCode(scope, codeStream);
+// }
+// if (this.needFreeReturn) {
+// codeStream.return_();
+// }
+// // local variable attributes
+// codeStream.exitUserScope(scope);
+// codeStream.recordPositionsFrom(0, this.declarationSourceEnd);
+// classFile.completeCodeAttribute(codeAttributeOffset);
+// attributeNumber++;
+// } else {
+// checkArgumentsSize();
+// }
+// classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
+//
+// // if a problem got reported during code gen, then trigger problem method creation
+// if (ignoreFurtherInvestigation) {
+// throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
+// }
+// }
+
+// private void checkArgumentsSize() {
+// TypeBinding[] parameters = binding.parameters;
+// int size = 1; // an abstact method or a native method cannot be static
+// for (int i = 0, max = parameters.length; i < max; i++) {
+// TypeBinding parameter = parameters[i];
+// if (parameter == LongBinding || parameter == DoubleBinding) {
+// size += 2;
+// } else {
+// size++;
+// }
+// if (size > 0xFF) {
+// scope.problemReporter().noMoreAvailableSpaceForArgument(scope.locals[i], scope.locals[i].declaration);
+// }
+// }
+// }
+
+ public boolean hasErrors() {
+ return this.ignoreFurtherInvestigation;
+ }
+
+ public boolean isAbstract() {
+
+ if (binding != null)
+ return binding.isAbstract();
+ return (modifiers & AccAbstract) != 0;
+ }
+
+ public boolean isClinit() {
+
+ return false;
+ }
+
+ public boolean isConstructor() {
+
+ return false;
+ }
+
+ public boolean isDefaultConstructor() {
+
+ return false;
+ }
+
+ public boolean isInitializationMethod() {
+
+ return false;
+ }
+
+// public boolean isNative() {
+//
+// if (binding != null)
+// return binding.isNative();
+// return (modifiers & AccNative) != 0;
+// }
+
+ public boolean isStatic() {
+
+ if (binding != null)
+ return binding.isStatic();
+ return (modifiers & AccStatic) != 0;
+ }
+
+ /**
+ * Fill up the method body with statement
+ */
+ public abstract void parseStatements(
+ UnitParser parser,
+ CompilationUnitDeclaration unit);
+ public StringBuffer print(int tab, StringBuffer output) {
+
+ printIndent(tab, output);
+ printModifiers(this.modifiers, output);
+ printReturnType(0, output).append(this.selector).append('(');
+ if (this.arguments != null) {
+ for (int i = 0; i < this.arguments.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ this.arguments[i].print(0, output);
+ }
+ }
+ output.append(')');
+ if (this.thrownExceptions != null) {
+ output.append(" throws "); //$NON-NLS-1$
+ for (int i = 0; i < this.thrownExceptions.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ this.thrownExceptions[i].print(0, output);
+ }
+ }
+ printBody(tab + 1, output);
+ return output;
+ }
+
+ public StringBuffer printBody(int indent, StringBuffer output) {
+
+ if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0)
+ return output.append(';');
+
+ output.append(" {"); //$NON-NLS-1$
+ if (this.statements != null) {
+ for (int i = 0; i < this.statements.length; i++) {
+ output.append('\n');
+ this.statements[i].printStatement(indent, output);
+ }
+ }
+ output.append('\n'); //$NON-NLS-1$
+ printIndent(indent == 0 ? 0 : indent - 1, output).append('}');
+ return output;
+ }
+
+ public StringBuffer printReturnType(int indent, StringBuffer output) {
+
+ return output;
+ }
+ public void resolve(ClassScope upperScope) {
+
+ if (binding == null) {
+ ignoreFurtherInvestigation = true;
+ }
+
+ try {
+ bindArguments();
+ bindThrownExceptions();
+ resolveStatements();
+ } catch (AbortMethod e) { // ========= abort on fatal error =============
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ public void resolveStatements() {
+
+ if (statements != null) {
+ int i = 0, length = statements.length;
+ while (i < length)
+ statements[i++].resolve(scope);
+ }
+ }
+
+ public String returnTypeToString(int tab) {
+
+ return ""; //$NON-NLS-1$
+ }
+
+ public void tagAsHavingErrors() {
+
+ ignoreFurtherInvestigation = true;
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ if (modifiers != AccDefault) {
+ s += modifiersString(modifiers);
+ }
+
+ s += returnTypeToString(0);
+ s += new String(selector) + "("; //$NON-NLS-1$
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length; i++) {
+ s += arguments[i].toString(0);
+ if (i != (arguments.length - 1))
+ s = s + ", "; //$NON-NLS-1$
+ };
+ };
+ s += ")"; //$NON-NLS-1$
+ if (thrownExceptions != null) {
+ s += " throws "; //$NON-NLS-1$
+ for (int i = 0; i < thrownExceptions.length; i++) {
+ s += thrownExceptions[i].toString(0);
+ if (i != (thrownExceptions.length - 1))
+ s = s + ", "; //$NON-NLS-1$
+ };
+ };
+
+ s += toStringStatements(tab + 1);
+ return s;
+ }
+
+ public String toStringStatements(int tab) {
+
+ if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0)
+ return ";"; //$NON-NLS-1$
+
+ String s = " {"; //$NON-NLS-1$
+ if (statements != null) {
+ for (int i = 0; i < statements.length; i++) {
+ s = s + "\n" + statements[i].toString(tab); //$NON-NLS-1$
+ if (!(statements[i] instanceof Block)) {
+ s += ";"; //$NON-NLS-1$
+ }
+ }
+ }
+ s += "\n" + tabString(tab == 0 ? 0 : tab - 1) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ ClassScope classScope) {
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java
new file mode 100644
index 0000000..84319d5
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public abstract class AbstractVariableDeclaration extends Statement {
+ public int modifiers;
+
+ public TypeReference type;
+ public Expression initialization;
+
+ public char[] name;
+ public int declarationEnd;
+ public int declarationSourceStart;
+ public int declarationSourceEnd;
+ public int modifiersSourceStart;
+
+ public AbstractVariableDeclaration() {}
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return flowInfo;
+ }
+
+ public abstract String name();
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output);
+ printModifiers(this.modifiers, output);
+ type.print(0, output).append(' ').append(this.name);
+ if (initialization != null) {
+ output.append(" = "); //$NON-NLS-1$
+ initialization.printExpression(indent, output);
+ }
+ return output.append(';');
+ }
+
+ public void resolve(BlockScope scope) {}
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ if (modifiers != AccDefault) {
+ s += modifiersString(modifiers);
+ }
+ s += type.toString(0) + " " + new String(name()); //$NON-NLS-1$
+ if (initialization != null)
+ s += " = " + initialization.toStringExpression(tab); //$NON-NLS-1$
+ return s;
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java
new file mode 100644
index 0000000..7eb480b
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.NestedTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticArgumentBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class AllocationExpression
+ extends Expression
+ implements InvocationSite {
+
+ public TypeReference type;
+ public Expression[] arguments;
+ public MethodBinding binding;
+
+ MethodBinding syntheticAccessor;
+
+ public AllocationExpression() {
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // check captured variables are initialized in current context (26134)
+ checkCapturedLocalInitializationIfNecessary(this.binding.declaringClass, currentScope, flowInfo);
+
+ // process arguments
+ if (arguments != null) {
+ for (int i = 0, count = arguments.length; i < count; i++) {
+ flowInfo =
+ arguments[i]
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+ }
+ // record some dependency information for exception types
+ ReferenceBinding[] thrownExceptions;
+ if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
+ // check exception handling
+ flowContext.checkExceptionHandlers(
+ thrownExceptions,
+ this,
+ flowInfo,
+ currentScope);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ manageSyntheticAccessIfNecessary(currentScope);
+
+ return flowInfo;
+ }
+
+ public void checkCapturedLocalInitializationIfNecessary(ReferenceBinding checkedType, BlockScope currentScope, FlowInfo flowInfo) {
+
+ if (checkedType.isLocalType()
+ && !checkedType.isAnonymousType()
+ && !currentScope.isDefinedInType(checkedType)) { // only check external allocations
+ NestedTypeBinding nestedType = (NestedTypeBinding) checkedType;
+ SyntheticArgumentBinding[] syntheticArguments = nestedType.syntheticOuterLocalVariables();
+ if (syntheticArguments != null)
+ for (int i = 0, count = syntheticArguments.length; i < count; i++){
+ SyntheticArgumentBinding syntheticArgument = syntheticArguments[i];
+ LocalVariableBinding targetLocal;
+ if ((targetLocal = syntheticArgument.actualOuterLocalVariable) == null) continue;
+// if (targetLocal.declaration != null && !flowInfo.isDefinitelyAssigned(targetLocal)){
+// currentScope.problemReporter().uninitializedLocalVariable(targetLocal, this);
+// }
+ }
+
+ }
+ }
+
+ public Expression enclosingInstance() {
+ return null;
+ }
+
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// ReferenceBinding allocatedType = binding.declaringClass;
+//
+// codeStream.new_(allocatedType);
+// if (valueRequired) {
+// codeStream.dup();
+// }
+// // better highlight for allocation: display the type individually
+// codeStream.recordPositionsFrom(pc, type.sourceStart);
+//
+// // handling innerclass instance allocation - enclosing instance arguments
+// if (allocatedType.isNestedType()) {
+// codeStream.generateSyntheticEnclosingInstanceValues(
+// currentScope,
+// allocatedType,
+// enclosingInstance(),
+// this);
+// }
+// // generate the arguments for constructor
+// if (arguments != null) {
+// for (int i = 0, count = arguments.length; i < count; i++) {
+// arguments[i].generateCode(currentScope, codeStream, true);
+// }
+// }
+// // handling innerclass instance allocation - outer local arguments
+// if (allocatedType.isNestedType()) {
+// codeStream.generateSyntheticOuterArgumentValues(
+// currentScope,
+// allocatedType,
+// this);
+// }
+// // invoke constructor
+// if (syntheticAccessor == null) {
+// codeStream.invokespecial(binding);
+// } else {
+// // synthetic accessor got some extra arguments appended to its signature, which need values
+// for (int i = 0,
+// max = syntheticAccessor.parameters.length - binding.parameters.length;
+// i < max;
+// i++) {
+// codeStream.aconst_null();
+// }
+// codeStream.invokespecial(syntheticAccessor);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public boolean isSuperAccess() {
+
+ return false;
+ }
+
+ public boolean isTypeAccess() {
+
+ return true;
+ }
+
+ /* Inner emulation consists in either recording a dependency
+ * link only, or performing one level of propagation.
+ *
+ * Dependency mechanism is used whenever dealing with source target
+ * types, since by the time we reach them, we might not yet know their
+ * exact need.
+ */
+ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+
+ ReferenceBinding allocatedType;
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if ((allocatedType = binding.declaringClass).isNestedType()
+ && currentScope.enclosingSourceType().isLocalType()) {
+
+ if (allocatedType.isLocalType()) {
+ ((LocalTypeBinding) allocatedType).addInnerEmulationDependent(currentScope, false);
+ // request cascade of accesses
+ } else {
+ // locally propagate, since we already now the desired shape for sure
+ currentScope.propagateInnerEmulation(allocatedType, false);
+ // request cascade of accesses
+ }
+ }
+ }
+
+ public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
+
+ if (binding.isPrivate()
+ && (currentScope.enclosingSourceType() != binding.declaringClass)) {
+
+// if (currentScope
+// .environment()
+// .options
+// .isPrivateConstructorAccessChangingVisibility) {
+// binding.tagForClearingPrivateModifier();
+// // constructor will not be dumped as private, no emulation required thus
+// } else {
+ syntheticAccessor =
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+// }
+ }
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ output.append("new "); //$NON-NLS-1$
+ type.printExpression(0, output);
+ output.append('(');
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ arguments[i].printExpression(0, output);
+ }
+ }
+ return output.append(')');
+ }
+ public TypeBinding resolveType(BlockScope scope) {
+
+ // Propagate the type checking to the arguments, and check if the constructor is defined.
+ constant = NotAConstant;
+ this.resolvedType = type.resolveType(scope);
+ // will check for null after args are resolved
+
+ // buffering the arguments' types
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ boolean argHasError = false;
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
+ argHasError = true;
+ if (argHasError)
+ return this.resolvedType;
+ }
+ if (this.resolvedType == null)
+ return null;
+
+ if (!this.resolvedType.canBeInstantiated()) {
+ scope.problemReporter().cannotInstantiate(type, this.resolvedType);
+ return this.resolvedType;
+ }
+ ReferenceBinding allocatedType = (ReferenceBinding) this.resolvedType;
+ if (!(binding = scope.getConstructor(allocatedType, argumentTypes, this))
+ .isValidBinding()) {
+ if (binding.declaringClass == null)
+ binding.declaringClass = allocatedType;
+ scope.problemReporter().invalidConstructor(this, binding);
+ return this.resolvedType;
+ }
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(binding, this);
+
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
+ return allocatedType;
+ }
+
+ public void setActualReceiverType(ReferenceBinding receiverType) {
+ // ignored
+ }
+
+ public void setDepth(int i) {
+ // ignored
+ }
+
+ public void setFieldIndex(int i) {
+ // ignored
+ }
+
+ public String toStringExpression() {
+
+ String s = "new " + type.toString(0); //$NON-NLS-1$
+ if (arguments == null)
+ s = s + "()"; //$NON-NLS-1$
+ else {
+ s = s + "("; //$NON-NLS-1$
+ for (int i = 0; i < arguments.length; i++) {
+ s = s + arguments[i].toStringExpression();
+ if (i == (arguments.length - 1))
+ s = s + ")"; //$NON-NLS-1$
+ else
+ s = s + ", "; //$NON-NLS-1$
+ }
+ }
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ int argumentsLength;
+ type.traverse(visitor, scope);
+ if (arguments != null) {
+ argumentsLength = arguments.length;
+ for (int i = 0; i < argumentsLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
new file mode 100644
index 0000000..73b3689
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
+
+public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
+
+ public static final char[] ANONYMOUS_EMPTY_NAME = new char[] {};
+ public QualifiedAllocationExpression allocation;
+
+ public AnonymousLocalTypeDeclaration(CompilationResult compilationResult) {
+ super(compilationResult);
+ modifiers = AccDefault;
+ name = ANONYMOUS_EMPTY_NAME;
+ }
+
+ // use a default name in order to th name lookup
+ // to operate just like a regular type (which has a name)
+ //without checking systematically if the naem is null ....
+ public MethodBinding createsInternalConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
+
+ //Add to method'set, the default constuctor that just recall the
+ //super constructor with the same arguments
+ String baseName = "$anonymous"; //$NON-NLS-1$
+ TypeBinding[] argumentTypes = inheritedConstructorBinding.parameters;
+ int argumentsLength = argumentTypes.length;
+ //the constructor
+ ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationResult);
+ cd.selector = new char[] { 'x' }; //no maining
+ cd.sourceStart = sourceStart;
+ cd.sourceEnd = sourceEnd;
+ cd.modifiers = modifiers & AccVisibilityMASK;
+ cd.isDefaultConstructor = true;
+
+ if (argumentsLength > 0) {
+ Argument[] arguments = (cd.arguments = new Argument[argumentsLength]);
+ for (int i = argumentsLength; --i >= 0;) {
+ arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault);
+ }
+ }
+
+ //the super call inside the constructor
+ cd.constructorCall = SuperReference.implicitSuperConstructorCall();
+ cd.constructorCall.sourceStart = sourceStart;
+ cd.constructorCall.sourceEnd = sourceEnd;
+
+ if (argumentsLength > 0) {
+ Expression[] args;
+ args = cd.constructorCall.arguments = new Expression[argumentsLength];
+ for (int i = argumentsLength; --i >= 0;) {
+ args[i] = new SingleNameReference((baseName + i).toCharArray(), 0L);
+ }
+ }
+
+ //adding the constructor in the methods list
+ if (methods == null) {
+ methods = new AbstractMethodDeclaration[] { cd };
+ } else {
+ AbstractMethodDeclaration[] newMethods;
+ System.arraycopy(
+ methods,
+ 0,
+ newMethods = new AbstractMethodDeclaration[methods.length + 1],
+ 1,
+ methods.length);
+ newMethods[0] = cd;
+ methods = newMethods;
+ }
+
+ //============BINDING UPDATE==========================
+ cd.binding = new MethodBinding(
+ cd.modifiers, //methodDeclaration
+ argumentsLength == 0 ? NoParameters : argumentTypes, //arguments bindings
+ inheritedConstructorBinding.thrownExceptions, //exceptions
+ binding); //declaringClass
+
+ cd.scope = new MethodScope(scope, cd, true);
+ cd.bindArguments();
+ cd.constructorCall.resolve(cd.scope);
+
+ if (binding.methods == null) {
+ binding.methods = new MethodBinding[] { cd.binding };
+ } else {
+ MethodBinding[] newMethods;
+ System.arraycopy(
+ binding.methods,
+ 0,
+ newMethods = new MethodBinding[binding.methods.length + 1],
+ 1,
+ binding.methods.length);
+ newMethods[0] = cd.binding;
+ binding.methods = newMethods;
+ }
+ //===================================================
+
+ return cd.binding;
+
+ }
+ public void resolve(BlockScope scope) {
+
+ if (binding != null) {
+ // remember local types binding for innerclass emulation propagation
+ scope.referenceCompilationUnit().record((LocalTypeBinding)binding);
+ }
+ // scope and binding are provided in updateBindingSuperclass
+ resolve();
+ updateMaxFieldCount();
+ }
+
+ public String toString(int tab) {
+
+ return toStringBody(tab);
+ }
+
+ /**
+ * Iteration for a local anonymous innertype
+ *
+ */
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, blockScope)) {
+
+ int fieldsLength;
+ int methodsLength;
+ int memberTypesLength;
+
+ // is bound to the actual type from the allocation expression
+ // therefore it has already been iterated at this point.
+
+ if (memberTypes != null) {
+ memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ // local type cannot have static fields
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ } catch (AbortType e) {
+ }
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java
new file mode 100644
index 0000000..27da26c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class Argument extends LocalDeclaration {
+
+ public Argument(char[] name, long posNom, TypeReference tr, int modifiers) {
+
+ super(null, name, (int) (posNom >>> 32), (int) posNom);
+ this.declarationSourceEnd = (int) posNom;
+ this.modifiers = modifiers;
+ type = tr;
+ this.bits |= IsLocalDeclarationReachableMASK;
+ }
+
+ public void bind(MethodScope scope, TypeBinding typeBinding, boolean used) {
+
+ if (this.type != null)
+ this.type.resolvedType = typeBinding;
+ // record the resolved type into the type reference
+ int modifierFlag = this.modifiers;
+ if ((this.binding = scope.duplicateName(this.name)) != null) {
+ //the name already exist....may carry on with the first binding ....
+ scope.problemReporter().redefineArgument(this);
+ } else {
+ scope.addLocalVariable(
+ this.binding =
+ new LocalVariableBinding(this, typeBinding, modifierFlag, true));
+ //true stand for argument instead of just local
+ if (typeBinding != null && isTypeUseDeprecated(typeBinding, scope))
+ scope.problemReporter().deprecatedType(typeBinding, this.type);
+ this.binding.declaration = this;
+ this.binding.useFlag = used ? LocalVariableBinding.USED : LocalVariableBinding.UNUSED;
+ }
+ }
+
+ public TypeBinding resolveForCatch(BlockScope scope) {
+
+ // resolution on an argument of a catch clause
+ // provide the scope with a side effect : insertion of a LOCAL
+ // that represents the argument. The type must be from JavaThrowable
+
+ TypeBinding tb = type.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
+ if (tb == null)
+ return null;
+ if ((binding = scope.duplicateName(name)) != null) {
+ // the name already exists....may carry on with the first binding ....
+ scope.problemReporter().redefineArgument(this);
+ return null;
+ }
+ binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var (where isArgument = false)
+ scope.addLocalVariable(binding);
+ binding.constant = NotAConstant;
+ return tb;
+ }
+
+ public String toString(int tab) {
+
+ String s = ""; //$NON-NLS-1$
+ if (modifiers != AccDefault) {
+ s += modifiersString(modifiers);
+ }
+ if (type == null) {
+ s += " "; //$NON-NLS-1$
+ } else {
+ s += type.toString(tab) + " "; //$NON-NLS-1$
+ }
+ s += new String(name);
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ if (type != null)
+ type.traverse(visitor, scope);
+ if (initialization != null)
+ initialization.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java
new file mode 100644
index 0000000..9adf04f
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class ArrayAllocationExpression extends Expression {
+
+ public TypeReference type;
+
+ //dimensions.length gives the number of dimensions, but the
+ // last ones may be nulled as in new int[4][5][][]
+ public Expression[] dimensions;
+ public ArrayInitializer initializer;
+
+ /**
+ * ArrayAllocationExpression constructor comment.
+ */
+ public ArrayAllocationExpression() {
+ super();
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+ for (int i = 0, max = dimensions.length; i < max; i++) {
+ Expression dim;
+ if ((dim = dimensions[i]) != null) {
+ flowInfo = dim.analyseCode(currentScope, flowContext, flowInfo);
+ }
+ }
+ if (initializer != null) {
+ return initializer.analyseCode(currentScope, flowContext, flowInfo);
+ } else {
+ return flowInfo;
+ }
+ }
+
+ /**
+ * Code generation for a array allocation expression
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+//
+// if (initializer != null) {
+// initializer.generateCode(currentScope, codeStream, valueRequired);
+// return;
+// }
+//
+// int nonNullDimensionsLength = 0;
+// for (int i = 0, max = dimensions.length; i < max; i++)
+// if (dimensions[i] != null) {
+// dimensions[i].generateCode(currentScope, codeStream, true);
+// nonNullDimensionsLength++;
+// }
+//
+// // Generate a sequence of bytecodes corresponding to an array allocation
+// if (this.resolvedType.dimensions() == 1) {
+// // Mono-dimensional array
+// codeStream.newArray(currentScope, (ArrayBinding)this.resolvedType);
+// } else {
+// // Multi-dimensional array
+// codeStream.multianewarray(this.resolvedType, nonNullDimensionsLength);
+// }
+//
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// } else {
+// codeStream.pop();
+// }
+//
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ output.append("new "); //$NON-NLS-1$
+ type.print(0, output);
+ for (int i = 0; i < dimensions.length; i++) {
+ if (dimensions[i] == null)
+ output.append("[]"); //$NON-NLS-1$
+ else {
+ output.append('[');
+ dimensions[i].printExpression(0, output);
+ output.append(']');
+ }
+ }
+ if (initializer != null) initializer.printExpression(0, output);
+ return output;
+ }
+ public TypeBinding resolveType(BlockScope scope) {
+
+ // Build an array type reference using the current dimensions
+ // The parser does not check for the fact that dimension may be null
+ // only at the -end- like new int [4][][]. The parser allows new int[][4][]
+ // so this must be checked here......(this comes from a reduction to LL1 grammar)
+
+ TypeBinding referenceType = type.resolveType(scope);
+
+ // will check for null after dimensions are checked
+ constant = Constant.NotAConstant;
+ if (referenceType == VoidBinding) {
+ scope.problemReporter().cannotAllocateVoidArray(this);
+ referenceType = null;
+ }
+
+ // check the validity of the dimension syntax (and test for all null dimensions)
+ int explicitDimIndex = -1;
+ for (int i = dimensions.length; --i >= 0;) {
+ if (dimensions[i] != null) {
+ if (explicitDimIndex < 0) explicitDimIndex = i;
+ } else if (explicitDimIndex> 0) {
+ // should not have an empty dimension before an non-empty one
+ scope.problemReporter().incorrectLocationForEmptyDimension(this, i);
+ }
+ }
+
+ // explicitDimIndex < 0 says if all dimensions are nulled
+ // when an initializer is given, no dimension must be specified
+ if (initializer == null) {
+ if (explicitDimIndex < 0) {
+ scope.problemReporter().mustDefineDimensionsOrInitializer(this);
+ }
+ } else if (explicitDimIndex >= 0) {
+ scope.problemReporter().cannotDefineDimensionsAndInitializer(this);
+ }
+
+ // dimensions resolution
+ for (int i = 0; i <= explicitDimIndex; i++) {
+ if (dimensions[i] != null) {
+ TypeBinding dimensionType = dimensions[i].resolveTypeExpecting(scope, IntBinding);
+ if (dimensionType != null) {
+ dimensions[i].implicitWidening(IntBinding, dimensionType);
+ }
+ }
+ }
+
+ // building the array binding
+ if (referenceType != null) {
+ if (dimensions.length > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ this.resolvedType = scope.createArray(referenceType, dimensions.length);
+
+ // check the initializer
+ if (initializer != null) {
+ if ((initializer.resolveTypeExpecting(scope, this.resolvedType)) != null)
+ initializer.binding = (ArrayBinding)this.resolvedType;
+ }
+ }
+ return this.resolvedType;
+ }
+
+ public String toStringExpression() {
+
+ String s = "new " + type.toString(0); //$NON-NLS-1$
+ for (int i = 0; i < dimensions.length; i++) {
+ if (dimensions[i] == null)
+ s = s + "[]"; //$NON-NLS-1$
+ else
+ s = s + "[" + dimensions[i].toStringExpression() + "]"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ if (initializer != null)
+ s = s + initializer.toStringExpression();
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ int dimensionsLength = dimensions.length;
+ type.traverse(visitor, scope);
+ for (int i = 0; i < dimensionsLength; i++) {
+ if (dimensions[i] != null)
+ dimensions[i].traverse(visitor, scope);
+ }
+ if (initializer != null)
+ initializer.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java
new file mode 100644
index 0000000..1e16c28
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java
@@ -0,0 +1,218 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ArrayInitializer extends Expression {
+ public Expression[] expressions;
+
+ public ArrayBinding binding; //the type of the { , , , }
+
+ /**
+ * ArrayInitializer constructor comment.
+ */
+ public ArrayInitializer() {
+ super();
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ if (expressions != null) {
+ for (int i = 0, max = expressions.length; i < max; i++) {
+ flowInfo = expressions[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ }
+ return flowInfo;
+ }
+
+ /**
+ * Code generation for a array initializer
+ */
+ //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ // // Flatten the values and compute the dimensions, by iterating in depth into nested array initializers
+ //
+ // int pc = codeStream.position;
+ // int expressionLength = (expressions == null) ? 0: expressions.length;
+ // codeStream.generateInlinedValue(expressionLength);
+ // codeStream.newArray(currentScope, binding);
+ // if (expressions != null) {
+ // // binding is an ArrayType, so I can just deal with the dimension
+ // int elementsTypeID = binding.dimensions > 1 ? -1 : binding.leafComponentType.id;
+ // for (int i = 0; i < expressionLength; i++) {
+ // Expression expr;
+ // if ((expr = expressions[i]).constant != NotAConstant) {
+ // switch (elementsTypeID) { // filter out initializations to default values
+ // case T_int :
+ // case T_short :
+ // case T_byte :
+ // case T_char :
+ // case T_long :
+ // if (expr.constant.longValue() != 0) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // break;
+ // case T_float :
+ // case T_double :
+ // double constantValue = expr.constant.doubleValue();
+ // if (constantValue == -0.0 || constantValue != 0) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // break;
+ // case T_boolean :
+ // if (expr.constant.booleanValue() != false) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // break;
+ // default :
+ // if (!(expr instanceof NullLiteral)) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // }
+ // } else if (!(expr instanceof NullLiteral)) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // }
+ // }
+ // if (!valueRequired) {
+ // codeStream.pop();
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ //}
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ output.append('{');
+ if (expressions != null) {
+ int j = 20;
+ for (int i = 0; i < expressions.length; i++) {
+ if (i > 0)
+ output.append(", "); //$NON-NLS-1$
+ expressions[i].printExpression(0, output);
+ j--;
+ if (j == 0) {
+ output.append('\n');
+ printIndent(indent + 1, output);
+ j = 20;
+ }
+ }
+ }
+ return output.append('}');
+ }
+
+ public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedTb) {
+ // Array initializers can only occur on the right hand side of an assignment
+ // expression, therefore the expected type contains the valid information
+ // concerning the type that must be enforced by the elements of the array initializer.
+
+ // this method is recursive... (the test on isArrayType is the stop case)
+
+ constant = NotAConstant;
+ if (expectedTb.isArrayType()) {
+ binding = (ArrayBinding) expectedTb;
+ if (expressions == null)
+ return binding;
+ TypeBinding expectedElementsTb = binding.elementsType(scope);
+ if (expectedElementsTb.isBaseType()) {
+ for (int i = 0, length = expressions.length; i < length; i++) {
+ Expression expression = expressions[i];
+ TypeBinding expressionTb = (expression instanceof ArrayInitializer) ? expression.resolveTypeExpecting(scope,
+ expectedElementsTb) : expression.resolveType(scope);
+ if (expressionTb == null)
+ return null;
+
+ // Compile-time conversion required?
+ if (expression.isConstantValueOfTypeAssignableToType(expressionTb, expectedElementsTb)) {
+ expression.implicitWidening(expectedElementsTb, expressionTb);
+ } else if (BaseTypeBinding.isWidening(expectedElementsTb.id, expressionTb.id)) {
+ expression.implicitWidening(expectedElementsTb, expressionTb);
+ } else {
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionTb, expectedElementsTb);
+ return null;
+ }
+ }
+ } else {
+ for (int i = 0, length = expressions.length; i < length; i++)
+ if (expressions[i].resolveTypeExpecting(scope, expectedElementsTb) == null)
+ return null;
+ }
+ return binding;
+ }
+
+ // infer initializer type for error reporting based on first element
+ TypeBinding leafElementType = null;
+ int dim = 1;
+ if (expressions == null) {
+ leafElementType = scope.getJavaLangObject();
+ } else {
+ Expression currentExpression = expressions[0];
+ while (currentExpression != null && currentExpression instanceof ArrayInitializer) {
+ dim++;
+ Expression[] subExprs = ((ArrayInitializer) currentExpression).expressions;
+ if (subExprs == null) {
+ leafElementType = scope.getJavaLangObject();
+ currentExpression = null;
+ break;
+ }
+ currentExpression = ((ArrayInitializer) currentExpression).expressions[0];
+ }
+ if (currentExpression != null) {
+ leafElementType = currentExpression.resolveType(scope);
+ }
+ }
+ if (leafElementType != null) {
+ TypeBinding probableTb = scope.createArray(leafElementType, dim);
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(this, probableTb, expectedTb);
+ }
+ return null;
+ }
+
+ public String toStringExpression() {
+
+ String s = "{"; //$NON-NLS-1$
+ if (expressions != null) {
+ int j = 20;
+ for (int i = 0; i < expressions.length; i++) {
+ s = s + expressions[i].toStringExpression() + ","; //$NON-NLS-1$
+ j--;
+ if (j == 0) {
+ s = s + "\n ";j = 20;}}}; //$NON-NLS-1$
+ s = s + "}"; //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (expressions != null) {
+ int expressionsLength = expressions.length;
+ for (int i = 0; i < expressionsLength; i++)
+ expressions[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
new file mode 100644
index 0000000..26e133c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
+ int dimensions;
+public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
+ super( sources , poss);
+ dimensions = dim ;
+}
+public ArrayQualifiedTypeReference(char[][] sources , TypeBinding tb, int dim, long[] poss) {
+ super( sources , tb, poss);
+ dimensions = dim ;
+}
+public int dimensions() {
+ return dimensions;
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ if (dimensions > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ return scope.createArray(scope.getType(tokens), dimensions);
+}
+public String toStringExpression(int tab){
+ /* slow speed */
+
+ String s = super.toStringExpression(tab) ;
+ if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
+ for (int i=1 ; i <= dimensions ; i++)
+ s = s + "[]" ; //$NON-NLS-1$
+ return s ;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java
new file mode 100644
index 0000000..5d49323
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ArrayReference extends Reference {
+
+ public Expression receiver;
+ public Expression position;
+
+ public ArrayReference(Expression rec, Expression pos) {
+ this.receiver = rec;
+ this.position = pos;
+ sourceStart = rec.sourceStart;
+ }
+
+ public FlowInfo analyseAssignment(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo,
+ Assignment assignment,
+ boolean compoundAssignment) {
+
+ if (assignment.expression == null) {
+ return analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ } else {
+ return assignment
+ .expression
+ .analyseCode(
+ currentScope,
+ flowContext,
+ analyseCode(currentScope, flowContext, flowInfo).unconditionalInits())
+ .unconditionalInits();
+ }
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return position.analyseCode(
+ currentScope,
+ flowContext,
+ receiver.analyseCode(currentScope, flowContext, flowInfo));
+ }
+
+// public void generateAssignment(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Assignment assignment,
+// boolean valueRequired) {
+//
+// receiver.generateCode(currentScope, codeStream, true);
+// position.generateCode(currentScope, codeStream, true);
+// assignment.expression.generateCode(currentScope, codeStream, true);
+// codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(assignment.implicitConversion);
+// }
+// }
+
+ /**
+ * Code generation for a array reference
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// receiver.generateCode(currentScope, codeStream, true);
+// position.generateCode(currentScope, codeStream, true);
+// codeStream.arrayAt(this.resolvedType.id);
+// // Generating code for the potential runtime type checking
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// } else {
+// if (this.resolvedType == LongBinding
+// || this.resolvedType == DoubleBinding) {
+// codeStream.pop2();
+// } else {
+// codeStream.pop();
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+//
+// public void generateCompoundAssignment(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Expression expression,
+// int operator,
+// int assignmentImplicitConversion,
+// boolean valueRequired) {
+//
+// receiver.generateCode(currentScope, codeStream, true);
+// position.generateCode(currentScope, codeStream, true);
+// codeStream.dup2();
+// codeStream.arrayAt(this.resolvedType.id);
+// int operationTypeID;
+// if ((operationTypeID = implicitConversion >> 4) == T_String) {
+// codeStream.generateStringAppend(currentScope, null, expression);
+// } else {
+// // promote the array reference to the suitable operation type
+// codeStream.generateImplicitConversion(implicitConversion);
+// // generate the increment value (will by itself be promoted to the operation value)
+// if (expression == IntLiteral.One) { // prefix operation
+// codeStream.generateConstant(expression.constant, implicitConversion);
+// } else {
+// expression.generateCode(currentScope, codeStream, true);
+// }
+// // perform the operation
+// codeStream.sendOperator(operator, operationTypeID);
+// // cast the value back to the array reference type
+// codeStream.generateImplicitConversion(assignmentImplicitConversion);
+// }
+// codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
+// }
+//
+// public void generatePostIncrement(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// CompoundAssignment postIncrement,
+// boolean valueRequired) {
+//
+// receiver.generateCode(currentScope, codeStream, true);
+// position.generateCode(currentScope, codeStream, true);
+// codeStream.dup2();
+// codeStream.arrayAt(this.resolvedType.id);
+// if (valueRequired) {
+// if ((this.resolvedType == LongBinding)
+// || (this.resolvedType == DoubleBinding)) {
+// codeStream.dup2_x2();
+// } else {
+// codeStream.dup_x2();
+// }
+// }
+// codeStream.generateConstant(
+// postIncrement.expression.constant,
+// implicitConversion);
+// codeStream.sendOperator(postIncrement.operator, this.resolvedType.id);
+// codeStream.generateImplicitConversion(
+// postIncrement.assignmentImplicitConversion);
+// codeStream.arrayAtPut(this.resolvedType.id, false);
+// }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ receiver.printExpression(0, output).append('[');
+ return position.printExpression(0, output).append(']');
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ constant = Constant.NotAConstant;
+ TypeBinding arrayType = receiver.resolveType(scope);
+ if (arrayType != null) {
+ if (arrayType.isArrayType()) {
+ this.resolvedType = ((ArrayBinding) arrayType).elementsType(scope);
+ } else {
+ scope.problemReporter().referenceMustBeArrayTypeAt(arrayType, this);
+ }
+ }
+ TypeBinding positionType = position.resolveTypeExpecting(scope, IntBinding);
+ if (positionType != null) {
+ position.implicitWidening(IntBinding, positionType);
+ }
+ return this.resolvedType;
+ }
+
+ public String toStringExpression() {
+
+ return receiver.toStringExpression() + "[" //$NON-NLS-1$
+ +position.toStringExpression() + "]"; //$NON-NLS-1$
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ receiver.traverse(visitor, scope);
+ position.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java
new file mode 100644
index 0000000..fb4d932
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ArrayTypeReference extends SingleTypeReference {
+ public int dimensions;
+/**
+ * ArrayTypeReference constructor comment.
+ * @param source char[]
+ * @param dim int
+ * @param pos int
+ */
+public ArrayTypeReference(char[] source, int dim, long pos) {
+ super(source, pos);
+ dimensions = dim ;
+}
+public ArrayTypeReference(char[] source, TypeBinding tb, int dim, long pos) {
+ super(source, tb, pos);
+ dimensions = dim ;}
+public int dimensions() {
+ return dimensions;
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ if (dimensions > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ return scope.createArray(scope.getType(token), dimensions);
+
+}
+public String toStringExpression(int tab){
+
+ String s = super.toStringExpression(tab) ;
+ if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
+ for (int i=1 ; i <= dimensions ; i++)
+ s = s + "[]" ; //$NON-NLS-1$
+ return s ;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java
new file mode 100644
index 0000000..87f61e8
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class AssertStatement extends Statement {
+
+ public Expression assertExpression, exceptionArgument;
+
+ // for local variable attribute
+ int preAssertInitStateIndex = -1;
+ private FieldBinding assertionSyntheticFieldBinding;
+
+ public AssertStatement(
+ Expression exceptionArgument,
+ Expression assertExpression,
+ int startPosition) {
+
+ this.assertExpression = assertExpression;
+ this.exceptionArgument = exceptionArgument;
+ sourceStart = startPosition;
+ sourceEnd = exceptionArgument.sourceEnd;
+ }
+
+ public AssertStatement(Expression assertExpression, int startPosition) {
+
+ this.assertExpression = assertExpression;
+ sourceStart = startPosition;
+ sourceEnd = assertExpression.sourceEnd;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ preAssertInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
+
+ Constant cst = this.assertExpression.optimizedBooleanConstant();
+ boolean isOptimizedTrueAssertion = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isOptimizedFalseAssertion = cst != NotAConstant && cst.booleanValue() == false;
+
+ FlowInfo assertInfo = flowInfo.copy();
+ if (isOptimizedTrueAssertion) {
+ assertInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ assertInfo = assertExpression.analyseCode(currentScope, flowContext, assertInfo).unconditionalInits();
+
+ if (exceptionArgument != null) {
+ // only gets evaluated when escaping - results are not taken into account
+ FlowInfo exceptionInfo = exceptionArgument.analyseCode(currentScope, flowContext, assertInfo.copy());
+
+ if (!isOptimizedTrueAssertion){
+ flowContext.checkExceptionHandlers(
+ currentScope.getJavaLangAssertionError(),
+ this,
+ exceptionInfo,
+ currentScope);
+ }
+ }
+
+ // add the assert support in the clinit
+ manageSyntheticAccessIfNecessary(currentScope);
+ if (isOptimizedFalseAssertion) {
+ return flowInfo; // if assertions are enabled, the following code will be unreachable
+ } else {
+ return flowInfo.mergedWith(assertInfo.unconditionalInits());
+ }
+ }
+
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+//
+// if (this.assertionSyntheticFieldBinding != null) {
+// Label assertionActivationLabel = new Label(codeStream);
+// codeStream.getstatic(this.assertionSyntheticFieldBinding);
+// codeStream.ifne(assertionActivationLabel);
+// Label falseLabel = new Label(codeStream);
+// assertExpression.generateOptimizedBoolean(currentScope, codeStream, (falseLabel = new Label(codeStream)), null , true);
+// codeStream.newJavaLangAssertionError();
+// codeStream.dup();
+// if (exceptionArgument != null) {
+// exceptionArgument.generateCode(currentScope, codeStream, true);
+// codeStream.invokeJavaLangAssertionErrorConstructor(exceptionArgument.implicitConversion & 0xF);
+// } else {
+// codeStream.invokeJavaLangAssertionErrorDefaultConstructor();
+// }
+// codeStream.athrow();
+// falseLabel.place();
+// assertionActivationLabel.place();
+// }
+//
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (preAssertInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(currentScope, preAssertInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output);
+ output.append("assert "); //$NON-NLS-1$
+ this.assertExpression.printExpression(0, output);
+ if (this.exceptionArgument != null) {
+ output.append(": "); //$NON-NLS-1$
+ this.exceptionArgument.printExpression(0, output);
+ }
+ return output.append(';');
+ }
+ public void resolve(BlockScope scope) {
+
+ assertExpression.resolveTypeExpecting(scope, BooleanBinding);
+ if (exceptionArgument != null) {
+ TypeBinding exceptionArgumentType = exceptionArgument.resolveType(scope);
+ if (exceptionArgumentType != null){
+ if (exceptionArgumentType.id == T_void){
+ scope.problemReporter().illegalVoidExpression(exceptionArgument);
+ }
+ exceptionArgument.implicitConversion = (exceptionArgumentType.id << 4) + exceptionArgumentType.id;
+ }
+ }
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ assertExpression.traverse(visitor, scope);
+ if (exceptionArgument != null) {
+ exceptionArgument.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
+
+ // need assertion flag: $assertionsDisabled on outer most source clas
+ // (in case of static member of interface, will use the outermost static member - bug 22334)
+ SourceTypeBinding outerMostClass = currentScope.enclosingSourceType();
+ while (outerMostClass.isLocalType()){
+ ReferenceBinding enclosing = outerMostClass.enclosingType();
+ if (enclosing == null || enclosing.isInterface()) break;
+ outerMostClass = (SourceTypeBinding) enclosing;
+ }
+
+ this.assertionSyntheticFieldBinding = outerMostClass.addSyntheticField(this, currentScope);
+
+ // find and enable assertion support
+ TypeDeclaration typeDeclaration = outerMostClass.scope.referenceType();
+ AbstractMethodDeclaration[] methods = typeDeclaration.methods;
+ for (int i = 0, max = methods.length; i < max; i++) {
+ AbstractMethodDeclaration method = methods[i];
+ if (method.isClinit()) {
+ ((Clinit) method).addSupportForAssertion(assertionSyntheticFieldBinding);
+ break;
+ }
+ }
+ }
+
+ public String toString(int tab) {
+
+ StringBuffer buffer = new StringBuffer(tabString(tab));
+ buffer.append("assert "); //$NON-NLS-1$
+ buffer.append(this.assertExpression);
+ if (this.exceptionArgument != null) {
+ buffer.append(":"); //$NON-NLS-1$
+ buffer.append(this.exceptionArgument);
+ buffer.append(";"); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java
new file mode 100644
index 0000000..90a58c8
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Genady Beriozkin - added support for reporting assignment with no effect
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class Assignment extends Expression {
+
+ public Expression lhs;
+ public Expression expression;
+
+ public Assignment(Expression lhs, Expression expression, int sourceEnd) {
+ //lhs is always a reference by construction ,
+ //but is build as an expression ==> the checkcast cannot fail
+
+ this.lhs = lhs;
+ lhs.bits |= IsStrictlyAssignedMASK; // tag lhs as assigned
+
+ this.expression = expression;
+
+ this.sourceStart = lhs.sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+ // record setting a variable: various scenarii are possible, setting an array reference,
+ // a field reference, a blank final field reference, a field of an enclosing instance or
+ // just a local variable.
+
+ return ((Reference) lhs)
+ .analyseAssignment(currentScope, flowContext, flowInfo, this, false)
+ .unconditionalInits();
+ }
+
+ void checkAssignmentEffect(BlockScope scope) {
+
+ Binding left = getDirectBinding(this.lhs);
+ if (left != null && left == getDirectBinding(this.expression)) {
+ scope.problemReporter().assignmentHasNoEffect(this, left.shortReadableName());
+ this.bits |= IsAssignmentWithNoEffectMASK; // record assignment has no effect
+ }
+ }
+
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// // various scenarii are possible, setting an array reference,
+// // a field reference, a blank final field reference, a field of an enclosing instance or
+// // just a local variable.
+//
+// int pc = codeStream.position;
+// if ((this.bits & IsAssignmentWithNoEffectMASK) != 0) {
+// if (valueRequired) {
+// this.expression.generateCode(currentScope, codeStream, true);
+// }
+// } else {
+// ((Reference) lhs).generateAssignment(currentScope, codeStream, this, valueRequired);
+// // variable may have been optimized out
+// // the lhs is responsible to perform the implicitConversion generation for the assignment since optimized for unused local assignment.
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ Binding getDirectBinding(Expression someExpression) {
+ if (someExpression instanceof SingleNameReference) {
+ return ((SingleNameReference)someExpression).binding;
+ } else if (someExpression instanceof FieldReference) {
+ FieldReference fieldRef = (FieldReference)someExpression;
+ if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) {
+ return fieldRef.binding;
+ }
+ }
+ return null;
+ }
+ public StringBuffer print(int indent, StringBuffer output) {
+
+ //no () when used as a statement
+ printIndent(indent, output);
+ return printExpressionNoParenthesis(indent, output);
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ //subclass redefine printExpressionNoParenthesis()
+ output.append('(');
+ return printExpressionNoParenthesis(0, output).append(')');
+ }
+
+ public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+
+ lhs.printExpression(indent, output).append(" = "); //$NON-NLS-1$
+ return expression.printExpression(0, output);
+ }
+
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ //no () when used as a statement
+ return print(indent, output).append(';');
+ }
+ public TypeBinding resolveType(BlockScope scope) {
+
+ // due to syntax lhs may be only a NameReference, a FieldReference or an ArrayReference
+ constant = NotAConstant;
+ if (!(this.lhs instanceof Reference)) {
+ scope.problemReporter().expressionShouldBeAVariable(this.lhs);
+ }
+ this.resolvedType = lhs.resolveType(scope); // expressionType contains the assignment type (lhs Type)
+ TypeBinding rhsType = expression.resolveType(scope);
+ if (this.resolvedType == null || rhsType == null) {
+ return null;
+ }
+ checkAssignmentEffect(scope);
+
+ // Compile-time conversion of base-types : implicit narrowing integer into byte/short/character
+ // may require to widen the rhs expression at runtime
+ if ((expression.isConstantValueOfTypeAssignableToType(rhsType, this.resolvedType)
+ || (this.resolvedType.isBaseType() && BaseTypeBinding.isWidening(this.resolvedType.id, rhsType.id)))
+ || rhsType.isCompatibleWith(this.resolvedType)) {
+ expression.implicitWidening(this.resolvedType, rhsType);
+ return this.resolvedType;
+ }
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
+ expression,
+ rhsType,
+ this.resolvedType);
+ return this.resolvedType;
+ }
+
+ public String toString(int tab) {
+
+ //no () when used as a statement
+ return tabString(tab) + toStringExpressionNoParenthesis();
+ }
+
+ public String toStringExpression() {
+
+ //subclass redefine toStringExpressionNoParenthesis()
+ return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+
+ public String toStringExpressionNoParenthesis() {
+
+ return lhs.toStringExpression() + " " //$NON-NLS-1$
+ + "=" //$NON-NLS-1$
+ + ((expression.constant != null) && (expression.constant != NotAConstant)
+ ? " /*cst:" + expression.constant.toString() + "*/ " //$NON-NLS-1$ //$NON-NLS-2$
+ : " ") //$NON-NLS-1$
+ + expression.toStringExpression();
+ }
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ expression.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java
new file mode 100644
index 0000000..ce506cb
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java
@@ -0,0 +1,1754 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class BinaryExpression extends OperatorExpression {
+
+ public Expression left, right;
+ public Constant optimizedBooleanConstant;
+
+ public BinaryExpression(Expression left, Expression right, int operator) {
+
+ this.left = left;
+ this.right = right;
+ this.bits |= operator << OperatorSHIFT; // encode operator
+ this.sourceStart = left.sourceStart;
+ this.sourceEnd = right.sourceEnd;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return right
+ .analyseCode(
+ currentScope,
+ flowContext,
+ left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits())
+ .unconditionalInits();
+ }
+
+ public void computeConstant(BlockScope scope, int leftId, int rightId) {
+
+ //compute the constant when valid
+ if ((this.left.constant != Constant.NotAConstant)
+ && (this.right.constant != Constant.NotAConstant)) {
+ try {
+ this.constant =
+ Constant.computeConstantOperation(
+ this.left.constant,
+ leftId,
+ (this.bits & OperatorMASK) >> OperatorSHIFT,
+ this.right.constant,
+ rightId);
+ } catch (ArithmeticException e) {
+ this.constant = Constant.NotAConstant;
+ // 1.2 no longer throws an exception at compile-time
+ //scope.problemReporter().compileTimeConstantThrowsArithmeticException(this);
+ }
+ } else {
+ this.constant = Constant.NotAConstant;
+ //add some work for the boolean operators & |
+// this.optimizedBooleanConstant(
+// leftId,
+// (this.bits & OperatorMASK) >> OperatorSHIFT,
+// rightId);
+ }
+ }
+
+ public Constant optimizedBooleanConstant() {
+
+ return this.optimizedBooleanConstant == null ? this.constant : this.optimizedBooleanConstant;
+ }
+
+ /**
+ * Code generation for a binary operation
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// Label falseLabel, endLabel;
+// if (constant != Constant.NotAConstant) {
+// if (valueRequired)
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// bits |= OnlyValueRequiredMASK;
+// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+// case PLUS :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_String :
+// codeStream.generateStringAppend(currentScope, left, right);
+// if (!valueRequired)
+// codeStream.pop();
+// break;
+// case T_int :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.iadd();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.ladd();
+// break;
+// case T_double :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.dadd();
+// break;
+// case T_float :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.fadd();
+// break;
+// }
+// break;
+// case MINUS :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.isub();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lsub();
+// break;
+// case T_double :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.dsub();
+// break;
+// case T_float :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.fsub();
+// break;
+// }
+// break;
+// case MULTIPLY :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.imul();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lmul();
+// break;
+// case T_double :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.dmul();
+// break;
+// case T_float :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.fmul();
+// break;
+// }
+// break;
+// case DIVIDE :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, true);
+// right.generateCode(currentScope, codeStream, true);
+// codeStream.idiv();
+// if (!valueRequired)
+// codeStream.pop();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, true);
+// right.generateCode(currentScope, codeStream, true);
+// codeStream.ldiv();
+// if (!valueRequired)
+// codeStream.pop2();
+// break;
+// case T_double :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.ddiv();
+// break;
+// case T_float :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.fdiv();
+// break;
+// }
+// break;
+// case REMAINDER :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, true);
+// right.generateCode(currentScope, codeStream, true);
+// codeStream.irem();
+// if (!valueRequired)
+// codeStream.pop();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, true);
+// right.generateCode(currentScope, codeStream, true);
+// codeStream.lrem();
+// if (!valueRequired)
+// codeStream.pop2();
+// break;
+// case T_double :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.drem();
+// break;
+// case T_float :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.frem();
+// break;
+// }
+// break;
+// case AND :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// // 0 & x
+// if ((left.constant != Constant.NotAConstant)
+// && (left.constant.typeID() == T_int)
+// && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, false);
+// if (valueRequired)
+// codeStream.iconst_0();
+// } else {
+// // x & 0
+// if ((right.constant != Constant.NotAConstant)
+// && (right.constant.typeID() == T_int)
+// && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, false);
+// if (valueRequired)
+// codeStream.iconst_0();
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.iand();
+// }
+// }
+// break;
+// case T_long :
+// // 0 & x
+// if ((left.constant != Constant.NotAConstant)
+// && (left.constant.typeID() == T_long)
+// && (left.constant.longValue() == 0L)) {
+// right.generateCode(currentScope, codeStream, false);
+// if (valueRequired)
+// codeStream.lconst_0();
+// } else {
+// // x & 0
+// if ((right.constant != Constant.NotAConstant)
+// && (right.constant.typeID() == T_long)
+// && (right.constant.longValue() == 0L)) {
+// left.generateCode(currentScope, codeStream, false);
+// if (valueRequired)
+// codeStream.lconst_0();
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.land();
+// }
+// }
+// break;
+// case T_boolean : // logical and
+// generateOptimizedLogicalAnd(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// /* improving code gen for such a case: boolean b = i < 0 && false;
+// * since the label has never been used, we have the inlined value on the stack. */
+// if (falseLabel.hasForwardReferences()) {
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// } else {
+// falseLabel.place();
+// }
+// }
+// }
+// break;
+// case OR :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// // 0 | x
+// if ((left.constant != Constant.NotAConstant)
+// && (left.constant.typeID() == T_int)
+// && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// // x | 0
+// if ((right.constant != Constant.NotAConstant)
+// && (right.constant.typeID() == T_int)
+// && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.ior();
+// }
+// }
+// break;
+// case T_long :
+// // 0 | x
+// if ((left.constant != Constant.NotAConstant)
+// && (left.constant.typeID() == T_long)
+// && (left.constant.longValue() == 0L)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// // x | 0
+// if ((right.constant != Constant.NotAConstant)
+// && (right.constant.typeID() == T_long)
+// && (right.constant.longValue() == 0L)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lor();
+// }
+// }
+// break;
+// case T_boolean : // logical or
+// generateOptimizedLogicalOr(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// /* improving code gen for such a case: boolean b = i < 0 || true;
+// * since the label has never been used, we have the inlined value on the stack. */
+// if (falseLabel.hasForwardReferences()) {
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// } else {
+// falseLabel.place();
+// }
+// }
+// }
+// break;
+// case XOR :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// // 0 ^ x
+// if ((left.constant != Constant.NotAConstant)
+// && (left.constant.typeID() == T_int)
+// && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// // x ^ 0
+// if ((right.constant != Constant.NotAConstant)
+// && (right.constant.typeID() == T_int)
+// && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.ixor();
+// }
+// }
+// break;
+// case T_long :
+// // 0 ^ x
+// if ((left.constant != Constant.NotAConstant)
+// && (left.constant.typeID() == T_long)
+// && (left.constant.longValue() == 0L)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// // x ^ 0
+// if ((right.constant != Constant.NotAConstant)
+// && (right.constant.typeID() == T_long)
+// && (right.constant.longValue() == 0L)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lxor();
+// }
+// }
+// break;
+// case T_boolean :
+// generateOptimizedLogicalXor(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// /* improving code gen for such a case: boolean b = i < 0 ^ bool;
+// * since the label has never been used, we have the inlined value on the stack. */
+// if (falseLabel.hasForwardReferences()) {
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// } else {
+// falseLabel.place();
+// }
+// }
+// }
+// break;
+// case LEFT_SHIFT :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.ishl();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lshl();
+// }
+// break;
+// case RIGHT_SHIFT :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.ishr();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lshr();
+// }
+// break;
+// case UNSIGNED_RIGHT_SHIFT :
+// switch (bits & ReturnTypeIDMASK) {
+// case T_int :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.iushr();
+// break;
+// case T_long :
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired)
+// codeStream.lushr();
+// }
+// break;
+// case GREATER :
+// generateOptimizedGreaterThan(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// }
+// break;
+// case GREATER_EQUAL :
+// generateOptimizedGreaterThanOrEqual(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// }
+// break;
+// case LESS :
+// generateOptimizedLessThan(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// }
+// break;
+// case LESS_EQUAL :
+// generateOptimizedLessThanOrEqual(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// }
+// }
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ /**
+ * Boolean operator code generation
+ * Optimized operations are: <, <=, >, >=, &, |, ^
+ */
+// public void generateOptimizedBoolean(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
+// super.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// }
+// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+// case LESS :
+// generateOptimizedLessThan(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// case LESS_EQUAL :
+// generateOptimizedLessThanOrEqual(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// case GREATER :
+// generateOptimizedGreaterThan(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// case GREATER_EQUAL :
+// generateOptimizedGreaterThanOrEqual(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// case AND :
+// generateOptimizedLogicalAnd(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// case OR :
+// generateOptimizedLogicalOr(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// case XOR :
+// generateOptimizedLogicalXor(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// }
+// super.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+//
+// /**
+// * Boolean generation for >
+// */
+// public void generateOptimizedGreaterThan(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// int promotedTypeID = left.implicitConversion >> 4;
+// // both sides got promoted in the same way
+// if (promotedTypeID == T_int) {
+// // 0 > x
+// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.iflt(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.ifge(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// // x > 0
+// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.ifgt(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.ifle(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// }
+// // default comparison
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmpgt(trueLabel);
+// break;
+// case T_float :
+// codeStream.fcmpl();
+// codeStream.ifgt(trueLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifgt(trueLabel);
+// break;
+// case T_double :
+// codeStream.dcmpl();
+// codeStream.ifgt(trueLabel);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicit falling through the TRUE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmple(falseLabel);
+// break;
+// case T_float :
+// codeStream.fcmpl();
+// codeStream.ifle(falseLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifle(falseLabel);
+// break;
+// case T_double :
+// codeStream.dcmpl();
+// codeStream.ifle(falseLabel);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+
+ /**
+ * Boolean generation for >=
+ */
+// public void generateOptimizedGreaterThanOrEqual(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// int promotedTypeID = left.implicitConversion >> 4;
+// // both sides got promoted in the same way
+// if (promotedTypeID == T_int) {
+// // 0 >= x
+// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.ifle(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.ifgt(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// // x >= 0
+// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.ifge(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.iflt(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// }
+// // default comparison
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmpge(trueLabel);
+// break;
+// case T_float :
+// codeStream.fcmpl();
+// codeStream.ifge(trueLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifge(trueLabel);
+// break;
+// case T_double :
+// codeStream.dcmpl();
+// codeStream.ifge(trueLabel);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicit falling through the TRUE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmplt(falseLabel);
+// break;
+// case T_float :
+// codeStream.fcmpl();
+// codeStream.iflt(falseLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.iflt(falseLabel);
+// break;
+// case T_double :
+// codeStream.dcmpl();
+// codeStream.iflt(falseLabel);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+//
+// /**
+// * Boolean generation for <
+// */
+// public void generateOptimizedLessThan(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// int promotedTypeID = left.implicitConversion >> 4;
+// // both sides got promoted in the same way
+// if (promotedTypeID == T_int) {
+// // 0 < x
+// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.ifgt(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.ifle(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// // x < 0
+// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.iflt(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.ifge(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// }
+// // default comparison
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmplt(trueLabel);
+// break;
+// case T_float :
+// codeStream.fcmpg();
+// codeStream.iflt(trueLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.iflt(trueLabel);
+// break;
+// case T_double :
+// codeStream.dcmpg();
+// codeStream.iflt(trueLabel);
+// }
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicit falling through the TRUE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmpge(falseLabel);
+// break;
+// case T_float :
+// codeStream.fcmpg();
+// codeStream.ifge(falseLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifge(falseLabel);
+// break;
+// case T_double :
+// codeStream.dcmpg();
+// codeStream.ifge(falseLabel);
+// }
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+//
+// /**
+// * Boolean generation for <=
+// */
+// public void generateOptimizedLessThanOrEqual(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// int promotedTypeID = left.implicitConversion >> 4;
+// // both sides got promoted in the same way
+// if (promotedTypeID == T_int) {
+// // 0 <= x
+// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.ifge(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.iflt(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// // x <= 0
+// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicitly falling through the FALSE case
+// codeStream.ifle(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicitly falling through the TRUE case
+// codeStream.ifgt(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// }
+// // default comparison
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmple(trueLabel);
+// break;
+// case T_float :
+// codeStream.fcmpg();
+// codeStream.ifle(trueLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifle(trueLabel);
+// break;
+// case T_double :
+// codeStream.dcmpg();
+// codeStream.ifle(trueLabel);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// }
+// } else {
+// if (trueLabel == null) {
+// // implicit falling through the TRUE case
+// switch (promotedTypeID) {
+// case T_int :
+// codeStream.if_icmpgt(falseLabel);
+// break;
+// case T_float :
+// codeStream.fcmpg();
+// codeStream.ifgt(falseLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifgt(falseLabel);
+// break;
+// case T_double :
+// codeStream.dcmpg();
+// codeStream.ifgt(falseLabel);
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// return;
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+//
+// /**
+// * Boolean generation for &
+// */
+// public void generateOptimizedLogicalAnd(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// Constant condConst;
+// if ((left.implicitConversion & 0xF) == T_boolean) {
+// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // & x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// } else {
+// // & x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_0();
+// } else {
+// if (falseLabel != null) {
+// // implicit falling through the TRUE case
+// codeStream.goto_(falseLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+// return;
+// }
+// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // x &
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// } else {
+// // x &
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_0();
+// } else {
+// if (falseLabel != null) {
+// // implicit falling through the TRUE case
+// codeStream.goto_(falseLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+// return;
+// }
+// }
+// // default case
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// codeStream.iand();
+// if ((bits & OnlyValueRequiredMASK) == 0) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifne(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifeq(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+//
+// /**
+// * Boolean generation for |
+// */
+// public void generateOptimizedLogicalOr(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// Constant condConst;
+// if ((left.implicitConversion & 0xF) == T_boolean) {
+// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // | x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_1();
+// } else {
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// } else {
+// // | x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// }
+// return;
+// }
+// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // x |
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_1();
+// } else {
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// } else {
+// // x |
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// }
+// return;
+// }
+// }
+// // default case
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// codeStream.ior();
+// if ((bits & OnlyValueRequiredMASK) == 0) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifne(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifeq(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+//
+// /**
+// * Boolean generation for ^
+// */
+// public void generateOptimizedLogicalXor(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// Constant condConst;
+// if ((left.implicitConversion & 0xF) == T_boolean) {
+// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // ^ x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// falseLabel,
+// trueLabel,
+// valueRequired);
+// } else {
+// // ^ x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// }
+// return;
+// }
+// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // x ^
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// falseLabel,
+// trueLabel,
+// valueRequired);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// } else {
+// // x ^
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// }
+// return;
+// }
+// }
+// // default case
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// codeStream.ixor();
+// if ((bits & OnlyValueRequiredMASK) == 0) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifne(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifeq(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+//
+// public void generateOptimizedStringBuffer(
+// BlockScope blockScope,
+// CodeStream codeStream,
+// int typeID) {
+//
+// /* In the case trying to make a string concatenation, there is no need to create a new
+// * string buffer, thus use a lower-level API for code generation involving only the
+// * appending of arguments to the existing StringBuffer
+// */
+//
+// if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
+// && ((bits & ReturnTypeIDMASK) == T_String)) {
+// if (constant != NotAConstant) {
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.invokeStringBufferAppendForType(implicitConversion & 0xF);
+// } else {
+// int pc = codeStream.position;
+// left.generateOptimizedStringBuffer(
+// blockScope,
+// codeStream,
+// left.implicitConversion & 0xF);
+// codeStream.recordPositionsFrom(pc, left.sourceStart);
+// pc = codeStream.position;
+// right.generateOptimizedStringBuffer(
+// blockScope,
+// codeStream,
+// right.implicitConversion & 0xF);
+// codeStream.recordPositionsFrom(pc, right.sourceStart);
+// }
+// } else {
+// super.generateOptimizedStringBuffer(blockScope, codeStream, typeID);
+// }
+// }
+//
+// public void generateOptimizedStringBufferCreation(
+// BlockScope blockScope,
+// CodeStream codeStream,
+// int typeID) {
+//
+// /* In the case trying to make a string concatenation, there is no need to create a new
+// * string buffer, thus use a lower-level API for code generation involving only the
+// * appending of arguments to the existing StringBuffer
+// */
+//
+// if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
+// && ((bits & ReturnTypeIDMASK) == T_String)) {
+// if (constant != NotAConstant) {
+// codeStream.newStringBuffer(); // new: java.lang.StringBuffer
+// codeStream.dup();
+// codeStream.ldc(constant.stringValue());
+// codeStream.invokeStringBufferStringConstructor();
+// // invokespecial: java.lang.StringBuffer.(Ljava.lang.String;)V
+// } else {
+// int pc = codeStream.position;
+// left.generateOptimizedStringBufferCreation(
+// blockScope,
+// codeStream,
+// left.implicitConversion & 0xF);
+// codeStream.recordPositionsFrom(pc, left.sourceStart);
+// pc = codeStream.position;
+// right.generateOptimizedStringBuffer(
+// blockScope,
+// codeStream,
+// right.implicitConversion & 0xF);
+// codeStream.recordPositionsFrom(pc, right.sourceStart);
+// }
+// } else {
+// super.generateOptimizedStringBufferCreation(blockScope, codeStream, typeID);
+// }
+// }
+//
+// public boolean isCompactableOperation() {
+//
+// return true;
+// }
+//
+// public void optimizedBooleanConstant(int leftId, int operator, int rightId) {
+//
+// switch (operator) {
+// case AND :
+// if ((leftId != T_boolean) || (rightId != T_boolean))
+// return;
+// case AND_AND :
+// Constant cst;
+// if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (cst.booleanValue() == false) { // left is equivalent to false
+// optimizedBooleanConstant = cst; // constant(false)
+// return;
+// } else { //left is equivalent to true
+// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+// optimizedBooleanConstant = cst;
+// // the conditional result is equivalent to the right conditional value
+// }
+// return;
+// }
+// }
+// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (cst.booleanValue() == false) { // right is equivalent to false
+// optimizedBooleanConstant = cst; // constant(false)
+// }
+// }
+// return;
+// case OR :
+// if ((leftId != T_boolean) || (rightId != T_boolean))
+// return;
+// case OR_OR :
+// if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (cst.booleanValue() == true) { // left is equivalent to true
+// optimizedBooleanConstant = cst; // constant(true)
+// return;
+// } else { //left is equivalent to false
+// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+// optimizedBooleanConstant = cst;
+// }
+// return;
+// }
+// }
+// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (cst.booleanValue() == true) { // right is equivalent to true
+// optimizedBooleanConstant = cst; // constant(true)
+// }
+// }
+// }
+// }
+ public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+
+ left.printExpression(indent, output).append(' ').append(operatorToString()).append(' ');
+ return right.printExpression(0, output);
+ }
+ public TypeBinding resolveType(BlockScope scope) {
+
+ // use the id of the type to navigate into the table
+ TypeBinding leftTb = left.resolveType(scope);
+ TypeBinding rightTb = right.resolveType(scope);
+ if (leftTb == null || rightTb == null) {
+ constant = Constant.NotAConstant;
+ return null;
+ }
+ int leftId = leftTb.id;
+ int rightId = rightTb.id;
+ if (leftId > 15
+ || rightId > 15) { // must convert String + Object || Object + String
+ if (leftId == T_String) {
+ rightId = T_Object;
+ } else if (rightId == T_String) {
+ leftId = T_Object;
+ } else {
+ constant = Constant.NotAConstant;
+ scope.problemReporter().invalidOperator(this, leftTb, rightTb);
+ return null;
+ }
+ }
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == PLUS) {
+ if (leftId == T_String
+ && rightTb.isArrayType()
+ && ((ArrayBinding) rightTb).elementsType(scope) == CharBinding)
+ scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(
+ right);
+ else if (
+ rightId == T_String
+ && leftTb.isArrayType()
+ && ((ArrayBinding) leftTb).elementsType(scope) == CharBinding)
+ scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(
+ left);
+ }
+
+ // the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
+
+ // Don't test for result = 0. If it is zero, some more work is done.
+ // On the one hand when it is not zero (correct code) we avoid doing the test
+ int result =
+ ResolveTypeTables[(bits & OperatorMASK) >> OperatorSHIFT][(leftId << 4)
+ + rightId];
+ left.implicitConversion = result >>> 12;
+ right.implicitConversion = (result >>> 4) & 0x000FF;
+
+ bits |= result & 0xF;
+ switch (result & 0xF) { // record the current ReturnTypeID
+ // only switch on possible result type.....
+ case T_boolean :
+ this.resolvedType = BooleanBinding;
+ break;
+ case T_byte :
+ this.resolvedType = ByteBinding;
+ break;
+ case T_char :
+ this.resolvedType = CharBinding;
+ break;
+ case T_double :
+ this.resolvedType = DoubleBinding;
+ break;
+ case T_float :
+ this.resolvedType = FloatBinding;
+ break;
+ case T_int :
+ this.resolvedType = IntBinding;
+ break;
+ case T_long :
+ this.resolvedType = LongBinding;
+ break;
+ case T_String :
+ this.resolvedType = scope.getJavaLangString();
+ break;
+ default : //error........
+ constant = Constant.NotAConstant;
+ scope.problemReporter().invalidOperator(this, leftTb, rightTb);
+ return null;
+ }
+
+ // compute the constant when valid
+ computeConstant(scope, leftId, rightId);
+ return this.resolvedType;
+ }
+
+ public String toStringExpressionNoParenthesis() {
+
+ return left.toStringExpression() + " " + //$NON-NLS-1$
+ operatorToString() + " " + //$NON-NLS-1$
+ right.toStringExpression();
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ left.traverse(visitor, scope);
+ right.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
new file mode 100644
index 0000000..30a2c2b
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class Block extends Statement {
+
+ public Statement[] statements;
+ public int explicitDeclarations;
+ // the number of explicit declaration , used to create scope
+ public BlockScope scope;
+ public static final Block None = new Block(0);
+
+ public Block(int explicitDeclarations) {
+ this.explicitDeclarations = explicitDeclarations;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // empty block
+ if (statements == null) return flowInfo;
+ boolean didAlreadyComplain = false;
+ for (int i = 0, max = statements.length; i < max; i++) {
+ Statement stat;
+ if (!flowInfo.complainIfUnreachable(stat = statements[i], scope, didAlreadyComplain)) {
+ flowInfo = stat.analyseCode(scope, flowContext, flowInfo);
+ } else {
+ didAlreadyComplain = true;
+ }
+ }
+ return flowInfo;
+ }
+
+ public static final Block EmptyWith(int sourceStart, int sourceEnd) {
+
+ //return an empty block which position is s and e
+ Block bk = new Block(0);
+ bk.sourceStart = sourceStart;
+ bk.sourceEnd = sourceEnd;
+ return bk;
+ }
+
+ /**
+ * Code generation for a block
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+// if (statements != null) {
+// for (int i = 0, max = statements.length; i < max; i++) {
+// statements[i].generateCode(scope, codeStream);
+// }
+// } // for local variable debug attributes
+// if (scope != currentScope) { // was really associated with its own scope
+// codeStream.exitUserScope(scope);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public boolean isEmptyBlock() {
+
+ return statements == null;
+ }
+ public StringBuffer printBody(int indent, StringBuffer output) {
+
+ if (this.statements == null) return output;
+ for (int i = 0; i < statements.length; i++) {
+ statements[i].printStatement(indent + 1, output);
+ output.append('\n');
+ }
+ return output;
+ }
+
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output);
+ output.append("{\n"); //$NON-NLS-1$
+ printBody(indent, output);
+ return printIndent(indent, output).append('}');
+ }
+ public void resolve(BlockScope upperScope) {
+
+ if (statements != null) {
+ scope =
+ explicitDeclarations == 0
+ ? upperScope
+ : new BlockScope(upperScope, explicitDeclarations);
+ int i = 0, length = statements.length;
+ while (i < length)
+ statements[i++].resolve(scope);
+ }
+ }
+
+ public void resolveUsing(BlockScope givenScope) {
+
+ // this optimized resolve(...) is sent only on none empty blocks
+ scope = givenScope;
+ if (statements != null) {
+ int i = 0, length = statements.length;
+ while (i < length)
+ statements[i++].resolve(scope);
+ }
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ if (this.statements == null) {
+ s += "{\n"; //$NON-NLS-1$
+ s += tabString(tab);
+ s += "}"; //$NON-NLS-1$
+ return s;
+ }
+ s += "{\n"; //$NON-NLS-1$
+ s += this.toStringStatements(tab);
+ s += tabString(tab);
+ s += "}"; //$NON-NLS-1$
+ return s;
+ }
+
+ public String toStringStatements(int tab) {
+
+ if (this.statements == null)
+ return ""; //$NON-NLS-1$
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < statements.length; i++) {
+ buffer.append(statements[i].toString(tab + 1));
+ if (statements[i] instanceof Block) {
+ buffer.append("\n"); //$NON-NLS-1$
+ } else {
+ buffer.append(";\n"); //$NON-NLS-1$
+ }
+ };
+ return buffer.toString();
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ if (statements != null) {
+ int statementLength = statements.length;
+ for (int i = 0; i < statementLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ }
+
+ /**
+ * Dispatch the call on its last statement.
+ */
+ public void branchChainTo(Label label) {
+ if (this.statements != null) {
+ this.statements[statements.length - 1].branchChainTo(label);
+ }
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java
new file mode 100644
index 0000000..245a491
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public abstract class BranchStatement extends Statement {
+ public Expression expression;
+ public Label targetLabel;
+ public ASTNode[] subroutines;
+/**
+ * BranchStatement constructor comment.
+ */
+public BranchStatement(Expression expr, int s,int e) {
+ expression = expr ;
+ sourceStart = s;
+ sourceEnd = e;
+}
+/**
+ * Branch code generation
+ *
+ * generate the finallyInvocationSequence.
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+//
+// // generation of code responsible for invoking the finally
+// // blocks in sequence
+// if (subroutines != null){
+// for (int i = 0, max = subroutines.length; i < max; i++){
+// ASTNode sub;
+// if ((sub = subroutines[i]) instanceof SynchronizedStatement){
+// codeStream.load(((SynchronizedStatement)sub).synchroVariable);
+// codeStream.monitorexit();
+// } else {
+// TryStatement trySub = (TryStatement) sub;
+// if (trySub.subRoutineCannotReturn) {
+// codeStream.goto_(trySub.subRoutineStartLabel);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// } else {
+// codeStream.jsr(trySub.subRoutineStartLabel);
+// }
+// }
+// }
+// }
+// codeStream.goto_(targetLabel);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public void resetStateForCodeGeneration() {
+ if (this.targetLabel != null) {
+ this.targetLabel.resetStateForCodeGeneration();
+ }
+}
+
+public void resolve(BlockScope scope) {
+}
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java
new file mode 100644
index 0000000..a033e1e
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class BreakStatement extends BranchStatement {
+
+ public BreakStatement(Expression expr, int sourceStart, int e) {
+ super(expr, sourceStart, e);
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // here requires to generate a sequence of finally blocks invocations depending corresponding
+ // to each of the traversed try statements, so that execution will terminate properly.
+
+ // lookup the label, this should answer the returnContext
+// FlowContext targetContext = (label == null)
+// ? flowContext.getTargetContextForDefaultBreak()
+// : flowContext.getTargetContextForBreakLabel(label);
+//
+// if (targetContext == null) {
+// if (label == null) {
+// currentScope.problemReporter().invalidBreak(this);
+// } else {
+// currentScope.problemReporter().undefinedLabel(this);
+// }
+// return flowInfo; // pretend it did not break since no actual target
+// }
+//
+// targetLabel = targetContext.breakLabel();
+// FlowContext traversedContext = flowContext;
+// int subIndex = 0, maxSub = 5;
+// subroutines = new ASTNode[maxSub];
+//
+// do {
+// ASTNode sub;
+// if ((sub = traversedContext.subRoutine()) != null) {
+// if (subIndex == maxSub) {
+// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
+// }
+// subroutines[subIndex++] = sub;
+// if (sub.cannotReturn()) {
+// break;
+// }
+// }
+// traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
+//
+// ASTNode node;
+// if ((node = traversedContext.associatedNode) instanceof TryStatement) {
+// TryStatement tryStatement = (TryStatement) node;
+// flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
+// } else if (traversedContext == targetContext) {
+// // only record break info once accumulated through subroutines, and only against target context
+// targetContext.recordBreakFrom(flowInfo);
+// break;
+// }
+// } while ((traversedContext = traversedContext.parent) != null);
+//
+// // resize subroutines
+// if (subIndex != maxSub) {
+// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
+// }
+ return FlowInfo.DEAD_END;
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s += "break "; //$NON-NLS-1$
+ if (expression != null)
+ s += expression.toString();
+ return s;
+ }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("break "); //$NON-NLS-1$
+ if (expression != null) output.append(expression);
+ return output.append(';');
+ }
+ public void traverse(
+ IAbstractSyntaxTreeVisitor visitor,
+ BlockScope blockscope) {
+
+ visitor.visit(this, blockscope);
+ visitor.endVisit(this, blockscope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java
new file mode 100644
index 0000000..976bc66
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.CaseLabel;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class CaseStatement extends Statement {
+
+ public Expression constantExpression;
+ public CaseLabel targetLabel;
+ public CaseStatement(int sourceStart, Expression constantExpression) {
+ this.constantExpression = constantExpression;
+ this.sourceEnd = constantExpression.sourceEnd;
+ this.sourceStart = sourceStart;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ if (constantExpression.constant == NotAConstant)
+ currentScope.problemReporter().caseExpressionMustBeConstant(constantExpression);
+
+ this.constantExpression.analyseCode(currentScope, flowContext, flowInfo);
+ return flowInfo;
+ }
+
+ /**
+ * Case code generation
+ *
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+// targetLabel.place();
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output);
+ if (constantExpression == null) {
+ output.append("default : "); //$NON-NLS-1$
+ } else {
+ output.append("case "); //$NON-NLS-1$
+ constantExpression.printExpression(0, output).append(" : "); //$NON-NLS-1$
+ }
+ return output.append(';');
+ }
+ /**
+ * No-op : should use resolveCase(...) instead.
+ */
+ public void resolve(BlockScope scope) {
+ }
+
+ public Constant resolveCase(
+ BlockScope scope,
+ TypeBinding switchType,
+ SwitchStatement switchStatement) {
+
+ // add into the collection of cases of the associated switch statement
+ switchStatement.cases[switchStatement.caseCount++] = this;
+ TypeBinding caseType = constantExpression.resolveType(scope);
+ if (caseType == null || switchType == null)
+ return null;
+ if (constantExpression.isConstantValueOfTypeAssignableToType(caseType, switchType))
+ return constantExpression.constant;
+ if (caseType.isCompatibleWith(switchType))
+ return constantExpression.constant;
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
+ constantExpression,
+ caseType,
+ switchType);
+ return null;
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s = s + "case " + constantExpression.toStringExpression() + " : "; //$NON-NLS-1$ //$NON-NLS-2$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ constantExpression.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java
new file mode 100644
index 0000000..950716d
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java
@@ -0,0 +1,313 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class CastExpression extends Expression {
+
+ public Expression expression;
+ public Expression type;
+ public boolean needRuntimeCheckcast;
+
+ //expression.implicitConversion holds the cast for baseType casting
+ public CastExpression(Expression e, Expression t) {
+ expression = e;
+ type = t;
+
+ //due to the fact an expression may start with ( and that a cast also start with (
+ //the field is an expression....it can be a TypeReference OR a NameReference Or
+ //an expression <--this last one is invalid.......
+
+ // :-( .............
+
+ //if (type instanceof TypeReference )
+ // flag = IsTypeReference ;
+ //else
+ // if (type instanceof NameReference)
+ // flag = IsNameReference ;
+ // else
+ // flag = IsExpression ;
+
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return expression
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+
+ public final void areTypesCastCompatible(
+ BlockScope scope,
+ TypeBinding castType,
+ TypeBinding expressionType) {
+
+ // see specifications 5.5
+ // handle errors and process constant when needed
+
+ // if either one of the type is null ==>
+ // some error has been already reported some where ==>
+ // we then do not report an obvious-cascade-error.
+
+ needRuntimeCheckcast = false;
+ if (castType == null || expressionType == null) return;
+
+ // identity conversion cannot be performed upfront, due to side-effects
+ // like constant propagation
+
+ if (castType.isBaseType()) {
+ if (expressionType.isBaseType()) {
+ if (expressionType == castType) {
+ expression.implicitWidening(castType, expressionType);
+ constant = expression.constant; //use the same constant
+ return;
+ }
+ if (expressionType.isCompatibleWith(castType)
+ || BaseTypeBinding.isNarrowing(castType.id, expressionType.id)) {
+ expression.implicitConversion = (castType.id << 4) + expressionType.id;
+ if (expression.constant != Constant.NotAConstant)
+ constant = expression.constant.castTo(expression.implicitConversion);
+ return;
+ }
+ }
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ }
+
+ //-----------cast to something which is NOT a base type--------------------------
+ if (expressionType == NullBinding) {
+ // if (castType.isArrayType()){ // 26903 - need checkcast when casting null to array type
+ // needRuntimeCheckcast = true;
+ // }
+ return; //null is compatible with every thing
+ }
+ if (expressionType.isBaseType()) {
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ }
+
+ if (expressionType.isArrayType()) {
+ if (castType == expressionType) return; // identity conversion
+
+ if (castType.isArrayType()) {
+ //------- (castType.isArray) expressionType.isArray -----------
+ TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType(scope);
+ if (exprElementType.isBaseType()) {
+ // <---stop the recursion-------
+ if (((ArrayBinding) castType).elementsType(scope) == exprElementType)
+ needRuntimeCheckcast = true;
+ else
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ }
+ // recursively on the elements...
+ areTypesCastCompatible(
+ scope,
+ ((ArrayBinding) castType).elementsType(scope),
+ exprElementType);
+ return;
+ } else if (
+ castType.isClass()) {
+ //------(castType.isClass) expressionType.isArray ---------------
+ if (scope.isJavaLangObject(castType))
+ return;
+ } else { //------- (castType.isInterface) expressionType.isArray -----------
+ if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
+ needRuntimeCheckcast = true;
+ return;
+ }
+ }
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ }
+
+ if (expressionType.isClass()) {
+ if (castType.isArrayType()) {
+ // ---- (castType.isArray) expressionType.isClass -------
+ if (scope.isJavaLangObject(expressionType)) { // potential runtime error
+ needRuntimeCheckcast = true;
+ return;
+ }
+ } else if (castType.isClass()) { // ----- (castType.isClass) expressionType.isClass ------
+ if (expressionType.isCompatibleWith(castType)){ // no runtime error
+ if (castType.id == T_String) constant = expression.constant; // (String) cst is still a constant
+ return;
+ }
+ if (castType.isCompatibleWith(expressionType)) {
+ // potential runtime error
+ needRuntimeCheckcast = true;
+ return;
+ }
+ } else { // ----- (castType.isInterface) expressionType.isClass -------
+ if (((ReferenceBinding) expressionType).isFinal()) {
+ // no subclass for expressionType, thus compile-time check is valid
+ if (expressionType.isCompatibleWith(castType))
+ return;
+ } else { // a subclass may implement the interface ==> no check at compile time
+ needRuntimeCheckcast = true;
+ return;
+ }
+ }
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ }
+
+ // if (expressionType.isInterface()) { cannot be anything else
+ if (castType.isArrayType()) {
+ // ----- (castType.isArray) expressionType.isInterface ------
+ if (scope.isJavaLangCloneable(expressionType)
+ || scope.isJavaIoSerializable(expressionType)) // potential runtime error
+ needRuntimeCheckcast = true;
+ else
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ } else if (castType.isClass()) { // ----- (castType.isClass) expressionType.isInterface --------
+ if (scope.isJavaLangObject(castType)) // no runtime error
+ return;
+ if (((ReferenceBinding) castType).isFinal()) {
+ // no subclass for castType, thus compile-time check is valid
+ if (!castType.isCompatibleWith(expressionType)) {
+ // potential runtime error
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ return;
+ }
+ }
+ } else { // ----- (castType.isInterface) expressionType.isInterface -------
+ if (castType == expressionType) return; // identity conversion
+ if (Scope.compareTypes(castType, expressionType) == NotRelated) {
+ MethodBinding[] castTypeMethods = ((ReferenceBinding) castType).methods();
+ MethodBinding[] expressionTypeMethods =
+ ((ReferenceBinding) expressionType).methods();
+ int exprMethodsLength = expressionTypeMethods.length;
+ for (int i = 0, castMethodsLength = castTypeMethods.length; i < castMethodsLength; i++)
+ for (int j = 0; j < exprMethodsLength; j++) {
+ if ((castTypeMethods[i].returnType != expressionTypeMethods[j].returnType)
+ && (castTypeMethods[i].selector == expressionTypeMethods[j].selector)
+ && castTypeMethods[i].areParametersEqual(expressionTypeMethods[j])) {
+ scope.problemReporter().typeCastError(this, castType, expressionType);
+ }
+ }
+ }
+ }
+ needRuntimeCheckcast = true;
+ return;
+ }
+
+ /**
+ * Cast expression code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// if (constant != NotAConstant) {
+// if (valueRequired
+// || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
+// codeStream.generateConstant(constant, implicitConversion);
+// if (needRuntimeCheckcast) {
+// codeStream.checkcast(this.resolvedType);
+// if (!valueRequired)
+// codeStream.pop();
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// expression.generateCode(
+// currentScope,
+// codeStream,
+// valueRequired || needRuntimeCheckcast);
+// if (needRuntimeCheckcast) {
+// codeStream.checkcast(this.resolvedType);
+// if (!valueRequired)
+// codeStream.pop();
+// } else {
+// if (valueRequired)
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public Expression innermostCastedExpression(){
+ Expression current = this.expression;
+ while (current instanceof CastExpression) {
+ current = ((CastExpression) current).expression;
+ }
+ return current;
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ output.append('(');
+ type.print(0, output).append(") "); //$NON-NLS-1$
+ return expression.printExpression(0, output);
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+ // compute a new constant if the cast is effective
+
+ // due to the fact an expression may start with ( and that a cast can also start with (
+ // the field is an expression....it can be a TypeReference OR a NameReference Or
+ // any kind of Expression <-- this last one is invalid.......
+
+ constant = Constant.NotAConstant;
+ implicitConversion = T_undefined;
+ if ((type instanceof TypeReference) || (type instanceof NameReference)) {
+ this.resolvedType = type.resolveType(scope);
+ TypeBinding castedExpressionType = expression.resolveType(scope);
+ if (this.resolvedType != null && castedExpressionType != null) {
+ areTypesCastCompatible(scope, this.resolvedType, castedExpressionType);
+ }
+ return this.resolvedType;
+ } else { // expression as a cast !!!!!!!!
+ TypeBinding castedExpressionType = expression.resolveType(scope);
+ if (castedExpressionType == null) return null;
+ scope.problemReporter().invalidTypeReference(type);
+ return null;
+ }
+ }
+
+ public String toStringExpression() {
+
+ return "(" + type.toString(0) + ") " + //$NON-NLS-2$ //$NON-NLS-1$
+ expression.toStringExpression();
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ type.traverse(visitor, blockScope);
+ expression.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java
new file mode 100644
index 0000000..bbd37e2
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
+
+public class Clinit extends AbstractMethodDeclaration {
+
+ public final static char[] ConstantPoolName = "".toCharArray(); //$NON-NLS-1$
+
+ private FieldBinding assertionSyntheticFieldBinding = null;
+ private FieldBinding classLiteralSyntheticField = null;
+
+ public Clinit(CompilationResult compilationResult) {
+ super(compilationResult);
+ modifiers = 0;
+ selector = ConstantPoolName;
+ }
+
+ public void analyseCode(
+ ClassScope classScope,
+ InitializationFlowContext staticInitializerFlowContext,
+ FlowInfo flowInfo) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ ExceptionHandlingFlowContext clinitContext =
+ new ExceptionHandlingFlowContext(
+ staticInitializerFlowContext.parent,
+ this,
+ NoExceptions,
+ scope,
+ FlowInfo.DEAD_END);
+
+ // check for missing returning path
+ this.needFreeReturn = flowInfo.isReachable();
+
+ // check missing blank final field initializations
+ flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
+ FieldBinding[] fields = scope.enclosingSourceType().fields();
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field;
+ if ((field = fields[i]).isStatic()
+ && field.isFinal()
+ && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
+ scope.problemReporter().uninitializedBlankFinalField(
+ field,
+ scope.referenceType().declarationOf(field));
+ // can complain against the field decl, since only one
+ }
+ }
+ // check static initializers thrown exceptions
+ staticInitializerFlowContext.checkInitializerExceptions(
+ scope,
+ clinitContext,
+ flowInfo);
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ /**
+ * Bytecode generation for a method
+ *
+ * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
+ * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
+ */
+// public void generateCode(ClassScope classScope, ClassFile classFile) {
+//
+// int clinitOffset = 0;
+// if (ignoreFurtherInvestigation) {
+// // should never have to add any problem method
+// return;
+// }
+// try {
+// clinitOffset = classFile.contentsOffset;
+// this.generateCode(classScope, classFile, clinitOffset);
+// } catch (AbortMethod e) {
+// // should never occur
+// // the clinit referenceContext is the type declaration
+// // All clinit problems will be reported against the type: AbortType instead of AbortMethod
+// // reset the contentsOffset to the value before generating the clinit code
+// // decrement the number of method info as well.
+// // This is done in the addProblemMethod and addProblemConstructor for other
+// // cases.
+// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
+// // a branch target required a goto_w, restart code gen in wide mode.
+// try {
+// if (statements != null) {
+// for (int i = 0, max = statements.length; i < max; i++)
+// statements[i].resetStateForCodeGeneration();
+// }
+// classFile.contentsOffset = clinitOffset;
+// classFile.methodCount--;
+// classFile.codeStream.wideMode = true; // request wide mode
+// this.generateCode(classScope, classFile, clinitOffset);
+// // restart method generation
+// } catch (AbortMethod e2) {
+// classFile.contentsOffset = clinitOffset;
+// classFile.methodCount--;
+// }
+// } else {
+// // produce a problem method accounting for this fatal error
+// classFile.contentsOffset = clinitOffset;
+// classFile.methodCount--;
+// }
+// }
+// }
+
+ /**
+ * Bytecode generation for a method
+ *
+ * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
+ * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
+ */
+// private void generateCode(
+// ClassScope classScope,
+// ClassFile classFile,
+// int clinitOffset) {
+//
+// ConstantPool constantPool = classFile.constantPool;
+// int constantPoolOffset = constantPool.currentOffset;
+// int constantPoolIndex = constantPool.currentIndex;
+// classFile.generateMethodInfoHeaderForClinit();
+// int codeAttributeOffset = classFile.contentsOffset;
+// classFile.generateCodeAttributeHeader();
+// CodeStream codeStream = classFile.codeStream;
+// this.resolve(classScope);
+//
+// codeStream.reset(this, classFile);
+// TypeDeclaration declaringType = classScope.referenceContext;
+//
+// // initialize local positions - including initializer scope.
+// MethodScope staticInitializerScope = declaringType.staticInitializerScope;
+// staticInitializerScope.computeLocalVariablePositions(0, codeStream);
+//
+// // 1.4 feature
+// // This has to be done before any other initialization
+// if (this.assertionSyntheticFieldBinding != null) {
+// // generate code related to the activation of assertion for this class
+// codeStream.generateClassLiteralAccessForType(
+// classScope.enclosingSourceType(),
+// classLiteralSyntheticField);
+// codeStream.invokeJavaLangClassDesiredAssertionStatus();
+// Label falseLabel = new Label(codeStream);
+// codeStream.ifne(falseLabel);
+// codeStream.iconst_1();
+// Label jumpLabel = new Label(codeStream);
+// codeStream.goto_(jumpLabel);
+// falseLabel.place();
+// codeStream.iconst_0();
+// jumpLabel.place();
+// codeStream.putstatic(this.assertionSyntheticFieldBinding);
+// }
+// // generate initializers
+// 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(staticInitializerScope, codeStream);
+// }
+// }
+// }
+// if (codeStream.position == 0) {
+// // do not need to output a Clinit if no bytecodes
+// // so we reset the offset inside the byte array contents.
+// classFile.contentsOffset = clinitOffset;
+// // like we don't addd a method we need to undo the increment on the method count
+// classFile.methodCount--;
+// // reset the constant pool to its state before the clinit
+// constantPool.resetForClinit(constantPoolIndex, constantPoolOffset);
+// } else {
+// if (this.needFreeReturn) {
+// int oldPosition = codeStream.position;
+// codeStream.return_();
+// codeStream.updateLocalVariablesAttribute(oldPosition);
+// }
+// // Record the end of the clinit: point to the declaration of the class
+// codeStream.recordPositionsFrom(0, declaringType.sourceStart);
+// classFile.completeCodeAttributeForClinit(codeAttributeOffset);
+// }
+// }
+
+ public boolean isClinit() {
+
+ return true;
+ }
+
+ public boolean isInitializationMethod() {
+
+ return true;
+ }
+
+ public boolean isStatic() {
+
+ return true;
+ }
+
+ public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
+ //the clinit is filled by hand ....
+ }
+ public StringBuffer print(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("()"); //$NON-NLS-1$
+ printBody(tab + 1, output);
+ return output;
+ }
+ public void resolve(ClassScope scope) {
+
+ this.scope = new MethodScope(scope, scope.referenceContext, true);
+ }
+
+ public String toString(int tab) {
+
+ String s = ""; //$NON-NLS-1$
+ s = s + tabString(tab);
+ s = s + "()"; //$NON-NLS-1$
+ s = s + toStringStatements(tab + 1);
+ return s;
+ }
+
+ public void traverse(
+ IAbstractSyntaxTreeVisitor visitor,
+ ClassScope classScope) {
+
+ visitor.visit(this, classScope);
+ visitor.endVisit(this, classScope);
+ }
+
+ // 1.4 feature
+ public void addSupportForAssertion(FieldBinding assertionSyntheticFieldBinding) {
+
+ this.assertionSyntheticFieldBinding = assertionSyntheticFieldBinding;
+
+ // we need to add the field right now, because the field infos are generated before the methods
+ SourceTypeBinding sourceType =
+ this.scope.outerMostMethodScope().enclosingSourceType();
+ this.classLiteralSyntheticField =
+ sourceType.addSyntheticField(sourceType, scope);
+ }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java
new file mode 100644
index 0000000..583b11a
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -0,0 +1,347 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+import java.util.ArrayList;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
+import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
+import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
+
+public class CompilationUnitDeclaration extends ASTNode implements ProblemSeverities, ReferenceContext {
+
+ public ImportReference currentPackage;
+ public ImportReference[] imports;
+ // public TypeDeclaration[] types;
+ public ArrayList types;
+
+ //public char[][] name;
+ public int[][] comments;
+
+ public boolean ignoreFurtherInvestigation = false; // once pointless to investigate due to errors
+ public boolean ignoreMethodBodies = false;
+ public CompilationUnitScope scope;
+ public ProblemReporter problemReporter;
+ public CompilationResult compilationResult;
+
+ private LocalTypeBinding[] localTypes;
+ int localTypeCount = 0;
+
+ public boolean isPropagatingInnerClassEmulation;
+
+ public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
+
+ this.problemReporter = problemReporter;
+ this.compilationResult = compilationResult;
+ this.types = new ArrayList();
+ //by definition of a compilation unit....
+ sourceStart = 0;
+ sourceEnd = sourceLength - 1;
+ }
+
+ /*
+ * We cause the compilation task to abort to a given extent.
+ */
+ public void abort(int abortLevel) {
+
+ switch (abortLevel) {
+ case AbortType :
+ throw new AbortType(compilationResult);
+ case AbortMethod :
+ throw new AbortMethod(compilationResult);
+ default :
+ throw new AbortCompilationUnit(compilationResult);
+ }
+ }
+
+ /*
+ * Dispatch code analysis AND request saturation of inner emulation
+ */
+ public void analyseCode() {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (types != null) {
+ for (int i = 0, count = types.size(); i < count; i++) {
+ if (types.get(i) instanceof TypeDeclaration)
+ ((TypeDeclaration) types.get(i)).analyseCode(scope);
+ }
+ }
+ // request inner emulation propagation
+ propagateInnerEmulationForAllLocalTypes();
+ } catch (AbortCompilationUnit e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+ }
+
+ /*
+ * When unit result is about to be accepted, removed back pointers
+ * to compiler structures.
+ */
+ public void cleanUp() {
+ if (this.types != null) {
+ for (int i = 0, max = this.types.size(); i < max; i++) {
+ if (this.types.get(i) instanceof TypeDeclaration) {
+ cleanUp((TypeDeclaration) this.types.get(i));
+ }
+ }
+ for (int i = 0, max = this.localTypeCount; i < max; i++) {
+ // null out the type's scope backpointers
+ localTypes[i].scope = null; // local members are already in the list
+ }
+ }
+ // ClassFile[] classFiles = compilationResult.getClassFiles();
+ // for (int i = 0, max = classFiles.length; i < max; i++) {
+ // // clear the classFile back pointer to the bindings
+ // ClassFile classFile = classFiles[i];
+ // // null out the classfile backpointer to a type binding
+ // classFile.referenceBinding = null;
+ // classFile.codeStream = null; // codeStream holds onto ast and scopes
+ // classFile.innerClassesBindings = null;
+ // }
+ }
+ private void cleanUp(TypeDeclaration type) {
+ if (type.memberTypes != null) {
+ for (int i = 0, max = type.memberTypes.length; i < max; i++) {
+ cleanUp(type.memberTypes[i]);
+ }
+ }
+ if (type.binding != null) {
+ // null out the type's scope backpointers
+ type.binding.scope = null;
+ }
+ }
+
+// public void checkUnusedImports() {
+//
+// if (this.scope.imports != null) {
+// for (int i = 0, max = this.scope.imports.length; i < max; i++) {
+// ImportBinding importBinding = this.scope.imports[i];
+// ImportReference importReference = importBinding.reference;
+// if (importReference != null && !importReference.used) {
+// scope.problemReporter().unusedImport(importReference);
+// }
+// }
+// }
+// }
+
+ public CompilationResult compilationResult() {
+ return compilationResult;
+ }
+
+ /*
+ * Finds the matching type amoung this compilation unit types.
+ * Returns null if no type with this name is found.
+ * The type name is a compound name
+ * eg. if we're looking for X.A.B then a type name would be {X, A, B}
+ */
+ public TypeDeclaration declarationOfType(char[][] typeName) {
+
+ for (int i = 0; i < this.types.size(); i++) {
+ if (this.types.get(i) instanceof TypeDeclaration) {
+ TypeDeclaration typeDecl = ((TypeDeclaration) this.types.get(i)).declarationOfType(typeName);
+ if (typeDecl != null) {
+ return typeDecl;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Bytecode generation
+ */
+ // public void generateCode() {
+ //
+ // if (ignoreFurtherInvestigation) {
+ // if (types != null) {
+ // for (int i = 0, count = types.length; i < count; i++) {
+ // types[i].ignoreFurtherInvestigation = true;
+ // // propagate the flag to request problem type creation
+ // types[i].generateCode(scope);
+ // }
+ // }
+ // return;
+ // }
+ // try {
+ // if (types != null) {
+ // for (int i = 0, count = types.length; i < count; i++)
+ // types[i].generateCode(scope);
+ // }
+ // } catch (AbortCompilationUnit e) {
+ // }
+ // }
+
+ public char[] getFileName() {
+
+ return compilationResult.getFileName();
+ }
+
+ public char[] getMainTypeName() {
+
+ if (compilationResult.compilationUnit == null) {
+ char[] fileName = compilationResult.getFileName();
+
+ int start = CharOperation.lastIndexOf('/', fileName) + 1;
+ if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName))
+ start = CharOperation.lastIndexOf('\\', fileName) + 1;
+
+ int end = CharOperation.lastIndexOf('.', fileName);
+ if (end == -1)
+ end = fileName.length;
+
+ return CharOperation.subarray(fileName, start, end);
+ } else {
+ return compilationResult.compilationUnit.getMainTypeName();
+ }
+ }
+
+ public boolean isEmpty() {
+
+ return (currentPackage == null) && (imports == null) && (types == null);
+ }
+
+ public boolean hasErrors() {
+ return this.ignoreFurtherInvestigation;
+ }
+ public StringBuffer print(int indent, StringBuffer output) {
+
+ if (currentPackage != null) {
+ printIndent(indent, output).append("package "); //$NON-NLS-1$
+ currentPackage.print(0, output, false).append(";\n"); //$NON-NLS-1$
+ }
+ if (imports != null)
+ for (int i = 0; i < imports.length; i++) {
+ printIndent(indent, output).append("import "); //$NON-NLS-1$
+ imports[i].print(0, output).append(";\n"); //$NON-NLS-1$
+ }
+
+ if (types != null) {
+ for (int i = 0; i < types.size(); i++) {
+ ((ASTNode)types.get(i)).print(indent, output).append("\n"); //$NON-NLS-1$
+ }
+ }
+ return output;
+ }
+
+ /*
+ * Force inner local types to update their innerclass emulation
+ */
+ public void propagateInnerEmulationForAllLocalTypes() {
+
+ isPropagatingInnerClassEmulation = true;
+ for (int i = 0, max = this.localTypeCount; i < max; i++) {
+
+ LocalTypeBinding localType = localTypes[i];
+ // only propagate for reachable local types
+ if ((localType.scope.referenceType().bits & IsReachableMASK) != 0) {
+ localType.updateInnerEmulationDependents();
+ }
+ }
+ }
+
+ /*
+ * Keep track of all local types, so as to update their innerclass
+ * emulation later on.
+ */
+ public void record(LocalTypeBinding localType) {
+
+ if (this.localTypeCount == 0) {
+ this.localTypes = new LocalTypeBinding[5];
+ } else if (this.localTypeCount == this.localTypes.length) {
+ System.arraycopy(
+ this.localTypes,
+ 0,
+ (this.localTypes = new LocalTypeBinding[this.localTypeCount * 2]),
+ 0,
+ this.localTypeCount);
+ }
+ this.localTypes[this.localTypeCount++] = localType;
+ }
+
+ public void resolve() {
+
+ try {
+ if (types != null) {
+ for (int i = 0, count = types.size(); i < count; i++) {
+ if (types.get(i) instanceof TypeDeclaration) {
+ ((TypeDeclaration) types.get(i)).resolve(scope);
+ }
+ }
+ }
+// if (!this.compilationResult.hasSyntaxError())
+// checkUnusedImports();
+ } catch (AbortCompilationUnit e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+ }
+
+ public void tagAsHavingErrors() {
+ ignoreFurtherInvestigation = true;
+ }
+
+ public String toString(int tab) {
+
+ String s = ""; //$NON-NLS-1$
+ if (currentPackage != null)
+ s = tabString(tab) + "package " + currentPackage.toString(0, false) + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (imports != null)
+ for (int i = 0; i < imports.length; i++) {
+ s += tabString(tab) + "include " + imports[i].toString() + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ };
+
+ if (types != null)
+ for (int i = 0; i < types.size(); i++) {
+ s += ((ASTNode) types.get(i)).toString(tab) + "\n"; //$NON-NLS-1$
+ }
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, scope)) {
+ if (currentPackage != null) {
+ currentPackage.traverse(visitor, scope);
+ }
+ if (imports != null) {
+ int importLength = imports.length;
+ for (int i = 0; i < importLength; i++) {
+ imports[i].traverse(visitor, scope);
+ }
+ }
+ if (types != null) {
+ int typesLength = types.size();
+ for (int i = 0; i < typesLength; i++) {
+ if (types.get(i) instanceof TypeDeclaration) {
+ ((TypeDeclaration) types.get(i)).traverse(visitor, scope);
+ }
+ }
+ }
+ }
+ visitor.endVisit(this, scope);
+ } catch (AbortCompilationUnit e) {
+ }
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java
new file mode 100644
index 0000000..5912979
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class CompoundAssignment extends Assignment implements OperatorIds {
+ public int operator;
+ public int assignmentImplicitConversion;
+
+ // var op exp is equivalent to var = (varType) var op exp
+ // assignmentImplicitConversion stores the cast needed for the assignment
+
+public CompoundAssignment(Expression lhs, Expression expression,int operator, int sourceEnd) {
+ //lhs is always a reference by construction ,
+ //but is build as an expression ==> the checkcast cannot fail
+
+ super(lhs, expression, sourceEnd);
+ lhs.bits &= ~IsStrictlyAssignedMASK; // tag lhs as NON assigned - it is also a read access
+ this.operator = operator ;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ // record setting a variable: various scenarii are possible, setting an array reference,
+ // a field reference, a blank final field reference, a field of an enclosing instance or
+ // just a local variable.
+
+ return ((Reference) lhs).analyseAssignment(currentScope, flowContext, flowInfo, this, true).unconditionalInits();
+}
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+//
+// // various scenarii are possible, setting an array reference,
+// // a field reference, a blank final field reference, a field of an enclosing instance or
+// // just a local variable.
+//
+// int pc = codeStream.position;
+// ((Reference) lhs).generateCompoundAssignment(currentScope, codeStream, expression, operator, assignmentImplicitConversion, valueRequired);
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public String operatorToString() {
+ switch (operator) {
+ case PLUS :
+ return "+="; //$NON-NLS-1$
+ case MINUS :
+ return "-="; //$NON-NLS-1$
+ case MULTIPLY :
+ return "*="; //$NON-NLS-1$
+ case DIVIDE :
+ return "/="; //$NON-NLS-1$
+ case AND :
+ return "&="; //$NON-NLS-1$
+ case OR :
+ return "|="; //$NON-NLS-1$
+ case XOR :
+ return "^="; //$NON-NLS-1$
+ case REMAINDER :
+ return "%="; //$NON-NLS-1$
+ case LEFT_SHIFT :
+ return "<<="; //$NON-NLS-1$
+ case RIGHT_SHIFT :
+ return ">>="; //$NON-NLS-1$
+ case UNSIGNED_RIGHT_SHIFT :
+ return ">>>="; //$NON-NLS-1$
+ };
+ return "unknown operator"; //$NON-NLS-1$
+}
+public TypeBinding resolveType(BlockScope scope) {
+ constant = NotAConstant;
+ if (!(this.lhs instanceof Reference)) {
+ scope.problemReporter().expressionShouldBeAVariable(this.lhs);
+ }
+ TypeBinding lhsType = lhs.resolveType(scope);
+ TypeBinding expressionType = expression.resolveType(scope);
+ if (lhsType == null || expressionType == null)
+ return null;
+
+ int lhsId = lhsType.id;
+ int expressionId = expressionType.id;
+ if (restrainUsageToNumericTypes() && !lhsType.isNumericType()) {
+ scope.problemReporter().operatorOnlyValidOnNumericType(this, lhsType, expressionType);
+ return null;
+ }
+ if (lhsId > 15 || expressionId > 15) {
+ if (lhsId != T_String) { // String += Object is valid wheraas Object -= String is not
+ scope.problemReporter().invalidOperator(this, lhsType, expressionType);
+ return null;
+ }
+ expressionId = T_Object; // use the Object has tag table
+ }
+
+ // the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
+
+ // the conversion is stored INTO the reference (info needed for the code gen)
+ int result = OperatorExpression.ResolveTypeTables[operator][ (lhsId << 4) + expressionId];
+ if (result == T_undefined) {
+ scope.problemReporter().invalidOperator(this, lhsType, expressionType);
+ return null;
+ }
+ if (operator == PLUS){
+ if(scope.isJavaLangObject(lhsType)) {
+ // += is illegal
+ scope.problemReporter().invalidOperator(this, lhsType, expressionType);
+ return null;
+ } else if ((lhsType.isNumericType() || lhsId == T_boolean) && !expressionType.isNumericType()){
+ // += is illegal
+ scope.problemReporter().invalidOperator(this, lhsType, expressionType);
+ return null;
+ }
+ }
+ lhs.implicitConversion = result >>> 12;
+ expression.implicitConversion = (result >>> 4) & 0x000FF;
+ assignmentImplicitConversion = (lhsId << 4) + (result & 0x0000F);
+ return this.resolvedType = lhsType;
+}
+public boolean restrainUsageToNumericTypes(){
+ return false ;}
+public String toStringExpressionNoParenthesis() {
+
+ return lhs.toStringExpression() + " " + //$NON-NLS-1$
+ operatorToString() + " " + //$NON-NLS-1$
+ expression.toStringExpression() ; }
+public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ expression.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java
new file mode 100644
index 0000000..9bd4807
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class ConditionalExpression extends OperatorExpression {
+
+ public Expression condition, valueIfTrue, valueIfFalse;
+ public Constant optimizedBooleanConstant;
+ public Constant optimizedIfTrueConstant;
+ public Constant optimizedIfFalseConstant;
+
+ private int returnTypeSlotSize = 1;
+
+ // for local variables table attributes
+ int trueInitStateIndex = -1;
+ int falseInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public ConditionalExpression(
+ Expression condition,
+ Expression valueIfTrue,
+ Expression valueIfFalse) {
+ this.condition = condition;
+ this.valueIfTrue = valueIfTrue;
+ this.valueIfFalse = valueIfFalse;
+ sourceStart = condition.sourceStart;
+ sourceEnd = valueIfFalse.sourceEnd;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ Constant cst = this.condition.optimizedBooleanConstant();
+ boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ int mode = flowInfo.reachMode();
+ flowInfo = condition.analyseCode(currentScope, flowContext, flowInfo, cst == NotAConstant);
+
+ // process the if-true part
+ FlowInfo trueFlowInfo = flowInfo.initsWhenTrue().copy();
+ if (isConditionOptimizedFalse) {
+ trueFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ trueInitStateIndex = currentScope.methodScope().recordInitializationStates(trueFlowInfo);
+ trueFlowInfo = valueIfTrue.analyseCode(currentScope, flowContext, trueFlowInfo);
+
+ // process the if-false part
+ FlowInfo falseFlowInfo = flowInfo.initsWhenFalse().copy();
+ if (isConditionOptimizedTrue) {
+ falseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ falseInitStateIndex = currentScope.methodScope().recordInitializationStates(falseFlowInfo);
+ falseFlowInfo = valueIfFalse.analyseCode(currentScope, flowContext, falseFlowInfo);
+
+ // merge if-true & if-false initializations
+ FlowInfo mergedInfo;
+ if (isConditionOptimizedTrue){
+ mergedInfo = trueFlowInfo.addPotentialInitializationsFrom(falseFlowInfo);
+ } else if (isConditionOptimizedFalse) {
+ mergedInfo = falseFlowInfo.addPotentialInitializationsFrom(trueFlowInfo);
+ } else {
+ // merge using a conditional info - 1GK2BLM
+ // if ((t && (v = t)) ? t : t && (v = f)) r = v; -- ok
+ cst = this.optimizedIfTrueConstant;
+ boolean isValueIfTrueOptimizedTrue = cst != null && cst != NotAConstant && cst.booleanValue() == true;
+ boolean isValueIfTrueOptimizedFalse = cst != null && cst != NotAConstant && cst.booleanValue() == false;
+
+ cst = this.optimizedIfFalseConstant;
+ boolean isValueIfFalseOptimizedTrue = cst != null && cst != NotAConstant && cst.booleanValue() == true;
+ boolean isValueIfFalseOptimizedFalse = cst != null && cst != NotAConstant && cst.booleanValue() == false;
+
+ UnconditionalFlowInfo trueInfoWhenTrue = trueFlowInfo.initsWhenTrue().copy().unconditionalInits();
+ if (isValueIfTrueOptimizedFalse) trueInfoWhenTrue.setReachMode(FlowInfo.UNREACHABLE);
+
+ UnconditionalFlowInfo falseInfoWhenTrue = falseFlowInfo.initsWhenTrue().copy().unconditionalInits();
+ if (isValueIfFalseOptimizedFalse) falseInfoWhenTrue.setReachMode(FlowInfo.UNREACHABLE);
+
+ UnconditionalFlowInfo trueInfoWhenFalse = trueFlowInfo.initsWhenFalse().copy().unconditionalInits();
+ if (isValueIfTrueOptimizedTrue) trueInfoWhenFalse.setReachMode(FlowInfo.UNREACHABLE);
+
+ UnconditionalFlowInfo falseInfoWhenFalse = falseFlowInfo.initsWhenFalse().copy().unconditionalInits();
+ if (isValueIfFalseOptimizedTrue) falseInfoWhenFalse.setReachMode(FlowInfo.UNREACHABLE);
+
+ mergedInfo =
+ FlowInfo.conditional(
+ trueInfoWhenTrue.mergedWith(falseInfoWhenTrue),
+ trueInfoWhenFalse.mergedWith(falseInfoWhenFalse));
+ }
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ mergedInfo.setReachMode(mode);
+ return mergedInfo;
+ }
+
+ /**
+ * Code generation for the conditional operator ?:
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// Label endifLabel, falseLabel;
+// if (constant != NotAConstant) {
+// if (valueRequired)
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// Constant cst = condition.constant;
+// Constant condCst = condition.optimizedBooleanConstant();
+// boolean needTruePart =
+// !(((cst != NotAConstant) && (cst.booleanValue() == false))
+// || ((condCst != NotAConstant) && (condCst.booleanValue() == false)));
+// boolean needFalsePart =
+// !(((cst != NotAConstant) && (cst.booleanValue() == true))
+// || ((condCst != NotAConstant) && (condCst.booleanValue() == true)));
+// endifLabel = new Label(codeStream);
+//
+// // Generate code for the condition
+// boolean needConditionValue = (cst == NotAConstant) && (condCst == NotAConstant);
+// condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// needConditionValue);
+//
+// if (trueInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// trueInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, trueInitStateIndex);
+// }
+// // Then code generation
+// if (needTruePart) {
+// valueIfTrue.generateCode(currentScope, codeStream, valueRequired);
+// if (needFalsePart) {
+// // Jump over the else part
+// int position = codeStream.position;
+// codeStream.goto_(endifLabel);
+// codeStream.updateLastRecordedEndPC(position);
+// // Tune codestream stack size
+// if (valueRequired) {
+// codeStream.decrStackSize(returnTypeSlotSize);
+// }
+// }
+// }
+// if (needFalsePart) {
+// falseLabel.place();
+// if (falseInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// falseInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, falseInitStateIndex);
+// }
+// valueIfFalse.generateCode(currentScope, codeStream, valueRequired);
+// // End of if statement
+// endifLabel.place();
+// }
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// // implicit conversion
+// if (valueRequired)
+// codeStream.generateImplicitConversion(implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+//
+// /**
+// * Optimized boolean code generation for the conditional operator ?:
+// */
+// public void generateOptimizedBoolean(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean) // constant
+// || (valueIfTrue.implicitConversion >> 4) != T_boolean) { // non boolean values
+// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+// return;
+// }
+// Constant cst = condition.constant;
+// Constant condCst = condition.optimizedBooleanConstant();
+// boolean needTruePart =
+// !(((cst != NotAConstant) && (cst.booleanValue() == false))
+// || ((condCst != NotAConstant) && (condCst.booleanValue() == false)));
+// boolean needFalsePart =
+// !(((cst != NotAConstant) && (cst.booleanValue() == true))
+// || ((condCst != NotAConstant) && (condCst.booleanValue() == true)));
+//
+// Label internalFalseLabel, endifLabel = new Label(codeStream);
+//
+// // Generate code for the condition
+// boolean needConditionValue = (cst == NotAConstant) && (condCst == NotAConstant);
+// condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// internalFalseLabel = new Label(codeStream),
+// needConditionValue);
+//
+// if (trueInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// trueInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, trueInitStateIndex);
+// }
+// // Then code generation
+// if (needTruePart) {
+// valueIfTrue.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+//
+// if (needFalsePart) {
+// // Jump over the else part
+// int position = codeStream.position;
+// codeStream.goto_(endifLabel);
+// codeStream.updateLastRecordedEndPC(position);
+// // No need to decrement codestream stack size
+// // since valueIfTrue was already consumed by branch bytecode
+// }
+// }
+// if (needFalsePart) {
+// internalFalseLabel.place();
+// if (falseInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// falseInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, falseInitStateIndex);
+// }
+// valueIfFalse.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+//
+// // End of if statement
+// endifLabel.place();
+// }
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// // no implicit conversion for boolean values
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+//
+// public Constant optimizedBooleanConstant() {
+//
+// return this.optimizedBooleanConstant == null ? this.constant : this.optimizedBooleanConstant;
+// }
+//
+// public TypeBinding resolveType(BlockScope scope) {
+// // specs p.368
+// constant = NotAConstant;
+// TypeBinding conditionType = condition.resolveTypeExpecting(scope, BooleanBinding);
+// TypeBinding valueIfTrueType = valueIfTrue.resolveType(scope);
+// TypeBinding valueIfFalseType = valueIfFalse.resolveType(scope);
+// if (conditionType == null || valueIfTrueType == null || valueIfFalseType == null)
+// return null;
+//
+// // Propagate the constant value from the valueIfTrue and valueIFFalse expression if it is possible
+// Constant condConstant, trueConstant, falseConstant;
+// if ((condConstant = condition.constant) != NotAConstant
+// && (trueConstant = valueIfTrue.constant) != NotAConstant
+// && (falseConstant = valueIfFalse.constant) != NotAConstant) {
+// // all terms are constant expression so we can propagate the constant
+// // from valueIFTrue or valueIfFalse to teh receiver constant
+// constant = condConstant.booleanValue() ? trueConstant : falseConstant;
+// }
+// if (valueIfTrueType == valueIfFalseType) { // harmed the implicit conversion
+// valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
+// valueIfFalse.implicitConversion = valueIfTrue.implicitConversion;
+// if (valueIfTrueType == LongBinding || valueIfTrueType == DoubleBinding) {
+// returnTypeSlotSize = 2;
+// }
+//
+// if (valueIfTrueType == BooleanBinding) {
+// this.optimizedIfTrueConstant = valueIfTrue.optimizedBooleanConstant();
+// this.optimizedIfFalseConstant = valueIfFalse.optimizedBooleanConstant();
+//
+// // Propagate the optimized boolean constant if possible
+// if ((condConstant = condition.optimizedBooleanConstant()) != NotAConstant) {
+//
+// this.optimizedBooleanConstant = condConstant.booleanValue()
+// ? optimizedIfTrueConstant
+// : optimizedIfFalseConstant;
+// }
+// }
+// return this.resolvedType = valueIfTrueType;
+// }
+// // Determine the return type depending on argument types
+// // Numeric types
+// if (valueIfTrueType.isNumericType() && valueIfFalseType.isNumericType()) {
+// // (Short x Byte) or (Byte x Short)"
+// if ((valueIfTrueType == ByteBinding && valueIfFalseType == ShortBinding)
+// || (valueIfTrueType == ShortBinding && valueIfFalseType == ByteBinding)) {
+// valueIfTrue.implicitWidening(ShortBinding, valueIfTrueType);
+// valueIfFalse.implicitWidening(ShortBinding, valueIfFalseType);
+// this.resolvedType = ShortBinding;
+// return ShortBinding;
+// }
+// // x constant(Int) ---> and reciprocally
+// if ((valueIfTrueType == ByteBinding || valueIfTrueType == ShortBinding || valueIfTrueType == CharBinding)
+// && (valueIfFalseType == IntBinding
+// && valueIfFalse.isConstantValueOfTypeAssignableToType(valueIfFalseType, valueIfTrueType))) {
+// valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
+// valueIfFalse.implicitWidening(valueIfTrueType, valueIfFalseType);
+// this.resolvedType = valueIfTrueType;
+// return valueIfTrueType;
+// }
+// if ((valueIfFalseType == ByteBinding
+// || valueIfFalseType == ShortBinding
+// || valueIfFalseType == CharBinding)
+// && (valueIfTrueType == IntBinding
+// && valueIfTrue.isConstantValueOfTypeAssignableToType(valueIfTrueType, valueIfFalseType))) {
+// valueIfTrue.implicitWidening(valueIfFalseType, valueIfTrueType);
+// valueIfFalse.implicitWidening(valueIfFalseType, valueIfFalseType);
+// this.resolvedType = valueIfFalseType;
+// return valueIfFalseType;
+// }
+// // Manual binary numeric promotion
+// // int
+// if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_int)
+// && BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_int)) {
+// valueIfTrue.implicitWidening(IntBinding, valueIfTrueType);
+// valueIfFalse.implicitWidening(IntBinding, valueIfFalseType);
+// this.resolvedType = IntBinding;
+// return IntBinding;
+// }
+// // long
+// if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_long)
+// && BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_long)) {
+// valueIfTrue.implicitWidening(LongBinding, valueIfTrueType);
+// valueIfFalse.implicitWidening(LongBinding, valueIfFalseType);
+// returnTypeSlotSize = 2;
+// this.resolvedType = LongBinding;
+// return LongBinding;
+// }
+// // float
+// if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_float)
+// && BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_float)) {
+// valueIfTrue.implicitWidening(FloatBinding, valueIfTrueType);
+// valueIfFalse.implicitWidening(FloatBinding, valueIfFalseType);
+// this.resolvedType = FloatBinding;
+// return FloatBinding;
+// }
+// // double
+// valueIfTrue.implicitWidening(DoubleBinding, valueIfTrueType);
+// valueIfFalse.implicitWidening(DoubleBinding, valueIfFalseType);
+// returnTypeSlotSize = 2;
+// this.resolvedType = DoubleBinding;
+// return DoubleBinding;
+// }
+// // Type references (null null is already tested)
+// if ((valueIfTrueType.isBaseType() && valueIfTrueType != NullBinding)
+// || (valueIfFalseType.isBaseType() && valueIfFalseType != NullBinding)) {
+// scope.problemReporter().conditionalArgumentsIncompatibleTypes(
+// this,
+// valueIfTrueType,
+// valueIfFalseType);
+// return null;
+// }
+// if (valueIfFalseType.isCompatibleWith(valueIfTrueType)) {
+// valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
+// valueIfFalse.implicitWidening(valueIfTrueType, valueIfFalseType);
+// this.resolvedType = valueIfTrueType;
+// return valueIfTrueType;
+// }
+// if (valueIfTrueType.isCompatibleWith(valueIfFalseType)) {
+// valueIfTrue.implicitWidening(valueIfFalseType, valueIfTrueType);
+// valueIfFalse.implicitWidening(valueIfFalseType, valueIfFalseType);
+// this.resolvedType = valueIfFalseType;
+// return valueIfFalseType;
+// }
+// scope.problemReporter().conditionalArgumentsIncompatibleTypes(
+// this,
+// valueIfTrueType,
+// valueIfFalseType);
+// return null;
+// }
+ public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+
+ condition.printExpression(indent, output).append(" ? "); //$NON-NLS-1$
+ valueIfTrue.printExpression(0, output).append(" : "); //$NON-NLS-1$
+ return valueIfFalse.printExpression(0, output);
+ }
+ public String toStringExpressionNoParenthesis() {
+ return condition.toStringExpression() + " ? " + //$NON-NLS-1$
+ valueIfTrue.toStringExpression() + " : " + //$NON-NLS-1$
+ valueIfFalse.toStringExpression();
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ condition.traverse(visitor, scope);
+ valueIfTrue.traverse(visitor, scope);
+ valueIfFalse.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstructorDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstructorDeclaration.java
new file mode 100644
index 0000000..0bf4ad0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -0,0 +1,447 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import java.util.ArrayList;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
+
+
+public class ConstructorDeclaration extends AbstractMethodDeclaration {
+
+ public ExplicitConstructorCall constructorCall;
+ public final static char[] ConstantPoolName = "".toCharArray(); //$NON-NLS-1$
+ public boolean isDefaultConstructor = false;
+
+ public ConstructorDeclaration(CompilationResult compilationResult){
+ super(compilationResult);
+ }
+
+ public void analyseCode(
+ ClassScope classScope,
+ InitializationFlowContext initializerFlowContext,
+ FlowInfo flowInfo) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+
+ if (this.binding != null && this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
+ if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
+ scope.problemReporter().unusedPrivateConstructor(this);
+ }
+ }
+
+ // check constructor recursion, once all constructor got resolved
+ if (isRecursive(null /*lazy initialized visited list*/)) {
+ this.scope.problemReporter().recursiveConstructorInvocation(this.constructorCall);
+ }
+
+ try {
+ ExceptionHandlingFlowContext constructorContext =
+ new ExceptionHandlingFlowContext(
+ initializerFlowContext.parent,
+ this,
+ binding.thrownExceptions,
+ scope,
+ FlowInfo.DEAD_END);
+ initializerFlowContext.checkInitializerExceptions(
+ scope,
+ constructorContext,
+ flowInfo);
+
+ // anonymous constructor can gain extra thrown exceptions from unhandled ones
+ if (binding.declaringClass.isAnonymousType()) {
+ ArrayList computedExceptions = constructorContext.extendedExceptions;
+ if (computedExceptions != null){
+ int size;
+ if ((size = computedExceptions.size()) > 0){
+ ReferenceBinding[] actuallyThrownExceptions;
+ computedExceptions.toArray(actuallyThrownExceptions = new ReferenceBinding[size]);
+ binding.thrownExceptions = actuallyThrownExceptions;
+ }
+ }
+ }
+
+ // propagate to constructor call
+ if (constructorCall != null) {
+ // if calling 'this(...)', then flag all non-static fields as definitely
+ // set since they are supposed to be set inside other local constructor
+ if (constructorCall.accessMode == ExplicitConstructorCall.This) {
+ FieldBinding[] fields = binding.declaringClass.fields();
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field;
+ if (!(field = fields[i]).isStatic()) {
+ flowInfo.markAsDefinitelyAssigned(field);
+ }
+ }
+ }
+ flowInfo = constructorCall.analyseCode(scope, constructorContext, flowInfo);
+ }
+ // propagate to statements
+ if (statements != null) {
+ boolean didAlreadyComplain = false;
+ for (int i = 0, count = statements.length; i < count; i++) {
+ Statement stat;
+ if (!flowInfo.complainIfUnreachable(stat = statements[i], scope, didAlreadyComplain)) {
+ flowInfo = stat.analyseCode(scope, constructorContext, flowInfo);
+ } else {
+ didAlreadyComplain = true;
+ }
+ }
+ }
+ // check for missing returning path
+ this.needFreeReturn = flowInfo.isReachable();
+
+ // check missing blank final field initializations
+ if ((constructorCall != null)
+ && (constructorCall.accessMode != ExplicitConstructorCall.This)) {
+ flowInfo = flowInfo.mergedWith(constructorContext.initsOnReturn);
+ FieldBinding[] fields = binding.declaringClass.fields();
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldBinding field;
+ if ((!(field = fields[i]).isStatic())
+ && field.isFinal()
+ && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
+ scope.problemReporter().uninitializedBlankFinalField(
+ field,
+ isDefaultConstructor ? (ASTNode) scope.referenceType() : this);
+ }
+ }
+ }
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ /**
+ * Bytecode generation for a constructor
+ *
+ * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
+ * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
+ */
+// public void generateCode(ClassScope classScope, ClassFile classFile) {
+//
+// int problemResetPC = 0;
+// if (ignoreFurtherInvestigation) {
+// if (this.binding == null)
+// return; // Handle methods with invalid signature or duplicates
+// int problemsLength;
+// IProblem[] problems =
+// scope.referenceCompilationUnit().compilationResult.getProblems();
+// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+// classFile.addProblemConstructor(this, binding, problemsCopy);
+// return;
+// }
+// try {
+// problemResetPC = classFile.contentsOffset;
+// this.internalGenerateCode(classScope, classFile);
+// } catch (AbortMethod e) {
+// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
+// // a branch target required a goto_w, restart code gen in wide mode.
+// try {
+// if (statements != null) {
+// for (int i = 0, max = statements.length; i < max; i++)
+// statements[i].resetStateForCodeGeneration();
+// }
+// classFile.contentsOffset = problemResetPC;
+// classFile.methodCount--;
+// classFile.codeStream.wideMode = true; // request wide mode
+// this.internalGenerateCode(classScope, classFile); // restart method generation
+// } catch (AbortMethod e2) {
+// int problemsLength;
+// IProblem[] problems =
+// scope.referenceCompilationUnit().compilationResult.getAllProblems();
+// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+// classFile.addProblemConstructor(this, binding, problemsCopy, problemResetPC);
+// }
+// } else {
+// int problemsLength;
+// IProblem[] problems =
+// scope.referenceCompilationUnit().compilationResult.getAllProblems();
+// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+// classFile.addProblemConstructor(this, binding, problemsCopy, problemResetPC);
+// }
+// }
+// }
+//
+// public void generateSyntheticFieldInitializationsIfNecessary(
+// MethodScope scope,
+// CodeStream codeStream,
+// ReferenceBinding declaringClass) {
+//
+// if (!declaringClass.isNestedType()) return;
+//
+// NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;
+//
+// SyntheticArgumentBinding[] syntheticArgs = nestedType.syntheticEnclosingInstances();
+// for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
+// SyntheticArgumentBinding syntheticArg;
+// if ((syntheticArg = syntheticArgs[i]).matchingField != null) {
+// codeStream.aload_0();
+// codeStream.load(syntheticArg);
+// codeStream.putfield(syntheticArg.matchingField);
+// }
+// }
+// syntheticArgs = nestedType.syntheticOuterLocalVariables();
+// for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
+// SyntheticArgumentBinding syntheticArg;
+// if ((syntheticArg = syntheticArgs[i]).matchingField != null) {
+// codeStream.aload_0();
+// codeStream.load(syntheticArg);
+// codeStream.putfield(syntheticArg.matchingField);
+// }
+// }
+// }
+//
+// private void internalGenerateCode(ClassScope classScope, ClassFile classFile) {
+//
+// classFile.generateMethodInfoHeader(binding);
+// int methodAttributeOffset = classFile.contentsOffset;
+// int attributeNumber = classFile.generateMethodInfoAttribute(binding);
+// if ((!binding.isNative()) && (!binding.isAbstract())) {
+//
+// TypeDeclaration declaringType = classScope.referenceContext;
+// int codeAttributeOffset = classFile.contentsOffset;
+// classFile.generateCodeAttributeHeader();
+// CodeStream codeStream = classFile.codeStream;
+// codeStream.reset(this, classFile);
+//
+// // initialize local positions - including initializer scope.
+// ReferenceBinding declaringClass = binding.declaringClass;
+//
+// int argSlotSize = 1; // this==aload0
+//
+// if (declaringClass.isNestedType()){
+// NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;
+// this.scope.extraSyntheticArguments = nestedType.syntheticOuterLocalVariables();
+// scope.computeLocalVariablePositions(// consider synthetic arguments if any
+// nestedType.enclosingInstancesSlotSize + 1,
+// codeStream);
+// argSlotSize += nestedType.enclosingInstancesSlotSize;
+// argSlotSize += nestedType.outerLocalVariablesSlotSize;
+// } else {
+// scope.computeLocalVariablePositions(1, codeStream);
+// }
+//
+// if (arguments != null) {
+// for (int i = 0, max = arguments.length; i < max; i++) {
+// // arguments initialization for local variable debug attributes
+// LocalVariableBinding argBinding;
+// codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
+// argBinding.recordInitializationStartPC(0);
+// TypeBinding argType;
+// if ((argType = argBinding.type) == LongBinding || (argType == DoubleBinding)) {
+// argSlotSize += 2;
+// } else {
+// argSlotSize++;
+// }
+// }
+// }
+//
+// MethodScope initializerScope = declaringType.initializerScope;
+// initializerScope.computeLocalVariablePositions(argSlotSize, codeStream); // offset by the argument size (since not linked to method scope)
+//
+// boolean needFieldInitializations = constructorCall == null || constructorCall.accessMode != ExplicitConstructorCall.This;
+//
+// // post 1.4 source level, synthetic initializations occur prior to explicit constructor call
+// boolean preInitSyntheticFields = scope.environment().options.targetJDK >= CompilerOptions.JDK1_4;
+//
+// if (needFieldInitializations && preInitSyntheticFields){
+// generateSyntheticFieldInitializationsIfNecessary(scope, codeStream, declaringClass);
+// }
+// // generate constructor call
+// if (constructorCall != null) {
+// constructorCall.generateCode(scope, codeStream);
+// }
+// // generate field initialization - only if not invoking another constructor call of the same class
+// if (needFieldInitializations) {
+// if (!preInitSyntheticFields){
+// generateSyntheticFieldInitializationsIfNecessary(scope, codeStream, declaringClass);
+// }
+// // 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(initializerScope, codeStream);
+// }
+// }
+// }
+// }
+// // generate statements
+// if (statements != null) {
+// for (int i = 0, max = statements.length; i < max; i++) {
+// statements[i].generateCode(scope, codeStream);
+// }
+// }
+// if (this.needFreeReturn) {
+// codeStream.return_();
+// }
+// // local variable attributes
+// codeStream.exitUserScope(scope);
+// codeStream.recordPositionsFrom(0, this.bodyEnd);
+// classFile.completeCodeAttribute(codeAttributeOffset);
+// attributeNumber++;
+// }
+// classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
+//
+// // if a problem got reported during code gen, then trigger problem method creation
+// if (ignoreFurtherInvestigation) {
+// throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
+// }
+// }
+
+ public boolean isConstructor() {
+
+ return true;
+ }
+
+ public boolean isDefaultConstructor() {
+
+ return isDefaultConstructor;
+ }
+
+ public boolean isInitializationMethod() {
+
+ return true;
+ }
+
+ /**
+ * Returns true if the constructor is directly involved in a cycle.
+ * Given most constructors aren't, we only allocate the visited list
+ * lazily.
+ */
+ public boolean isRecursive(ArrayList visited) {
+
+ if (this.binding == null
+ || this.constructorCall == null
+ || this.constructorCall.binding == null
+ || this.constructorCall.isSuperAccess()
+ || !this.constructorCall.binding.isValidBinding()) {
+ return false;
+ }
+
+ ConstructorDeclaration targetConstructor =
+ ((ConstructorDeclaration)this.scope.referenceType().declarationOf(constructorCall.binding));
+ if (this == targetConstructor) return true; // direct case
+
+ if (visited == null) { // lazy allocation
+ visited = new ArrayList(1);
+ } else {
+ int index = visited.indexOf(this);
+ if (index >= 0) return index == 0; // only blame if directly part of the cycle
+ }
+ visited.add(this);
+
+ return targetConstructor.isRecursive(visited);
+ }
+
+ public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
+
+ //fill up the constructor body with its statements
+ if (ignoreFurtherInvestigation)
+ return;
+ if (isDefaultConstructor){
+ constructorCall = SuperReference.implicitSuperConstructorCall();
+ constructorCall.sourceStart = sourceStart;
+ constructorCall.sourceEnd = sourceEnd;
+ return;
+ }
+ parser.parse(this, unit);
+
+ }
+
+ /*
+ * Type checking for constructor, just another method, except for special check
+ * for recursive constructor invocations.
+ */
+ public void resolveStatements() {
+
+ if (!CharOperation.equals(scope.enclosingSourceType().sourceName, selector)){
+ scope.problemReporter().missingReturnType(this);
+ }
+
+ // if null ==> an error has occurs at parsing time ....
+ if (this.constructorCall != null) {
+ // e.g. using super() in java.lang.Object
+ if (this.binding != null
+ && this.binding.declaringClass.id == T_Object
+ && this.constructorCall.accessMode != ExplicitConstructorCall.This) {
+ if (this.constructorCall.accessMode == ExplicitConstructorCall.Super) {
+ scope.problemReporter().cannotUseSuperInJavaLangObject(this.constructorCall);
+ }
+ this.constructorCall = null;
+ } else {
+ this.constructorCall.resolve(this.scope);
+ }
+ }
+
+ super.resolveStatements();
+ }
+
+ public String toStringStatements(int tab) {
+
+ String s = " {"; //$NON-NLS-1$
+ if (constructorCall != null) {
+ s = s + "\n" + constructorCall.toString(tab) + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (statements != null) {
+ for (int i = 0; i < statements.length; i++) {
+ s = s + "\n" + statements[i].toString(tab); //$NON-NLS-1$
+ if (!(statements[i] instanceof Block)) {
+ s += ";"; //$NON-NLS-1$
+ }
+ }
+ }
+ s += "\n" + tabString(tab == 0 ? 0 : tab - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$
+ //$NON-NLS-2$ //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ ClassScope classScope) {
+
+ if (visitor.visit(this, classScope)) {
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (thrownExceptions != null) {
+ int thrownExceptionsLength = thrownExceptions.length;
+ for (int i = 0; i < thrownExceptionsLength; i++)
+ thrownExceptions[i].traverse(visitor, scope);
+ }
+ if (constructorCall != null)
+ constructorCall.traverse(visitor, scope);
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ContinueStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ContinueStatement.java
new file mode 100644
index 0000000..7498fd8
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ContinueStatement.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class ContinueStatement extends BranchStatement {
+
+ public ContinueStatement(Expression expr, int s, int e) {
+
+ super(expr, s, e);
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // here requires to generate a sequence of finally blocks invocations depending corresponding
+ // to each of the traversed try statements, so that execution will terminate properly.
+
+ // lookup the label, this should answer the returnContext
+// FlowContext targetContext = (expression == null)
+// ? flowContext.getTargetContextForDefaultContinue()
+// : flowContext.getTargetContextForContinueLabel(label);
+
+// if (targetContext == null) {
+// if (expression == null) {
+// currentScope.problemReporter().invalidContinue(this);
+// } else {
+// currentScope.problemReporter().undefinedLabel(this);
+// }
+// return flowInfo; // pretend it did not continue since no actual target
+// }
+
+// if (targetContext == FlowContext.NotContinuableContext) {
+// currentScope.problemReporter().invalidContinue(this);
+// return flowInfo; // pretend it did not continue since no actual target
+// }
+// targetLabel = targetContext.continueLabel();
+// FlowContext traversedContext = flowContext;
+// int subIndex = 0, maxSub = 5;
+// subroutines = new ASTNode[maxSub];
+//
+// do {
+// ASTNode sub;
+// if ((sub = traversedContext.subRoutine()) != null) {
+// if (subIndex == maxSub) {
+// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
+// }
+// subroutines[subIndex++] = sub;
+// if (sub.cannotReturn()) {
+// break;
+// }
+// }
+// traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
+//
+// ASTNode node;
+// if ((node = traversedContext.associatedNode) instanceof TryStatement) {
+// TryStatement tryStatement = (TryStatement) node;
+// flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
+// } else if (traversedContext == targetContext) {
+// // only record continue info once accumulated through subroutines, and only against target context
+// targetContext.recordContinueFrom(flowInfo);
+// break;
+// }
+// } while ((traversedContext = traversedContext.parent) != null);
+//
+// // resize subroutines
+// if (subIndex != maxSub) {
+// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
+// }
+ return FlowInfo.DEAD_END;
+ }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("continue "); //$NON-NLS-1$
+ if (expression != null) output.append(expression);
+ return output.append(';');
+ }
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s += "continue "; //$NON-NLS-1$
+ if (expression != null)
+ s += expression.toString();
+ return s;
+ }
+
+ public void traverse(
+ IAbstractSyntaxTreeVisitor visitor,
+ BlockScope blockScope) {
+
+ visitor.visit(this, blockScope);
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DefaultCase.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DefaultCase.java
new file mode 100644
index 0000000..587f248
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DefaultCase.java
@@ -0,0 +1,91 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.CaseLabel;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class DefaultCase extends Statement {
+
+ public CaseLabel targetLabel;
+
+ /**
+ * DefautCase constructor comment.
+ */
+ public DefaultCase(int sourceEnd, int sourceStart) {
+
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ return flowInfo;
+ }
+
+ /**
+ * Default case code generation
+ *
+ * @param currentScope
+ * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream
+ * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ //
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // int pc = codeStream.position;
+ // targetLabel.place();
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ //
+ // }
+ /**
+ * No-op : should use resolveCase(...) instead.
+ */
+ public void resolve(BlockScope scope) {
+ }
+
+ public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
+
+ // remember the default case into the associated switch statement
+ if (switchStatement.defaultCase != null)
+ scope.problemReporter().duplicateDefaultCase(this);
+
+ // on error the last default will be the selected one .... (why not) ....
+ switchStatement.defaultCase = this;
+ resolve(scope);
+ return null;
+ }
+
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output);
+ output.append("default : "); //$NON-NLS-1$
+ return output.append(';');
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s = s + "default : "; //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+
+ visitor.visit(this, blockScope);
+ visitor.endVisit(this, blockScope);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoStatement.java
new file mode 100644
index 0000000..32dfabd
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoStatement.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.LoopingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class DoStatement extends Statement {
+
+ public Expression condition;
+ public Statement action;
+
+ private Label breakLabel, continueLabel;
+
+ // for local variables table attributes
+ int mergedInitStateIndex = -1;
+
+ public DoStatement(Expression condition, Statement action, int s, int e) {
+
+ this.sourceStart = s;
+ this.sourceEnd = e;
+ this.condition = condition;
+ this.action = action;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ breakLabel = new Label();
+ continueLabel = new Label();
+ LoopingFlowContext loopingContext =
+ new LoopingFlowContext(
+ flowContext,
+ this,
+ breakLabel,
+ continueLabel,
+ currentScope);
+
+ Constant cst = condition.constant;
+ boolean isConditionTrue = cst != NotAConstant && cst.booleanValue() == true;
+ cst = condition.optimizedBooleanConstant();
+ boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ int previousMode = flowInfo.reachMode();
+
+ if ((action != null) && !action.isEmptyBlock()) {
+ flowInfo = action.analyseCode(currentScope, loopingContext, flowInfo);
+
+ // code generation can be optimized when no need to continue in the loop
+ if (!flowInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
+ continueLabel = null;
+ }
+ }
+ /* Reset reach mode, to address following scenario.
+ * final blank;
+ * do { if (true) break; else blank = 0; } while(false);
+ * blank = 1; // may be initialized already
+ */
+ flowInfo.setReachMode(previousMode);
+
+ flowInfo =
+ condition.analyseCode(
+ currentScope,
+ loopingContext,
+ (action == null
+ ? flowInfo
+ : (flowInfo.mergedWith(loopingContext.initsOnContinue))));
+ if (!isConditionOptimizedFalse && continueLabel != null) {
+ loopingContext.complainOnFinalAssignmentsInLoop(currentScope, flowInfo);
+ }
+
+ // infinite loop
+ FlowInfo mergedInfo;
+ if (isConditionTrue) {
+ mergedInfo = loopingContext.initsOnBreak;
+ if (!mergedInfo.isReachable()) mergedInfo.addPotentialInitializationsFrom(flowInfo.initsWhenFalse());
+ } else {
+ // end of loop: either condition false or break
+ mergedInfo =
+ flowInfo.initsWhenFalse().unconditionalInits().mergedWith(
+ loopingContext.initsOnBreak);
+ if (isConditionOptimizedTrue && !loopingContext.initsOnBreak.isReachable()) {
+ mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ }
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ /**
+ * Do statement code generation
+ *
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+//
+// // labels management
+// Label actionLabel = new Label(codeStream);
+// actionLabel.place();
+// breakLabel.codeStream = codeStream;
+// if (continueLabel != null) {
+// continueLabel.codeStream = codeStream;
+// }
+//
+// // generate action
+// if (action != null) {
+// action.generateCode(currentScope, codeStream);
+// }
+// // generate condition
+// if (continueLabel != null) {
+// continueLabel.place();
+// condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// actionLabel,
+// null,
+// true);
+// }
+// breakLabel.place();
+//
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//
+// }
+
+ public void resetStateForCodeGeneration() {
+ if (this.breakLabel != null) {
+ this.breakLabel.resetStateForCodeGeneration();
+ }
+ if (this.continueLabel != null) {
+ this.continueLabel.resetStateForCodeGeneration();
+ }
+ }
+
+ public void resolve(BlockScope scope) {
+
+ TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
+ condition.implicitWidening(type, type);
+ if (action != null)
+ action.resolve(scope);
+ }
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output).append("do"); //$NON-NLS-1$
+ if (action == null)
+ output.append(" ;\n"); //$NON-NLS-1$
+ else {
+ output.append('\n');
+ action.printStatement(indent + 1, output).append('\n');
+ }
+ output.append("while ("); //$NON-NLS-1$
+ return condition.printExpression(0, output).append(");"); //$NON-NLS-1$
+ }
+ public String toString(int tab) {
+
+ String inFront, s = tabString(tab);
+ inFront = s;
+ s = s + "do"; //$NON-NLS-1$
+ if (action == null)
+ s = s + " {}\n"; //$NON-NLS-1$
+ else if (action instanceof Block)
+ s = s + "\n" + action.toString(tab + 1) + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
+ else
+ s = s + " {\n" + action.toString(tab + 1) + ";}\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ s = s + inFront + "while (" + condition.toStringExpression() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ if (action != null) {
+ action.traverse(visitor, scope);
+ }
+ condition.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoubleLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoubleLiteral.java
new file mode 100644
index 0000000..7095049
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/DoubleLiteral.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class DoubleLiteral extends NumberLiteral {
+ double value;
+public DoubleLiteral(char[] token, int s, int e) {
+ super(token, s,e);
+}
+public void computeConstant() {
+
+ //the source is correctly formated so the exception should never occurs
+
+ Double computedValue;
+ try { computedValue = Double.valueOf(String.valueOf(source));}
+ catch(NumberFormatException e){return ;} //how can it happen ????
+
+ if (computedValue.doubleValue() > Double.MAX_VALUE) return ; //may be Infinity
+ if (computedValue.doubleValue() < Double.MIN_VALUE)
+ { //only a true 0 can be made of zeros
+ //2.00000000000000000e-324 is illegal ....
+ label :
+ for (int i=0;i> 4) == T_double)
+// codeStream.generateInlinedValue(value);
+// else
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public TypeBinding literalType(BlockScope scope) {
+ return DoubleBinding;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ visitor.visit(this, blockScope);
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EmptyStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EmptyStatement.java
new file mode 100644
index 0000000..1fb6260
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EmptyStatement.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class EmptyStatement extends Statement {
+
+ public EmptyStatement(int startPosition, int endPosition) {
+ this.sourceStart = startPosition;
+ this.sourceEnd = endPosition;
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return flowInfo;
+ }
+
+// public void generateCode(BlockScope currentScope, CodeStream codeStream){
+// // no bytecode, no need to check for reachability or recording source positions
+// }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+ return printIndent(tab, output).append(';');
+ }
+ public void resolve(BlockScope scope) {
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+
+ public String toString(int tab) {
+ return tabString(tab) + ";"; //$NON-NLS-1$
+ }
+}
+
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EqualExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EqualExpression.java
new file mode 100644
index 0000000..3788b65
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EqualExpression.java
@@ -0,0 +1,560 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class EqualExpression extends BinaryExpression {
+
+public EqualExpression(Expression left, Expression right,int operator) {
+ super(left,right,operator);
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
+ if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
+ if (left.constant.booleanValue()) { // true == anything
+ // this is equivalent to the right argument inits
+ return right.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // false == anything
+ // this is equivalent to the right argument inits negated
+ return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
+ if (right.constant.booleanValue()) { // anything == true
+ // this is equivalent to the right argument inits
+ return left.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // anything == false
+ // this is equivalent to the right argument inits negated
+ return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ return right.analyseCode(
+ currentScope, flowContext,
+ left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).unconditionalInits();
+ } else { //NOT_EQUAL :
+ if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
+ if (!left.constant.booleanValue()) { // false != anything
+ // this is equivalent to the right argument inits
+ return right.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // true != anything
+ // this is equivalent to the right argument inits negated
+ return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
+ if (!right.constant.booleanValue()) { // anything != false
+ // this is equivalent to the right argument inits
+ return left.analyseCode(currentScope, flowContext, flowInfo);
+ } else { // anything != true
+ // this is equivalent to the right argument inits negated
+ return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
+ }
+ }
+ return right.analyseCode(
+ currentScope, flowContext,
+ left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).asNegatedCondition().unconditionalInits();
+ }
+}
+public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castType, TypeBinding expressionType) {
+ //see specifications 5.5
+ //A more complete version of this method is provided on
+ //CastExpression (it deals with constant and need runtime checkcast)
+
+ if (castType == expressionType) return true;
+
+ //========ARRAY===============
+ if (expressionType.isArrayType()) {
+ if (castType.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
+ TypeBinding expressionEltType = ((ArrayBinding) expressionType).elementsType(scope);
+ if (expressionEltType.isBaseType())
+ // <---stop the recursion-------
+ return ((ArrayBinding) castType).elementsType(scope) == expressionEltType;
+ //recursivly on the elts...
+ return areTypesCastCompatible(scope, ((ArrayBinding) castType).elementsType(scope), expressionEltType);
+ }
+ if (castType.isBaseType()) {
+ return false;
+ }
+ if (castType.isClass()) { //------(castTb.isClass) expressionTb.isArray ---------------
+ if (scope.isJavaLangObject(castType))
+ return true;
+ return false;
+ }
+ if (castType.isInterface()) { //------- (castTb.isInterface) expressionTb.isArray -----------
+ if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
+ return true;
+ }
+ return false;
+ }
+
+ return false;
+ }
+
+ //------------(castType) null--------------
+ if (expressionType == NullBinding) {
+ return !castType.isBaseType();
+ }
+
+ //========BASETYPE==============
+ if (expressionType.isBaseType()) {
+ return false;
+ }
+
+
+ //========REFERENCE TYPE===================
+
+ if (expressionType.isClass()) {
+ if (castType.isArrayType()) { // ---- (castTb.isArray) expressionTb.isClass -------
+ if (scope.isJavaLangObject(expressionType))
+ return true;
+ }
+ if (castType.isBaseType()) {
+ return false;
+ }
+ if (castType.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
+ if (expressionType.isCompatibleWith(castType))
+ return true;
+ else {
+ if (castType.isCompatibleWith(expressionType)) {
+ return true;
+ }
+ return false;
+ }
+ }
+ if (castType.isInterface()) { // ----- (castTb.isInterface) expressionTb.isClass -------
+ if (((ReferenceBinding) expressionType).isFinal()) { //no subclass for expressionTb, thus compile-time check is valid
+ if (expressionType.isCompatibleWith(castType))
+ return true;
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ if (expressionType.isInterface()) {
+ if (castType.isArrayType()) { // ----- (castTb.isArray) expressionTb.isInterface ------
+ if (scope.isJavaLangCloneable(expressionType) || scope.isJavaIoSerializable(expressionType))
+ //potential runtime error
+ {
+ return true;
+ }
+ return false;
+ }
+ if (castType.isBaseType()) {
+ return false;
+ }
+ if (castType.isClass()) { // ----- (castTb.isClass) expressionTb.isInterface --------
+ if (scope.isJavaLangObject(castType))
+ return true;
+ if (((ReferenceBinding) castType).isFinal()) { //no subclass for castTb, thus compile-time check is valid
+ if (castType.isCompatibleWith(expressionType)) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ if (castType.isInterface()) { // ----- (castTb.isInterface) expressionTb.isInterface -------
+ if (Scope.compareTypes(castType, expressionType) == NotRelated) {
+ MethodBinding[] castTbMethods = ((ReferenceBinding) castType).methods();
+ int castTbMethodsLength = castTbMethods.length;
+ MethodBinding[] expressionTbMethods = ((ReferenceBinding) expressionType).methods();
+ int expressionTbMethodsLength = expressionTbMethods.length;
+ for (int i = 0; i < castTbMethodsLength; i++) {
+ for (int j = 0; j < expressionTbMethodsLength; j++) {
+ if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
+ if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
+ if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+}
+public final void computeConstant(TypeBinding leftType, TypeBinding rightType) {
+ if ((this.left.constant != NotAConstant) && (this.right.constant != NotAConstant)) {
+ this.constant =
+ Constant.computeConstantOperationEQUAL_EQUAL(
+ left.constant,
+ leftType.id,
+ EQUAL_EQUAL,
+ right.constant,
+ rightType.id);
+ if (((this.bits & OperatorMASK) >> OperatorSHIFT) == NOT_EQUAL)
+ constant = Constant.fromValue(!constant.booleanValue());
+ } else {
+ this.constant = NotAConstant;
+ // no optimization for null == null
+ }
+}
+/**
+ * Normal == or != code generation.
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+//
+// if (constant != NotAConstant) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// Label falseLabel;
+// bits |= OnlyValueRequiredMASK;
+// generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// falseLabel = new Label(codeStream),
+// valueRequired);
+// if (falseLabel.hasForwardReferences()) {
+// if (valueRequired){
+// // comparison is TRUE
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0){
+// codeStream.ireturn();
+// // comparison is FALSE
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// Label endLabel = new Label(codeStream);
+// codeStream.goto_(endLabel);
+// codeStream.decrStackSize(1);
+// // comparison is FALSE
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// } else {
+// falseLabel.place();
+// }
+// }
+//}
+/**
+ * Boolean operator code generation
+ * Optimized operations are: == and !=
+ */
+//public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+//
+// if (constant != Constant.NotAConstant) {
+// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+// return;
+// }
+// if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
+// if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
+// generateOptimizedBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+// } else {
+// generateOptimizedNonBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+// }
+// } else {
+// if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
+// generateOptimizedBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
+// } else {
+// generateOptimizedNonBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
+// }
+// }
+//}
+/**
+ * Boolean generation for == with boolean operands
+ *
+ * Note this code does not optimize conditional constants !!!!
+ */
+//public void generateOptimizedBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+//
+// // optimized cases: true == x, false == x
+// if (left.constant != NotAConstant) {
+// boolean inline = left.constant.booleanValue();
+// right.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
+// return;
+// } // optimized cases: x == true, x == false
+// if (right.constant != NotAConstant) {
+// boolean inline = right.constant.booleanValue();
+// left.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
+// return;
+// }
+// // default case
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.if_icmpeq(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.if_icmpne(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+//}
+///**
+// * Boolean generation for == with non-boolean operands
+// *
+// */
+//public void generateOptimizedNonBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// Constant inline;
+// if ((inline = right.constant) != NotAConstant) {
+// // optimized case: x == 0
+// if (((left.implicitConversion >> 4) == T_int) && (inline.intValue() == 0)) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifeq(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifne(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// }
+// if ((inline = left.constant) != NotAConstant) {
+// // optimized case: 0 == x
+// if (((left.implicitConversion >> 4) == T_int)
+// && (inline.intValue() == 0)) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifeq(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifne(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// }
+// // null cases
+// // optimized case: x == null
+// if (right instanceof NullLiteral) {
+// if (left instanceof NullLiteral) {
+// // null == null
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
+// codeStream.iconst_1();
+// } else {
+// codeStream.iconst_0();
+// }
+// } else {
+// if (falseLabel == null) {
+// // implicit falling through the FALSE case
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// }
+// } else {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifnull(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifnonnull(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// } else if (left instanceof NullLiteral) { // optimized case: null == x
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// codeStream.ifnull(trueLabel);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.ifnonnull(falseLabel);
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+//
+// // default case
+// left.generateCode(currentScope, codeStream, valueRequired);
+// right.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// switch (left.implicitConversion >> 4) { // operand runtime type
+// case T_int :
+// codeStream.if_icmpeq(trueLabel);
+// break;
+// case T_float :
+// codeStream.fcmpl();
+// codeStream.ifeq(trueLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifeq(trueLabel);
+// break;
+// case T_double :
+// codeStream.dcmpl();
+// codeStream.ifeq(trueLabel);
+// break;
+// default :
+// codeStream.if_acmpeq(trueLabel);
+// }
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// switch (left.implicitConversion >> 4) { // operand runtime type
+// case T_int :
+// codeStream.if_icmpne(falseLabel);
+// break;
+// case T_float :
+// codeStream.fcmpl();
+// codeStream.ifne(falseLabel);
+// break;
+// case T_long :
+// codeStream.lcmp();
+// codeStream.ifne(falseLabel);
+// break;
+// case T_double :
+// codeStream.dcmpl();
+// codeStream.ifne(falseLabel);
+// break;
+// default :
+// codeStream.if_acmpne(falseLabel);
+// }
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public boolean isCompactableOperation() {
+ return false;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // always return BooleanBinding
+ TypeBinding leftType = left.resolveType(scope);
+ TypeBinding rightType = right.resolveType(scope);
+ if (leftType == null || rightType == null){
+ constant = NotAConstant;
+ return null;
+ }
+
+ // both base type
+ if (leftType.isBaseType() && rightType.isBaseType()) {
+ // the code is an int
+ // (cast) left == (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
+ int result = ResolveTypeTables[EQUAL_EQUAL][ (leftType.id << 4) + rightType.id];
+ left.implicitConversion = result >>> 12;
+ right.implicitConversion = (result >>> 4) & 0x000FF;
+ bits |= result & 0xF;
+ if ((result & 0x0000F) == T_undefined) {
+ constant = Constant.NotAConstant;
+ scope.problemReporter().invalidOperator(this, leftType, rightType);
+ return null;
+ }
+ computeConstant(leftType, rightType);
+ this.resolvedType = BooleanBinding;
+ return BooleanBinding;
+ }
+
+ // Object references
+ // spec 15.20.3
+ if (areTypesCastCompatible(scope, rightType, leftType) || areTypesCastCompatible(scope, leftType, rightType)) {
+ // (special case for String)
+ if ((rightType.id == T_String) && (leftType.id == T_String))
+ computeConstant(leftType, rightType);
+ else
+ constant = NotAConstant;
+ if (rightType.id == T_String)
+ right.implicitConversion = String2String;
+ if (leftType.id == T_String)
+ left.implicitConversion = String2String;
+ this.resolvedType = BooleanBinding;
+ return BooleanBinding;
+ }
+ constant = NotAConstant;
+ scope.problemReporter().notCompatibleTypesError(this, leftType, rightType);
+ return null;
+}
+public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ left.traverse(visitor, scope);
+ right.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExplicitConstructorCall.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExplicitConstructorCall.java
new file mode 100644
index 0000000..acd983f
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -0,0 +1,345 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
+
+public class ExplicitConstructorCall
+ extends Statement
+ implements InvocationSite {
+
+ public Expression[] arguments;
+ public Expression qualification;
+ public MethodBinding binding;
+
+ public int accessMode;
+
+ public final static int ImplicitSuper = 1;
+ public final static int Super = 2;
+ public final static int This = 3;
+
+ public VariableBinding[][] implicitArguments;
+ boolean discardEnclosingInstance;
+
+ MethodBinding syntheticAccessor;
+
+ public ExplicitConstructorCall(int accessMode) {
+ this.accessMode = accessMode;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // must verify that exceptions potentially thrown by this expression are caught in the method.
+
+ try {
+ ((MethodScope) currentScope).isConstructorCall = true;
+
+ // process enclosing instance
+ if (qualification != null) {
+ flowInfo =
+ qualification
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+ // process arguments
+ if (arguments != null) {
+ for (int i = 0, max = arguments.length; i < max; i++) {
+ flowInfo =
+ arguments[i]
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+ }
+
+ ReferenceBinding[] thrownExceptions;
+ if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
+ // check exceptions
+ flowContext.checkExceptionHandlers(
+ thrownExceptions,
+ (accessMode == ImplicitSuper)
+ ? (ASTNode) currentScope.methodScope().referenceContext
+ : (ASTNode) this,
+ flowInfo,
+ currentScope);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ manageSyntheticAccessIfNecessary(currentScope);
+ return flowInfo;
+ } finally {
+ ((MethodScope) currentScope).isConstructorCall = false;
+ }
+ }
+
+ /**
+ * Constructor call code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// try {
+// ((MethodScope) currentScope).isConstructorCall = true;
+//
+// int pc = codeStream.position;
+// codeStream.aload_0();
+//
+// // handling innerclass constructor invocation
+// ReferenceBinding targetType = binding.declaringClass;
+// // handling innerclass instance allocation - enclosing instance arguments
+// if (targetType.isNestedType()) {
+// codeStream.generateSyntheticEnclosingInstanceValues(
+// currentScope,
+// targetType,
+// discardEnclosingInstance ? null : qualification,
+// this);
+// }
+// // regular code gen
+// if (arguments != null) {
+// for (int i = 0, max = arguments.length; i < max; i++) {
+// arguments[i].generateCode(currentScope, codeStream, true);
+// }
+// }
+// // handling innerclass instance allocation - outer local arguments
+// if (targetType.isNestedType()) {
+// codeStream.generateSyntheticOuterArgumentValues(
+// currentScope,
+// targetType,
+// this);
+// }
+// if (syntheticAccessor != null) {
+// // synthetic accessor got some extra arguments appended to its signature, which need values
+// for (int i = 0,
+// max = syntheticAccessor.parameters.length - binding.parameters.length;
+// i < max;
+// i++) {
+// codeStream.aconst_null();
+// }
+// codeStream.invokespecial(syntheticAccessor);
+// } else {
+// codeStream.invokespecial(binding);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// } finally {
+// ((MethodScope) currentScope).isConstructorCall = false;
+// }
+// }
+
+ public boolean isImplicitSuper() {
+ //return true if I'm of these compiler added statement super();
+
+ return (accessMode == ImplicitSuper);
+ }
+
+ public boolean isSuperAccess() {
+
+ return accessMode != This;
+ }
+
+ public boolean isTypeAccess() {
+
+ return true;
+ }
+
+ /* Inner emulation consists in either recording a dependency
+ * link only, or performing one level of propagation.
+ *
+ * Dependency mechanism is used whenever dealing with source target
+ * types, since by the time we reach them, we might not yet know their
+ * exact need.
+ */
+ void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ ReferenceBinding superType;
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if ((superType = binding.declaringClass).isNestedType()
+ && currentScope.enclosingSourceType().isLocalType()) {
+
+ if (superType.isLocalType()) {
+ ((LocalTypeBinding) superType).addInnerEmulationDependent(currentScope, qualification != null);
+ } else {
+ // locally propagate, since we already now the desired shape for sure
+ currentScope.propagateInnerEmulation(superType, qualification != null);
+ }
+ }
+ }
+
+ public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if (binding.isPrivate() && (accessMode != This)) {
+
+// if (currentScope
+// .environment()
+// .options
+// .isPrivateConstructorAccessChangingVisibility) {
+// binding.tagForClearingPrivateModifier();
+// // constructor will not be dumped as private, no emulation required thus
+// } else {
+ syntheticAccessor =
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+// }
+ }
+ }
+
+ public void resolve(BlockScope scope) {
+ // the return type should be void for a constructor.
+ // the test is made into getConstructor
+
+ // mark the fact that we are in a constructor call.....
+ // unmark at all returns
+ try {
+ ((MethodScope) scope).isConstructorCall = true;
+ ReferenceBinding receiverType = scope.enclosingSourceType();
+ if (accessMode != This)
+ receiverType = receiverType.superclass();
+
+ if (receiverType == null) {
+ return;
+ }
+
+ // qualification should be from the type of the enclosingType
+ if (qualification != null) {
+ if (accessMode != Super) {
+ scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
+ qualification,
+ receiverType);
+ }
+ ReferenceBinding enclosingType = receiverType.enclosingType();
+ if (enclosingType == null) {
+ scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
+ qualification,
+ receiverType);
+ discardEnclosingInstance = true;
+ } else {
+ TypeBinding qTb = qualification.resolveTypeExpecting(scope, enclosingType);
+ qualification.implicitWidening(qTb, qTb);
+ }
+ }
+
+ // arguments buffering for the method lookup
+ TypeBinding[] argTypes = NoParameters;
+ if (arguments != null) {
+ boolean argHasError = false; // typeChecks all arguments
+ int length = arguments.length;
+ argTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argTypes[i] = arguments[i].resolveType(scope)) == null)
+ argHasError = true;
+ if (argHasError)
+ return;
+ }
+ if ((binding = scope.getConstructor(receiverType, argTypes, this))
+ .isValidBinding()) {
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(binding, this);
+
+ // see for user-implicit widening conversion
+ if (arguments != null) {
+ int length = arguments.length;
+ TypeBinding[] paramTypes = binding.parameters;
+ for (int i = 0; i < length; i++)
+ arguments[i].implicitWidening(paramTypes[i], argTypes[i]);
+ }
+ if (binding.isPrivate()) {
+ binding.modifiers |= AccPrivateUsed;
+ }
+ } else {
+ if (binding.declaringClass == null)
+ binding.declaringClass = receiverType;
+ scope.problemReporter().invalidConstructor(this, binding);
+ }
+ } finally {
+ ((MethodScope) scope).isConstructorCall = false;
+ }
+ }
+
+ public void setActualReceiverType(ReferenceBinding receiverType) {
+ // ignored
+ }
+
+ public void setDepth(int depth) {
+ // ignore for here
+ }
+
+ public void setFieldIndex(int depth) {
+ // ignore for here
+ }
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output);
+ if (qualification != null) qualification.printExpression(0, output).append('.');
+ if (accessMode == This) {
+ output.append("this("); //$NON-NLS-1$
+ } else {
+ output.append("super("); //$NON-NLS-1$
+ }
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ arguments[i].printExpression(0, output);
+ }
+ }
+ return output.append(");"); //$NON-NLS-1$
+ }
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ if (qualification != null)
+ s = s + qualification.toStringExpression() + "."; //$NON-NLS-1$
+ if (accessMode == This) {
+ s = s + "this("; //$NON-NLS-1$
+ } else {
+ s = s + "super("; //$NON-NLS-1$
+ }
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++) {
+ s = s + arguments[i].toStringExpression();
+ if (i != arguments.length - 1)
+ s = s + ", "; //$NON-NLS-1$
+ }
+ s = s + ")"; //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ if (qualification != null) {
+ qualification.traverse(visitor, scope);
+ }
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Expression.java
new file mode 100644
index 0000000..69bd341
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Expression.java
@@ -0,0 +1,506 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class Expression extends Statement {
+
+ //some expression may not be used - from a java semantic point
+ //of view only - as statements. Other may. In order to avoid the creation
+ //of wrappers around expression in order to tune them as expression
+ //Expression is a subclass of Statement. See the message isValidJavaStatement()
+
+ public int implicitConversion;
+ public TypeBinding resolvedType;
+
+ public Constant constant;
+
+ public Expression() {
+ super();
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ return flowInfo;
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+
+ return analyseCode(currentScope, flowContext, flowInfo);
+ }
+
+ /**
+ * Constant usable for bytecode pattern optimizations, but cannot be inlined
+ * since it is not strictly equivalent to the definition of constant expressions.
+ * In particular, some side-effects may be required to occur (only the end value
+ * is known).
+ * Constant is known to be of boolean type
+ */
+ public Constant optimizedBooleanConstant() {
+
+ return this.constant;
+ }
+
+ public static final boolean isConstantValueRepresentable(
+ Constant constant,
+ int constantTypeID,
+ int targetTypeID) {
+
+ //true if there is no loss of precision while casting.
+ // constantTypeID == constant.typeID
+ if (targetTypeID == constantTypeID)
+ return true;
+ switch (targetTypeID) {
+ case T_char :
+ switch (constantTypeID) {
+ case T_char :
+ return true;
+ case T_double :
+ return constant.doubleValue() == constant.charValue();
+ case T_float :
+ return constant.floatValue() == constant.charValue();
+ case T_int :
+ return constant.intValue() == constant.charValue();
+ case T_short :
+ return constant.shortValue() == constant.charValue();
+ case T_byte :
+ return constant.byteValue() == constant.charValue();
+ case T_long :
+ return constant.longValue() == constant.charValue();
+ default :
+ return false;//boolean
+ }
+
+ case T_float :
+ switch (constantTypeID) {
+ case T_char :
+ return constant.charValue() == constant.floatValue();
+ case T_double :
+ return constant.doubleValue() == constant.floatValue();
+ case T_float :
+ return true;
+ case T_int :
+ return constant.intValue() == constant.floatValue();
+ case T_short :
+ return constant.shortValue() == constant.floatValue();
+ case T_byte :
+ return constant.byteValue() == constant.floatValue();
+ case T_long :
+ return constant.longValue() == constant.floatValue();
+ default :
+ return false;//boolean
+ }
+
+ case T_double :
+ switch (constantTypeID) {
+ case T_char :
+ return constant.charValue() == constant.doubleValue();
+ case T_double :
+ return true;
+ case T_float :
+ return constant.floatValue() == constant.doubleValue();
+ case T_int :
+ return constant.intValue() == constant.doubleValue();
+ case T_short :
+ return constant.shortValue() == constant.doubleValue();
+ case T_byte :
+ return constant.byteValue() == constant.doubleValue();
+ case T_long :
+ return constant.longValue() == constant.doubleValue();
+ default :
+ return false; //boolean
+ }
+
+ case T_byte :
+ switch (constantTypeID) {
+ case T_char :
+ return constant.charValue() == constant.byteValue();
+ case T_double :
+ return constant.doubleValue() == constant.byteValue();
+ case T_float :
+ return constant.floatValue() == constant.byteValue();
+ case T_int :
+ return constant.intValue() == constant.byteValue();
+ case T_short :
+ return constant.shortValue() == constant.byteValue();
+ case T_byte :
+ return true;
+ case T_long :
+ return constant.longValue() == constant.byteValue();
+ default :
+ return false; //boolean
+ }
+
+ case T_short :
+ switch (constantTypeID) {
+ case T_char :
+ return constant.charValue() == constant.shortValue();
+ case T_double :
+ return constant.doubleValue() == constant.shortValue();
+ case T_float :
+ return constant.floatValue() == constant.shortValue();
+ case T_int :
+ return constant.intValue() == constant.shortValue();
+ case T_short :
+ return true;
+ case T_byte :
+ return constant.byteValue() == constant.shortValue();
+ case T_long :
+ return constant.longValue() == constant.shortValue();
+ default :
+ return false; //boolean
+ }
+
+ case T_int :
+ switch (constantTypeID) {
+ case T_char :
+ return constant.charValue() == constant.intValue();
+ case T_double :
+ return constant.doubleValue() == constant.intValue();
+ case T_float :
+ return constant.floatValue() == constant.intValue();
+ case T_int :
+ return true;
+ case T_short :
+ return constant.shortValue() == constant.intValue();
+ case T_byte :
+ return constant.byteValue() == constant.intValue();
+ case T_long :
+ return constant.longValue() == constant.intValue();
+ default :
+ return false; //boolean
+ }
+
+ case T_long :
+ switch (constantTypeID) {
+ case T_char :
+ return constant.charValue() == constant.longValue();
+ case T_double :
+ return constant.doubleValue() == constant.longValue();
+ case T_float :
+ return constant.floatValue() == constant.longValue();
+ case T_int :
+ return constant.intValue() == constant.longValue();
+ case T_short :
+ return constant.shortValue() == constant.longValue();
+ case T_byte :
+ return constant.byteValue() == constant.longValue();
+ case T_long :
+ return true;
+ default :
+ return false; //boolean
+ }
+
+ default :
+ return false; //boolean
+ }
+ }
+
+ /**
+ * Expression statements are plain expressions, however they generate like
+ * normal expressions with no value required.
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// generateCode(currentScope, codeStream, false);
+// }
+
+ /**
+ * Every expression is responsible for generating its implicit conversion when necessary.
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// if (constant != NotAConstant) {
+// // generate a constant expression
+// int pc = codeStream.position;
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// } else {
+// // actual non-constant code generation
+// throw new ShouldNotImplement(ProjectPrefUtil.bind("ast.missingCode")); //$NON-NLS-1$
+// }
+// }
+
+ /**
+ * Default generation of a boolean value
+ */
+// public void generateOptimizedBoolean(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// // a label valued to nil means: by default we fall through the case...
+// // both nil means we leave the value on the stack
+//
+// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
+// int pc = codeStream.position;
+// if (constant.booleanValue() == true) {
+// // constant == true
+// if (valueRequired) {
+// if (falseLabel == null) {
+// // implicit falling through the FALSE case
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// } else {
+// if (valueRequired) {
+// if (falseLabel != null) {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.goto_(falseLabel);
+// }
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// generateCode(currentScope, codeStream, valueRequired);
+// // branching
+// int position = codeStream.position;
+// if (valueRequired) {
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // Implicit falling through the FALSE case
+// codeStream.ifne(trueLabel);
+// }
+// } else {
+// if (trueLabel == null) {
+// // Implicit falling through the TRUE case
+// codeStream.ifeq(falseLabel);
+// } else {
+// // No implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(position);
+// }
+//
+// /* Optimized (java) code generation for string concatenations that involve StringBuffer
+// * creation: going through this path means that there is no need for a new StringBuffer
+// * creation, further operands should rather be only appended to the current one.
+// * By default: no optimization.
+// */
+// public void generateOptimizedStringBuffer(
+// BlockScope blockScope,
+// net.sourceforge.phpdt.internal.compiler.codegen.CodeStream codeStream,
+// int typeID) {
+//
+// generateCode(blockScope, codeStream, true);
+// codeStream.invokeStringBufferAppendForType(typeID);
+// }
+
+ /* Optimized (java) code generation for string concatenations that involve StringBuffer
+ * creation: going through this path means that there is no need for a new StringBuffer
+ * creation, further operands should rather be only appended to the current one.
+ */
+// public void generateOptimizedStringBufferCreation(
+// BlockScope blockScope,
+// CodeStream codeStream,
+// int typeID) {
+//
+// // Optimization only for integers and strings
+// if (typeID == T_Object) {
+// // in the case the runtime value of valueOf(Object) returns null, we have to use append(Object) instead of directly valueOf(Object)
+// // append(Object) returns append(valueOf(Object)), which means that the null case is handled by append(String).
+// codeStream.newStringBuffer();
+// codeStream.dup();
+// codeStream.invokeStringBufferDefaultConstructor();
+// generateCode(blockScope, codeStream, true);
+// codeStream.invokeStringBufferAppendForType(T_Object);
+// return;
+// }
+// codeStream.newStringBuffer();
+// codeStream.dup();
+// if (typeID == T_String || typeID == T_null) {
+// if (constant != NotAConstant) {
+// codeStream.ldc(constant.stringValue());
+// } else {
+// generateCode(blockScope, codeStream, true);
+// codeStream.invokeStringValueOf(T_Object);
+// }
+// } else {
+// generateCode(blockScope, codeStream, true);
+// codeStream.invokeStringValueOf(typeID);
+// }
+// codeStream.invokeStringBufferStringConstructor();
+// }
+
+ // Base types need that the widening is explicitly done by the compiler using some bytecode like i2f
+ public void implicitWidening(
+ TypeBinding runtimeTimeType,
+ TypeBinding compileTimeType) {
+
+ if (runtimeTimeType == null || compileTimeType == null)
+ return;
+
+// if (compileTimeType.id == T_null) {
+// // this case is possible only for constant null
+// // The type of runtime is a reference type
+// // The code gen use the constant id thus any value
+// // for the runtime id (akak the <<4) could be used.
+// // T_Object is used as some general T_reference
+// implicitConversion = (T_Object << 4) + T_null;
+// return;
+// }
+
+ switch (runtimeTimeType.id) {
+ case T_byte :
+ case T_short :
+ case T_char :
+ implicitConversion = (T_int << 4) + compileTimeType.id;
+ break;
+ case T_String :
+ case T_float :
+ case T_boolean :
+ case T_double :
+ case T_int : //implicitConversion may result in i2i which will result in NO code gen
+ case T_long :
+ implicitConversion = (runtimeTimeType.id << 4) + compileTimeType.id;
+ break;
+ default : //nothing on regular object ref
+ }
+ }
+
+ public boolean isCompactableOperation() {
+
+ return false;
+ }
+
+ //Return true if the conversion is done AUTOMATICALLY by the vm
+ //while the javaVM is an int based-machine, thus for example pushing
+ //a byte onto the stack , will automatically creates a int on the stack
+ //(this request some work d be done by the VM on signed numbers)
+ public boolean isConstantValueOfTypeAssignableToType(
+ TypeBinding constantType,
+ TypeBinding targetType) {
+
+ if (constant == Constant.NotAConstant)
+ return false;
+ if (constantType == targetType)
+ return true;
+ if (constantType.isBaseType() && targetType.isBaseType()) {
+ //No free assignment conversion from anything but to integral ones.
+ if ((constantType == IntBinding
+ || BaseTypeBinding.isWidening(T_int, constantType.id))
+ && (BaseTypeBinding.isNarrowing(targetType.id, T_int))) {
+ //use current explicit conversion in order to get some new value to compare with current one
+ return isConstantValueRepresentable(constant, constantType.id, targetType.id);
+ }
+ }
+ return false;
+ }
+
+ public boolean isTypeReference() {
+ return false;
+ }
+ public StringBuffer print(int indent, StringBuffer output) {
+ printIndent(indent, output);
+ return printExpression(indent, output);
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ output.append(super.toString(0));
+ return output;
+ }
+
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+ return print(indent, output).append(";"); //$NON-NLS-1$
+ }
+ public void resolve(BlockScope scope) {
+ // drops the returning expression's type whatever the type is.
+
+ this.resolveType(scope);
+ return;
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+ // by default... subclasses should implement a better TC if required.
+
+ return null;
+ }
+
+ public TypeBinding resolveTypeExpecting(
+ BlockScope scope,
+ TypeBinding expectedType) {
+
+ TypeBinding expressionType = this.resolveType(scope);
+ if (expressionType == null) return null;
+ if (expressionType == expectedType) return expressionType;
+
+ if (!expressionType.isCompatibleWith(expectedType)) {
+ scope.problemReporter().typeMismatchError(expressionType, expectedType, this);
+ return null;
+ }
+ return expressionType;
+ }
+
+ public String toString(int tab) {
+
+ //Subclass re-define toStringExpression
+ String s = tabString(tab);
+ if (constant != null)
+ //before TC has runned
+ if (constant != NotAConstant)
+ //after the TC has runned
+ s += " /*cst:" + constant.toString() + "*/ "; //$NON-NLS-1$ //$NON-NLS-2$
+ return s + toStringExpression(tab);
+ }
+
+ //Subclass re-define toStringExpression
+ //This method is abstract and should never be called
+ //but we provide some code that is running.....just in case
+ //of developpement time (while every thing is not built)
+ public String toStringExpression() {
+
+ return super.toString(0);
+ }
+
+ public String toStringExpression(int tab) {
+ // default is regular toString expression (qualified allocation expressions redifine this method)
+ return this.toStringExpression();
+ }
+
+ public Expression toTypeReference() {
+ //by default undefined
+
+ //this method is meanly used by the parser in order to transform
+ //an expression that is used as a type reference in a cast ....
+ //--appreciate the fact that castExpression and ExpressionWithParenthesis
+ //--starts with the same pattern.....
+
+ return this;
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExtendedStringLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExtendedStringLiteral.java
new file mode 100644
index 0000000..6427535
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ExtendedStringLiteral.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class ExtendedStringLiteral extends StringLiteral {
+
+ /**
+ * Build a string+char literal
+ */
+// public ExtendedStringLiteral(StringLiteral str, CharLiteral character) {
+//
+// super(str.source, str.sourceStart, str.sourceEnd);
+// extendWith(character);
+// }
+
+ /**
+ * Build a two-strings literal
+ * */
+ public ExtendedStringLiteral(StringLiteral str1, StringLiteral str2) {
+
+ super(str1.source, str1.sourceStart, str1.sourceEnd);
+ extendWith(str2);
+ }
+
+ /**
+ * Add the lit source to mine, just as if it was mine
+ */
+// public ExtendedStringLiteral extendWith(CharLiteral lit) {
+//
+// //update the source
+// int length = source.length;
+// System.arraycopy(source, 0, (source = new char[length + 1]), 0, length);
+// source[length] = lit.value;
+// //position at the end of all literals
+// sourceEnd = lit.sourceEnd;
+// return this;
+// }
+
+ /**
+ * Add the lit source to mine, just as if it was mine
+ */
+ public ExtendedStringLiteral extendWith(StringLiteral lit) {
+
+ //uddate the source
+ int length = source.length;
+ System.arraycopy(
+ source,
+ 0,
+ source = new char[length + lit.source.length],
+ 0,
+ length);
+ System.arraycopy(lit.source, 0, source, length, lit.source.length);
+ //position at the end of all literals
+ sourceEnd = lit.sourceEnd;
+ return this;
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ return output.append("ExtendedStringLiteral{").append(source).append('}'); //$NON-NLS-1$
+ }
+ public String toStringExpression() {
+
+ String str = "ExtendedStringLiteral{" + new String(source) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
+ return str;
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java
new file mode 100644
index 0000000..f9d289e
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class FalseLiteral extends MagicLiteral {
+ static final char[] source = {'f', 'a', 'l', 's', 'e'};
+public FalseLiteral(int s , int e) {
+ super(s,e);
+}
+public void computeConstant() {
+
+ constant = Constant.fromValue(false);}
+/**
+ * Code generation for false literal
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// codeStream.iconst_0();
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+//public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+//
+// // falseLabel being not nil means that we will not fall through into the FALSE case
+//
+// int pc = codeStream.position;
+// if (valueRequired) {
+// if (falseLabel != null) {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// codeStream.goto_(falseLabel);
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public TypeBinding literalType(BlockScope scope) {
+ return BooleanBinding;
+}
+/**
+ *
+ */
+public char[] source() {
+ return source;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java
new file mode 100644
index 0000000..d561986
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java
@@ -0,0 +1,235 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class FieldDeclaration extends AbstractVariableDeclaration {
+ public FieldBinding binding;
+
+ boolean hasBeenResolved = false;
+
+ //allows to retrieve both the "type" part of the declaration (part1)
+ //and also the part that decribe the name and the init and optionally
+ //some other dimension ! ....
+ //public int[] a, b[] = X, c ;
+ //for b that would give for
+ // - part1 : public int[]
+ // - part2 : b[] = X,
+
+ public int endPart1Position;
+
+ public int endPart2Position;
+
+ public FieldDeclaration() {
+ }
+
+ public FieldDeclaration(char[] name, int sourceStart, int sourceEnd) {
+
+ this.name = name;
+
+ //due to some declaration like
+ // int x, y = 3, z , x ;
+ //the sourceStart and the sourceEnd is ONLY on the name
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+
+ public FieldDeclaration(Expression initialization, char[] name, int sourceStart, int sourceEnd) {
+
+ this.initialization = initialization;
+ this.name = name;
+
+ //due to some declaration like
+ // int x, y = 3, z , x ;
+ //the sourceStart and the sourceEnd is ONLY on the name
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+
+ public FlowInfo analyseCode(MethodScope initializationScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ if (this.binding != null && this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
+ if (!initializationScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
+ initializationScope.problemReporter().unusedPrivateField(this);
+ }
+ }
+ // cannot define static non-constant field inside nested class
+ if (binding != null && binding.isValidBinding() && binding.isStatic() && binding.constant == NotAConstant
+ && binding.declaringClass.isNestedType() && binding.declaringClass.isClass() && !binding.declaringClass.isStatic()) {
+ initializationScope.problemReporter().unexpectedStaticModifierForField((SourceTypeBinding) binding.declaringClass, this);
+ }
+
+ if (initialization != null) {
+ flowInfo = initialization.analyseCode(initializationScope, flowContext, flowInfo).unconditionalInits();
+ flowInfo.markAsDefinitelyAssigned(binding);
+ }
+ return flowInfo;
+ }
+
+ /**
+ * Code generation for a field declaration: standard assignment to a field
+ *
+ * @param currentScope
+ * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream
+ * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ //
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // // do not generate initialization code if final and static (constant is then
+ // // recorded inside the field itself).
+ // int pc = codeStream.position;
+ // boolean isStatic;
+ // if (initialization != null
+ // && !((isStatic = binding.isStatic()) && binding.constant != NotAConstant)) {
+ // // non-static field, need receiver
+ // if (!isStatic)
+ // codeStream.aload_0();
+ // // generate initialization value
+ // initialization.generateCode(currentScope, codeStream, true);
+ // // store into field
+ // if (isStatic) {
+ // codeStream.putstatic(binding);
+ // } else {
+ // codeStream.putfield(binding);
+ // }
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ public TypeBinding getTypeBinding(Scope scope) {
+
+ return type.getTypeBinding(scope);
+ }
+
+ public boolean isField() {
+
+ return true;
+ }
+
+ public boolean isStatic() {
+
+ if (binding != null)
+ return binding.isStatic();
+ return (modifiers & AccStatic) != 0;
+ }
+
+ public String name() {
+
+ return String.valueOf(name);
+ }
+
+ public void resolve(MethodScope initializationScope) {
+
+ // the two could be regrouped into
+ // a single line but it is clearer to have two lines while the reason of their
+ // existence is not at all the same. See comment for the second one.
+
+ //--------------------------------------------------------
+ if (!this.hasBeenResolved && binding != null && this.binding.isValidBinding()) {
+
+ this.hasBeenResolved = true;
+
+ if (isTypeUseDeprecated(this.binding.type, initializationScope))
+ initializationScope.problemReporter().deprecatedType(this.binding.type, this.type);
+
+ this.type.resolvedType = this.binding.type; // update binding for type reference
+
+ // the resolution of the initialization hasn't been done
+ if (this.initialization == null) {
+ this.binding.constant = Constant.NotAConstant;
+ } else {
+ int previous = initializationScope.fieldDeclarationIndex;
+ try {
+ initializationScope.fieldDeclarationIndex = this.binding.id;
+
+ // break dead-lock cycles by forcing constant to NotAConstant
+ this.binding.constant = Constant.NotAConstant;
+
+ TypeBinding typeBinding = this.binding.type;
+ TypeBinding initializationTypeBinding;
+
+ if (initialization instanceof ArrayInitializer) {
+
+ if ((initializationTypeBinding = this.initialization.resolveTypeExpecting(initializationScope, typeBinding)) != null) {
+ ((ArrayInitializer) this.initialization).binding = (ArrayBinding) initializationTypeBinding;
+ this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
+ }
+ } else if ((initializationTypeBinding = initialization.resolveType(initializationScope)) != null) {
+
+ if (this.initialization.isConstantValueOfTypeAssignableToType(initializationTypeBinding, typeBinding)
+ || (typeBinding.isBaseType() && BaseTypeBinding.isWidening(typeBinding.id, initializationTypeBinding.id))) {
+
+ this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
+
+ } else if (initializationTypeBinding.isCompatibleWith(typeBinding)) {
+ this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
+
+ } else {
+ initializationScope.problemReporter().typeMismatchError(initializationTypeBinding, typeBinding, this);
+ }
+ if (this.binding.isFinal()) { // cast from constant actual type to variable type
+ this.binding.constant = this.initialization.constant.castTo((this.binding.type.id << 4)
+ + this.initialization.constant.typeID());
+ }
+ } else {
+ this.binding.constant = NotAConstant;
+ }
+ } finally {
+ initializationScope.fieldDeclarationIndex = previous;
+ if (this.binding.constant == null)
+ this.binding.constant = Constant.NotAConstant;
+ }
+ }
+ }
+ }
+
+ public void traverse(ASTVisitor visitor, MethodScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ type.traverse(visitor, scope);
+ if (initialization != null)
+ initialization.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof FieldDeclaration) {
+ char[] objName = ((FieldDeclaration) obj).name;
+ if (name.length != objName.length) {
+ return false;
+ }
+ for (int i = 0; i < objName.length; i++) {
+ if (name[i] != objName[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return super.equals(obj);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldReference.java
new file mode 100644
index 0000000..22d3e6c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldReference.java
@@ -0,0 +1,557 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class FieldReference extends Reference implements InvocationSite {
+
+ public Expression receiver;
+ public char[] token;
+ public FieldBinding binding, codegenBinding;
+ public long nameSourcePosition; //(start<<32)+end
+ MethodBinding syntheticReadAccessor, syntheticWriteAccessor;
+ public TypeBinding receiverType;
+
+ public FieldReference(char[] source, long pos) {
+
+ token = source;
+ nameSourcePosition = pos;
+ //by default the position are the one of the field (not true for super access)
+// sourceStart = (int) (pos >>> 32);
+// sourceEnd = (int) (pos & 0x00000000FFFFFFFFL);
+ sourceStart = (int) pos;
+ sourceEnd = sourceStart + source.length;
+ bits |= BindingIds.FIELD;
+
+ }
+
+ public FlowInfo analyseAssignment(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo,
+ Assignment assignment,
+ boolean isCompound) {
+
+ // compound assignment extra work
+ if (isCompound) { // check the variable part is initialized if blank final
+ if (binding.isBlankFinal()
+ && receiver.isThis()
+ && currentScope.allowBlankFinalFieldAssignment(binding)
+ && (!flowInfo.isDefinitelyAssigned(binding))) {
+ currentScope.problemReporter().uninitializedBlankFinalField(binding, this);
+ // we could improve error msg here telling "cannot use compound assignment on final blank field"
+ }
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ }
+ flowInfo =
+ receiver
+ .analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic())
+ .unconditionalInits();
+ if (assignment.expression != null) {
+ flowInfo =
+ assignment
+ .expression
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+ manageSyntheticWriteAccessIfNecessary(currentScope);
+
+ // check if assigning a final field
+ if (binding.isFinal()) {
+ // in a context where it can be assigned?
+ if (binding.isBlankFinal()
+ && !isCompound
+ && receiver.isThis()
+ && !(receiver instanceof QualifiedThisReference)
+ && ((receiver.bits & ParenthesizedMASK) == 0) // (this).x is forbidden
+ && currentScope.allowBlankFinalFieldAssignment(binding)) {
+ if (flowInfo.isPotentiallyAssigned(binding)) {
+ currentScope.problemReporter().duplicateInitializationOfBlankFinalField(
+ binding,
+ this);
+ } else {
+ flowContext.recordSettingFinal(binding, this);
+ }
+ flowInfo.markAsDefinitelyAssigned(binding);
+ } else {
+ // assigning a final field outside an initializer or constructor or wrong reference
+ currentScope.problemReporter().cannotAssignToFinalField(binding, this);
+ }
+ }
+ return flowInfo;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return analyseCode(currentScope, flowContext, flowInfo, true);
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo,
+ boolean valueRequired) {
+
+ receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic());
+ if (valueRequired) {
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ }
+ return flowInfo;
+ }
+
+ public FieldBinding fieldBinding() {
+
+ return binding;
+ }
+
+// public void generateAssignment(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Assignment assignment,
+// boolean valueRequired) {
+//
+// receiver.generateCode(
+// currentScope,
+// codeStream,
+// !this.codegenBinding.isStatic());
+// assignment.expression.generateCode(currentScope, codeStream, true);
+// fieldStore(
+// codeStream,
+// this.codegenBinding,
+// syntheticWriteAccessor,
+// valueRequired);
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(assignment.implicitConversion);
+// }
+// }
+
+ /**
+ * Field reference code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// if (constant != NotAConstant) {
+// if (valueRequired) {
+// codeStream.generateConstant(constant, implicitConversion);
+// }
+// } else {
+// boolean isStatic = this.codegenBinding.isStatic();
+// receiver.generateCode(currentScope, codeStream, !isStatic);
+// if (valueRequired) {
+// if (this.codegenBinding.constant == NotAConstant) {
+// if (this.codegenBinding.declaringClass == null) { // array length
+// codeStream.arraylength();
+// } else {
+// if (syntheticReadAccessor == null) {
+// if (isStatic) {
+// codeStream.getstatic(this.codegenBinding);
+// } else {
+// codeStream.getfield(this.codegenBinding);
+// }
+// } else {
+// codeStream.invokestatic(syntheticReadAccessor);
+// }
+// }
+// codeStream.generateImplicitConversion(implicitConversion);
+// } else {
+// if (!isStatic) {
+// codeStream.invokeObjectGetClass(); // perform null check
+// codeStream.pop();
+// }
+// codeStream.generateConstant(this.codegenBinding.constant, implicitConversion);
+// }
+// } else {
+// if (!isStatic){
+// codeStream.invokeObjectGetClass(); // perform null check
+// codeStream.pop();
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+//
+// public void generateCompoundAssignment(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Expression expression,
+// int operator,
+// int assignmentImplicitConversion,
+// boolean valueRequired) {
+//
+// boolean isStatic;
+// receiver.generateCode(
+// currentScope,
+// codeStream,
+// !(isStatic = this.codegenBinding.isStatic()));
+// if (isStatic) {
+// if (syntheticReadAccessor == null) {
+// codeStream.getstatic(this.codegenBinding);
+// } else {
+// codeStream.invokestatic(syntheticReadAccessor);
+// }
+// } else {
+// codeStream.dup();
+// if (syntheticReadAccessor == null) {
+// codeStream.getfield(this.codegenBinding);
+// } else {
+// codeStream.invokestatic(syntheticReadAccessor);
+// }
+// }
+// int operationTypeID;
+// if ((operationTypeID = implicitConversion >> 4) == T_String) {
+// codeStream.generateStringAppend(currentScope, null, expression);
+// } else {
+// // promote the array reference to the suitable operation type
+// codeStream.generateImplicitConversion(implicitConversion);
+// // generate the increment value (will by itself be promoted to the operation value)
+// if (expression == IntLiteral.One) { // prefix operation
+// codeStream.generateConstant(expression.constant, implicitConversion);
+// } else {
+// expression.generateCode(currentScope, codeStream, true);
+// }
+// // perform the operation
+// codeStream.sendOperator(operator, operationTypeID);
+// // cast the value back to the array reference type
+// codeStream.generateImplicitConversion(assignmentImplicitConversion);
+// }
+// fieldStore(
+// codeStream,
+// this.codegenBinding,
+// syntheticWriteAccessor,
+// valueRequired);
+// }
+//
+// public void generatePostIncrement(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// CompoundAssignment postIncrement,
+// boolean valueRequired) {
+//
+// boolean isStatic;
+// receiver.generateCode(
+// currentScope,
+// codeStream,
+// !(isStatic = this.codegenBinding.isStatic()));
+// if (isStatic) {
+// if (syntheticReadAccessor == null) {
+// codeStream.getstatic(this.codegenBinding);
+// } else {
+// codeStream.invokestatic(syntheticReadAccessor);
+// }
+// } else {
+// codeStream.dup();
+// if (syntheticReadAccessor == null) {
+// codeStream.getfield(this.codegenBinding);
+// } else {
+// codeStream.invokestatic(syntheticReadAccessor);
+// }
+// }
+// if (valueRequired) {
+// if (isStatic) {
+// if ((this.codegenBinding.type == LongBinding)
+// || (this.codegenBinding.type == DoubleBinding)) {
+// codeStream.dup2();
+// } else {
+// codeStream.dup();
+// }
+// } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
+// if ((this.codegenBinding.type == LongBinding)
+// || (this.codegenBinding.type == DoubleBinding)) {
+// codeStream.dup2_x1();
+// } else {
+// codeStream.dup_x1();
+// }
+// }
+// }
+// codeStream.generateConstant(
+// postIncrement.expression.constant,
+// implicitConversion);
+// codeStream.sendOperator(postIncrement.operator, this.codegenBinding.type.id);
+// codeStream.generateImplicitConversion(
+// postIncrement.assignmentImplicitConversion);
+// fieldStore(codeStream, this.codegenBinding, syntheticWriteAccessor, false);
+// }
+
+ public static final Constant getConstantFor(
+ FieldBinding binding,
+ Reference reference,
+ boolean isImplicit,
+ Scope referenceScope) {
+
+ //propagation of the constant.
+
+ //ref can be a FieldReference, a SingleNameReference or a QualifiedNameReference
+ //indexInQualification may have a value greater than zero only for QualifiednameReference
+ //if ref==null then indexInQualification==0 AND implicitReceiver == false. This case is a
+ //degenerated case where a fake reference field (null)
+ //is associted to a real FieldBinding in order
+ //to allow its constant computation using the regular path (in other words, find the fieldDeclaration
+ //and proceed to its type resolution). As implicitReceiver is false, no error reporting
+ //against ref will be used ==> no nullPointerException risk ....
+
+ //special treatment for langage-built-in field (their declaring class is null)
+ if (binding.declaringClass == null) {
+ //currently only one field "length" : the constant computation is never done
+ return NotAConstant;
+ }
+ if (!binding.isFinal()) {
+ return binding.constant = NotAConstant;
+ }
+ if (binding.constant != null) {
+ if (isImplicit || (reference instanceof QualifiedNameReference
+ && binding == ((QualifiedNameReference)reference).binding)) {
+ return binding.constant;
+ }
+ return NotAConstant;
+ }
+
+ //The field has not been yet type checked.
+ //It also means that the field is not coming from a class that
+ //has already been compiled. It can only be from a class within
+ //compilation units to process. Thus the field is NOT from a BinaryTypeBinbing
+
+ SourceTypeBinding typeBinding = (SourceTypeBinding) binding.declaringClass;
+ TypeDeclaration typeDecl = typeBinding.scope.referenceContext;
+ FieldDeclaration fieldDecl = typeDecl.declarationOf(binding);
+
+ fieldDecl.resolve(binding.isStatic() //side effect on binding
+ ? typeDecl.staticInitializerScope
+ : typeDecl.initializerScope);
+
+ if (isImplicit || (reference instanceof QualifiedNameReference
+ && binding == ((QualifiedNameReference)reference).binding)) {
+ return binding.constant;
+ }
+ return NotAConstant;
+ }
+
+ public boolean isSuperAccess() {
+
+ return receiver.isSuper();
+ }
+
+ public boolean isTypeAccess() {
+
+ return receiver != null && receiver.isTypeReference();
+ }
+
+ /*
+ * No need to emulate access to protected fields since not implicitly accessed
+ */
+ public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope) {
+
+ if (binding.isPrivate()) {
+ if ((currentScope.enclosingSourceType() != binding.declaringClass)
+ && (binding.constant == NotAConstant)) {
+ syntheticReadAccessor =
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
+ return;
+ }
+
+ } else if (receiver instanceof QualifiedSuperReference) { // qualified super
+
+ // qualified super need emulation always
+ SourceTypeBinding destinationType =
+ (SourceTypeBinding) (((QualifiedSuperReference) receiver)
+ .currentCompatibleType);
+ syntheticReadAccessor = destinationType.addSyntheticMethod(binding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
+ return;
+
+ } else if (binding.isProtected()) {
+
+ SourceTypeBinding enclosingSourceType;
+ if (((bits & DepthMASK) != 0)
+ && binding.declaringClass.getPackage()
+ != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()) {
+
+ SourceTypeBinding currentCompatibleType =
+ (SourceTypeBinding) enclosingSourceType.enclosingTypeAt(
+ (bits & DepthMASK) >> DepthSHIFT);
+ syntheticReadAccessor = currentCompatibleType.addSyntheticMethod(binding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
+ return;
+ }
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
+// if (binding.declaringClass != this.receiverType
+// && !this.receiverType.isArrayType()
+// && binding.declaringClass != null // array.length
+// && binding.constant == NotAConstant
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && binding.declaringClass.id != T_Object)
+// //no change for Object fields (in case there was)
+// || !binding.declaringClass.canBeSeenBy(currentScope))) {
+// this.codegenBinding =
+// currentScope.enclosingSourceType().getUpdatedFieldBinding(
+// binding,
+// (ReferenceBinding) this.receiverType);
+// }
+ }
+
+ /*
+ * No need to emulate access to protected fields since not implicitly accessed
+ */
+ public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope) {
+
+ if (binding.isPrivate()) {
+ if (currentScope.enclosingSourceType() != binding.declaringClass) {
+ syntheticWriteAccessor =
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
+ return;
+ }
+
+ } else if (receiver instanceof QualifiedSuperReference) { // qualified super
+
+ // qualified super need emulation always
+ SourceTypeBinding destinationType =
+ (SourceTypeBinding) (((QualifiedSuperReference) receiver)
+ .currentCompatibleType);
+ syntheticWriteAccessor = destinationType.addSyntheticMethod(binding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
+ return;
+
+ } else if (binding.isProtected()) {
+
+ SourceTypeBinding enclosingSourceType;
+ if (((bits & DepthMASK) != 0)
+ && binding.declaringClass.getPackage()
+ != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()) {
+
+ SourceTypeBinding currentCompatibleType =
+ (SourceTypeBinding) enclosingSourceType.enclosingTypeAt(
+ (bits & DepthMASK) >> DepthSHIFT);
+ syntheticWriteAccessor =
+ currentCompatibleType.addSyntheticMethod(binding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
+ return;
+ }
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
+// if (binding.declaringClass != this.receiverType
+// && !this.receiverType.isArrayType()
+// && binding.declaringClass != null // array.length
+// && binding.constant == NotAConstant
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && binding.declaringClass.id != T_Object)
+// //no change for Object fields (in case there was)
+// || !binding.declaringClass.canBeSeenBy(currentScope))) {
+// this.codegenBinding =
+// currentScope.enclosingSourceType().getUpdatedFieldBinding(
+// binding,
+// (ReferenceBinding) this.receiverType);
+// }
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ // Answer the signature type of the field.
+ // constants are propaged when the field is final
+ // and initialized with a (compile time) constant
+
+ // regular receiver reference
+ this.receiverType = receiver.resolveType(scope);
+ if (this.receiverType == null) {
+ constant = NotAConstant;
+ return null;
+ }
+ // the case receiverType.isArrayType and token = 'length' is handled by the scope API
+ this.codegenBinding =
+ this.binding = scope.getField(this.receiverType, token, this);
+ if (!binding.isValidBinding()) {
+ constant = NotAConstant;
+ scope.problemReporter().invalidField(this, this.receiverType);
+ return null;
+ }
+
+ if (isFieldUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedField(binding, this);
+
+ boolean isImplicitThisRcv = receiver.isImplicitThis();
+ constant = FieldReference.getConstantFor(binding, this, isImplicitThisRcv, scope);
+ if (!isImplicitThisRcv) {
+ constant = NotAConstant;
+ }
+ if (binding.isStatic()) {
+ // static field accessed through receiver? legal but unoptimal (optional warning)
+ if (!(isImplicitThisRcv
+ || receiver.isSuper()
+ || (receiver instanceof NameReference
+ && (((NameReference) receiver).bits & BindingIds.TYPE) != 0))) {
+ scope.problemReporter().unnecessaryReceiverForStaticField(this, binding);
+ }
+ }
+ return this.resolvedType = binding.type;
+ }
+
+ public void setActualReceiverType(ReferenceBinding receiverType) {
+ // ignored
+ }
+
+ public void setDepth(int depth) {
+
+ bits &= ~DepthMASK; // flush previous depth if any
+ if (depth > 0) {
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
+ }
+ }
+
+ public void setFieldIndex(int index) {
+ // ignored
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ return receiver.printExpression(0, output).append('.').append(token);
+ }
+ public String toStringExpression() {
+
+ return receiver.toString() + "." //$NON-NLS-1$
+ + new String(token);
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ receiver.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FloatLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FloatLiteral.java
new file mode 100644
index 0000000..64035d5
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FloatLiteral.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class FloatLiteral extends NumberLiteral {
+ float value;
+ final static float Float_MIN_VALUE = Float.intBitsToFloat(1); // work-around VAJ problem 1F6IGUU
+public FloatLiteral(char[] token, int s, int e) {
+ super(token, s,e);
+}
+public void computeConstant() {
+
+ //the source is correctly formated so the exception should never occurs
+
+ Float computedValue;
+ try {
+ computedValue = Float.valueOf(String.valueOf(source));
+ } catch (NumberFormatException e) {
+ return;
+ }
+
+ if (computedValue.doubleValue() > Float.MAX_VALUE){
+ return; //may be Infinity
+ }
+ if (computedValue.floatValue() < Float_MIN_VALUE){
+ // see 1F6IGUU
+ //only a true 0 can be made of zeros
+ //1.00000000e-46f is illegal ....
+ label : for (int i = 0; i < source.length; i++) {
+ switch (source[i]) {
+ case '.' :
+ case 'f' :
+ case 'F' :
+ case '0' :
+ break;
+ case 'e' :
+ case 'E' :
+ break label; //exposant are valid !....
+ default :
+ return; //error
+
+
+ }
+ }
+ }
+ constant = Constant.fromValue(value = computedValue.floatValue());
+}
+/**
+ * Code generation for float literal
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// if ((implicitConversion >> 4) == T_float)
+// codeStream.generateInlinedValue(value);
+// else
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public TypeBinding literalType(BlockScope scope) {
+ return FloatBinding;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ visitor.visit(this, blockScope);
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java
new file mode 100644
index 0000000..7d0f14c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java
@@ -0,0 +1,384 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.LoopingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ForStatement extends Statement {
+
+ public Statement[] initializations;
+ public Expression condition;
+ public Statement[] increments;
+ public Statement action;
+
+ //when there is no local declaration, there is no need of a new scope
+ //scope is positionned either to a new scope, or to the "upper"scope (see resolveType)
+ public boolean neededScope;
+ public BlockScope scope;
+
+ private Label breakLabel, continueLabel;
+
+ // for local variables table attributes
+ int preCondInitStateIndex = -1;
+ int condIfTrueInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public ForStatement(
+ Statement[] initializations,
+ Expression condition,
+ Statement[] increments,
+ Statement action,
+ boolean neededScope,
+ int s,
+ int e) {
+
+ this.sourceStart = s;
+ this.sourceEnd = e;
+ this.initializations = initializations;
+ this.condition = condition;
+ this.increments = increments;
+ this.action = action;
+ this.neededScope = neededScope;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ breakLabel = new Label();
+ continueLabel = new Label();
+
+ // process the initializations
+ if (initializations != null) {
+ int count = initializations.length, i = 0;
+ while (i < count) {
+ flowInfo = initializations[i++].analyseCode(scope, flowContext, flowInfo);
+ }
+ }
+ preCondInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(flowInfo);
+
+ Constant cst = this.condition == null ? null : this.condition.constant;
+ boolean isConditionTrue = cst == null || (cst != NotAConstant && cst.booleanValue() == true);
+ boolean isConditionFalse = cst != null && (cst != NotAConstant && cst.booleanValue() == false);
+
+ cst = this.condition == null ? null : this.condition.optimizedBooleanConstant();
+ boolean isConditionOptimizedTrue = cst == null || (cst != NotAConstant && cst.booleanValue() == true);
+ boolean isConditionOptimizedFalse = cst != null && (cst != NotAConstant && cst.booleanValue() == false);
+
+ // process the condition
+ LoopingFlowContext condLoopContext = null;
+ if (condition != null) {
+ if (!isConditionTrue) {
+ flowInfo =
+ condition.analyseCode(
+ scope,
+ (condLoopContext =
+ new LoopingFlowContext(flowContext, this, null, null, scope)),
+ flowInfo);
+ }
+ }
+
+ // process the action
+ LoopingFlowContext loopingContext;
+ FlowInfo actionInfo;
+ if (action == null ){
+// || (action.isEmptyBlock() && currentScope.environment().options.complianceLevel <= CompilerOptions.JDK1_3)) {
+ if (condLoopContext != null)
+ condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
+ if (isConditionTrue) {
+ return FlowInfo.DEAD_END;
+ } else {
+ if (isConditionFalse){
+ continueLabel = null; // for(;false;p());
+ }
+ actionInfo = flowInfo.initsWhenTrue().copy();
+ loopingContext =
+ new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
+ }
+ } else {
+ loopingContext =
+ new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
+ FlowInfo initsWhenTrue = flowInfo.initsWhenTrue();
+ condIfTrueInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(initsWhenTrue);
+
+ if (isConditionFalse) {
+ actionInfo = FlowInfo.DEAD_END;
+ } else {
+ actionInfo = initsWhenTrue.copy();
+ if (isConditionOptimizedFalse){
+ actionInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ }
+ if (!actionInfo.complainIfUnreachable(action, scope, false)) {
+ actionInfo = action.analyseCode(scope, loopingContext, actionInfo);
+ }
+
+ // code generation can be optimized when no need to continue in the loop
+ if (!actionInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
+ continueLabel = null;
+ } else {
+ if (condLoopContext != null)
+ condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
+ loopingContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
+ actionInfo =
+ actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits());
+ // for increments
+ }
+ }
+ if ((continueLabel != null) && (increments != null)) {
+ LoopingFlowContext loopContext =
+ new LoopingFlowContext(flowContext, this, null, null, scope);
+ int i = 0, count = increments.length;
+ while (i < count)
+ actionInfo = increments[i++].analyseCode(scope, loopContext, actionInfo);
+ loopContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
+ }
+
+ // infinite loop
+ FlowInfo mergedInfo;
+ if (isConditionOptimizedTrue) {
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(
+ mergedInfo = loopingContext.initsOnBreak);
+ return mergedInfo;
+ }
+
+ //end of loop: either condition false or break
+ mergedInfo =
+ flowInfo.initsWhenFalse().unconditionalInits().mergedWith(
+ loopingContext.initsOnBreak.unconditionalInits());
+ if (isConditionOptimizedTrue && continueLabel == null){
+ mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ /**
+ * For statement code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+//
+// // generate the initializations
+// if (initializations != null) {
+// for (int i = 0, max = initializations.length; i < max; i++) {
+// initializations[i].generateCode(scope, codeStream);
+// }
+// }
+//
+// // label management
+// Label actionLabel = new Label(codeStream);
+// Label conditionLabel = new Label(codeStream);
+// breakLabel.codeStream = codeStream;
+// if (continueLabel != null) {
+// continueLabel.codeStream = codeStream;
+// }
+// // jump over the actionBlock
+// if ((condition != null)
+// && (condition.constant == NotAConstant)
+// && !((action == null || action.isEmptyBlock()) && (increments == null))) {
+// int jumpPC = codeStream.position;
+// codeStream.goto_(conditionLabel);
+// codeStream.recordPositionsFrom(jumpPC, condition.sourceStart);
+// }
+// // generate the loop action
+// actionLabel.place();
+// if (action != null) {
+// // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
+// if (condIfTrueInitStateIndex != -1) {
+// // insert all locals initialized inside the condition into the action generated prior to the condition
+// codeStream.addDefinitelyAssignedVariables(
+// currentScope,
+// condIfTrueInitStateIndex);
+// }
+// action.generateCode(scope, codeStream);
+// }
+// // continuation point
+// if (continueLabel != null) {
+// continueLabel.place();
+// // generate the increments for next iteration
+// if (increments != null) {
+// for (int i = 0, max = increments.length; i < max; i++) {
+// increments[i].generateCode(scope, codeStream);
+// }
+// }
+// }
+//
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (preCondInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// preCondInitStateIndex);
+// }
+//
+// // generate the condition
+// conditionLabel.place();
+// if ((condition != null) && (condition.constant == NotAConstant)) {
+// condition.generateOptimizedBoolean(scope, codeStream, actionLabel, null, true);
+// } else {
+// if (continueLabel != null) {
+// codeStream.goto_(actionLabel);
+// }
+// }
+// breakLabel.place();
+//
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (neededScope) {
+// codeStream.exitUserScope(scope);
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public void resetStateForCodeGeneration() {
+ if (this.breakLabel != null) {
+ this.breakLabel.resetStateForCodeGeneration();
+ }
+ if (this.continueLabel != null) {
+ this.continueLabel.resetStateForCodeGeneration();
+ }
+ }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("for ("); //$NON-NLS-1$
+ //inits
+ if (initializations != null) {
+ for (int i = 0; i < initializations.length; i++) {
+ //nice only with expressions
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ initializations[i].print(0, output);
+ }
+ }
+ output.append("; "); //$NON-NLS-1$
+ //cond
+ if (condition != null) condition.printExpression(0, output);
+ output.append("; "); //$NON-NLS-1$
+ //updates
+ if (increments != null) {
+ for (int i = 0; i < increments.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ increments[i].print(0, output);
+ }
+ }
+ output.append(") "); //$NON-NLS-1$
+ //block
+ if (action == null)
+ output.append(';');
+ else {
+ output.append('\n');
+ action.printStatement(tab + 1, output); //$NON-NLS-1$
+ }
+ return output.append(';');
+ }
+ public void resolve(BlockScope upperScope) {
+
+ // use the scope that will hold the init declarations
+ scope = neededScope ? new BlockScope(upperScope) : upperScope;
+ if (initializations != null)
+ for (int i = 0, length = initializations.length; i < length; i++)
+ initializations[i].resolve(scope);
+ if (condition != null) {
+ TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
+ condition.implicitWidening(type, type);
+ }
+ if (increments != null)
+ for (int i = 0, length = increments.length; i < length; i++)
+ increments[i].resolve(scope);
+ if (action != null)
+ action.resolve(scope);
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab) + "for ("; //$NON-NLS-1$
+ if (!neededScope)
+ s = s + " //--NO upperscope scope needed\n" + tabString(tab) + " "; //$NON-NLS-2$ //$NON-NLS-1$
+ //inits
+ if (initializations != null) {
+ for (int i = 0; i < initializations.length; i++) {
+ //nice only with expressions
+ s = s + initializations[i].toString(0);
+ if (i != (initializations.length - 1))
+ s = s + " , "; //$NON-NLS-1$
+ }
+ };
+ s = s + "; "; //$NON-NLS-1$
+ //cond
+ if (condition != null)
+ s = s + condition.toStringExpression();
+ s = s + "; "; //$NON-NLS-1$
+ //updates
+ if (increments != null) {
+ for (int i = 0; i < increments.length; i++) {
+ //nice only with expressions
+ s = s + increments[i].toString(0);
+ if (i != (increments.length - 1))
+ s = s + " , "; //$NON-NLS-1$
+ }
+ };
+ s = s + ") "; //$NON-NLS-1$
+ //block
+ if (action == null)
+ s = s + "{}"; //$NON-NLS-1$
+ else
+ s = s + "\n" + action.toString(tab + 1); //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ if (initializations != null) {
+ int initializationsLength = initializations.length;
+ for (int i = 0; i < initializationsLength; i++)
+ initializations[i].traverse(visitor, scope);
+ }
+
+ if (condition != null)
+ condition.traverse(visitor, scope);
+
+ if (increments != null) {
+ int incrementsLength = increments.length;
+ for (int i = 0; i < incrementsLength; i++)
+ increments[i].traverse(visitor, scope);
+ }
+
+ if (action != null)
+ action.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java
new file mode 100644
index 0000000..7959ba7
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class IfStatement extends Statement {
+
+ //this class represents the case of only one statement in
+ //either else and/or then branches.
+
+ public Expression condition;
+ public Statement thenStatement;
+ public Statement elseStatement;
+ public Expression[] elseifConditions;
+ public Statement[] elseifStatements;
+ public boolean checkUnreachable;
+ boolean thenExit;
+
+
+ // for local variables table attributes
+ int thenInitStateIndex = -1;
+ int elseInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public IfStatement(
+ Expression condition,
+ Statement thenStatement,
+ int s,
+ int e) {
+
+ this.condition = condition;
+ this.thenStatement = thenStatement;
+ sourceStart = s;
+ sourceEnd = e;
+ checkUnreachable = true;
+ }
+
+ public IfStatement(
+ Expression condition,
+ Statement thenStatement,
+ Statement elseStatement,
+ int s,
+ int e) {
+
+ this.condition = condition;
+ this.thenStatement = thenStatement;
+ this.elseStatement = elseStatement;
+ sourceEnd = e;
+ sourceStart = s;
+ checkUnreachable = true;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // process the condition
+ flowInfo = condition.analyseCode(currentScope, flowContext, flowInfo);
+
+ Constant cst = this.condition.optimizedBooleanConstant();
+ boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ // process the THEN part
+ FlowInfo thenFlowInfo = flowInfo.initsWhenTrue().copy();
+ if (isConditionOptimizedFalse) {
+ thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ if (this.thenStatement != null) {
+ // Save info for code gen
+ thenInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(thenFlowInfo);
+ if (!thenFlowInfo.complainIfUnreachable(thenStatement, currentScope, false)) {
+ thenFlowInfo =
+ thenStatement.analyseCode(currentScope, flowContext, thenFlowInfo);
+ }
+ };
+ // optimizing the jump around the ELSE part
+ this.thenExit = !thenFlowInfo.isReachable();
+
+ // process the ELSE part
+ FlowInfo elseFlowInfo = flowInfo.initsWhenFalse().copy();
+ if (isConditionOptimizedTrue) {
+ elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ if (this.elseStatement != null) {
+ // Save info for code gen
+ elseInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(elseFlowInfo);
+ if (!elseFlowInfo.complainIfUnreachable(elseStatement, currentScope, false)) {
+ elseFlowInfo =
+ elseStatement.analyseCode(currentScope, flowContext, elseFlowInfo);
+ }
+ }
+
+ boolean elseExit = !elseFlowInfo.isReachable();
+
+ // merge THEN & ELSE initializations
+ FlowInfo mergedInfo;
+// if (isConditionOptimizedTrue){
+// if (!this.thenExit) {
+// mergedInfo = thenFlowInfo;
+// } else {
+// mergedInfo = elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+// }
+//
+// } else if (isConditionOptimizedFalse) {
+// if (!elseExit) {
+// mergedInfo = elseFlowInfo;
+// } else {
+// mergedInfo = thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+// }
+//
+// } else {
+// mergedInfo = thenFlowInfo.mergedWith(elseFlowInfo.unconditionalInits());
+// }
+ if (isConditionOptimizedTrue){
+ if (!this.thenExit) {
+ mergedInfo = thenFlowInfo.addPotentialInitializationsFrom(elseFlowInfo);
+ } else {
+ mergedInfo = elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+
+ } else if (isConditionOptimizedFalse) {
+ if (!elseExit) {
+ mergedInfo = elseFlowInfo.addPotentialInitializationsFrom(thenFlowInfo);
+ } else {
+ mergedInfo = thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+
+ } else {
+ mergedInfo = thenFlowInfo.mergedWith(elseFlowInfo.unconditionalInits());
+ }
+
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ /**
+ * If code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((this.bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+// Label endifLabel = new Label(codeStream);
+//
+// // optimizing the then/else part code gen
+// Constant cst;
+// boolean hasThenPart =
+// !(((cst = this.condition.optimizedBooleanConstant()) != NotAConstant
+// && cst.booleanValue() == false)
+// || this.thenStatement == null
+// || this.thenStatement.isEmptyBlock());
+// boolean hasElsePart =
+// !((cst != NotAConstant && cst.booleanValue() == true)
+// || this.elseStatement == null
+// || this.elseStatement.isEmptyBlock());
+//
+// if (hasThenPart) {
+// Label falseLabel;
+// // generate boolean condition
+// this.condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// true);
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (thenInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// thenInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, thenInitStateIndex);
+// }
+// // generate then statement
+// this.thenStatement.generateCode(currentScope, codeStream);
+// // jump around the else statement
+// if (hasElsePart && !thenExit) {
+// this.thenStatement.branchChainTo(endifLabel);
+// int position = codeStream.position;
+// codeStream.goto_(endifLabel);
+// codeStream.updateLastRecordedEndPC(position);
+// //goto is tagged as part of the thenAction block
+// }
+// falseLabel.place();
+// } else {
+// if (hasElsePart) {
+// // generate boolean condition
+// this.condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// endifLabel,
+// null,
+// true);
+// } else {
+// // generate condition side-effects
+// this.condition.generateCode(currentScope, codeStream, false);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+// }
+// // generate else statement
+// if (hasElsePart) {
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (elseInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// elseInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, elseInitStateIndex);
+// }
+// this.elseStatement.generateCode(currentScope, codeStream);
+// }
+// endifLabel.place();
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output).append("if ("); //$NON-NLS-1$
+ condition.printExpression(0, output).append(")\n"); //$NON-NLS-1$
+ thenStatement.printStatement(indent + 2, output);
+ if (elseStatement != null) {
+ output.append('\n');
+ printIndent(indent, output);
+ output.append("else\n"); //$NON-NLS-1$
+ elseStatement.printStatement(indent + 2, output);
+ }
+ return output;
+ }
+ public void resolve(BlockScope scope) {
+
+ TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
+ condition.implicitWidening(type, type);
+ if (thenStatement != null)
+ thenStatement.resolve(scope);
+ if (elseStatement != null)
+ elseStatement.resolve(scope);
+ }
+
+ public String toString(int tab) {
+
+ String inFront, s = tabString(tab);
+ inFront = s;
+ s = s + "if (" + condition.toStringExpression() + ") \n"; //$NON-NLS-1$ //$NON-NLS-2$
+ s = s + thenStatement.toString(tab + 2) + ";"; //$NON-NLS-1$
+ if (elseStatement != null)
+ s = s + "\n" + inFront + "else\n" + elseStatement.toString(tab + 2) + ";"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ condition.traverse(visitor, blockScope);
+ if (thenStatement != null)
+ thenStatement.traverse(visitor, blockScope);
+ if (elseStatement != null)
+ elseStatement.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImplicitDocTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImplicitDocTypeReference.java
new file mode 100644
index 0000000..c6287f0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImplicitDocTypeReference.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ImplicitDocTypeReference extends TypeReference {
+
+ public char[] token;
+
+ public ImplicitDocTypeReference(char[] name, int pos) {
+ super();
+ this.token = name;
+ this.sourceStart = pos;
+ this.sourceEnd = pos;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#copyDims(int)
+ */
+ public TypeReference copyDims(int dim) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
+ */
+ public TypeBinding getTypeBinding(Scope scope) {
+ this.constant = NotAConstant;
+ return this.resolvedType = scope.enclosingSourceType();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeName()
+ */
+ public char[][] getTypeName() {
+ if (this.token != null) {
+ char[][] tokens = { this.token };
+ return tokens;
+ }
+ return null;
+ }
+ public boolean isThis() {
+ return true;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.ClassScope)
+ */
+ public void traverse(ASTVisitor visitor, ClassScope classScope) {
+ // Do nothing
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#printExpression(int, java.lang.StringBuffer)
+ */
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ return new StringBuffer();
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImportReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImportReference.java
new file mode 100644
index 0000000..4f45275
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ImportReference.java
@@ -0,0 +1,117 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
+
+import org.eclipse.core.resources.IFile;
+
+public class ImportReference extends ASTNode {
+
+ public char[][] tokens;
+
+ // public long[] sourcePositions; //each entry is using the code : (start<<32) + end
+ public boolean onDemand = true; //most of the time
+
+ public final char[] includeSource;
+
+ public int declarationEnd;// doesn't include an potential trailing comment
+
+ public int declarationSourceStart;
+
+ public int declarationSourceEnd;
+
+ public boolean used;
+
+ private IFile fFile;
+
+ public ImportReference(char[][] sources, char[] sourceString, int start, int end, boolean d) { // char[][] sources , long[] poss ,
+ // boolean d) {
+ tokens = sources;
+ // sourcePositions = poss ;
+ includeSource = sourceString;
+ onDemand = d;
+ sourceEnd = end;//(int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
+ sourceStart = start;//(int)(sourcePositions[0]>>>32) ;
+ fFile = null;
+ }
+
+ /**
+ * @return char[][]
+ */
+ public char[][] getImportName() {
+ return tokens;
+ }
+
+ public char[] getIncludeName() {
+ return includeSource;
+ }
+
+ public StringBuffer print(int indent, StringBuffer output) {
+
+ return print(indent, output, true);
+ }
+
+ public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) {
+
+ /* when withOnDemand is false, only the name is printed */
+ for (int i = 0; i < tokens.length; i++) {
+ if (i > 0)
+ output.append('.');
+ output.append(tokens[i]);
+ }
+ if (withOnDemand && onDemand) {
+ output.append(".*"); //$NON-NLS-1$
+ }
+ return output;
+ }
+
+ public String toString(int tab) {
+
+ return toString(tab, true);
+ }
+
+ public String toString(int tab, boolean withOnDemand) {
+ /* when withOnDemand is false, only the name is printed */
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < tokens.length; i++) {
+ buffer.append(tokens[i]);
+ if (i < (tokens.length - 1)) {
+ buffer.append("."); //$NON-NLS-1$
+ }
+ }
+ if (withOnDemand && onDemand) {
+ buffer.append(".*"); //$NON-NLS-1$
+ }
+ buffer.append(" - ");
+ buffer.append(includeSource);
+ return buffer.toString();
+ // return new String(includeSource);
+ }
+
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+
+ /**
+ * @return Returns the filePath.
+ */
+ public IFile getFile() {
+ return fFile;
+ }
+
+ /**
+ * @param filePath
+ * The filePath to set.
+ */
+ public void setFile(IFile filePath) {
+ fFile = filePath;
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Initializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Initializer.java
new file mode 100644
index 0000000..4c5f8d6
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Initializer.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
+
+public class Initializer extends FieldDeclaration {
+
+ public Block block;
+ public int lastFieldID;
+ public int bodyStart;
+ public Initializer(Block block, int modifiers) {
+ this.block = block;
+ this.modifiers = modifiers;
+
+ declarationSourceStart = sourceStart = bodyStart = block.sourceStart;
+ }
+
+ public FlowInfo analyseCode(
+ MethodScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return block.analyseCode(currentScope, flowContext, flowInfo);
+ }
+
+ /**
+ * Code generation for a non-static initializer:
+ * standard block code gen
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+// block.generateCode(currentScope, codeStream);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public boolean isField() {
+
+ return false;
+ }
+
+ public boolean isStatic() {
+
+ return (modifiers & AccStatic) != 0;
+ }
+
+ public void parseStatements(
+ UnitParser parser,
+ TypeDeclaration type,
+ CompilationUnitDeclaration unit) {
+
+ //fill up the method body with statement
+ parser.parse(this, type, unit);
+ }
+
+ public void resolve(MethodScope scope) {
+
+ int previous = scope.fieldDeclarationIndex;
+ try {
+ scope.fieldDeclarationIndex = lastFieldID;
+ if (isStatic()) {
+ ReferenceBinding declaringType = scope.enclosingSourceType();
+ if (declaringType.isNestedType() && !declaringType.isStatic())
+ scope.problemReporter().innerTypesCannotDeclareStaticInitializers(
+ declaringType,
+ this);
+ }
+ block.resolve(scope);
+ } finally {
+ scope.fieldDeclarationIndex = previous;
+ }
+ }
+
+ public String toString(int tab) {
+
+ if (modifiers != 0) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(tabString(tab));
+ buffer.append(modifiersString(modifiers));
+ buffer.append("{\n"); //$NON-NLS-1$
+ buffer.append(block.toStringStatements(tab));
+ buffer.append(tabString(tab));
+ buffer.append("}"); //$NON-NLS-1$
+ return buffer.toString();
+ } else {
+ return block.toString(tab);
+ }
+ }
+
+ public void traverse(ASTVisitor visitor, MethodScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ block.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InnerTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InnerTypeDeclaration.java
new file mode 100644
index 0000000..cd375b7
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InnerTypeDeclaration.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+
+public class InnerTypeDeclaration extends TypeDeclaration {
+
+ public InnerTypeDeclaration(CompilationResult compilationResult){
+ super(compilationResult);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InstanceOfExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InstanceOfExpression.java
new file mode 100644
index 0000000..22e3e57
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InstanceOfExpression.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class InstanceOfExpression extends OperatorExpression {
+
+ public Expression expression;
+ public TypeReference type;
+
+ public InstanceOfExpression(
+ Expression expression,
+ TypeReference type,
+ int operator) {
+
+ this.expression = expression;
+ this.type = type;
+ this.bits |= operator << OperatorSHIFT;
+ this.sourceStart = expression.sourceStart;
+ this.sourceEnd = type.sourceEnd;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return expression
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+
+ public final boolean areTypesCastCompatible(
+ BlockScope scope,
+ TypeBinding castType,
+ TypeBinding expressionType) {
+
+ // see specifications p.68
+ //A more cpmplete version of this method is provided on
+ //CastExpression (it deals with constant and need runtime checkcast)
+
+ if (castType == expressionType) return true;
+
+ //by grammatical construction, the first test is ALWAYS false
+ //if (castTb.isBaseType())
+ //{ if (expressionTb.isBaseType())
+ // { if (expression.isConstantValueOfTypeAssignableToType(expressionTb,castTb))
+ // { return true;}
+ // else
+ // { if (expressionTb==castTb)
+ // { return true;}
+ // else
+ // { if (scope.areTypesCompatible(expressionTb,castTb))
+ // { return true; }
+ //
+ // if (BaseTypeBinding.isNarrowing(castTb.id,expressionTb.id))
+ // { return true;}
+ // return false;}}}
+ // else
+ // { return false; }}
+ //else
+ { //-------------checkcast to something which is NOT a basetype----------------------------------
+
+ //null is compatible with every thing ....
+ if (NullBinding == expressionType) {
+ return true;
+ }
+ if (expressionType.isArrayType()) {
+ if (castType.isArrayType()) {
+ //------- (castTb.isArray) expressionTb.isArray -----------
+ TypeBinding expressionEltTb = ((ArrayBinding) expressionType).elementsType(scope);
+ if (expressionEltTb.isBaseType())
+ // <---stop the recursion-------
+ return ((ArrayBinding) castType).elementsType(scope) == expressionEltTb;
+ //recursivly on the elts...
+ return areTypesCastCompatible(
+ scope,
+ ((ArrayBinding) castType).elementsType(scope),
+ expressionEltTb);
+ }
+ if (castType.isClass()) {
+ //------(castTb.isClass) expressionTb.isArray ---------------
+ if (scope.isJavaLangObject(castType))
+ return true;
+ return false;
+ }
+ if (castType.isInterface()) {
+ //------- (castTb.isInterface) expressionTb.isArray -----------
+ if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
+ return true;
+ }
+ return false;
+ }
+
+ return false;
+ }
+ if (expressionType.isBaseType()) {
+ return false;
+ }
+ if (expressionType.isClass()) {
+ if (castType.isArrayType()) {
+ // ---- (castTb.isArray) expressionTb.isClass -------
+ if (scope.isJavaLangObject(expressionType)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ if (castType.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
+ if (expressionType.isCompatibleWith(castType))
+ return true;
+ else {
+ if (castType.isCompatibleWith(expressionType)) {
+ return true;
+ }
+ return false;
+ }
+ }
+ if (castType.isInterface()) {
+ // ----- (castTb.isInterface) expressionTb.isClass -------
+ if (((ReferenceBinding) expressionType).isFinal()) {
+ //no subclass for expressionTb, thus compile-time check is valid
+ if (expressionType.isCompatibleWith(castType))
+ return true;
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ if (expressionType.isInterface()) {
+ if (castType.isArrayType()) {
+ // ----- (castTb.isArray) expressionTb.isInterface ------
+ if (scope.isJavaLangCloneable(expressionType)
+ || scope.isJavaIoSerializable(expressionType))
+ //potential runtime error
+ {
+ return true;
+ }
+ return false;
+ }
+ if (castType.isClass()) {
+ // ----- (castTb.isClass) expressionTb.isInterface --------
+ if (scope.isJavaLangObject(castType))
+ return true;
+ if (((ReferenceBinding) castType).isFinal()) {
+ //no subclass for castTb, thus compile-time check is valid
+ if (castType.isCompatibleWith(expressionType)) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ if (castType.isInterface()) {
+ // ----- (castTb.isInterface) expressionTb.isInterface -------
+ if ((Scope.compareTypes(castType, expressionType) == NotRelated)) {
+ MethodBinding[] castTbMethods = ((ReferenceBinding) castType).methods();
+ int castTbMethodsLength = castTbMethods.length;
+ MethodBinding[] expressionTbMethods =
+ ((ReferenceBinding) expressionType).methods();
+ int expressionTbMethodsLength = expressionTbMethods.length;
+ for (int i = 0; i < castTbMethodsLength; i++) {
+ for (int j = 0; j < expressionTbMethodsLength; j++) {
+ if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
+ if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
+ if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+ }
+ }
+ /**
+ * Code generation for instanceOfExpression
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// expression.generateCode(currentScope, codeStream, true);
+// codeStream.instance_of(type.resolvedType);
+// if (!valueRequired)
+// codeStream.pop();
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ constant = NotAConstant;
+ TypeBinding expressionType = expression.resolveType(scope);
+ TypeBinding checkType = type.resolveType(scope);
+ if (expressionType == null || checkType == null)
+ return null;
+
+ if (!areTypesCastCompatible(scope, checkType, expressionType)) {
+ scope.problemReporter().notCompatibleTypesError(this, expressionType, checkType);
+ return null;
+ }
+ this.resolvedType = BooleanBinding;
+ return BooleanBinding;
+ }
+ public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+
+ expression.printExpression(indent, output).append(" instanceof "); //$NON-NLS-1$
+ return type.print(0, output);
+ }
+ public String toStringExpressionNoParenthesis() {
+
+ return expression.toStringExpression() + " instanceof " + //$NON-NLS-1$
+ type.toString(0);
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ expression.traverse(visitor, scope);
+ type.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteral.java
new file mode 100644
index 0000000..d78e934
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteral.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.impl.DoubleConstant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class IntLiteral extends NumberLiteral {
+ public int value;
+
+ public static final IntLiteral
+ One = new IntLiteral(new char[]{'1'},0,0,1);//used for ++ and --
+
+ static final Constant FORMAT_ERROR = new DoubleConstant(1.0/0.0); // NaN;
+public IntLiteral(char[] token, int s, int e) {
+ super(token, s,e);
+}
+public IntLiteral(char[] token, int s,int e, int value) {
+ this(token, s,e);
+ this.value = value;
+}
+public IntLiteral(int intValue) {
+ //special optimized constructor : the cst is the argument
+
+ //value that should not be used
+ // tokens = null ;
+ // sourceStart = 0;
+ // sourceEnd = 0;
+ super(null,0,0);
+ constant = Constant.fromValue(intValue);
+ value = intValue;
+
+}
+public void computeConstant() {
+ //a special constant is use for the potential Integer.MAX_VALUE+1
+ //which is legal if used with a - as prefix....cool....
+ //notice that Integer.MIN_VALUE == -2147483648
+
+ long MAX = Integer.MAX_VALUE;
+ if (this == One) { constant = Constant.One; return ;}
+
+ int length = source.length;
+ long computedValue = 0L;
+ if (source[0] == '0')
+ { MAX = 0xFFFFFFFFL ; //a long in order to be positive !
+ if (length == 1) { constant = Constant.fromValue(0); return ;}
+ final int shift,radix;
+ int j ;
+ if ( (source[1] == 'x') | (source[1] == 'X') )
+ { shift = 4 ; j = 2; radix = 16;}
+ else
+ { shift = 3 ; j = 1; radix = 8;}
+ while (source[j]=='0')
+ { j++; //jump over redondant zero
+ if (j == length)
+ { //watch for 000000000000000000 :-(
+ constant = Constant.fromValue(value = (int)computedValue);
+ return ;}}
+
+ while (j MAX) return /*constant stays null*/ ;}}
+ else
+ { //-----------regular case : radix = 10-----------
+ for (int i = 0 ; i < length;i++)
+ { int digitValue ;
+ if ((digitValue = Character.digit(source[i],10)) < 0 )
+ { constant = FORMAT_ERROR; return ;}
+ computedValue = 10*computedValue + digitValue;
+ if (computedValue > MAX) return /*constant stays null*/ ; }}
+
+ constant = Constant.fromValue(value = (int)computedValue);
+
+}
+/**
+ * Code generation for int literal
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// if ((implicitConversion >> 4) == T_int)
+// codeStream.generateInlinedValue(value);
+// else
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public TypeBinding literalType(BlockScope scope) {
+ return IntBinding;
+}
+public final boolean mayRepresentMIN_VALUE(){
+ //a special autorized int literral is 2147483648
+ //which is ONE over the limit. This special case
+ //only is used in combinaison with - to denote
+ //the minimal value of int -2147483648
+
+ return ((source.length == 10) &&
+ (source[0] == '2') &&
+ (source[1] == '1') &&
+ (source[2] == '4') &&
+ (source[3] == '7') &&
+ (source[4] == '4') &&
+ (source[5] == '8') &&
+ (source[6] == '3') &&
+ (source[7] == '6') &&
+ (source[8] == '4') &&
+ (source[9] == '8'));}
+public TypeBinding resolveType(BlockScope scope) {
+ // the format may be incorrect while the scanner could detect
+ // such an error only on painfull tests...easier and faster here
+
+ TypeBinding tb = super.resolveType(scope);
+ if (constant == FORMAT_ERROR) {
+ constant = NotAConstant;
+ scope.problemReporter().constantOutOfFormat(this);
+ this.resolvedType = null;
+ return null;
+ }
+ return tb;
+}
+public String toStringExpression(){
+
+ if (source == null)
+ /* special optimized IntLiteral that are created by the compiler */
+ return String.valueOf(value);
+
+ return super.toStringExpression();}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteralMinValue.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteralMinValue.java
new file mode 100644
index 0000000..7f82c7f
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IntLiteralMinValue.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+
+
+public class IntLiteralMinValue extends IntLiteral {
+
+ final static char[] CharValue = new char[]{'-','2','1','4','7','4','8','3','6','4','8'};
+ final static Constant MIN_VALUE = Constant.fromValue(Integer.MIN_VALUE) ;
+
+public IntLiteralMinValue() {
+ super(CharValue,0,0,Integer.MIN_VALUE);
+ constant = MIN_VALUE;
+}
+public void computeConstant(){
+
+ /*precomputed at creation time*/ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
new file mode 100644
index 0000000..b4b9dfd
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+
+
+
+public class JavadocArrayQualifiedTypeReference extends ArrayQualifiedTypeReference {
+
+ public int tagSourceStart, tagSourceEnd;
+
+ public JavadocArrayQualifiedTypeReference(JavadocQualifiedTypeReference typeRef, int dim) {
+ super(typeRef.tokens, dim, typeRef.sourcePositions);
+ }
+
+ protected void reportInvalidType(Scope scope) {
+ scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
+ }
+ protected void reportDeprecatedType(Scope scope) {
+ scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
+ }
+
+ /* (non-Javadoc)
+ * Redefine to capture javadoc specific signatures
+ * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ */
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArraySingleTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArraySingleTypeReference.java
new file mode 100644
index 0000000..2b7a99c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocArraySingleTypeReference.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+
+
+public class JavadocArraySingleTypeReference extends ArrayTypeReference {
+
+ public JavadocArraySingleTypeReference(char[] name, int dim, long pos) {
+ super(name, dim, pos);
+ this.bits |= InsideJavadoc;
+ }
+
+ protected void reportInvalidType(Scope scope) {
+ scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
+ }
+ protected void reportDeprecatedType(Scope scope) {
+ scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
+ }
+
+ /* (non-Javadoc)
+ * Redefine to capture javadoc specific signatures
+ * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ */
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
new file mode 100644
index 0000000..a68f5a7
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+
+public class JavadocQualifiedTypeReference extends QualifiedTypeReference {
+
+ public int tagSourceStart, tagSourceEnd;
+ public PackageBinding packageBinding;
+
+ public JavadocQualifiedTypeReference(char[][] sources, long[] pos, int tagStart, int tagEnd) {
+ super(sources, pos);
+ this.tagSourceStart = tagStart;
+ this.tagSourceEnd = tagEnd;
+ this.bits |= InsideJavadoc;
+ }
+
+ protected void reportInvalidType(Scope scope) {
+ scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
+ }
+ protected void reportDeprecatedType(Scope scope) {
+ scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
+ }
+
+ /* (non-Javadoc)
+ * Redefine to capture javadoc specific signatures
+ * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ */
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+
+ /*
+ *
+ */
+ private TypeBinding internalResolveType(Scope scope) {
+ // handle the error here
+ this.constant = NotAConstant;
+ if (this.resolvedType != null) { // is a shared type reference which was already resolved
+ if (!this.resolvedType.isValidBinding())
+ return null; // already reported error
+ } else {
+ this.resolvedType = getTypeBinding(scope);
+ if (!this.resolvedType.isValidBinding()) {
+ Binding binding = scope.getTypeOrPackage(this.tokens);
+ if (binding instanceof PackageBinding) {
+ this.packageBinding = (PackageBinding) binding;
+ } else {
+ reportInvalidType(scope);
+ }
+ return null;
+ }
+ if (isTypeUseDeprecated(this.resolvedType, scope)) {
+ reportDeprecatedType(scope);
+ }
+ }
+ return this.resolvedType;
+ }
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ * We need to override to handle package references
+ */
+ public TypeBinding resolveType(BlockScope blockScope) {
+ return internalResolveType(blockScope);
+ }
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.ClassScope)
+ * We need to override to handle package references
+ */
+ public TypeBinding resolveType(ClassScope classScope) {
+ return internalResolveType(classScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocReturnStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocReturnStatement.java
new file mode 100644
index 0000000..9465de8
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocReturnStatement.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class JavadocReturnStatement extends ReturnStatement {
+ public char[] description;
+
+ public JavadocReturnStatement(int s, int e, char[] descr) {
+ super(null, s, e);
+ this.description = descr;
+ this.bits |= InsideJavadoc;
+ }
+
+ public void resolve(BlockScope scope) {
+ MethodScope methodScope = scope.methodScope();
+ MethodBinding methodBinding;
+ TypeBinding methodType =
+ (methodScope.referenceContext instanceof AbstractMethodDeclaration)
+ ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null
+ ? null
+ : methodBinding.returnType)
+ : VoidBinding;
+ if (methodType == null || methodType == VoidBinding) {
+ scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd);
+ }
+ }
+
+ /* (non-Javadoc)
+ * Redefine to capture javadoc specific signatures
+ * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ */
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocSingleTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocSingleTypeReference.java
new file mode 100644
index 0000000..4c93535
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/JavadocSingleTypeReference.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class JavadocSingleTypeReference extends SingleTypeReference {
+
+ public int tagSourceStart, tagSourceEnd;
+ public PackageBinding packageBinding;
+
+ public JavadocSingleTypeReference(char[] source, long pos, int tagStart, int tagEnd) {
+ super(source, pos);
+ this.tagSourceStart = tagStart;
+ this.tagSourceEnd = tagEnd;
+ this.bits |= InsideJavadoc;
+ }
+
+ protected void reportInvalidType(Scope scope) {
+ scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
+ }
+ protected void reportDeprecatedType(Scope scope) {
+ scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
+ }
+
+ /* (non-Javadoc)
+ * Redefine to capture javadoc specific signatures
+ * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ */
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+
+ /*
+ *
+ */
+ private TypeBinding internalResolveType(Scope scope) {
+ // handle the error here
+ this.constant = NotAConstant;
+ if (this.resolvedType != null) { // is a shared type reference which was already resolved
+ if (!this.resolvedType.isValidBinding())
+ return null; // already reported error
+ } else {
+ this.resolvedType = getTypeBinding(scope);
+ if (!this.resolvedType.isValidBinding()) {
+ char[][] tokens = { this.token };
+ Binding binding = scope.getTypeOrPackage(tokens);
+ if (binding instanceof PackageBinding) {
+ this.packageBinding = (PackageBinding) binding;
+ } else {
+ reportInvalidType(scope);
+ }
+ return null;
+ }
+ if (isTypeUseDeprecated(this.resolvedType, scope)) {
+ reportDeprecatedType(scope);
+ }
+ }
+ return this.resolvedType;
+ }
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
+ * We need to override to handle package references
+ */
+ public TypeBinding resolveType(BlockScope blockScope) {
+ return internalResolveType(blockScope);
+ }
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.ClassScope)
+ * We need to override to handle package references
+ */
+ public TypeBinding resolveType(ClassScope classScope) {
+ return internalResolveType(classScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LabeledStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LabeledStatement.java
new file mode 100644
index 0000000..7070de7
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LabeledStatement.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.LabelFlowContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+
+public class LabeledStatement extends Statement {
+
+ public Statement statement;
+ public char[] label;
+ public Label targetLabel;
+
+ // for local variables table attributes
+ int mergedInitStateIndex = -1;
+
+ /**
+ * LabeledStatement constructor comment.
+ */
+ public LabeledStatement(char[] l, Statement st, int s, int e) {
+
+ this.statement = st;
+ this.label = l;
+ this.sourceStart = s;
+ this.sourceEnd = e;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // need to stack a context to store explicit label, answer inits in case of normal completion merged
+ // with those relative to the exit path from break statement occurring inside the labeled statement.
+ if (statement == null) {
+ return flowInfo;
+ } else {
+ LabelFlowContext labelContext;
+ FlowInfo mergedInfo =
+ statement
+ .analyseCode(
+ currentScope,
+ (labelContext =
+ new LabelFlowContext(
+ flowContext,
+ this,
+ label,
+ (targetLabel = new Label()),
+ currentScope)),
+ flowInfo)
+ .mergedWith(labelContext.initsOnBreak);
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+ }
+
+ public ASTNode concreteStatement() {
+
+ // return statement.concreteStatement(); // for supporting nested labels: a:b:c: someStatement (see 21912)
+ return statement;
+ }
+
+ /**
+ * Code generation for labeled statement
+ *
+ * may not need actual source positions recording
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// int pc = codeStream.position;
+// if (targetLabel != null) {
+// targetLabel.codeStream = codeStream;
+// if (statement != null) {
+// statement.generateCode(currentScope, codeStream);
+// }
+// targetLabel.place();
+// }
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append(label).append(": "); //$NON-NLS-1$
+ if (this.statement == null)
+ output.append(';');
+ else
+ this.statement.printStatement(0, output);
+ return output;
+ }
+ public void resolve(BlockScope scope) {
+
+ statement.resolve(scope);
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s += new String(label) + ": " + statement.toString(0); //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ statement.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+
+ public void resetStateForCodeGeneration() {
+ if (this.targetLabel != null) {
+ this.targetLabel.resetStateForCodeGeneration();
+ }
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java
new file mode 100644
index 0000000..3c4fcbf
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public abstract class Literal extends Expression {
+
+public Literal(int s,int e) {
+ sourceStart = s ;
+ sourceEnd= e;
+}
+
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return flowInfo;
+}
+
+public abstract void computeConstant() ;
+ //ON ERROR constant STAYS NULL
+public abstract TypeBinding literalType(BlockScope scope);
+public StringBuffer printExpression(int indent, StringBuffer output){
+
+ return output.append(source());
+ }
+public TypeBinding resolveType(BlockScope scope) {
+ // compute the real value, which must range its type's range
+
+ computeConstant();
+ if (constant == null) {
+ scope.problemReporter().constantOutOfRange(this);
+ constant = Constant.NotAConstant;
+ return null;
+ }
+ this.resolvedType = literalType(scope);
+ return this.resolvedType;
+}
+public abstract char[] source() ;
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalDeclaration.java
new file mode 100644
index 0000000..a094fc4
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalDeclaration.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class LocalDeclaration extends AbstractVariableDeclaration {
+
+ public LocalVariableBinding binding;
+
+ public LocalDeclaration(
+ Expression expr,
+ char[] name,
+ int sourceStart,
+ int sourceEnd) {
+
+ initialization = expr;
+ this.name = name;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ if (initialization != null) {
+ this.declarationSourceEnd = initialization.sourceEnd;
+ this.declarationEnd = initialization.sourceEnd;
+ } else {
+ this.declarationEnd = sourceEnd;
+ }
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // record variable initialization if any
+ if (flowInfo.isReachable()) {
+ bits |= IsLocalDeclarationReachableMASK; // only set if actually reached
+ }
+ if (initialization == null)
+ return flowInfo;
+
+ flowInfo =
+ initialization
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+
+ // final int i = (i = 0);
+ // no need to complain since (i = 0) part will get the blame
+ //if (binding.isFinal() && flowInfo.isPotentiallyAssigned(binding)) {
+ // currentScope.problemReporter().duplicateInitializationOfFinalLocal(binding, this);
+ //}
+
+ flowInfo.markAsDefinitelyAssigned(binding);
+ return flowInfo;
+ }
+
+ public void checkModifiers() {
+
+ //only potential valid modifier is <>
+ if (((modifiers & AccJustFlag) & ~AccFinal) != 0)
+ //AccModifierProblem -> other (non-visibility problem)
+ //AccAlternateModifierProblem -> duplicate modifier
+ //AccModifierProblem | AccAlternateModifierProblem -> visibility problem"
+
+ modifiers = (modifiers & ~AccAlternateModifierProblem) | AccModifierProblem;
+ }
+
+ /**
+ * Code generation for a local declaration:
+ * normal assignment to a local variable + unused variable handling
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// // even if not reachable, variable must be added to visible if allocated (28298)
+// if (binding.resolvedPosition != -1) {
+// codeStream.addVisibleLocalVariable(binding);
+// }
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+// Constant inlinedValue;
+//
+// // something to initialize?
+// if (initialization != null) {
+// // initialize to constant value?
+// if ((inlinedValue = initialization.constant) != NotAConstant) {
+// // forget initializing unused or final locals set to constant value (final ones are inlined)
+// if (binding.resolvedPosition != -1) { // may need to preserve variable
+// int initPC = codeStream.position;
+// codeStream.generateConstant(inlinedValue, initialization.implicitConversion);
+// codeStream.recordPositionsFrom(initPC, initialization.sourceStart);
+// codeStream.store(binding, false);
+// binding.recordInitializationStartPC(codeStream.position);
+// // codeStream.lastInitStateIndexWhenRemovingInits = -2; // reinitialize remove index
+// // codeStream.lastInitStateIndexWhenAddingInits = -2; // reinitialize add index
+// }
+// } else { // initializing to non-constant value
+// initialization.generateCode(currentScope, codeStream, true);
+// // if binding unused generate then discard the value
+// if (binding.resolvedPosition != -1) {
+// // 26903, need extra cast to store null in array local var
+// if (binding.type.isArrayType()
+// && (initialization.resolvedType == NullBinding // arrayLoc = null
+// || ((initialization instanceof CastExpression) // arrayLoc = (type[])null
+// && (((CastExpression)initialization).innermostCastedExpression().resolvedType == NullBinding)))){
+// codeStream.checkcast(binding.type);
+// }
+// codeStream.store(binding, false);
+// if (binding.initializationCount == 0) {
+// /* Variable may have been initialized during the code initializing it
+// e.g. int i = (i = 1);
+// */
+// binding.recordInitializationStartPC(codeStream.position);
+// // codeStream.lastInitStateIndexWhenRemovingInits = -2; // reinitialize remove index
+// // codeStream.lastInitStateIndexWhenAddingInits = -2; // reinitialize add index
+// }
+// } else {
+// if ((binding.type == LongBinding) || (binding.type == DoubleBinding)) {
+// codeStream.pop2();
+// } else {
+// codeStream.pop();
+// }
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public String name() {
+
+ return String.valueOf(name);
+ }
+
+ public void resolve(BlockScope scope) {
+
+ // create a binding and add it to the scope
+ TypeBinding tb = type.resolveType(scope);
+
+ checkModifiers();
+
+ if (tb != null) {
+ if (tb == VoidBinding) {
+ scope.problemReporter().variableTypeCannotBeVoid(this);
+ return;
+ }
+ if (tb.isArrayType() && ((ArrayBinding) tb).leafComponentType == VoidBinding) {
+ scope.problemReporter().variableTypeCannotBeVoidArray(this);
+ return;
+ }
+ }
+
+ // duplicate checks
+ if ((binding = scope.duplicateName(name)) != null) {
+ // the name already exists... may carry on with the first binding...
+ scope.problemReporter().redefineLocal(this);
+ } else {
+ if ((modifiers & AccFinal)!= 0 && this.initialization == null) {
+ modifiers |= AccBlankFinal;
+ }
+ binding = new LocalVariableBinding(this, tb, modifiers, false);
+ scope.addLocalVariable(binding);
+ binding.constant = NotAConstant;
+ // allow to recursivelly target the binding....
+ // the correct constant is harmed if correctly computed at the end of this method
+ }
+
+ if (tb == null) {
+ if (initialization != null)
+ initialization.resolveType(scope); // want to report all possible errors
+ return;
+ }
+
+ // store the constant for final locals
+ if (initialization != null) {
+ if (initialization instanceof ArrayInitializer) {
+ TypeBinding initTb = initialization.resolveTypeExpecting(scope, tb);
+ if (initTb != null) {
+ ((ArrayInitializer) initialization).binding = (ArrayBinding) initTb;
+ initialization.implicitWidening(tb, initTb);
+ }
+ } else {
+ TypeBinding initTb = initialization.resolveType(scope);
+ if (initTb != null) {
+ if (initialization.isConstantValueOfTypeAssignableToType(initTb, tb)
+ || (tb.isBaseType() && BaseTypeBinding.isWidening(tb.id, initTb.id))
+ || initTb.isCompatibleWith(tb))
+ initialization.implicitWidening(tb, initTb);
+ else
+ scope.problemReporter().typeMismatchError(initTb, tb, this);
+ }
+ }
+
+ // change the constant in the binding when it is final
+ // (the optimization of the constant propagation will be done later on)
+ // cast from constant actual type to variable type
+ binding.constant =
+ binding.isFinal()
+ ? initialization.constant.castTo((tb.id << 4) + initialization.constant.typeID())
+ : NotAConstant;
+ }
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ type.traverse(visitor, scope);
+ if (initialization != null)
+ initialization.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalTypeDeclaration.java
new file mode 100644
index 0000000..a75f126
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LocalTypeDeclaration.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
+
+public class LocalTypeDeclaration extends InnerTypeDeclaration {
+ public AbstractMethodDeclaration enclosingMethod;
+
+public LocalTypeDeclaration(CompilationResult compilationResult){
+ super(compilationResult);
+}
+
+/**
+ * Iteration for a local innertype
+ *
+ */
+public void traverse(ASTVisitor visitor, BlockScope blockScope) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, blockScope)) {
+ if (superclass != null)
+ superclass.traverse(visitor, scope);
+ if (superInterfaces != null) {
+ int superInterfaceLength = superInterfaces.length;
+ for (int i = 0; i < superInterfaceLength; i++)
+ superInterfaces[i].traverse(visitor, scope);
+ }
+ if (memberTypes != null) {
+ int memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ int fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ // local type cannot have static fields
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ int methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ } catch (AbortType e) {
+ }
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteral.java
new file mode 100644
index 0000000..e09a01d
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteral.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.impl.DoubleConstant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class LongLiteral extends NumberLiteral {
+ long value;
+
+ static final Constant FORMAT_ERROR = new DoubleConstant(1.0/0.0); // NaN;
+
+public LongLiteral(char[] token, int s,int e) {
+ super(token, s,e);
+}
+public LongLiteral(char[] token, int s,int e, long value) {
+ this(token, s,e);
+ this.value = value;
+}
+public void computeConstant() {
+ //the overflow (when radix=10) is tested using the fact that
+ //the value should always grow during its computation
+
+ int length = source.length - 1; //minus one because the last char is 'l' or 'L'
+
+ long computedValue ;
+ if (source[0] == '0')
+ { if (length == 1) { constant = Constant.fromValue(0L); return; }
+ final int shift,radix;
+ int j ;
+ if ( (source[1] == 'x') | (source[1] == 'X') )
+ { shift = 4 ; j = 2; radix = 16;}
+ else
+ { shift = 3 ; j = 1; radix = 8;}
+ int nbDigit = 0;
+ while (source[j]=='0')
+ { j++; //jump over redondant zero
+ if ( j == length)
+ { //watch for 0000000000000L
+ constant = Constant.fromValue(value = 0L);
+ return ;}}
+
+ int digitValue ;
+ if ((digitValue = Character.digit(source[j++],radix)) < 0 )
+ { constant = FORMAT_ERROR; return ;}
+ if (digitValue >= 8) nbDigit = 4;
+ else if (digitValue >= 4) nbDigit = 3;
+ else if (digitValue >= 2) nbDigit = 2;
+ else nbDigit = 1; //digitValue is not 0
+ computedValue = digitValue ;
+ while (j 64) return /*constant stays null*/ ;
+ computedValue = (computedValue< computedValue) return /*constant stays null*/;}}
+
+ constant = Constant.fromValue(value = computedValue);
+}
+/**
+ * Code generation for long literal
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// if ((implicitConversion >> 4) == T_long)
+// codeStream.generateInlinedValue(value);
+// else
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public TypeBinding literalType(BlockScope scope) {
+ return LongBinding;
+}
+public final boolean mayRepresentMIN_VALUE(){
+ //a special autorized int literral is 9223372036854775808L
+ //which is ONE over the limit. This special case
+ //only is used in combinaison with - to denote
+ //the minimal value of int -9223372036854775808L
+
+ return ((source.length == 20) &&
+ (source[0] == '9') &&
+ (source[1] == '2') &&
+ (source[2] == '2') &&
+ (source[3] == '3') &&
+ (source[4] == '3') &&
+ (source[5] == '7') &&
+ (source[6] == '2') &&
+ (source[7] == '0') &&
+ (source[8] == '3') &&
+ (source[9] == '6') &&
+ (source[10] == '8') &&
+ (source[11] == '5') &&
+ (source[12] == '4') &&
+ (source[13] == '7') &&
+ (source[14] == '7') &&
+ (source[15] == '5') &&
+ (source[16] == '8') &&
+ (source[17] == '0') &&
+ (source[18] == '8'));}
+public TypeBinding resolveType(BlockScope scope) {
+ // the format may be incorrect while the scanner could detect
+ // such error only on painfull tests...easier and faster here
+
+ TypeBinding tb = super.resolveType(scope);
+ if (constant == FORMAT_ERROR) {
+ constant = NotAConstant;
+ scope.problemReporter().constantOutOfFormat(this);
+ this.resolvedType = null;
+ return null;
+ }
+ return tb;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteralMinValue.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteralMinValue.java
new file mode 100644
index 0000000..eb4d900
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/LongLiteralMinValue.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+
+
+public class LongLiteralMinValue extends LongLiteral {
+
+ final static char[] CharValue = new char[]{'-', '9','2','2','3','3','7','2','0','3','6','8','5','4','7','7','5','8','0','8','L'};
+ final static Constant MIN_VALUE = Constant.fromValue(Long.MIN_VALUE) ;
+
+public LongLiteralMinValue(){
+ super(CharValue,0,0,Long.MIN_VALUE);
+ constant = MIN_VALUE;
+}
+public void computeConstant() {
+
+ /*precomputed at creation time*/}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MagicLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MagicLiteral.java
new file mode 100644
index 0000000..52faae0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MagicLiteral.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+public abstract class MagicLiteral extends Literal {
+public MagicLiteral(int s , int e) {
+ super(s,e);
+}
+public boolean isValidJavaStatement(){
+ //should never be reach, but with a bug in the ast tree....
+ //see comment on the Statement class
+
+ return false ;}
+/**
+ * source method comment.
+ */
+public char[] source() {
+ return null;
+}
+public String toStringExpression(){
+
+ return new String(source()) ; }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MemberTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MemberTypeDeclaration.java
new file mode 100644
index 0000000..7320bbd
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MemberTypeDeclaration.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
+
+public class MemberTypeDeclaration extends InnerTypeDeclaration {
+ public TypeDeclaration enclosingType;
+
+public MemberTypeDeclaration(CompilationResult compilationResult){
+ super(compilationResult);
+}
+/**
+ * Iteration for a member innertype
+ *
+ */
+public void traverse(ASTVisitor visitor, ClassScope classScope) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, classScope)) {
+ if (superclass != null)
+ superclass.traverse(visitor, scope);
+ if (superInterfaces != null) {
+ int superInterfaceLength = superInterfaces.length;
+ for (int i = 0; i < superInterfaceLength; i++)
+ superInterfaces[i].traverse(visitor, scope);
+ }
+ if (memberTypes != null) {
+ int memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ int fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ field.traverse(visitor, staticInitializerScope);
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ int methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+ } catch (AbortType e) {
+ }
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MessageSend.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MessageSend.java
new file mode 100644
index 0000000..cdb2f4b
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MessageSend.java
@@ -0,0 +1,312 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ProblemMethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class MessageSend extends Expression implements InvocationSite {
+ public Expression receiver ;
+ public char[] selector ;
+ public Expression[] arguments ;
+ public MethodBinding binding, codegenBinding;
+
+ public long nameSourcePosition ; //(start<<32)+end
+
+ MethodBinding syntheticAccessor;
+
+ public TypeBinding receiverType, qualifyingType;
+
+public MessageSend() {
+
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic()).unconditionalInits();
+ if (arguments != null) {
+ int length = arguments.length;
+ for (int i = 0; i < length; i++) {
+ flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ }
+ ReferenceBinding[] thrownExceptions;
+ if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
+ // must verify that exceptions potentially thrown by this expression are caught in the method
+ flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo, currentScope);
+ }
+ manageSyntheticAccessIfNecessary(currentScope);
+ return flowInfo;
+}
+/**
+ * MessageSend code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+//
+// int pc = codeStream.position;
+//
+// // generate receiver/enclosing instance access
+// boolean isStatic = codegenBinding.isStatic();
+// // outer access ?
+// if (!isStatic && ((bits & DepthMASK) != 0) && receiver.isImplicitThis()){
+// // outer method can be reached through emulation if implicit access
+// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+// Object[] path = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(path, this, targetType, currentScope);
+// } else {
+// receiver.generateCode(currentScope, codeStream, !isStatic);
+// }
+// // generate arguments
+// if (arguments != null){
+// for (int i = 0, max = arguments.length; i < max; i++){
+// arguments[i].generateCode(currentScope, codeStream, true);
+// }
+// }
+// // actual message invocation
+// if (syntheticAccessor == null){
+// if (isStatic){
+// codeStream.invokestatic(codegenBinding);
+// } else {
+// if( (receiver.isSuper()) || codegenBinding.isPrivate()){
+// codeStream.invokespecial(codegenBinding);
+// } else {
+// if (codegenBinding.declaringClass.isInterface()){
+// codeStream.invokeinterface(codegenBinding);
+// } else {
+// codeStream.invokevirtual(codegenBinding);
+// }
+// }
+// }
+// } else {
+// codeStream.invokestatic(syntheticAccessor);
+// }
+// // operation on the returned value
+// if (valueRequired){
+// // implicit conversion if necessary
+// codeStream.generateImplicitConversion(implicitConversion);
+// } else {
+// // pop return value if any
+// switch(binding.returnType.id){
+// case T_long :
+// case T_double :
+// codeStream.pop2();
+// break;
+// case T_void :
+// break;
+// default:
+// codeStream.pop();
+// }
+// }
+// codeStream.recordPositionsFrom(pc, (int)(this.nameSourcePosition >>> 32)); // highlight selector
+//}
+public boolean isSuperAccess() {
+ return receiver.isSuper();
+}
+public boolean isTypeAccess() {
+ return receiver != null && receiver.isTypeReference();
+}
+public void manageSyntheticAccessIfNecessary(BlockScope currentScope){
+
+ if (binding.isPrivate()){
+
+ // depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy)
+ if (currentScope.enclosingSourceType() != binding.declaringClass){
+
+ syntheticAccessor = ((SourceTypeBinding)binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ return;
+ }
+
+ } else if (receiver instanceof QualifiedSuperReference){ // qualified super
+
+ // qualified super need emulation always
+ SourceTypeBinding destinationType = (SourceTypeBinding)(((QualifiedSuperReference)receiver).currentCompatibleType);
+ syntheticAccessor = destinationType.addSyntheticMethod(binding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ return;
+
+ } else if (binding.isProtected()){
+
+ SourceTypeBinding enclosingSourceType;
+ if (((bits & DepthMASK) != 0)
+ && binding.declaringClass.getPackage()
+ != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()){
+
+ SourceTypeBinding currentCompatibleType = (SourceTypeBinding)enclosingSourceType.enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+ syntheticAccessor = currentCompatibleType.addSyntheticMethod(binding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ return;
+ }
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
+ // and not from Object or implicit static method call.
+// if (binding.declaringClass != this.qualifyingType
+// && !this.qualifyingType.isArrayType()
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && (!receiver.isImplicitThis() || !binding.isStatic())
+// && binding.declaringClass.id != T_Object) // no change for Object methods
+// || !binding.declaringClass.canBeSeenBy(currentScope))) {
+//
+// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(binding, (ReferenceBinding) this.qualifyingType);
+// }
+}
+public StringBuffer printExpression(int indent, StringBuffer output){
+
+ if (!receiver.isImplicitThis()) receiver.printExpression(0, output).append('.');
+ output.append(selector).append('(') ; //$NON-NLS-1$
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length ; i ++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ arguments[i].printExpression(0, output);
+ }
+ }
+ return output.append(')');
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // Answer the signature return type
+ // Base type promotion
+
+ constant = NotAConstant;
+ this.qualifyingType = this.receiverType = receiver.resolveType(scope);
+
+ // will check for null after args are resolved
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ boolean argHasError = false; // typeChecks all arguments
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++){
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null){
+ argHasError = true;
+ }
+ }
+ if (argHasError){
+ if(receiverType instanceof ReferenceBinding) {
+ // record any selector match, for clients who may still need hint about possible method match
+ this.codegenBinding = this.binding = scope.findMethod((ReferenceBinding)receiverType, selector, new TypeBinding[]{}, this);
+ }
+ return null;
+ }
+ }
+ if (this.receiverType == null)
+ return null;
+
+ // base type cannot receive any message
+ if (this.receiverType.isBaseType()) {
+ scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
+ return null;
+ }
+
+ this.codegenBinding = this.binding =
+ receiver.isImplicitThis()
+ ? scope.getImplicitMethod(selector, argumentTypes, this)
+ : scope.getMethod(this.receiverType, selector, argumentTypes, this);
+ if (!binding.isValidBinding()) {
+ if (binding.declaringClass == null) {
+ if (this.receiverType instanceof ReferenceBinding) {
+ binding.declaringClass = (ReferenceBinding) this.receiverType;
+ } else {
+ scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
+ return null;
+ }
+ }
+ scope.problemReporter().invalidMethod(this, binding);
+ // record the closest match, for clients who may still need hint about possible method match
+ if (binding instanceof ProblemMethodBinding){
+ MethodBinding closestMatch = ((ProblemMethodBinding)binding).closestMatch;
+ if (closestMatch != null) this.codegenBinding = this.binding = closestMatch;
+ }
+ return binding == null ? null : binding.returnType;
+ }
+ if (!binding.isStatic()) {
+ // the "receiver" must not be a type, in other words, a NameReference that the TC has bound to a Type
+ if (receiver instanceof NameReference
+ && (((NameReference) receiver).bits & BindingIds.TYPE) != 0) {
+ scope.problemReporter().mustUseAStaticMethod(this, binding);
+ }
+ } else {
+ // static message invoked through receiver? legal but unoptimal (optional warning).
+ if (!(receiver.isImplicitThis()
+ || receiver.isSuper()
+ || (receiver instanceof NameReference
+ && (((NameReference) receiver).bits & BindingIds.TYPE) != 0))) {
+ scope.problemReporter().unnecessaryReceiverForStaticMethod(this, binding);
+ }
+ }
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
+
+ //-------message send that are known to fail at compile time-----------
+ if (binding.isAbstract()) {
+ if (receiver.isSuper()) {
+ scope.problemReporter().cannotDireclyInvokeAbstractMethod(this, binding);
+ }
+ // abstract private methods cannot occur nor abstract static............
+ }
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(binding, this);
+
+ return this.resolvedType = binding.returnType;
+}
+public void setActualReceiverType(ReferenceBinding receiverType) {
+ this.qualifyingType = receiverType;
+}
+public void setDepth(int depth) {
+ bits &= ~DepthMASK; // flush previous depth if any
+ if (depth > 0) {
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
+ }
+}
+public void setFieldIndex(int depth) {
+ // ignore for here
+}
+
+public String toStringExpression(){
+
+ String s = ""; //$NON-NLS-1$
+ if (!receiver.isImplicitThis())
+ s = s + receiver.toStringExpression()+"."; //$NON-NLS-1$
+ s = s + new String(selector) + "(" ; //$NON-NLS-1$
+ if (arguments != null)
+ for (int i = 0; i < arguments.length ; i ++)
+ { s = s + arguments[i].toStringExpression();
+ if ( i != arguments.length -1 ) s = s + " , " ;};; //$NON-NLS-1$
+ s =s + ")" ; //$NON-NLS-1$
+ return s;
+}
+
+public void traverse(ASTVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope)) {
+ receiver.traverse(visitor, blockScope);
+ if (arguments != null) {
+ int argumentsLength = arguments.length;
+ for (int i = 0; i < argumentsLength; i++)
+ arguments[i].traverse(visitor, blockScope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java
new file mode 100644
index 0000000..0e23833
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
+
+public class MethodDeclaration extends AbstractMethodDeclaration {
+
+ public TypeReference returnType;
+ public static final int FUNCTION_DEFINITION = 1;
+ public static final int METHOD_DEFINITION = 2;
+ public int type;
+
+ /**
+ * MethodDeclaration constructor comment.
+ */
+ public MethodDeclaration(CompilationResult compilationResult) {
+ super(compilationResult);
+ }
+
+ public void analyseCode(ClassScope classScope, InitializationFlowContext initializationContext, FlowInfo flowInfo) {
+
+ // starting of the code analysis for methods
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (binding == null)
+ return;
+
+ if (this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
+ if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
+ scope.problemReporter().unusedPrivateMethod(this);
+ }
+ }
+
+ // may be in a non necessary for innerclass with static final constant fields
+ if (binding.isAbstract()) // || binding.isNative())
+ return;
+
+ ExceptionHandlingFlowContext methodContext =
+ new ExceptionHandlingFlowContext(initializationContext, this, binding.thrownExceptions, scope, FlowInfo.DEAD_END);
+
+ // propagate to statements
+ if (statements != null) {
+ boolean didAlreadyComplain = false;
+ for (int i = 0, count = statements.length; i < count; i++) {
+ Statement stat;
+ if (!flowInfo.complainIfUnreachable((stat = statements[i]), scope, didAlreadyComplain)) {
+ flowInfo = stat.analyseCode(scope, methodContext, flowInfo);
+ } else {
+ didAlreadyComplain = true;
+ }
+ }
+ }
+ // check for missing returning path
+ TypeBinding returnType = binding.returnType;
+ if ((returnType == VoidBinding) || isAbstract()) {
+ this.needFreeReturn = flowInfo.isReachable();
+ } else {
+ if (flowInfo != FlowInfo.DEAD_END) {
+ scope.problemReporter().shouldReturn(returnType, this);
+ }
+ }
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
+
+ //fill up the method body with statement
+ if (ignoreFurtherInvestigation)
+ return;
+ parser.parse(this, unit);
+ }
+
+ public void resolveStatements() {
+
+ // ========= abort on fatal error =============
+ if (this.returnType != null && this.binding != null) {
+ this.returnType.resolvedType = this.binding.returnType;
+ // record the return type binding
+ }
+ // look if the name of the method is correct
+ if (binding != null && isTypeUseDeprecated(binding.returnType, scope))
+ scope.problemReporter().deprecatedType(binding.returnType, returnType);
+
+ if (scope != null) {
+ if (CharOperation.equals(scope.enclosingSourceType().sourceName, selector))
+ scope.problemReporter().methodWithConstructorName(this);
+
+ // by grammatical construction, interface methods are always abstract
+ if (!scope.enclosingSourceType().isInterface()) {
+
+ // if a method has an semicolon body and is not declared as abstract==>error
+ // native methods may have a semicolon body
+ // if ((modifiers & AccSemicolonBody) != 0) {
+ // if ((modifiers & AccNative) == 0)
+ // if ((modifiers & AccAbstract) == 0)
+ // scope.problemReporter().methodNeedingAbstractModifier(this);
+ // } else {
+ // // the method HAS a body --> abstract native modifiers are forbiden
+ // if (((modifiers & AccNative) != 0) || ((modifiers & AccAbstract) != 0))
+ // scope.problemReporter().methodNeedingNoBody(this);
+ // }
+ }
+ }
+ super.resolveStatements();
+ }
+
+ public String returnTypeToString(int tab) {
+
+ if (returnType == null)
+ return ""; //$NON-NLS-1$
+ return returnType.toString(tab) + " "; //$NON-NLS-1$
+ }
+
+ public void traverse(ASTVisitor visitor, ClassScope classScope) {
+
+ if (visitor.visit(this, classScope)) {
+ if (returnType != null)
+ returnType.traverse(visitor, scope);
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (thrownExceptions != null) {
+ int thrownExceptionsLength = thrownExceptions.length;
+ for (int i = 0; i < thrownExceptionsLength; i++)
+ thrownExceptions[i].traverse(visitor, scope);
+ }
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NameReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NameReference.java
new file mode 100644
index 0000000..3dbaaa9
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NameReference.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
+import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public abstract class NameReference extends Reference implements InvocationSite, BindingIds {
+
+ public Binding binding, codegenBinding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
+
+ public TypeBinding receiverType; // raw receiver type
+ public TypeBinding actualReceiverType; // modified receiver type - actual one according to namelookup
+
+ //the error printing
+ //some name reference are build as name reference but
+ //only used as type reference. When it happens, instead of
+ //creating a new objet (aTypeReference) we just flag a boolean
+ //This concesion is valuable while their are cases when the NameReference
+ //will be a TypeReference (static message sends.....) and there is
+ //no changeClass in java.
+public NameReference() {
+ super();
+ bits |= TYPE | VARIABLE; // restrictiveFlag
+
+}
+public FieldBinding fieldBinding() {
+ //this method should be sent ONLY after a check against isFieldReference()
+ //check its use doing senders.........
+
+ return (FieldBinding) binding ;
+}
+public boolean isSuperAccess() {
+ return false;
+}
+public boolean isTypeAccess() {
+ // null is acceptable when we are resolving the first part of a reference
+ return binding == null || binding instanceof ReferenceBinding;
+}
+public boolean isTypeReference() {
+ return binding instanceof ReferenceBinding;
+}
+public void setActualReceiverType(ReferenceBinding receiverType) {
+ this.actualReceiverType = receiverType;
+}
+public void setDepth(int depth) {
+ bits &= ~DepthMASK; // flush previous depth if any
+ if (depth > 0) {
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
+ }
+}
+public void setFieldIndex(int index){
+ // ignored
+}
+
+public abstract String unboundReferenceErrorName();
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java
new file mode 100644
index 0000000..791b6a0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class NullLiteral extends MagicLiteral {
+
+ static final char[] source = {'n' , 'u' , 'l' , 'l'};
+
+ public NullLiteral(int s , int e) {
+
+ super(s,e);
+ }
+
+ public void computeConstant() {
+
+ constant = NotAConstant;
+ }
+
+ /**
+ * Code generation for the null literal
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// codeStream.aconst_null();
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+ public TypeBinding literalType(BlockScope scope) {
+ return NullBinding;
+ }
+
+ /**
+ *
+ */
+ public char[] source() {
+ return source;
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java
new file mode 100644
index 0000000..a80651d
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+public abstract class NumberLiteral extends Literal {
+ char[] source;
+public NumberLiteral(char[] token, int s, int e) {
+ this(s,e) ;
+ source = token ;
+}
+public NumberLiteral(int s, int e) {
+ super (s,e) ;
+}
+public boolean isValidJavaStatement(){
+ //should never be reach, but with a bug in the ast tree....
+ //see comment on the Statement class
+
+ return false ;}
+public char[] source(){
+ return source;}
+public String toStringExpression(){
+
+ return new String(source);}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OR_OR_Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OR_OR_Expression.java
new file mode 100644
index 0000000..67b76e7
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OR_OR_Expression.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+//dedicated treatment for the ||
+public class OR_OR_Expression extends BinaryExpression {
+
+ int rightInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public OR_OR_Expression(Expression left, Expression right, int operator) {
+ super(left, right, operator);
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ Constant cst = this.left.optimizedBooleanConstant();
+ boolean isLeftOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isLeftOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ if (isLeftOptimizedFalse) {
+ // FALSE || anything
+ // need to be careful of scenario:
+ // (x || y) || !z, if passing the left info to the right, it would be swapped by the !
+ FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ mergedInfo = right.analyseCode(currentScope, flowContext, mergedInfo);
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ FlowInfo leftInfo = left.analyseCode(currentScope, flowContext, flowInfo);
+
+ // need to be careful of scenario:
+ // (x || y) || !z, if passing the left info to the right, it would be swapped by the !
+ FlowInfo rightInfo = leftInfo.initsWhenFalse().unconditionalInits().copy();
+ rightInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(rightInfo);
+
+ int previousMode = rightInfo.reachMode();
+ if (isLeftOptimizedTrue){
+ rightInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ rightInfo = right.analyseCode(currentScope, flowContext, rightInfo);
+ FlowInfo falseMergedInfo = rightInfo.initsWhenFalse().copy();
+ rightInfo.setReachMode(previousMode); // reset after falseMergedInfo got extracted
+
+ FlowInfo mergedInfo = FlowInfo.conditional(
+ // merging two true initInfos for such a negative case: if ((t && (b = t)) || f) r = b; // b may not have been initialized
+ leftInfo.initsWhenTrue().copy().unconditionalInits().mergedWith(
+ rightInfo.initsWhenTrue().copy().unconditionalInits()),
+ falseMergedInfo);
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ /**
+ * Code generation for a binary operation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+// int pc = codeStream.position;
+// Label falseLabel, endLabel;
+// if (constant != Constant.NotAConstant) {
+// if (valueRequired)
+// codeStream.generateConstant(constant, implicitConversion);
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// bits |= OnlyValueRequiredMASK;
+// generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// /* improving code gen for such a case: boolean b = i < 0 || true;
+// * since the label has never been used, we have the inlined value on the stack. */
+// if (falseLabel.hasForwardReferences()) {
+// if (valueRequired) {
+// codeStream.iconst_1();
+// if ((bits & ValueForReturnMASK) != 0) {
+// codeStream.ireturn();
+// falseLabel.place();
+// codeStream.iconst_0();
+// } else {
+// codeStream.goto_(endLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_0();
+// endLabel.place();
+// }
+// } else {
+// falseLabel.place();
+// }
+// }
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+//
+// /**
+// * Boolean operator code generation
+// * Optimized operations are: ||
+// */
+// public void generateOptimizedBoolean(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+// if (constant != Constant.NotAConstant) {
+// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
+// return;
+// }
+// Constant condConst;
+// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // || x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_1();
+// } else {
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// } else {
+// // || x
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// right.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// return;
+// }
+// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+// if (condConst.booleanValue() == true) {
+// // x ||
+// Label internalFalseLabel = new Label(codeStream);
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// internalFalseLabel, // will be true in the end
+// false);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// internalFalseLabel.place();
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// if (valueRequired) {
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// codeStream.iconst_1();
+// } else {
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// // reposition the endPC
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// } else {
+// // x ||
+// if ((bits & OnlyValueRequiredMASK) != 0) {
+// left.generateCode(currentScope, codeStream, valueRequired);
+// } else {
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// false);
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// return;
+// }
+// // default case
+// if (falseLabel == null) {
+// if (trueLabel != null) {
+// // implicit falling through the FALSE case
+// left.generateOptimizedBoolean(currentScope, codeStream, trueLabel, null, true);
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// null,
+// valueRequired);
+// }
+// } else {
+// // implicit falling through the TRUE case
+// if (trueLabel == null) {
+// Label internalTrueLabel = new Label(codeStream);
+// left.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// internalTrueLabel,
+// null,
+// true);
+// if (rightInitStateIndex != -1) {
+// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
+// }
+// right.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// falseLabel,
+// valueRequired);
+// internalTrueLabel.place();
+// } else {
+// // no implicit fall through TRUE/FALSE --> should never occur
+// }
+// }
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// }
+
+ public boolean isCompactableOperation() {
+ return false;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ left.traverse(visitor, scope);
+ right.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java
new file mode 100644
index 0000000..f4eb5db
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java
@@ -0,0 +1,1571 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+public abstract class OperatorExpression extends Expression implements OperatorIds {
+
+ public static int[][] ResolveTypeTables = new int[NumberOfTables][];
+
+ static {classInitialize();}
+
+ /**
+ * OperatorExpression constructor comment.
+ */
+ public OperatorExpression() {
+ super();
+ }
+ public static final void classInitialize() {
+ ResolveTypeTables[AND] = get_AND();
+ ResolveTypeTables[AND_AND] = get_AND_AND();
+ ResolveTypeTables[DIVIDE] = get_DIVIDE();
+ ResolveTypeTables[EQUAL_EQUAL] = get_EQUAL_EQUAL();
+ ResolveTypeTables[GREATER] = get_GREATER();
+ ResolveTypeTables[GREATER_EQUAL] = get_GREATER_EQUAL();
+ ResolveTypeTables[LEFT_SHIFT] = get_LEFT_SHIFT();
+ ResolveTypeTables[LESS] = get_LESS();
+ ResolveTypeTables[LESS_EQUAL] = get_LESS_EQUAL();
+ ResolveTypeTables[MINUS] = get_MINUS();
+ ResolveTypeTables[MULTIPLY] = get_MULTIPLY();
+ ResolveTypeTables[OR] = get_OR();
+ ResolveTypeTables[OR_OR] = get_OR_OR();
+ ResolveTypeTables[PLUS] = get_PLUS();
+ ResolveTypeTables[REMAINDER] = get_REMAINDER();
+ ResolveTypeTables[RIGHT_SHIFT] = get_RIGHT_SHIFT();
+ ResolveTypeTables[UNSIGNED_RIGHT_SHIFT] = get_UNSIGNED_RIGHT_SHIFT();
+ ResolveTypeTables[XOR] = get_XOR();
+ }
+
+ public static final String generateTableTestCase(){
+ //return a String which is a java method allowing to test
+ //the non zero entries of all tables
+
+ /*
+ net.sourceforge.phpdt.internal.compiler.ast.
+ OperatorExpression.generateTableTestCase();
+ */
+
+ int[] operators = new int[]{AND,AND_AND,DIVIDE,GREATER,GREATER_EQUAL,
+ LEFT_SHIFT,LESS,LESS_EQUAL,MINUS,MULTIPLY,OR,OR_OR,PLUS,REMAINDER,
+ RIGHT_SHIFT,UNSIGNED_RIGHT_SHIFT,XOR};
+
+ class Decode {
+ public final String constant(int code){
+ switch(code){
+ case T_boolean : return "true" ; //$NON-NLS-1$
+ case T_byte : return "((byte) 3)" ; //$NON-NLS-1$
+ case T_char : return "'A'" ; //$NON-NLS-1$
+ case T_double : return "300.0d" ; //$NON-NLS-1$
+ case T_float : return "100.0f" ; //$NON-NLS-1$
+ case T_int : return "1" ; //$NON-NLS-1$
+ case T_long : return "7L" ; //$NON-NLS-1$
+ case T_String : return "\"hello-world\"" ; //$NON-NLS-1$
+ case T_null : return "null"; //$NON-NLS-1$
+ case T_short : return "((short) 5)"; //$NON-NLS-1$
+ case T_Object : return "null";} //$NON-NLS-1$
+ return "";} //$NON-NLS-1$
+
+ public final String type(int code){
+ switch(code){
+ case T_boolean : return "z" ; //$NON-NLS-1$
+ case T_byte : return "b" ; //$NON-NLS-1$
+ case T_char : return "c" ; //$NON-NLS-1$
+ case T_double : return "d" ; //$NON-NLS-1$
+ case T_float : return "f" ; //$NON-NLS-1$
+ case T_int : return "i" ; //$NON-NLS-1$
+ case T_long : return "l" ; //$NON-NLS-1$
+ case T_String : return "str" ; //$NON-NLS-1$
+ case T_null : return "null"; //$NON-NLS-1$
+ case T_short : return "s"; //$NON-NLS-1$
+ case T_Object : return "obj";} //$NON-NLS-1$
+ return "xxx";} //$NON-NLS-1$
+
+ public final String operator(int operator){
+ switch (operator) {
+ case EQUAL_EQUAL : return "=="; //$NON-NLS-1$
+ case LESS_EQUAL : return "<="; //$NON-NLS-1$
+ case GREATER_EQUAL :return ">="; //$NON-NLS-1$
+ case LEFT_SHIFT : return "<<"; //$NON-NLS-1$
+ case RIGHT_SHIFT : return ">>"; //$NON-NLS-1$
+ case UNSIGNED_RIGHT_SHIFT : return ">>>"; //$NON-NLS-1$
+ case OR_OR :return "||"; //$NON-NLS-1$
+ case AND_AND : return "&&"; //$NON-NLS-1$
+ case PLUS : return "+"; //$NON-NLS-1$
+ case MINUS : return "-"; //$NON-NLS-1$
+ case NOT : return "!"; //$NON-NLS-1$
+ case REMAINDER : return "%"; //$NON-NLS-1$
+ case XOR : return "^"; //$NON-NLS-1$
+ case AND : return "&"; //$NON-NLS-1$
+ case MULTIPLY : return "*"; //$NON-NLS-1$
+ case OR : return "|"; //$NON-NLS-1$
+ case TWIDDLE : return "~"; //$NON-NLS-1$
+ case DIVIDE : return "/"; //$NON-NLS-1$
+ case GREATER : return ">"; //$NON-NLS-1$
+ case LESS : return "<"; }; //$NON-NLS-1$
+ return "????";} //$NON-NLS-1$
+ }
+
+
+ Decode decode = new Decode();
+ String s ;
+
+ s = "\tpublic static void binaryOperationTablesTestCase(){\n" + //$NON-NLS-1$
+
+ "\t\t//TC test : all binary operation (described in tables)\n"+ //$NON-NLS-1$
+ "\t\t//method automatically generated by\n"+ //$NON-NLS-1$
+ "\t\t//net.sourceforge.phpdt.internal.compiler.ast.OperatorExpression.generateTableTestCase();\n"+ //$NON-NLS-1$
+
+ "\t\tString str0 ;\t String str\t= "+decode.constant(T_String)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tint i0 ;\t int i\t= "+decode.constant(T_int)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tboolean z0;\t boolean z\t= "+decode.constant(T_boolean)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tchar c0; \t char c\t= "+decode.constant(T_char)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tfloat f0; \t float f\t= "+decode.constant(T_float)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tdouble d0;\t double d\t= "+decode.constant(T_double)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tbyte b0; \t byte b\t= "+decode.constant(T_byte)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tshort s0; \t short s\t= "+decode.constant(T_short)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tlong l0; \t long l\t= "+decode.constant(T_long)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\t\tObject obj0; \t Object obj\t= "+decode.constant(T_Object)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+ "\n"; //$NON-NLS-1$
+
+ int error = 0;
+ for (int i=0; i < operators.length ; i++)
+ { int operator = operators[i];
+ for (int left=0; left<16;left++)
+ for (int right=0; right<16;right++)
+ { int result = (ResolveTypeTables[operator][(left<<4)+right]) & 0x0000F;
+ if (result != T_undefined)
+
+ //1/ First regular computation then 2/ comparaison
+ //with a compile time constant (generated by the compiler)
+ // z0 = s >= s;
+ // if ( z0 != (((short) 5) >= ((short) 5)))
+ // System.out.println(155);
+
+ { s += "\t\t"+decode.type(result)+"0"+" = "+decode.type(left); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
+ s += " "+decode.operator(operator)+" "+decode.type(right)+";\n"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$
+ String begin = result == T_String ? "\t\tif (! " : "\t\tif ( "; //$NON-NLS-2$ //$NON-NLS-1$
+ String test = result == T_String ? ".equals(" : " != (" ; //$NON-NLS-2$ //$NON-NLS-1$
+ s += begin +decode.type(result)+"0"+test //$NON-NLS-1$
+ +decode.constant(left)+" " //$NON-NLS-1$
+ +decode.operator(operator)+" " //$NON-NLS-1$
+ +decode.constant(right)+"))\n"; //$NON-NLS-1$
+ s += "\t\t\tSystem.out.println("+ (++error) +");\n"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+ }
+ }
+
+ return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}" ; //$NON-NLS-1$
+ }
+
+ public static final int[] get_AND(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ // table[(T_undefined<<4)+T_undefined] = T_undefined ;
+ // table[(T_undefined<<4)+T_byte] = T_undefined ;
+ // table[(T_undefined<<4)+T_long] = T_undefined ;
+ // table[(T_undefined<<4)+T_short] = T_undefined ;
+ // table[(T_undefined<<4)+T_void] = T_undefined ;
+ // table[(T_undefined<<4)+T_String] = T_undefined ;
+ // table[(T_undefined<<4)+T_Object] = T_undefined ;
+ // table[(T_undefined<<4)+T_double] = T_undefined ;
+ // table[(T_undefined<<4)+T_float] = T_undefined ;
+ // table[(T_undefined<<4)+T_boolean] = T_undefined ;
+ // table[(T_undefined<<4)+T_char] = T_undefined ;
+ // table[(T_undefined<<4)+T_int] = T_undefined ;
+ // table[(T_undefined<<4)+T_null] = T_undefined ;
+
+ // table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12) +(Byte2Int<<4) +T_int ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12) +(Short2Int<<4)+T_int;
+ // table[(T_byte<<4)+T_void] = T_undefined ;
+ // table[(T_byte<<4)+T_String] = T_undefined ;
+ // table[(T_byte<<4)+T_Object] = T_undefined ;
+ // table[(T_byte<<4)+T_double] = T_undefined ;
+ // table[(T_byte<<4)+T_float] = T_undefined ;
+ // table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12) +(Char2Int<<4) +T_int ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12) +(Int2Int<<4) +T_int ;
+ // table[(T_byte<<4)+T_null] = T_undefined ;
+
+ // table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long; ;
+ // table[(T_long<<4)+T_void] = T_undefined ;
+ // table[(T_long<<4)+T_String] = T_undefined ;
+ // table[(T_long<<4)+T_Object] = T_undefined ;
+ // table[(T_long<<4)+T_double] = T_undefined ;
+ // table[(T_long<<4)+T_float] = T_undefined ;
+ // table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ;
+ // table[(T_long<<4)+T_null] = T_undefined ;
+
+ // table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_short<<4)+T_void] = T_undefined ;
+ // table[(T_short<<4)+T_String] = T_undefined ;
+ // table[(T_short<<4)+T_Object] = T_undefined ;
+ // table[(T_short<<4)+T_double] = T_undefined ;
+ // table[(T_short<<4)+T_float] = T_undefined ;
+ // table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_short<<4)+T_null] = T_undefined ;
+
+ // table[(T_void<<4)+T_undefined] = T_undefined ;
+ // table[(T_void<<4)+T_byte] = T_undefined ;
+ // table[(T_void<<4)+T_long] = T_undefined ;
+ // table[(T_void<<4)+T_short] = T_undefined ;
+ // table[(T_void<<4)+T_void] = T_undefined ;
+ // table[(T_void<<4)+T_String] = T_undefined ;
+ // table[(T_void<<4)+T_Object] = T_undefined ;
+ // table[(T_void<<4)+T_double] = T_undefined ;
+ // table[(T_void<<4)+T_float] = T_undefined ;
+ // table[(T_void<<4)+T_boolean] = T_undefined ;
+ // table[(T_void<<4)+T_char] = T_undefined ;
+ // table[(T_void<<4)+T_int] = T_undefined ;
+ // table[(T_void<<4)+T_null] = T_undefined ;
+
+ // table[(T_String<<4)+T_undefined] = T_undefined ;
+ // table[(T_String<<4)+T_byte] = T_undefined ;
+ // table[(T_String<<4)+T_long] = T_undefined ;
+ // table[(T_String<<4)+T_short] = T_undefined ;
+ // table[(T_String<<4)+T_void] = T_undefined ;
+ // table[(T_String<<4)+T_String] = T_undefined ;
+ // table[(T_String<<4)+T_Object] = T_undefined ;
+ // table[(T_String<<4)+T_double] = T_undefined ;
+ // table[(T_String<<4)+T_float] = T_undefined ;
+ // table[(T_String<<4)+T_boolean] = T_undefined ;
+ // table[(T_String<<4)+T_char] = T_undefined ;
+ // table[(T_String<<4)+T_int] = T_undefined ;
+ // table[(T_String<<4)+T_null] = T_undefined ;
+
+ // table[(T_Object<<4)+T_undefined] = T_undefined ;
+ // table[(T_Object<<4)+T_byte] = T_undefined ;
+ // table[(T_Object<<4)+T_long] = T_undefined ;
+ // table[(T_Object<<4)+T_short] = T_undefined ;
+ // table[(T_Object<<4)+T_void] = T_undefined ;
+ // table[(T_Object<<4)+T_String] = T_undefined ;
+ // table[(T_Object<<4)+T_Object] = T_undefined ;
+ // table[(T_Object<<4)+T_double] = T_undefined ;
+ // table[(T_Object<<4)+T_float] = T_undefined ;
+ // table[(T_Object<<4)+T_boolean] = T_undefined ;
+ // table[(T_Object<<4)+T_char] = T_undefined ;
+ // table[(T_Object<<4)+T_int] = T_undefined ;
+ // table[(T_Object<<4)+T_null] = T_undefined ;
+
+ // table[(T_double<<4)+T_undefined] = T_undefined ;
+ // table[(T_double<<4)+T_byte] = T_undefined ;
+ // table[(T_double<<4)+T_long] = T_undefined ;
+ // table[(T_double<<4)+T_short] = T_undefined ;
+ // table[(T_double<<4)+T_void] = T_undefined ;
+ // table[(T_double<<4)+T_String] = T_undefined ;
+ // table[(T_double<<4)+T_Object] = T_undefined ;
+ // table[(T_double<<4)+T_double] = T_undefined ;
+ // table[(T_double<<4)+T_float] = T_undefined ;
+ // table[(T_double<<4)+T_boolean] = T_undefined ;
+ // table[(T_double<<4)+T_char] = T_undefined ;
+ // table[(T_double<<4)+T_int] = T_undefined;
+ // table[(T_double<<4)+T_null] = T_undefined ;
+
+ // table[(T_float<<4)+T_undefined] = T_undefined ;
+ // table[(T_float<<4)+T_byte] = T_undefined ;
+ // table[(T_float<<4)+T_long] = T_undefined ;
+ // table[(T_float<<4)+T_short] = T_undefined ;
+ // table[(T_float<<4)+T_void] = T_undefined ;
+ // table[(T_float<<4)+T_String] = T_undefined ;
+ // table[(T_float<<4)+T_Object] = T_undefined ;
+ // table[(T_float<<4)+T_double] = T_undefined ;
+ // table[(T_float<<4)+T_float] = T_undefined ;
+ // table[(T_float<<4)+T_boolean] = T_undefined ;
+ // table[(T_float<<4)+T_char] = T_undefined ;
+ // table[(T_float<<4)+T_int] = T_undefined ;
+ // table[(T_float<<4)+T_null] = T_undefined ;
+
+ // table[(T_boolean<<4)+T_undefined] = T_undefined ;
+ // table[(T_boolean<<4)+T_byte] = T_undefined ;
+ // table[(T_boolean<<4)+T_long] = T_undefined ;
+ // table[(T_boolean<<4)+T_short] = T_undefined ;
+ // table[(T_boolean<<4)+T_void] = T_undefined ;
+ // table[(T_boolean<<4)+T_String] = T_undefined ;
+ // table[(T_boolean<<4)+T_Object] = T_undefined ;
+ // table[(T_boolean<<4)+T_double] = T_undefined ;
+ // table[(T_boolean<<4)+T_float] = T_undefined ;
+ table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean << 12)+(Boolean2Boolean << 4)+T_boolean ;
+ // table[(T_boolean<<4)+T_char] = T_undefined ;
+ // table[(T_boolean<<4)+T_int] = T_undefined ;
+ // table[(T_boolean<<4)+T_null] = T_undefined ;
+
+ // table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_char<<4)+T_void] = T_undefined ;
+ // table[(T_char<<4)+T_String] = T_undefined ;
+ // table[(T_char<<4)+T_Object] = T_undefined ;
+ // table[(T_char<<4)+T_double] = T_undefined ;
+ // table[(T_char<<4)+T_float] = T_undefined ;
+ // table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_char<<4)+T_null] = T_undefined ;
+
+ // table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_int<<4)+T_void] = T_undefined ;
+ // table[(T_int<<4)+T_String] = T_undefined ;
+ // table[(T_int<<4)+T_Object] = T_undefined ;
+ // table[(T_int<<4)+T_double] = T_undefined ;
+ // table[(T_int<<4)+T_float] = T_undefined ;
+ // table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_int<<4)+T_null] = T_undefined ;
+
+ // table[(T_null<<4)+T_undefined] = T_undefined ;
+ // table[(T_null<<4)+T_byte] = T_undefined ;
+ // table[(T_null<<4)+T_long] = T_undefined ;
+ // table[(T_null<<4)+T_short] = T_undefined ;
+ // table[(T_null<<4)+T_void] = T_undefined ;
+ // table[(T_null<<4)+T_String] = T_undefined ;
+ // table[(T_null<<4)+T_Object] = T_undefined ;
+ // table[(T_null<<4)+T_double] = T_undefined ;
+ // table[(T_null<<4)+T_float] = T_undefined ;
+ // table[(T_null<<4)+T_boolean] = T_undefined ;
+ // table[(T_null<<4)+T_char] = T_undefined ;
+ // table[(T_null<<4)+T_int] = T_undefined ;
+ // table[(T_null<<4)+T_null] = T_undefined ;
+
+ return table ;
+ }
+
+ public static final int[] get_AND_AND(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ // table[(T_undefined<<4)+T_undefined] = T_undefined ;
+ // table[(T_undefined<<4)+T_byte] = T_undefined ;
+ // table[(T_undefined<<4)+T_long] = T_undefined ;
+ // table[(T_undefined<<4)+T_short] = T_undefined ;
+ // table[(T_undefined<<4)+T_void] = T_undefined ;
+ // table[(T_undefined<<4)+T_String] = T_undefined ;
+ // table[(T_undefined<<4)+T_Object] = T_undefined ;
+ // table[(T_undefined<<4)+T_double] = T_undefined ;
+ // table[(T_undefined<<4)+T_float] = T_undefined ;
+ // table[(T_undefined<<4)+T_boolean] = T_undefined ;
+ // table[(T_undefined<<4)+T_char] = T_undefined ;
+ // table[(T_undefined<<4)+T_int] = T_undefined ;
+ // table[(T_undefined<<4)+T_null] = T_undefined ;
+
+ // table[(T_byte<<4)+T_undefined] = T_undefined ;
+ // table[(T_byte<<4)+T_byte] = T_undefined ;
+ // table[(T_byte<<4)+T_long] = T_undefined ;
+ // table[(T_byte<<4)+T_short] = T_undefined ;
+ // table[(T_byte<<4)+T_void] = T_undefined ;
+ // table[(T_byte<<4)+T_String] = T_undefined ;
+ // table[(T_byte<<4)+T_Object] = T_undefined ;
+ // table[(T_byte<<4)+T_double] = T_undefined ;
+ // table[(T_byte<<4)+T_float] = T_undefined ;
+ // table[(T_byte<<4)+T_boolean] = T_undefined ;
+ // table[(T_byte<<4)+T_char] = T_undefined ;
+ // table[(T_byte<<4)+T_int] = T_undefined ;
+ // table[(T_byte<<4)+T_null] = T_undefined ;
+
+ // table[(T_long<<4)+T_undefined] = T_undefined ;
+ // table[(T_long<<4)+T_byte] = T_undefined;
+ // table[(T_long<<4)+T_long] = T_undefined ;
+ // table[(T_long<<4)+T_short] = T_undefined ;
+ // table[(T_long<<4)+T_void] = T_undefined ;
+ // table[(T_long<<4)+T_String] = T_undefined ;
+ // table[(T_long<<4)+T_Object] = T_undefined ;
+ // table[(T_long<<4)+T_double] = T_undefined ;
+ // table[(T_long<<4)+T_float] = T_undefined ;
+ // table[(T_long<<4)+T_boolean] = T_undefined ;
+ // table[(T_long<<4)+T_char] = T_undefined ;
+ // table[(T_long<<4)+T_int] = T_undefined ;
+ // table[(T_long<<4)+T_null] = T_undefined ;
+
+ // table[(T_short<<4)+T_undefined] = T_undefined ;
+ // table[(T_short<<4)+T_byte] = T_undefined ;
+ // table[(T_short<<4)+T_long] = T_undefined ;
+ // table[(T_short<<4)+T_short] = T_undefined ;
+ // table[(T_short<<4)+T_void] = T_undefined ;
+ // table[(T_short<<4)+T_String] = T_undefined ;
+ // table[(T_short<<4)+T_Object] = T_undefined ;
+ // table[(T_short<<4)+T_double] = T_undefined ;
+ // table[(T_short<<4)+T_float] = T_undefined ;
+ // table[(T_short<<4)+T_boolean] = T_undefined ;
+ // table[(T_short<<4)+T_char] = T_undefined ;
+ // table[(T_short<<4)+T_int] = T_undefined ;
+ // table[(T_short<<4)+T_null] = T_undefined ;
+
+ // table[(T_void<<4)+T_undefined] = T_undefined ;
+ // table[(T_void<<4)+T_byte] = T_undefined ;
+ // table[(T_void<<4)+T_long] = T_undefined ;
+ // table[(T_void<<4)+T_short] = T_undefined ;
+ // table[(T_void<<4)+T_void] = T_undefined ;
+ // table[(T_void<<4)+T_String] = T_undefined ;
+ // table[(T_void<<4)+T_Object] = T_undefined ;
+ // table[(T_void<<4)+T_double] = T_undefined ;
+ // table[(T_void<<4)+T_float] = T_undefined ;
+ // table[(T_void<<4)+T_boolean] = T_undefined ;
+ // table[(T_void<<4)+T_char] = T_undefined ;
+ // table[(T_void<<4)+T_int] = T_undefined ;
+ // table[(T_void<<4)+T_null] = T_undefined ;
+
+ // table[(T_String<<4)+T_undefined] = T_undefined ;
+ // table[(T_String<<4)+T_byte] = T_undefined ;
+ // table[(T_String<<4)+T_long] = T_undefined ;
+ // table[(T_String<<4)+T_short] = T_undefined ;
+ // table[(T_String<<4)+T_void] = T_undefined ;
+ // table[(T_String<<4)+T_String] = T_undefined ;
+ // table[(T_String<<4)+T_Object] = T_undefined ;
+ // table[(T_String<<4)+T_double] = T_undefined ;
+ // table[(T_String<<4)+T_float] = T_undefined ;
+ // table[(T_String<<4)+T_boolean] = T_undefined ;
+ // table[(T_String<<4)+T_char] = T_undefined ;
+ // table[(T_String<<4)+T_int] = T_undefined ;
+ // table[(T_String<<4)+T_null] = T_undefined ;
+
+ // table[(T_Object<<4)+T_undefined] = T_undefined ;
+ // table[(T_Object<<4)+T_byte] = T_undefined ;
+ // table[(T_Object<<4)+T_long] = T_undefined ;
+ // table[(T_Object<<4)+T_short] = T_undefined ;
+ // table[(T_Object<<4)+T_void] = T_undefined ;
+ // table[(T_Object<<4)+T_String] = T_undefined ;
+ // table[(T_Object<<4)+T_Object] = T_undefined ;
+ // table[(T_Object<<4)+T_double] = T_undefined ;
+ // table[(T_Object<<4)+T_float] = T_undefined ;
+ // table[(T_Object<<4)+T_boolean] = T_undefined ;
+ // table[(T_Object<<4)+T_char] = T_undefined ;
+ // table[(T_Object<<4)+T_int] = T_undefined ;
+ // table[(T_Object<<4)+T_null] = T_undefined ;
+
+ // table[(T_double<<4)+T_undefined] = T_undefined ;
+ // table[(T_double<<4)+T_byte] = T_undefined ;
+ // table[(T_double<<4)+T_long] = T_undefined ;
+ // table[(T_double<<4)+T_short] = T_undefined ;
+ // table[(T_double<<4)+T_void] = T_undefined ;
+ // table[(T_double<<4)+T_String] = T_undefined ;
+ // table[(T_double<<4)+T_Object] = T_undefined ;
+ // table[(T_double<<4)+T_double] = T_undefined ;
+ // table[(T_double<<4)+T_float] = T_undefined ;
+ // table[(T_double<<4)+T_boolean] = T_undefined ;
+ // table[(T_double<<4)+T_char] = T_undefined ;
+ // table[(T_double<<4)+T_int] = T_undefined;
+ // table[(T_double<<4)+T_null] = T_undefined ;
+
+ // table[(T_float<<4)+T_undefined] = T_undefined ;
+ // table[(T_float<<4)+T_byte] = T_undefined ;
+ // table[(T_float<<4)+T_long] = T_undefined ;
+ // table[(T_float<<4)+T_short] = T_undefined ;
+ // table[(T_float<<4)+T_void] = T_undefined ;
+ // table[(T_float<<4)+T_String] = T_undefined ;
+ // table[(T_float<<4)+T_Object] = T_undefined ;
+ // table[(T_float<<4)+T_double] = T_undefined ;
+ // table[(T_float<<4)+T_float] = T_undefined ;
+ // table[(T_float<<4)+T_boolean] = T_undefined ;
+ // table[(T_float<<4)+T_char] = T_undefined ;
+ // table[(T_float<<4)+T_int] = T_undefined ;
+ // table[(T_float<<4)+T_null] = T_undefined ;
+
+ // table[(T_boolean<<4)+T_undefined] = T_undefined ;
+ // table[(T_boolean<<4)+T_byte] = T_undefined ;
+ // table[(T_boolean<<4)+T_long] = T_undefined ;
+ // table[(T_boolean<<4)+T_short] = T_undefined ;
+ // table[(T_boolean<<4)+T_void] = T_undefined ;
+ // table[(T_boolean<<4)+T_String] = T_undefined ;
+ // table[(T_boolean<<4)+T_Object] = T_undefined ;
+ // table[(T_boolean<<4)+T_double] = T_undefined ;
+ // table[(T_boolean<<4)+T_float] = T_undefined ;
+ table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
+ // table[(T_boolean<<4)+T_char] = T_undefined ;
+ // table[(T_boolean<<4)+T_int] = T_undefined ;
+ // table[(T_boolean<<4)+T_null] = T_undefined ;
+
+ // table[(T_char<<4)+T_undefined] = T_undefined ;
+ // table[(T_char<<4)+T_byte] = T_undefined ;
+ // table[(T_char<<4)+T_long] = T_undefined;
+ // table[(T_char<<4)+T_short] = T_undefined ;
+ // table[(T_char<<4)+T_void] = T_undefined ;
+ // table[(T_char<<4)+T_String] = T_undefined ;
+ // table[(T_char<<4)+T_Object] = T_undefined ;
+ // table[(T_char<<4)+T_double] = T_undefined ;
+ // table[(T_char<<4)+T_float] = T_undefined ;
+ // table[(T_char<<4)+T_boolean] = T_undefined ;
+ // table[(T_char<<4)+T_char] = T_undefined ;
+ // table[(T_char<<4)+T_int] = T_undefined ;
+ // table[(T_char<<4)+T_null] = T_undefined ;
+
+ // table[(T_int<<4)+T_undefined] = T_undefined ;
+ // table[(T_int<<4)+T_byte] = T_undefined ;
+ // table[(T_int<<4)+T_long] = T_undefined ;
+ // table[(T_int<<4)+T_short] = T_undefined ;
+ // table[(T_int<<4)+T_void] = T_undefined ;
+ // table[(T_int<<4)+T_String] = T_undefined ;
+ // table[(T_int<<4)+T_Object] = T_undefined ;
+ // table[(T_int<<4)+T_double] = T_undefined ;
+ // table[(T_int<<4)+T_float] = T_undefined ;
+ // table[(T_int<<4)+T_boolean] = T_undefined ;
+ // table[(T_int<<4)+T_char] = T_undefined ;
+ // table[(T_int<<4)+T_int] = T_undefined ;
+ // table[(T_int<<4)+T_null] = T_undefined ;
+
+ // table[(T_null<<4)+T_undefined] = T_undefined ;
+ // table[(T_null<<4)+T_byte] = T_undefined ;
+ // table[(T_null<<4)+T_long] = T_undefined ;
+ // table[(T_null<<4)+T_short] = T_undefined ;
+ // table[(T_null<<4)+T_void] = T_undefined ;
+ // table[(T_null<<4)+T_String] = T_undefined ;
+ // table[(T_null<<4)+T_Object] = T_undefined ;
+ // table[(T_null<<4)+T_double] = T_undefined ;
+ // table[(T_null<<4)+T_float] = T_undefined ;
+ // table[(T_null<<4)+T_boolean] = T_undefined ;
+ // table[(T_null<<4)+T_char] = T_undefined ;
+ // table[(T_null<<4)+T_int] = T_undefined ;
+ // table[(T_null<<4)+T_null] = T_undefined ;
+ return table ;
+ }
+
+ public static final int[] get_DIVIDE(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ // int[] table = new int[16*16] ;
+
+ return get_MINUS();
+ }
+
+ public static final int[] get_EQUAL_EQUAL(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ // table[(T_undefined<<4)+T_undefined] = T_undefined ;
+ // table[(T_undefined<<4)+T_byte] = T_undefined ;
+ // table[(T_undefined<<4)+T_long] = T_undefined ;
+ // table[(T_undefined<<4)+T_short] = T_undefined ;
+ // table[(T_undefined<<4)+T_void] = T_undefined ;
+ // table[(T_undefined<<4)+T_String] = T_undefined ;
+ // table[(T_undefined<<4)+T_Object] = T_undefined ;
+ // table[(T_undefined<<4)+T_double] = T_undefined ;
+ // table[(T_undefined<<4)+T_float] = T_undefined ;
+ // table[(T_undefined<<4)+T_boolean] = T_undefined ;
+ // table[(T_undefined<<4)+T_char] = T_undefined ;
+ // table[(T_undefined<<4)+T_int] = T_undefined ;
+ // table[(T_undefined<<4)+T_null] = T_undefined ;
+
+ // table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_byte<<4)+T_void] = T_undefined ;
+ // table[(T_byte<<4)+T_String] = T_undefined ;
+ // table[(T_byte<<4)+T_Object] = T_undefined ;
+ table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
+ // table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean;
+ // table[(T_byte<<4)+T_null] = T_undefined ;
+
+ // table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
+ // table[(T_long<<4)+T_void] = T_undefined ;
+ // table[(T_long<<4)+T_String] = T_undefined ;
+ // table[(T_long<<4)+T_Object] = T_undefined ;
+ table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
+ // table[(T_long<<4)+T_null] = T_undefined ;
+
+ // table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_short<<4)+T_void] = T_undefined ;
+ // table[(T_short<<4)+T_String] = T_undefined ;
+ // table[(T_short<<4)+T_Object] = T_undefined ;
+ table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
+ // table[(T_short<<4)+T_null] = T_undefined ;
+
+ // table[(T_void<<4)+T_undefined] = T_undefined ;
+ // table[(T_void<<4)+T_byte] = T_undefined ;
+ // table[(T_void<<4)+T_long] = T_undefined ;
+ // table[(T_void<<4)+T_short] = T_undefined ;
+ // table[(T_void<<4)+T_void] = T_undefined ;
+ // table[(T_void<<4)+T_String] = T_undefined ;
+ // table[(T_void<<4)+T_Object] = T_undefined ;
+ // table[(T_void<<4)+T_double] = T_undefined ;
+ // table[(T_void<<4)+T_float] = T_undefined ;
+ // table[(T_void<<4)+T_boolean] = T_undefined ;
+ // table[(T_void<<4)+T_char] = T_undefined ;
+ // table[(T_void<<4)+T_int] = T_undefined ;
+ // table[(T_void<<4)+T_null] = T_undefined ;
+
+ // table[(T_String<<4)+T_undefined] = T_undefined ;
+ // table[(T_String<<4)+T_byte] = T_undefined ;
+ // table[(T_String<<4)+T_long] = T_undefined ;
+ // table[(T_String<<4)+T_short] = T_undefined ;
+ // table[(T_String<<4)+T_void] = T_undefined ;
+ table[(T_String<<4)+T_String] = /*String2Object String2Object*/
+ (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
+ table[(T_String<<4)+T_Object] = /*String2Object Object2Object*/
+ (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
+ // table[(T_String<<4)+T_double] = T_undefined ;
+ // table[(T_String<<4)+T_float] = T_undefined ;
+ // table[(T_String<<4)+T_boolean] = T_undefined ;
+ // table[(T_String<<4)+T_char] = T_undefined ;
+ // table[(T_String<<4)+T_int] = T_undefined ;
+ table[(T_String<<4)+T_null] = /*Object2String null2Object */
+ (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
+
+ // table[(T_Object<<4)+T_undefined] = T_undefined ;
+ // table[(T_Object<<4)+T_byte] = T_undefined ;
+ // table[(T_Object<<4)+T_long] = T_undefined ;
+ // table[(T_Object<<4)+T_short] = T_undefined ;
+ // table[(T_Object<<4)+T_void] = T_undefined ;
+ table[(T_Object<<4)+T_String] = /*Object2Object String2Object*/
+ (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
+ table[(T_Object<<4)+T_Object] = /*Object2Object Object2Object*/
+ (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
+ // table[(T_Object<<4)+T_double] = T_undefined ;
+ // table[(T_Object<<4)+T_float] = T_undefined ;
+ // table[(T_Object<<4)+T_boolean] = T_undefined ;
+ // table[(T_Object<<4)+T_char] = T_undefined ;
+ // table[(T_Object<<4)+T_int] = T_undefined ;
+ table[(T_Object<<4)+T_null] = /*Object2Object null2Object*/
+ (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
+
+ // table[(T_double<<4)+T_undefined] = T_undefined ;
+ table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
+ // table[(T_double<<4)+T_void] = T_undefined ;
+ // table[(T_double<<4)+T_String] = T_undefined ;
+ // table[(T_double<<4)+T_Object] = T_undefined ;
+ table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean;
+ // table[(T_double<<4)+T_boolean] = T_undefined ;
+ table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean ;
+ // table[(T_double<<4)+T_null] = T_undefined ;
+
+ // table[(T_float<<4)+T_undefined] = T_undefined ;
+ table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
+ // table[(T_float<<4)+T_void] = T_undefined ;
+ // table[(T_float<<4)+T_String] = T_undefined ;
+ // table[(T_float<<4)+T_Object] = T_undefined ;
+ table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_float<<4)+T_boolean] = T_undefined ;
+ table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
+ // table[(T_float<<4)+T_null] = T_undefined ;
+
+ // table[(T_boolean<<4)+T_undefined] = T_undefined ;
+ // table[(T_boolean<<4)+T_byte] = T_undefined ;
+ // table[(T_boolean<<4)+T_long] = T_undefined ;
+ // table[(T_boolean<<4)+T_short] = T_undefined ;
+ // table[(T_boolean<<4)+T_void] = T_undefined ;
+ // table[(T_boolean<<4)+T_String] = T_undefined ;
+ // table[(T_boolean<<4)+T_Object] = T_undefined ;
+ // table[(T_boolean<<4)+T_double] = T_undefined ;
+ // table[(T_boolean<<4)+T_float] = T_undefined ;
+ table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
+ // table[(T_boolean<<4)+T_char] = T_undefined ;
+ // table[(T_boolean<<4)+T_int] = T_undefined ;
+ // table[(T_boolean<<4)+T_null] = T_undefined ;
+
+ // table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_char<<4)+T_void] = T_undefined ;
+ // table[(T_char<<4)+T_String] = T_undefined ;
+ // table[(T_char<<4)+T_Object] = T_undefined ;
+ table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
+ // table[(T_char<<4)+T_null] = T_undefined ;
+
+ // table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_int<<4)+T_void] = T_undefined ;
+ // table[(T_int<<4)+T_String] = T_undefined ;
+ // table[(T_int<<4)+T_Object] = T_undefined ;
+ table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean;
+ // table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean ;
+ // table[(T_int<<4)+T_null] = T_undefined ;
+
+ // table[(T_null<<4)+T_undefined] = T_undefined ;
+ // table[(T_null<<4)+T_byte] = T_undefined ;
+ // table[(T_null<<4)+T_long] = T_undefined ;
+ // table[(T_null<<4)+T_short] = T_undefined ;
+ // table[(T_null<<4)+T_void] = T_undefined ;
+ table[(T_null<<4)+T_String] = /*null2Object String2Object*/
+ (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
+ table[(T_null<<4)+T_Object] = /*null2Object Object2Object*/
+ (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ; ;
+ // table[(T_null<<4)+T_double] = T_undefined ;
+ // table[(T_null<<4)+T_float] = T_undefined ;
+ // table[(T_null<<4)+T_boolean] = T_undefined ;
+ // table[(T_null<<4)+T_char] = T_undefined ;
+ // table[(T_null<<4)+T_int] = T_undefined ;
+ table[(T_null<<4)+T_null] = /*null2Object null2Object*/
+ (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
+ return table ;
+ }
+
+ public static final int[] get_GREATER(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_LESS();
+ }
+
+ public static final int[] get_GREATER_EQUAL(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_LESS();
+ }
+
+ public static final int[] get_LEFT_SHIFT(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ // table[(T_undefined<<4)+T_undefined] = T_undefined ;
+ // table[(T_undefined<<4)+T_byte] = T_undefined ;
+ // table[(T_undefined<<4)+T_long] = T_undefined ;
+ // table[(T_undefined<<4)+T_short] = T_undefined ;
+ // table[(T_undefined<<4)+T_void] = T_undefined ;
+ // table[(T_undefined<<4)+T_String] = T_undefined ;
+ // table[(T_undefined<<4)+T_Object] = T_undefined ;
+ // table[(T_undefined<<4)+T_double] = T_undefined ;
+ // table[(T_undefined<<4)+T_float] = T_undefined ;
+ // table[(T_undefined<<4)+T_boolean] = T_undefined ;
+ // table[(T_undefined<<4)+T_char] = T_undefined ;
+ // table[(T_undefined<<4)+T_int] = T_undefined ;
+ // table[(T_undefined<<4)+T_null] = T_undefined ;
+
+ // table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_long] = (Byte2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_byte<<4)+T_void] = T_undefined ;
+ // table[(T_byte<<4)+T_String] = T_undefined ;
+ // table[(T_byte<<4)+T_Object] = T_undefined ;
+ // table[(T_byte<<4)+T_double] = T_undefined ;
+ // table[(T_byte<<4)+T_float] = T_undefined ;
+ // table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_byte<<4)+T_null] = T_undefined ;
+
+ // table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Int<<4)+T_long;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Int<<4)+T_long ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Int<<4)+T_long ;
+ // table[(T_long<<4)+T_void] = T_undefined ;
+ // table[(T_long<<4)+T_String] = T_undefined ;
+ // table[(T_long<<4)+T_Object] = T_undefined ;
+ // table[(T_long<<4)+T_double] = T_undefined ;
+ // table[(T_long<<4)+T_float] = T_undefined ;
+ // table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Int<<4)+T_long ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Int<<4)+T_long ;
+ // table[(T_long<<4)+T_null] = T_undefined ;
+
+ // table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_short<<4)+T_long] = (Short2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_short<<4)+T_void] = T_undefined ;
+ // table[(T_short<<4)+T_String] = T_undefined ;
+ // table[(T_short<<4)+T_Object] = T_undefined ;
+ // table[(T_short<<4)+T_double] = T_undefined ;
+ // table[(T_short<<4)+T_float] = T_undefined ;
+ // table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_short<<4)+T_null] = T_undefined ;
+
+ // table[(T_void<<4)+T_undefined] = T_undefined ;
+ // table[(T_void<<4)+T_byte] = T_undefined ;
+ // table[(T_void<<4)+T_long] = T_undefined ;
+ // table[(T_void<<4)+T_short] = T_undefined ;
+ // table[(T_void<<4)+T_void] = T_undefined ;
+ // table[(T_void<<4)+T_String] = T_undefined ;
+ // table[(T_void<<4)+T_Object] = T_undefined ;
+ // table[(T_void<<4)+T_double] = T_undefined ;
+ // table[(T_void<<4)+T_float] = T_undefined ;
+ // table[(T_void<<4)+T_boolean] = T_undefined ;
+ // table[(T_void<<4)+T_char] = T_undefined ;
+ // table[(T_void<<4)+T_int] = T_undefined ;
+ // table[(T_void<<4)+T_null] = T_undefined ;
+
+ // table[(T_String<<4)+T_undefined] = T_undefined ;
+ // table[(T_String<<4)+T_byte] = T_undefined ;
+ // table[(T_String<<4)+T_long] = T_undefined ;
+ // table[(T_String<<4)+T_short] = T_undefined ;
+ // table[(T_String<<4)+T_void] = T_undefined ;
+ // table[(T_String<<4)+T_String] = T_undefined ;
+ // table[(T_String<<4)+T_Object] = T_undefined ;
+ // table[(T_String<<4)+T_double] = T_undefined ;
+ // table[(T_String<<4)+T_float] = T_undefined ;
+ // table[(T_String<<4)+T_boolean] = T_undefined ;
+ // table[(T_String<<4)+T_char] = T_undefined ;
+ // table[(T_String<<4)+T_int] = T_undefined ;
+ // table[(T_String<<4)+T_null] = T_undefined ;
+
+ // table[(T_Object<<4)+T_undefined] = T_undefined ;
+ // table[(T_Object<<4)+T_byte] = T_undefined ;
+ // table[(T_Object<<4)+T_long] = T_undefined ;
+ // table[(T_Object<<4)+T_short] = T_undefined ;
+ // table[(T_Object<<4)+T_void] = T_undefined ;
+ // table[(T_Object<<4)+T_String] = T_undefined ;
+ // table[(T_Object<<4)+T_Object] = T_undefined ;
+ // table[(T_Object<<4)+T_double] = T_undefined ;
+ // table[(T_Object<<4)+T_float] = T_undefined ;
+ // table[(T_Object<<4)+T_boolean] = T_undefined ;
+ // table[(T_Object<<4)+T_char] = T_undefined ;
+ // table[(T_Object<<4)+T_int] = T_undefined ;
+ // table[(T_Object<<4)+T_null] = T_undefined ;
+
+ // table[(T_double<<4)+T_undefined] = T_undefined ;
+ // table[(T_double<<4)+T_byte] = T_undefined ;
+ // table[(T_double<<4)+T_long] = T_undefined ;
+ // table[(T_double<<4)+T_short] = T_undefined ;
+ // table[(T_double<<4)+T_void] = T_undefined ;
+ // table[(T_double<<4)+T_String] = T_undefined ;
+ // table[(T_double<<4)+T_Object] = T_undefined ;
+ // table[(T_double<<4)+T_double] = T_undefined ;
+ // table[(T_double<<4)+T_float] = T_undefined ;
+ // table[(T_double<<4)+T_boolean] = T_undefined ;
+ // table[(T_double<<4)+T_char] = T_undefined ;
+ // table[(T_double<<4)+T_int] = T_undefined;
+ // table[(T_double<<4)+T_null] = T_undefined ;
+
+ // table[(T_float<<4)+T_undefined] = T_undefined ;
+ // table[(T_float<<4)+T_byte] = T_undefined ;
+ // table[(T_float<<4)+T_long] = T_undefined ;
+ // table[(T_float<<4)+T_short] = T_undefined ;
+ // table[(T_float<<4)+T_void] = T_undefined ;
+ // table[(T_float<<4)+T_String] = T_undefined ;
+ // table[(T_float<<4)+T_Object] = T_undefined ;
+ // table[(T_float<<4)+T_double] = T_undefined ;
+ // table[(T_float<<4)+T_float] = T_undefined ;
+ // table[(T_float<<4)+T_boolean] = T_undefined ;
+ // table[(T_float<<4)+T_char] = T_undefined ;
+ // table[(T_float<<4)+T_int] = T_undefined ;
+ // table[(T_float<<4)+T_null] = T_undefined ;
+
+ // table[(T_boolean<<4)+T_undefined] = T_undefined ;
+ // table[(T_boolean<<4)+T_byte] = T_undefined ;
+ // table[(T_boolean<<4)+T_long] = T_undefined ;
+ // table[(T_boolean<<4)+T_short] = T_undefined ;
+ // table[(T_boolean<<4)+T_void] = T_undefined ;
+ // table[(T_boolean<<4)+T_String] = T_undefined ;
+ // table[(T_boolean<<4)+T_Object] = T_undefined ;
+ // table[(T_boolean<<4)+T_double] = T_undefined ;
+ // table[(T_boolean<<4)+T_float] = T_undefined ;
+ // table[(T_boolean<<4)+T_boolean] = T_undefined ;
+ // table[(T_boolean<<4)+T_char] = T_undefined ;
+ // table[(T_boolean<<4)+T_int] = T_undefined ;
+ // table[(T_boolean<<4)+T_null] = T_undefined ;
+
+ // table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_char<<4)+T_long] = (Char2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_char<<4)+T_void] = T_undefined ;
+ // table[(T_char<<4)+T_String] = T_undefined ;
+ // table[(T_char<<4)+T_Object] = T_undefined ;
+ // table[(T_char<<4)+T_double] = T_undefined ;
+ // table[(T_char<<4)+T_float] = T_undefined ;
+ // table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_char<<4)+T_null] = T_undefined ;
+
+ // table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_int<<4)+T_long] = (Int2Int<<12)+(Long2Int<<4)+T_int ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_int<<4)+T_void] = T_undefined ;
+ // table[(T_int<<4)+T_String] = T_undefined ;
+ // table[(T_int<<4)+T_Object] = T_undefined ;
+ // table[(T_int<<4)+T_double] = T_undefined ;
+ // table[(T_int<<4)+T_float] = T_undefined ;
+ // table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_int<<4)+T_null] = T_undefined ;
+
+ // table[(T_null<<4)+T_undefined] = T_undefined ;
+ // table[(T_null<<4)+T_byte] = T_undefined ;
+ // table[(T_null<<4)+T_long] = T_undefined ;
+ // table[(T_null<<4)+T_short] = T_undefined ;
+ // table[(T_null<<4)+T_void] = T_undefined ;
+ // table[(T_null<<4)+T_String] = T_undefined ;
+ // table[(T_null<<4)+T_Object] = T_undefined ;
+ // table[(T_null<<4)+T_double] = T_undefined ;
+ // table[(T_null<<4)+T_float] = T_undefined ;
+ // table[(T_null<<4)+T_boolean] = T_undefined ;
+ // table[(T_null<<4)+T_char] = T_undefined ;
+ // table[(T_null<<4)+T_int] = T_undefined ;
+ // table[(T_null<<4)+T_null] = T_undefined ;
+
+ return table ;
+ }
+
+ public static final int[] get_LESS(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ // table[(T_undefined<<4)+T_undefined] = T_undefined ;
+ // table[(T_undefined<<4)+T_byte] = T_undefined ;
+ // table[(T_undefined<<4)+T_long] = T_undefined ;
+ // table[(T_undefined<<4)+T_short] = T_undefined ;
+ // table[(T_undefined<<4)+T_void] = T_undefined ;
+ // table[(T_undefined<<4)+T_String] = T_undefined ;
+ // table[(T_undefined<<4)+T_Object] = T_undefined ;
+ // table[(T_undefined<<4)+T_double] = T_undefined ;
+ // table[(T_undefined<<4)+T_float] = T_undefined ;
+ // table[(T_undefined<<4)+T_boolean] = T_undefined ;
+ // table[(T_undefined<<4)+T_char] = T_undefined ;
+ // table[(T_undefined<<4)+T_int] = T_undefined ;
+ // table[(T_undefined<<4)+T_null] = T_undefined ;
+
+ // table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_byte<<4)+T_void] = T_undefined ;
+ // table[(T_byte<<4)+T_String] = T_undefined ;
+ // table[(T_byte<<4)+T_Object] = T_undefined ;
+ table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
+ // table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean ;
+ // table[(T_byte<<4)+T_null] = T_undefined ;
+
+ // table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
+ // table[(T_long<<4)+T_void] = T_undefined ;
+ // table[(T_long<<4)+T_String] = T_undefined ;
+ // table[(T_long<<4)+T_Object] = T_undefined ;
+ table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
+ // table[(T_long<<4)+T_null] = T_undefined ;
+
+ // table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_short<<4)+T_void] = T_undefined ;
+ // table[(T_short<<4)+T_String] = T_undefined ;
+ // table[(T_short<<4)+T_Object] = T_undefined ;
+ table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
+ // table[(T_short<<4)+T_null] = T_undefined ;
+
+ // table[(T_void<<4)+T_undefined] = T_undefined ;
+ // table[(T_void<<4)+T_byte] = T_undefined ;
+ // table[(T_void<<4)+T_long] = T_undefined ;
+ // table[(T_void<<4)+T_short] = T_undefined ;
+ // table[(T_void<<4)+T_void] = T_undefined ;
+ // table[(T_void<<4)+T_String] = T_undefined ;
+ // table[(T_void<<4)+T_Object] = T_undefined ;
+ // table[(T_void<<4)+T_double] = T_undefined ;
+ // table[(T_void<<4)+T_float] = T_undefined ;
+ // table[(T_void<<4)+T_boolean] = T_undefined ;
+ // table[(T_void<<4)+T_char] = T_undefined ;
+ // table[(T_void<<4)+T_int] = T_undefined ;
+ // table[(T_void<<4)+T_null] = T_undefined ;
+
+ // table[(T_String<<4)+T_undefined] = T_undefined ;
+ // table[(T_String<<4)+T_byte] = T_undefined ;
+ // table[(T_String<<4)+T_long] = T_undefined ;
+ // table[(T_String<<4)+T_short] = T_undefined ;
+ // table[(T_String<<4)+T_void] = T_undefined ;
+ // table[(T_String<<4)+T_String] = T_undefined ;
+ // table[(T_String<<4)+T_Object] = T_undefined ;
+ // table[(T_String<<4)+T_double] = T_undefined ;
+ // table[(T_String<<4)+T_float] = T_undefined ;
+ // table[(T_String<<4)+T_boolean] = T_undefined ;
+ // table[(T_String<<4)+T_char] = T_undefined ;
+ // table[(T_String<<4)+T_int] = T_undefined ;
+ // table[(T_String<<4)+T_null] = T_undefined ;
+
+ // table[(T_Object<<4)+T_undefined] = T_undefined ;
+ // table[(T_Object<<4)+T_byte] = T_undefined ;
+ // table[(T_Object<<4)+T_long] = T_undefined ;
+ // table[(T_Object<<4)+T_short] = T_undefined ;
+ // table[(T_Object<<4)+T_void] = T_undefined ;
+ // table[(T_Object<<4)+T_String] = T_undefined ;
+ // table[(T_Object<<4)+T_Object] = T_undefined ;
+ // table[(T_Object<<4)+T_double] = T_undefined ;
+ // table[(T_Object<<4)+T_float] = T_undefined ;
+ // table[(T_Object<<4)+T_boolean] = T_undefined ;
+ // table[(T_Object<<4)+T_char] = T_undefined ;
+ // table[(T_Object<<4)+T_int] = T_undefined ;
+ // table[(T_Object<<4)+T_null] = T_undefined ;
+
+ // table[(T_double<<4)+T_undefined] = T_undefined ;
+ table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean;
+ table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
+ // table[(T_double<<4)+T_void] = T_undefined ;
+ // table[(T_double<<4)+T_String] = T_undefined ;
+ // table[(T_double<<4)+T_Object] = T_undefined ;
+ table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean ;
+ // table[(T_double<<4)+T_boolean] = T_undefined ;
+ table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
+ table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean;
+ // table[(T_double<<4)+T_null] = T_undefined ;
+
+ // table[(T_float<<4)+T_undefined] = T_undefined ;
+ table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
+ // table[(T_float<<4)+T_void] = T_undefined ;
+ // table[(T_float<<4)+T_String] = T_undefined ;
+ // table[(T_float<<4)+T_Object] = T_undefined ;
+ table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_float<<4)+T_boolean] = T_undefined ;
+ table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
+ table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
+ // table[(T_float<<4)+T_null] = T_undefined ;
+
+ // table[(T_boolean<<4)+T_undefined] = T_undefined ;
+ // table[(T_boolean<<4)+T_byte] = T_undefined ;
+ // table[(T_boolean<<4)+T_long] = T_undefined ;
+ // table[(T_boolean<<4)+T_short] = T_undefined ;
+ // table[(T_boolean<<4)+T_void] = T_undefined ;
+ // table[(T_boolean<<4)+T_String] = T_undefined ;
+ // table[(T_boolean<<4)+T_Object] = T_undefined ;
+ // table[(T_boolean<<4)+T_double] = T_undefined ;
+ // table[(T_boolean<<4)+T_float] = T_undefined ;
+ // table[(T_boolean<<4)+T_boolean] = T_undefined ;
+ // table[(T_boolean<<4)+T_char] = T_undefined ;
+ // table[(T_boolean<<4)+T_int] = T_undefined ;
+ // table[(T_boolean<<4)+T_null] = T_undefined ;
+
+ // table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_char<<4)+T_void] = T_undefined ;
+ // table[(T_char<<4)+T_String] = T_undefined ;
+ // table[(T_char<<4)+T_Object] = T_undefined ;
+ table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
+ // table[(T_char<<4)+T_null] = T_undefined ;
+
+ // table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
+ // table[(T_int<<4)+T_void] = T_undefined ;
+ // table[(T_int<<4)+T_String] = T_undefined ;
+ // table[(T_int<<4)+T_Object] = T_undefined ;
+ table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
+ table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean ;
+ // table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean;
+ // table[(T_int<<4)+T_null] = T_undefined ;
+
+ // table[(T_null<<4)+T_undefined] = T_undefined ;
+ // table[(T_null<<4)+T_byte] = T_undefined ;
+ // table[(T_null<<4)+T_long] = T_undefined ;
+ // table[(T_null<<4)+T_short] = T_undefined ;
+ // table[(T_null<<4)+T_void] = T_undefined ;
+ // table[(T_null<<4)+T_String] = T_undefined ;
+ // table[(T_null<<4)+T_Object] = T_undefined ;
+ // table[(T_null<<4)+T_double] = T_undefined ;
+ // table[(T_null<<4)+T_float] = T_undefined ;
+ // table[(T_null<<4)+T_boolean] = T_undefined ;
+ // table[(T_null<<4)+T_char] = T_undefined ;
+ // table[(T_null<<4)+T_int] = T_undefined ;
+ // table[(T_null<<4)+T_null] = T_undefined ;
+
+ return table ;
+ }
+
+ public static final int[] get_LESS_EQUAL(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_LESS();
+ }
+
+ public static final int[] get_MINUS(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ table = (int[]) get_PLUS().clone();
+
+ // customization
+ table[(T_String<<4)+T_byte] = T_undefined ;
+ table[(T_String<<4)+T_long] = T_undefined ;
+ table[(T_String<<4)+T_short] = T_undefined ;
+ table[(T_String<<4)+T_void] = T_undefined ;
+ table[(T_String<<4)+T_String] = T_undefined ;
+ table[(T_String<<4)+T_Object] = T_undefined ;
+ table[(T_String<<4)+T_double] = T_undefined ;
+ table[(T_String<<4)+T_float] = T_undefined ;
+ table[(T_String<<4)+T_boolean] = T_undefined ;
+ table[(T_String<<4)+T_char] = T_undefined ;
+ table[(T_String<<4)+T_int] = T_undefined ;
+ table[(T_String<<4)+T_null] = T_undefined ;
+
+ table[(T_byte<<4) +T_String] = T_undefined ;
+ table[(T_long<<4) +T_String] = T_undefined ;
+ table[(T_short<<4) +T_String] = T_undefined ;
+ table[(T_void<<4) +T_String] = T_undefined ;
+ table[(T_Object<<4) +T_String] = T_undefined ;
+ table[(T_double<<4) +T_String] = T_undefined ;
+ table[(T_float<<4) +T_String] = T_undefined ;
+ table[(T_boolean<<4)+T_String] = T_undefined ;
+ table[(T_char<<4) +T_String] = T_undefined ;
+ table[(T_int<<4) +T_String] = T_undefined ;
+ table[(T_null<<4) +T_String] = T_undefined ;
+
+ table[(T_null<<4) +T_null] = T_undefined ;
+
+ return table ;
+ }
+
+ public static final int[] get_MULTIPLY(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_MINUS();
+ }
+
+ public static final int[] get_OR(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+
+ // int[] table = new int[16*16] ;
+ return get_AND() ;
+ }
+
+ public static final int[] get_OR_OR(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_AND_AND() ;
+ }
+
+ public static final int[] get_PLUS(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ int[] table = new int[16*16] ;
+
+ // table[(T_undefined<<4)+T_undefined] = T_undefined ;
+ // table[(T_undefined<<4)+T_byte] = T_undefined ;
+ // table[(T_undefined<<4)+T_long] = T_undefined ;
+ // table[(T_undefined<<4)+T_short] = T_undefined ;
+ // table[(T_undefined<<4)+T_void] = T_undefined ;
+ // table[(T_undefined<<4)+T_String] = T_undefined ;
+ // table[(T_undefined<<4)+T_Object] = T_undefined ;
+ // table[(T_undefined<<4)+T_double] = T_undefined ;
+ // table[(T_undefined<<4)+T_float] = T_undefined ;
+ // table[(T_undefined<<4)+T_boolean] = T_undefined ;
+ // table[(T_undefined<<4)+T_char] = T_undefined ;
+ // table[(T_undefined<<4)+T_int] = T_undefined ;
+ // table[(T_undefined<<4)+T_null] = T_undefined ;
+
+ // table[(T_byte<<4)+T_undefined] = T_undefined ;
+ table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_byte<<4)+T_void] = T_undefined ;
+ table[(T_byte<<4)+T_String] = (Byte2Byte<<12)+(String2String<<4)+T_String ;
+ // table[(T_byte<<4)+T_Object] = T_undefined ;
+ table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_float;
+ // table[(T_byte<<4)+T_boolean] = T_undefined ;
+ table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_byte<<4)+T_null] = T_undefined ;
+
+ // table[(T_long<<4)+T_undefined] = T_undefined ;
+ table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
+ table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long ;
+ // table[(T_long<<4)+T_void] = T_undefined ;
+ table[(T_long<<4)+T_String] = (Long2Long<<12)+(String2String<<4)+T_String ;
+ // table[(T_long<<4)+T_Object] = T_undefined ;
+ table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_float ;
+ // table[(T_long<<4)+T_boolean] = T_undefined ;
+ table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
+ table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ; ;
+ // table[(T_long<<4)+T_null] = T_undefined ;
+
+ // table[(T_short<<4)+T_undefined] = T_undefined ;
+ table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_short<<4)+T_void] = T_undefined ;
+ table[(T_short<<4)+T_String] = (Short2Short<<12)+(String2String<<4)+T_String ;
+ // table[(T_short<<4)+T_Object] = T_undefined ;
+ table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_float ;
+ // table[(T_short<<4)+T_boolean] = T_undefined ;
+ table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_short<<4)+T_null] = T_undefined ;
+
+ // table[(T_void<<4)+T_undefined] = T_undefined ;
+ // table[(T_void<<4)+T_byte] = T_undefined ;
+ // table[(T_void<<4)+T_long] = T_undefined ;
+ // table[(T_void<<4)+T_short] = T_undefined ;
+ // table[(T_void<<4)+T_void] = T_undefined ;
+ // table[(T_void<<4)+T_String] = T_undefined ;
+ // table[(T_void<<4)+T_Object] = T_undefined ;
+ // table[(T_void<<4)+T_double] = T_undefined ;
+ // table[(T_void<<4)+T_float] = T_undefined ;
+ // table[(T_void<<4)+T_boolean] = T_undefined ;
+ // table[(T_void<<4)+T_char] = T_undefined ;
+ // table[(T_void<<4)+T_int] = T_undefined ;
+ // table[(T_void<<4)+T_null] = T_undefined ;
+
+ // table[(T_String<<4)+T_undefined] = T_undefined ;
+ table[(T_String<<4)+T_byte] = (String2String<<12)+(Byte2Byte<<4)+T_String ;
+ table[(T_String<<4)+T_long] = (String2String<<12)+(Long2Long<<4)+T_String ;
+ table[(T_String<<4)+T_short] = (String2String<<12)+(Short2Short<<4)+T_String ;
+ // table[(T_String<<4)+T_void] = T_undefined ;
+ table[(T_String<<4)+T_String] = (String2String<<12)+(String2String<<4)+T_String ;
+ table[(T_String<<4)+T_Object] = (String2String<<12)+(Object2Object<<4)+T_String ;
+ table[(T_String<<4)+T_double] = (String2String<<12)+(Double2Double<<4)+T_String ;
+ table[(T_String<<4)+T_float] = (String2String<<12)+(Float2Float<<4)+T_String ;
+ table[(T_String<<4)+T_boolean] = (String2String<<12)+(Boolean2Boolean<<4)+T_String ;
+ table[(T_String<<4)+T_char] = (String2String<<12)+(Char2Char<<4)+T_String ;
+ table[(T_String<<4)+T_int] = (String2String<<12)+(Int2Int<<4)+T_String ;
+ table[(T_String<<4)+T_null] = (String2String<<12)+(T_null<<8)+(T_null<<4)+T_String ;
+
+ // table[(T_Object<<4)+T_undefined] = T_undefined ;
+ // table[(T_Object<<4)+T_byte] = T_undefined ;
+ // table[(T_Object<<4)+T_long] = T_undefined ;
+ // table[(T_Object<<4)+T_short] = T_undefined ;
+ // table[(T_Object<<4)+T_void] = T_undefined ;
+ table[(T_Object<<4)+T_String] = (Object2Object<<12)+(String2String<<4)+T_String ;
+ // table[(T_Object<<4)+T_Object] = T_undefined ;
+ // table[(T_Object<<4)+T_double] = T_undefined ;
+ // table[(T_Object<<4)+T_float] = T_undefined ;
+ // table[(T_Object<<4)+T_boolean] = T_undefined ;
+ // table[(T_Object<<4)+T_char] = T_undefined ;
+ // table[(T_Object<<4)+T_int] = T_undefined ;
+ // table[(T_Object<<4)+T_null] = T_undefined ;
+
+ // table[(T_double<<4)+T_undefined] = T_undefined ;
+ table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_double ;
+ table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_double ;
+ table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_double ; ;
+ // table[(T_double<<4)+T_void] = T_undefined ;
+ table[(T_double<<4)+T_String] = (Double2Double<<12)+(String2String<<4)+T_String ;
+ // table[(T_double<<4)+T_Object] = T_undefined ;
+ table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_double ; ;
+ // table[(T_double<<4)+T_boolean] = T_undefined ;
+ table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_double ; ;
+ table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_double ; ;
+ // table[(T_double<<4)+T_null] = T_undefined ;
+
+ // table[(T_float<<4)+T_undefined] = T_undefined ;
+ table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_float ;
+ table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_float ;
+ table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_float ;
+ // table[(T_float<<4)+T_void] = T_undefined ;
+ table[(T_float<<4)+T_String] = (Float2Float<<12)+(String2String<<4)+T_String ;
+ // table[(T_float<<4)+T_Object] = T_undefined ;
+ table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_float ;
+ // table[(T_float<<4)+T_boolean] = T_undefined ;
+ table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_float ;
+ table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_float ;
+ // table[(T_float<<4)+T_null] = T_undefined ;
+
+ // table[(T_boolean<<4)+T_undefined] = T_undefined ;
+ // table[(T_boolean<<4)+T_byte] = T_undefined ;
+ // table[(T_boolean<<4)+T_long] = T_undefined ;
+ // table[(T_boolean<<4)+T_short] = T_undefined ;
+ // table[(T_boolean<<4)+T_void] = T_undefined ;
+ table[(T_boolean<<4)+T_String] = (Boolean2Boolean<<12)+(String2String<<4)+T_String ;
+ // table[(T_boolean<<4)+T_Object] = T_undefined ;
+ // table[(T_boolean<<4)+T_double] = T_undefined ;
+ // table[(T_boolean<<4)+T_float] = T_undefined ;
+ // table[(T_boolean<<4)+T_boolean] = T_undefined ;
+ // table[(T_boolean<<4)+T_char] = T_undefined ;
+ // table[(T_boolean<<4)+T_int] = T_undefined ;
+ // table[(T_boolean<<4)+T_null] = T_undefined ;
+
+ // table[(T_char<<4)+T_undefined] = T_undefined ;
+ table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_char<<4)+T_void] = T_undefined ;
+ table[(T_char<<4)+T_String] = (Char2Char<<12)+(String2String<<4)+T_String ;
+ // table[(T_char<<4)+T_Object] = T_undefined ;
+ table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_float ;
+ // table[(T_char<<4)+T_boolean] = T_undefined ;
+ table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ; ;
+ table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_char<<4)+T_null] = T_undefined ;
+
+ // table[(T_int<<4)+T_undefined] = T_undefined ;
+ table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
+ table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
+ table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
+ // table[(T_int<<4)+T_void] = T_undefined ;
+ table[(T_int<<4)+T_String] = (Int2Int<<12)+(String2String<<4)+T_String ;
+ // table[(T_int<<4)+T_Object] = T_undefined ;
+ table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_double ;
+ table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_float ;
+ // table[(T_int<<4)+T_boolean] = T_undefined ;
+ table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
+ table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
+ // table[(T_int<<4)+T_null] = T_undefined ;
+
+ // table[(T_null<<4)+T_undefined] = T_undefined ;
+ // table[(T_null<<4)+T_byte] = T_undefined ;
+ // table[(T_null<<4)+T_long] = T_undefined ;
+ // table[(T_null<<4)+T_short] = T_undefined ;
+ // table[(T_null<<4)+T_void] = T_undefined ;
+ table[(T_null<<4)+T_String] = (T_null<<16)+(T_null<<12)+(String2String<<4)+T_String ;
+ // table[(T_null<<4)+T_Object] = T_undefined ;
+ // table[(T_null<<4)+T_double] = T_undefined ;
+ // table[(T_null<<4)+T_float] = T_undefined ;
+ // table[(T_null<<4)+T_boolean] = T_undefined ;
+ // table[(T_null<<4)+T_char] = T_undefined ;
+ // table[(T_null<<4)+T_int] = T_undefined ;
+ // table[(T_null<<4)+T_null] = (Null2String<<12)+(Null2String<<4)+T_String ;;
+
+ return table ;
+ }
+
+ public static final int[] get_REMAINDER(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_MINUS();
+ }
+
+ public static final int[] get_RIGHT_SHIFT(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_LEFT_SHIFT();
+ }
+
+ public static final int[] get_UNSIGNED_RIGHT_SHIFT(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_LEFT_SHIFT();
+ }
+
+ public static final int[] get_XOR(){
+
+ //the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4
+
+ // int[] table = new int[16*16] ;
+ return get_AND() ;
+ }
+
+ public String operatorToString() {
+ switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+ case EQUAL_EQUAL :
+ return "=="; //$NON-NLS-1$
+ case LESS_EQUAL :
+ return "<="; //$NON-NLS-1$
+ case GREATER_EQUAL :
+ return ">="; //$NON-NLS-1$
+ case NOT_EQUAL :
+ return "!="; //$NON-NLS-1$
+ case LEFT_SHIFT :
+ return "<<"; //$NON-NLS-1$
+ case RIGHT_SHIFT :
+ return ">>"; //$NON-NLS-1$
+ case UNSIGNED_RIGHT_SHIFT :
+ return ">>>"; //$NON-NLS-1$
+ case OR_OR :
+ return "||"; //$NON-NLS-1$
+ case AND_AND :
+ return "&&"; //$NON-NLS-1$
+ case PLUS :
+ return "+"; //$NON-NLS-1$
+ case MINUS :
+ return "-"; //$NON-NLS-1$
+ case NOT :
+ return "!"; //$NON-NLS-1$
+ case REMAINDER :
+ return "%"; //$NON-NLS-1$
+ case XOR :
+ return "^"; //$NON-NLS-1$
+ case AND :
+ return "&"; //$NON-NLS-1$
+ case MULTIPLY :
+ return "*"; //$NON-NLS-1$
+ case OR :
+ return "|"; //$NON-NLS-1$
+ case TWIDDLE :
+ return "~"; //$NON-NLS-1$
+ case DIVIDE :
+ return "/"; //$NON-NLS-1$
+ case GREATER :
+ return ">"; //$NON-NLS-1$
+ case LESS :
+ return "<"; //$NON-NLS-1$
+ case QUESTIONCOLON :
+ return "?:"; //$NON-NLS-1$
+ case EQUAL :
+ return "="; //$NON-NLS-1$
+ };
+ return "unknown operator"; //$NON-NLS-1$
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output){
+
+ output.append('(');
+ return printExpressionNoParenthesis(0, output).append(')');
+ }
+
+ public abstract StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output);
+
+ public String toStringExpression(){
+
+ //subclass redefine toStringExpressionNoParenthesis()
+ return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+
+ public abstract String toStringExpressionNoParenthesis();
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java
new file mode 100644
index 0000000..8f9ffa3
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+public interface OperatorIds {
+ public static final int AND_AND = 0;
+ public static final int OR_OR = 1;
+ public static final int AND = 2;
+ public static final int OR = 3;
+ public static final int LESS = 4;
+ public static final int LESS_EQUAL = 5;
+ public static final int GREATER = 6;
+ public static final int GREATER_EQUAL = 7;
+ public static final int XOR = 8;
+ public static final int DIVIDE = 9;
+ public static final int LEFT_SHIFT = 10;
+ public static final int NOT = 11;
+ public static final int TWIDDLE = 12;
+ public static final int MINUS = 13;
+ public static final int PLUS = 14;
+ public static final int MULTIPLY = 15;
+ public static final int REMAINDER = 16;
+ public static final int RIGHT_SHIFT = 17;
+ public static final int EQUAL_EQUAL = 18;
+ public static final int UNSIGNED_RIGHT_SHIFT= 19;
+ public static final int NumberOfTables = 20;
+
+ public static final int QUESTIONCOLON = 23;
+
+ public static final int NOT_EQUAL = 29;
+ public static final int EQUAL = 30;
+ public static final int INSTANCEOF = 31;
+ public static final int PLUS_PLUS = 32;
+ public static final int MINUS_MINUS = 33;
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixExpression.java
new file mode 100644
index 0000000..1f62325
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixExpression.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class PostfixExpression extends CompoundAssignment {
+
+ public PostfixExpression(Expression l, Expression e, int op, int pos) {
+
+ super(l, e, op, pos);
+ this.sourceStart = l.sourceStart;
+ this.sourceEnd = pos;
+ }
+
+ /**
+ * Code generation for PostfixExpression
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// // various scenarii are possible, setting an array reference,
+// // a field reference, a blank final field reference, a field of an enclosing instance or
+// // just a local variable.
+//
+// int pc = codeStream.position;
+// ((Reference) lhs).generatePostIncrement(currentScope, codeStream, this, valueRequired);
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public String operatorToString() {
+ switch (operator) {
+ case PLUS :
+ return "++"; //$NON-NLS-1$
+ case MINUS :
+ return "--"; //$NON-NLS-1$
+ }
+ return "unknown operator"; //$NON-NLS-1$
+ }
+
+ public boolean restrainUsageToNumericTypes() {
+
+ return true;
+ }
+
+ public String toStringExpressionNoParenthesis() {
+
+ return lhs.toStringExpression() + " " + operatorToString(); //$NON-NLS-1$
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixExpression.java
new file mode 100644
index 0000000..f978601
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixExpression.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+
+public class PrefixExpression extends CompoundAssignment {
+
+ /**
+ * PrefixExpression constructor comment.
+ * @param l net.sourceforge.phpdt.internal.compiler.ast.Expression
+ * @param r net.sourceforge.phpdt.internal.compiler.ast.Expression
+ * @param op int
+ */
+ public PrefixExpression(Expression l, Expression e, int op, int pos) {
+
+ super(l, e, op, l.sourceEnd);
+ this.sourceStart = pos;
+ this.sourceEnd = l.sourceEnd;
+ }
+
+ public String operatorToString() {
+
+ switch (operator) {
+ case PLUS :
+ return "++"; //$NON-NLS-1$
+ case MINUS :
+ return "--"; //$NON-NLS-1$
+ }
+ return "unknown operator"; //$NON-NLS-1$
+ }
+
+ public boolean restrainUsageToNumericTypes() {
+
+ return true;
+ }
+
+ public String toStringExpressionNoParenthesis() {
+
+ return operatorToString() + " " + lhs.toStringExpression(); //$NON-NLS-1$
+
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ lhs.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedAllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedAllocationExpression.java
new file mode 100644
index 0000000..8cc98e7
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -0,0 +1,350 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+/**
+ * Variation on allocation, where can be specified an enclosing instance and an anonymous type
+ */
+public class QualifiedAllocationExpression extends AllocationExpression {
+
+ //qualification may be on both side
+ public Expression enclosingInstance;
+ public AnonymousLocalTypeDeclaration anonymousType;
+ public ReferenceBinding superTypeBinding;
+
+ public QualifiedAllocationExpression() {
+ }
+
+ public QualifiedAllocationExpression(AnonymousLocalTypeDeclaration anonymousType) {
+ this.anonymousType = anonymousType;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // analyse the enclosing instance
+ if (enclosingInstance != null) {
+ flowInfo = enclosingInstance.analyseCode(currentScope, flowContext, flowInfo);
+ }
+
+ // check captured variables are initialized in current context (26134)
+ checkCapturedLocalInitializationIfNecessary(
+ this.superTypeBinding == null ? this.binding.declaringClass : this.superTypeBinding,
+ currentScope,
+ flowInfo);
+
+ // process arguments
+ if (arguments != null) {
+ for (int i = 0, count = arguments.length; i < count; i++) {
+ flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo);
+ }
+ }
+
+ // analyse the anonymous nested type
+ if (anonymousType != null) {
+ flowInfo = anonymousType.analyseCode(currentScope, flowContext, flowInfo);
+ }
+
+ // record some dependency information for exception types
+ ReferenceBinding[] thrownExceptions;
+ if (((thrownExceptions = binding.thrownExceptions).length) != 0) {
+ // check exception handling
+ flowContext.checkExceptionHandlers(
+ thrownExceptions,
+ this,
+ flowInfo,
+ currentScope);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ manageSyntheticAccessIfNecessary(currentScope);
+ return flowInfo;
+ }
+
+ public Expression enclosingInstance() {
+
+ return enclosingInstance;
+ }
+
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// ReferenceBinding allocatedType = binding.declaringClass;
+// codeStream.new_(allocatedType);
+// if (valueRequired) {
+// codeStream.dup();
+// }
+// // better highlight for allocation: display the type individually
+// codeStream.recordPositionsFrom(pc, type.sourceStart);
+//
+// // handling innerclass instance allocation - enclosing instance arguments
+// if (allocatedType.isNestedType()) {
+// codeStream.generateSyntheticEnclosingInstanceValues(
+// currentScope,
+// allocatedType,
+// enclosingInstance(),
+// this);
+// }
+// // generate the arguments for constructor
+// if (arguments != null) {
+// for (int i = 0, count = arguments.length; i < count; i++) {
+// arguments[i].generateCode(currentScope, codeStream, true);
+// }
+// }
+// // handling innerclass instance allocation - outer local arguments
+// if (allocatedType.isNestedType()) {
+// codeStream.generateSyntheticOuterArgumentValues(
+// currentScope,
+// allocatedType,
+// this);
+// }
+//
+// // invoke constructor
+// if (syntheticAccessor == null) {
+// codeStream.invokespecial(binding);
+// } else {
+// // synthetic accessor got some extra arguments appended to its signature, which need values
+// for (int i = 0,
+// max = syntheticAccessor.parameters.length - binding.parameters.length;
+// i < max;
+// i++) {
+// codeStream.aconst_null();
+// }
+// codeStream.invokespecial(syntheticAccessor);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//
+// if (anonymousType != null) {
+// anonymousType.generateCode(currentScope, codeStream);
+// }
+// }
+
+ public boolean isSuperAccess() {
+
+ // necessary to lookup super constructor of anonymous type
+ return anonymousType != null;
+ }
+
+ /* Inner emulation consists in either recording a dependency
+ * link only, or performing one level of propagation.
+ *
+ * Dependency mechanism is used whenever dealing with source target
+ * types, since by the time we reach them, we might not yet know their
+ * exact need.
+ */
+ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+
+ ReferenceBinding allocatedType;
+
+ // perform some emulation work in case there is some and we are inside a local type only
+ if ((allocatedType = binding.declaringClass).isNestedType()
+ && currentScope.enclosingSourceType().isLocalType()) {
+
+ if (allocatedType.isLocalType()) {
+ ((LocalTypeBinding) allocatedType).addInnerEmulationDependent(currentScope, enclosingInstance != null);
+ } else {
+ // locally propagate, since we already now the desired shape for sure
+ currentScope.propagateInnerEmulation(allocatedType, enclosingInstance != null);
+ }
+ }
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ // added for code assist...cannot occur with 'normal' code
+ if (anonymousType == null && enclosingInstance == null) {
+ return super.resolveType(scope);
+ }
+
+ // Propagate the type checking to the arguments, and checks if the constructor is defined.
+ // ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
+ // ClassInstanceCreationExpression ::= Name '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
+ // ==> by construction, when there is an enclosing instance the typename may NOT be qualified
+ // ==> therefore by construction the type is always a SingleTypeReferenceType instead of being either
+ // sometime a SingleTypeReference and sometime a QualifedTypeReference
+
+ constant = NotAConstant;
+ TypeBinding enclosingInstanceType = null;
+ TypeBinding receiverType = null;
+ boolean hasError = false;
+ if (anonymousType == null) { //----------------no anonymous class------------------------
+ if ((enclosingInstanceType = enclosingInstance.resolveType(scope)) == null){
+ hasError = true;
+ } else if (enclosingInstanceType.isBaseType() || enclosingInstanceType.isArrayType()) {
+ scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(
+ enclosingInstanceType,
+ enclosingInstance);
+ hasError = true;
+ } else if ((this.resolvedType = receiverType = ((SingleTypeReference) type).resolveTypeEnclosing(
+ scope,
+ (ReferenceBinding) enclosingInstanceType)) == null) {
+ hasError = true;
+ }
+ // will check for null after args are resolved
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null){
+ hasError = true;
+ }
+ }
+ // limit of fault-tolerance
+ if (hasError) return receiverType;
+
+ if (!receiverType.canBeInstantiated()) {
+ scope.problemReporter().cannotInstantiate(type, receiverType);
+ return receiverType;
+ }
+ if ((this.binding = scope.getConstructor((ReferenceBinding) receiverType, argumentTypes, this))
+ .isValidBinding()) {
+ if (isMethodUseDeprecated(binding, scope))
+ scope.problemReporter().deprecatedMethod(this.binding, this);
+
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(this.binding.parameters[i], argumentTypes[i]);
+ } else {
+ if (this.binding.declaringClass == null)
+ this.binding.declaringClass = (ReferenceBinding) receiverType;
+ scope.problemReporter().invalidConstructor(this, this.binding);
+ return receiverType;
+ }
+
+ // The enclosing instance must be compatible with the innermost enclosing type
+ ReferenceBinding expectedType = this.binding.declaringClass.enclosingType();
+ if (enclosingInstanceType.isCompatibleWith(expectedType))
+ return receiverType;
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
+ this.enclosingInstance,
+ enclosingInstanceType,
+ expectedType);
+ return receiverType;
+ }
+
+ //--------------there is an anonymous type declaration-----------------
+ if (this.enclosingInstance != null) {
+ if ((enclosingInstanceType = this.enclosingInstance.resolveType(scope)) == null) {
+ hasError = true;
+ } else if (enclosingInstanceType.isBaseType() || enclosingInstanceType.isArrayType()) {
+ scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(
+ enclosingInstanceType,
+ this.enclosingInstance);
+ hasError = true;
+ } else {
+ receiverType = ((SingleTypeReference) type).resolveTypeEnclosing(
+ scope,
+ (ReferenceBinding) enclosingInstanceType);
+ }
+ } else {
+ receiverType = type.resolveType(scope);
+ }
+ if (receiverType == null) {
+ hasError = true;
+ } else if (((ReferenceBinding) receiverType).isFinal()) {
+ scope.problemReporter().anonymousClassCannotExtendFinalClass(type, receiverType);
+ hasError = true;
+ }
+ TypeBinding[] argumentTypes = NoParameters;
+ if (arguments != null) {
+ int length = arguments.length;
+ argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++)
+ if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null) {
+ hasError = true;
+ }
+ }
+ // limit of fault-tolerance
+ if (hasError) {
+ return receiverType;
+ }
+
+ // an anonymous class inherits from java.lang.Object when declared "after" an interface
+ this.superTypeBinding =
+ receiverType.isInterface() ? scope.getJavaLangObject() : (ReferenceBinding) receiverType;
+ MethodBinding inheritedBinding =
+ scope.getConstructor(this.superTypeBinding, argumentTypes, this);
+ if (!inheritedBinding.isValidBinding()) {
+ if (inheritedBinding.declaringClass == null)
+ inheritedBinding.declaringClass = this.superTypeBinding;
+ scope.problemReporter().invalidConstructor(this, inheritedBinding);
+ return null;
+ }
+ if (enclosingInstance != null) {
+ if (!enclosingInstanceType.isCompatibleWith(inheritedBinding.declaringClass.enclosingType())) {
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
+ enclosingInstance,
+ enclosingInstanceType,
+ inheritedBinding.declaringClass.enclosingType());
+ return null;
+ }
+ }
+
+ // this promotion has to be done somewhere: here or inside the constructor of the
+ // anonymous class. We do it here while the constructor of the inner is then easier.
+ if (arguments != null)
+ for (int i = 0; i < arguments.length; i++)
+ arguments[i].implicitWidening(inheritedBinding.parameters[i], argumentTypes[i]);
+
+ // Update the anonymous inner class : superclass, interface
+ scope.addAnonymousType(anonymousType, (ReferenceBinding) receiverType);
+ anonymousType.resolve(scope);
+ binding = anonymousType.createsInternalConstructorWithBinding(inheritedBinding);
+ return anonymousType.binding; // 1.2 change
+ }
+
+ public String toStringExpression() {
+ return this.toStringExpression(0);
+ }
+
+ public String toStringExpression(int tab) {
+
+ String s = ""; //$NON-NLS-1$
+ if (enclosingInstance != null)
+ s += enclosingInstance.toString() + "."; //$NON-NLS-1$
+ s += super.toStringExpression();
+ if (anonymousType != null) {
+ s += anonymousType.toString(tab);
+ } //allows to restart just after the } one line under ....
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+
+ if (visitor.visit(this, scope)) {
+ if (enclosingInstance != null)
+ enclosingInstance.traverse(visitor, scope);
+ type.traverse(visitor, scope);
+ if (arguments != null) {
+ int argumentsLength = arguments.length;
+ for (int i = 0; i < argumentsLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (anonymousType != null)
+ anonymousType.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedNameReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedNameReference.java
new file mode 100644
index 0000000..26d4107
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedNameReference.java
@@ -0,0 +1,807 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ProblemFieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticAccessMethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
+
+
+public class QualifiedNameReference extends NameReference {
+
+ public char[][] tokens;
+ public FieldBinding[] otherBindings, otherCodegenBindings;
+ int[] otherDepths;
+ public int indexOfFirstFieldBinding;//points (into tokens) for the first token that corresponds to first FieldBinding
+ SyntheticAccessMethodBinding syntheticWriteAccessor;
+ SyntheticAccessMethodBinding[] syntheticReadAccessors;
+ protected FieldBinding lastFieldBinding;
+ public QualifiedNameReference(
+ char[][] sources,
+ int sourceStart,
+ int sourceEnd) {
+ super();
+ tokens = sources;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+ public FlowInfo analyseAssignment(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo,
+ Assignment assignment,
+ boolean isCompound) {
+
+ // determine the rank until which we now we do not need any actual value for the field access
+ int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
+ boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ lastFieldBinding = (FieldBinding) binding;
+ if (needValue) {
+ manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, this.actualReceiverType, 0);
+ } // check if final blank field
+ if (lastFieldBinding.isBlankFinal()
+ && this.otherBindings != null // the last field binding is only assigned
+ && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) {
+ if (!flowInfo.isDefinitelyAssigned(lastFieldBinding)) {
+ currentScope.problemReporter().uninitializedBlankFinalField(
+ lastFieldBinding,
+ this);
+ }
+ }
+ break;
+// case LOCAL :
+// // first binding is a local variable
+// LocalVariableBinding localBinding;
+// if (!flowInfo
+// .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+// }
+// if (flowInfo.isReachable()) {
+// localBinding.useFlag = LocalVariableBinding.USED;
+// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+// }
+ }
+
+ if (needValue) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ // only for first binding
+ }
+ // all intermediate field accesses are read accesses
+ if (otherBindings != null) {
+ for (int i = 0; i < otherBindingsCount-1; i++) {
+ lastFieldBinding = otherBindings[i];
+ needValue = !otherBindings[i+1].isStatic();
+ if (needValue) {
+ manageSyntheticReadAccessIfNecessary(
+ currentScope,
+ lastFieldBinding,
+ i == 0
+ ? ((VariableBinding)binding).type
+ : otherBindings[i-1].type,
+ i + 1);
+ }
+ }
+ lastFieldBinding = otherBindings[otherBindingsCount-1];
+ }
+
+ if (isCompound) {
+ if (binding == lastFieldBinding
+ && lastFieldBinding.isBlankFinal()
+ && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)
+ && (!flowInfo.isDefinitelyAssigned(lastFieldBinding))) {
+ currentScope.problemReporter().uninitializedBlankFinalField(
+ lastFieldBinding,
+ this);
+ }
+ TypeBinding lastReceiverType;
+ if (lastFieldBinding == binding){
+ lastReceiverType = this.actualReceiverType;
+ } else if (otherBindingsCount == 1){
+ lastReceiverType = ((VariableBinding)this.binding).type;
+ } else {
+ lastReceiverType = this.otherBindings[otherBindingsCount-2].type;
+ }
+ manageSyntheticReadAccessIfNecessary(
+ currentScope,
+ lastFieldBinding,
+ lastReceiverType,
+ lastFieldBinding == binding
+ ? 0
+ : otherBindingsCount);
+ }
+
+ if (assignment.expression != null) {
+ flowInfo =
+ assignment
+ .expression
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
+ }
+
+ // the last field access is a write access
+ if (lastFieldBinding.isFinal()) {
+ // in a context where it can be assigned?
+ if (lastFieldBinding.isBlankFinal()
+ && !isCompound
+ && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)
+ && indexOfFirstFieldBinding == 1) {
+ if (flowInfo.isPotentiallyAssigned(lastFieldBinding)) {
+ currentScope.problemReporter().duplicateInitializationOfBlankFinalField(lastFieldBinding, this);
+ } else {
+ flowContext.recordSettingFinal(lastFieldBinding, this);
+ }
+ flowInfo.markAsDefinitelyAssigned(lastFieldBinding);
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalField(lastFieldBinding, this);
+ if (currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) { // pretend it got assigned
+ flowInfo.markAsDefinitelyAssigned(lastFieldBinding);
+ }
+ }
+ }
+ // equivalent to valuesRequired[maxOtherBindings]
+ TypeBinding lastReceiverType;
+ if (lastFieldBinding == binding){
+ lastReceiverType = this.actualReceiverType;
+ } else if (otherBindingsCount == 1){
+ lastReceiverType = ((VariableBinding)this.binding).type;
+ } else {
+ lastReceiverType = this.otherBindings[otherBindingsCount-2].type;
+ }
+ manageSyntheticWriteAccessIfNecessary(currentScope, lastFieldBinding, lastReceiverType);
+
+ return flowInfo;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return analyseCode(currentScope, flowContext, flowInfo, true);
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo,
+ boolean valueRequired) {
+
+ // determine the rank until which we now we do not need any actual value for the field access
+ int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
+
+ boolean needValue = otherBindingsCount == 0 ? valueRequired : !this.otherBindings[0].isStatic();
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ if (needValue) {
+ manageSyntheticReadAccessIfNecessary(currentScope, (FieldBinding) binding, this.actualReceiverType, 0);
+ }
+ // check if reading a final blank field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isBlankFinal()
+ && (indexOfFirstFieldBinding == 1)
+ // was an implicit reference to the first field binding
+ && currentScope.allowBlankFinalFieldAssignment(fieldBinding)
+ && (!flowInfo.isDefinitelyAssigned(fieldBinding))) {
+ currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
+ }
+ break;
+// case LOCAL : // reading a local variable
+// LocalVariableBinding localBinding;
+// if (!flowInfo
+// .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+// }
+// if (flowInfo.isReachable()) {
+// localBinding.useFlag = LocalVariableBinding.USED;
+// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+// }
+ }
+ if (needValue) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ // only for first binding
+ }
+ if (otherBindings != null) {
+ for (int i = 0; i < otherBindingsCount; i++) {
+ needValue = i < otherBindingsCount-1 ? !otherBindings[i+1].isStatic() : valueRequired;
+ if (needValue) {
+ manageSyntheticReadAccessIfNecessary(
+ currentScope,
+ otherBindings[i],
+ i == 0
+ ? ((VariableBinding)binding).type
+ : otherBindings[i-1].type,
+ i + 1);
+ }
+ }
+ }
+ return flowInfo;
+ }
+ /**
+ * Check and/or redirect the field access to the delegate receiver if any
+ */
+ public TypeBinding checkFieldAccess(BlockScope scope) {
+ // check for forward references
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ MethodScope methodScope = scope.methodScope();
+ if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
+ && methodScope.fieldDeclarationIndex != MethodScope.NotInFieldDecl
+ && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
+ if ((!fieldBinding.isStatic() || methodScope.isStatic)
+ && this.indexOfFirstFieldBinding == 1)
+ scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
+ }
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= FIELD;
+ return getOtherFieldBindings(scope);
+ }
+// public void generateAssignment(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Assignment assignment,
+// boolean valueRequired) {
+//
+// generateReadSequence(currentScope, codeStream);
+// assignment.expression.generateCode(currentScope, codeStream, true);
+// fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired);
+// // equivalent to valuesRequired[maxOtherBindings]
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(assignment.implicitConversion);
+// }
+// }
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// if (constant != NotAConstant) {
+// if (valueRequired) {
+// codeStream.generateConstant(constant, implicitConversion);
+// }
+// } else {
+// generateReadSequence(currentScope, codeStream);
+// if (valueRequired) {
+// if (lastFieldBinding.declaringClass == null) { // array length
+// codeStream.arraylength();
+// codeStream.generateImplicitConversion(implicitConversion);
+// } else {
+// if (lastFieldBinding.constant != NotAConstant) {
+// if (!lastFieldBinding.isStatic()){
+// codeStream.invokeObjectGetClass();
+// codeStream.pop();
+// }
+// // inline the last field constant
+// codeStream.generateConstant(lastFieldBinding.constant, implicitConversion);
+// } else {
+// SyntheticAccessMethodBinding accessor =
+// syntheticReadAccessors == null
+// ? null
+// : syntheticReadAccessors[syntheticReadAccessors.length - 1];
+// if (accessor == null) {
+// if (lastFieldBinding.isStatic()) {
+// codeStream.getstatic(lastFieldBinding);
+// } else {
+// codeStream.getfield(lastFieldBinding);
+// }
+// } else {
+// codeStream.invokestatic(accessor);
+// }
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// }
+// } else {
+// if (lastFieldBinding != null && !lastFieldBinding.isStatic()){
+// codeStream.invokeObjectGetClass(); // perform null check
+// codeStream.pop();
+// }
+//
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+// public void generateCompoundAssignment(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Expression expression,
+// int operator,
+// int assignmentImplicitConversion,
+// boolean valueRequired) {
+//
+// generateReadSequence(currentScope, codeStream);
+// SyntheticAccessMethodBinding accessor =
+// syntheticReadAccessors == null
+// ? null
+// : syntheticReadAccessors[syntheticReadAccessors.length - 1];
+// if (lastFieldBinding.isStatic()) {
+// if (accessor == null) {
+// codeStream.getstatic(lastFieldBinding);
+// } else {
+// codeStream.invokestatic(accessor);
+// }
+// } else {
+// codeStream.dup();
+// if (accessor == null) {
+// codeStream.getfield(lastFieldBinding);
+// } else {
+// codeStream.invokestatic(accessor);
+// }
+// }
+// // the last field access is a write access
+// // perform the actual compound operation
+// int operationTypeID;
+// if ((operationTypeID = implicitConversion >> 4) == T_String) {
+// codeStream.generateStringAppend(currentScope, null, expression);
+// } else {
+// // promote the array reference to the suitable operation type
+// codeStream.generateImplicitConversion(implicitConversion);
+// // generate the increment value (will by itself be promoted to the operation value)
+// if (expression == IntLiteral.One) { // prefix operation
+// codeStream.generateConstant(expression.constant, implicitConversion);
+// } else {
+// expression.generateCode(currentScope, codeStream, true);
+// }
+// // perform the operation
+// codeStream.sendOperator(operator, operationTypeID);
+// // cast the value back to the array reference type
+// codeStream.generateImplicitConversion(assignmentImplicitConversion);
+// }
+// // actual assignment
+// fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired);
+// // equivalent to valuesRequired[maxOtherBindings]
+// }
+// public void generatePostIncrement(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// CompoundAssignment postIncrement,
+// boolean valueRequired) {
+// generateReadSequence(currentScope, codeStream);
+// SyntheticAccessMethodBinding accessor =
+// syntheticReadAccessors == null
+// ? null
+// : syntheticReadAccessors[syntheticReadAccessors.length - 1];
+// if (lastFieldBinding.isStatic()) {
+// if (accessor == null) {
+// codeStream.getstatic(lastFieldBinding);
+// } else {
+// codeStream.invokestatic(accessor);
+// }
+// } else {
+// codeStream.dup();
+// if (accessor == null) {
+// codeStream.getfield(lastFieldBinding);
+// } else {
+// codeStream.invokestatic(accessor);
+// }
+// }
+// // duplicate the old field value
+// if (valueRequired) {
+// if (lastFieldBinding.isStatic()) {
+// if ((lastFieldBinding.type == LongBinding)
+// || (lastFieldBinding.type == DoubleBinding)) {
+// codeStream.dup2();
+// } else {
+// codeStream.dup();
+// }
+// } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
+// if ((lastFieldBinding.type == LongBinding)
+// || (lastFieldBinding.type == DoubleBinding)) {
+// codeStream.dup2_x1();
+// } else {
+// codeStream.dup_x1();
+// }
+// }
+// }
+// codeStream.generateConstant(
+// postIncrement.expression.constant,
+// implicitConversion);
+// codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id);
+// codeStream.generateImplicitConversion(
+// postIncrement.assignmentImplicitConversion);
+// fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, false);
+// }
+// /*
+// * Generate code for all bindings (local and fields) excluding the last one, which may then be generated code
+// * for a read or write access.
+// */
+// public void generateReadSequence(
+// BlockScope currentScope,
+// CodeStream codeStream) {
+//
+// // determine the rank until which we now we do not need any actual value for the field access
+// int otherBindingsCount = this.otherCodegenBindings == null ? 0 : otherCodegenBindings.length;
+//
+// boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
+// switch (bits & RestrictiveFlagMASK) {
+// case FIELD :
+// lastFieldBinding = (FieldBinding) this.codegenBinding;
+// // if first field is actually constant, we can inline it
+// if (lastFieldBinding.constant != NotAConstant) {
+// break;
+// }
+// if (needValue && !lastFieldBinding.isStatic()) {
+// if ((bits & DepthMASK) != 0) {
+// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
+// } else {
+// generateReceiver(codeStream);
+// }
+// }
+// break;
+// case LOCAL : // reading the first local variable
+// if (!needValue) break; // no value needed
+// lastFieldBinding = null;
+// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
+// // regular local variable read
+// if (localBinding.constant != NotAConstant) {
+// codeStream.generateConstant(localBinding.constant, 0);
+// // no implicit conversion
+// } else {
+// // outer local?
+// if ((bits & DepthMASK) != 0) {
+// // outer local can be reached either through a synthetic arg or a synthetic field
+// VariableBinding[] path = currentScope.getEmulationPath(localBinding);
+// codeStream.generateOuterAccess(path, this, localBinding, currentScope);
+// } else {
+// codeStream.load(localBinding);
+// }
+// }
+// }
+//
+// // all intermediate field accesses are read accesses
+// // only the last field binding is a write access
+// if (this.otherCodegenBindings != null) {
+// for (int i = 0; i < otherBindingsCount; i++) {
+// FieldBinding nextField = this.otherCodegenBindings[i];
+// if (lastFieldBinding != null) {
+// needValue = !nextField.isStatic();
+// if (needValue) {
+// MethodBinding accessor =
+// syntheticReadAccessors == null ? null : syntheticReadAccessors[i];
+// if (accessor == null) {
+// if (lastFieldBinding.constant != NotAConstant) {
+// if (this.lastFieldBinding != this.codegenBinding && !this.lastFieldBinding.isStatic()) {
+// codeStream.invokeObjectGetClass(); // perform null check
+// codeStream.pop();
+// }
+// codeStream.generateConstant(lastFieldBinding.constant, 0);
+// } else if (lastFieldBinding.isStatic()) {
+// codeStream.getstatic(lastFieldBinding);
+// } else {
+// codeStream.getfield(lastFieldBinding);
+// }
+// } else {
+// codeStream.invokestatic(accessor);
+// }
+// } else {
+// if (this.codegenBinding != this.lastFieldBinding && !this.lastFieldBinding.isStatic()){
+// codeStream.invokeObjectGetClass(); // perform null check
+// codeStream.pop();
+// }
+// }
+// }
+// this.lastFieldBinding = nextField;
+// }
+// }
+// }
+// public void generateReceiver(CodeStream codeStream) {
+// codeStream.aload_0();
+// }
+ public TypeBinding getOtherFieldBindings(BlockScope scope) {
+ // At this point restrictiveFlag may ONLY have two potential value : FIELD LOCAL (i.e cast <<(VariableBinding) binding>> is valid)
+ if ((bits & FIELD) != 0) {
+ if (!((FieldBinding) binding).isStatic()) {
+ //must check for the static status....
+ if (indexOfFirstFieldBinding == 1) {
+ //the field is the first token of the qualified reference....
+ if (scope.methodScope().isStatic) {
+ scope.problemReporter().staticFieldAccessToNonStaticVariable(
+ this,
+ (FieldBinding) binding);
+ return null;
+ }
+ } else { //accessing to a field using a type as "receiver" is allowed only with static field
+ scope.problemReporter().staticFieldAccessToNonStaticVariable(
+ this,
+ (FieldBinding) binding);
+ return null;
+ }
+ }
+ if (isFieldUseDeprecated((FieldBinding) binding, scope))
+ scope.problemReporter().deprecatedField((FieldBinding) binding, this);
+ }
+ TypeBinding type = ((VariableBinding) binding).type;
+ int index = indexOfFirstFieldBinding;
+ int length = tokens.length;
+ if (index == length) { // restrictiveFlag == FIELD
+ this.constant = FieldReference.getConstantFor((FieldBinding) binding, this, false, scope);
+ return type;
+ }
+ // allocation of the fieldBindings array and its respective constants
+ int otherBindingsLength = length - index;
+ otherCodegenBindings = otherBindings = new FieldBinding[otherBindingsLength];
+ otherDepths = new int[otherBindingsLength];
+
+ // fill the first constant (the one of the binding)
+ this.constant =
+ ((bits & FIELD) != 0)
+ ? FieldReference.getConstantFor((FieldBinding) binding, this, false, scope)
+ : ((VariableBinding) binding).constant;
+ // save first depth, since will be updated by visibility checks of other bindings
+ int firstDepth = (bits & DepthMASK) >> DepthSHIFT;
+ // iteration on each field
+ while (index < length) {
+ char[] token = tokens[index];
+ if (type == null)
+ return null; // could not resolve type prior to this point
+
+ bits &= ~DepthMASK; // flush previous depth if any
+ FieldBinding field = scope.getField(type, token, this);
+ int place = index - indexOfFirstFieldBinding;
+ otherBindings[place] = field;
+ otherDepths[place] = (bits & DepthMASK) >> DepthSHIFT;
+ if (field.isValidBinding()) {
+ if (isFieldUseDeprecated(field, scope))
+ scope.problemReporter().deprecatedField(field, this);
+ Constant someConstant = FieldReference.getConstantFor(field, this, false, scope);
+ // constant propagation can only be performed as long as the previous one is a constant too.
+ if (this.constant != NotAConstant) {
+ this.constant = someConstant;
+ }
+
+ type = field.type;
+ index++;
+
+ if (field.isStatic()) {
+ // static field accessed through receiver? legal but unoptimal (optional warning)
+ scope.problemReporter().unnecessaryReceiverForStaticField(this, field);
+ }
+
+ } else {
+ constant = NotAConstant; //don't fill other constants slots...
+ scope.problemReporter().invalidField(this, field, index, type);
+ setDepth(firstDepth);
+ return null;
+ }
+ }
+ setDepth(firstDepth);
+ return (otherBindings[otherBindingsLength - 1]).type;
+ }
+ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+ //If inlinable field, forget the access emulation, the code gen will directly target it
+ if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) {
+ return;
+ }
+ if ((bits & RestrictiveFlagMASK) == LOCAL) {
+ currentScope.emulateOuterAccess((LocalVariableBinding) binding);
+ }
+ }
+ public void manageSyntheticReadAccessIfNecessary(
+ BlockScope currentScope,
+ FieldBinding fieldBinding,
+ TypeBinding lastReceiverType,
+ int index) {
+ // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings'
+ if (fieldBinding.constant != NotAConstant)
+ return;
+ if (fieldBinding.isPrivate()) { // private access
+ if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
+ if (syntheticReadAccessors == null) {
+ if (otherBindings == null)
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
+ else
+ syntheticReadAccessors =
+ new SyntheticAccessMethodBinding[otherBindings.length + 1];
+ }
+ syntheticReadAccessors[index] = ((SourceTypeBinding) fieldBinding.declaringClass).addSyntheticMethod(fieldBinding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
+ return;
+ }
+ } else if (fieldBinding.isProtected()){
+ int depth = index == 0 ? (bits & DepthMASK) >> DepthSHIFT : otherDepths[index-1];
+ // implicit protected access (only for first one)
+ if (depth > 0 && (fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage())) {
+ if (syntheticReadAccessors == null) {
+ if (otherBindings == null)
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
+ else
+ syntheticReadAccessors =
+ new SyntheticAccessMethodBinding[otherBindings.length + 1];
+ }
+ syntheticReadAccessors[index] =
+ ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth))
+ .addSyntheticMethod(fieldBinding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
+ return;
+ }
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
+// if (fieldBinding.declaringClass != lastReceiverType
+// && !lastReceiverType.isArrayType()
+// && fieldBinding.declaringClass != null
+// && fieldBinding.constant == NotAConstant
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && (index > 0 || indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
+// && fieldBinding.declaringClass.id != T_Object)
+// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
+// if (index == 0){
+// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
+// } else {
+// if (this.otherCodegenBindings == this.otherBindings){
+// int l = this.otherBindings.length;
+// System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
+// }
+// this.otherCodegenBindings[index-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
+// }
+// }
+ }
+ /*
+ * No need to emulate access to protected fields since not implicitly accessed
+ */
+ public void manageSyntheticWriteAccessIfNecessary(
+ BlockScope currentScope,
+ FieldBinding fieldBinding,
+ TypeBinding lastReceiverType) {
+ if (fieldBinding.isPrivate()) {
+ if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
+ syntheticWriteAccessor = ((SourceTypeBinding) fieldBinding.declaringClass)
+ .addSyntheticMethod(fieldBinding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ return;
+ }
+ } else if (fieldBinding.isProtected()){
+ int depth = fieldBinding == binding ? (bits & DepthMASK) >> DepthSHIFT : otherDepths[otherDepths.length-1];
+ if (depth > 0 && (fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage())) {
+ syntheticWriteAccessor = ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth))
+ .addSyntheticMethod(fieldBinding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ return;
+ }
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
+// if (fieldBinding.declaringClass != lastReceiverType
+// && !lastReceiverType.isArrayType()
+// && fieldBinding.declaringClass != null
+// && fieldBinding.constant == NotAConstant
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && (fieldBinding != binding || indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
+// && fieldBinding.declaringClass.id != T_Object)
+// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
+// if (fieldBinding == binding){
+// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
+// } else {
+// if (this.otherCodegenBindings == this.otherBindings){
+// int l = this.otherBindings.length;
+// System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
+// }
+// this.otherCodegenBindings[this.otherCodegenBindings.length-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
+// }
+// }
+
+ }
+ /**
+ * Normal field binding did not work, try to bind to a field of the delegate receiver.
+ */
+ public TypeBinding reportError(BlockScope scope) {
+ if (binding instanceof ProblemFieldBinding) {
+ scope.problemReporter().invalidField(this, (FieldBinding) binding);
+ } else if (binding instanceof ProblemReferenceBinding) {
+ scope.problemReporter().invalidType(this, (TypeBinding) binding);
+ } else {
+ scope.problemReporter().unresolvableReference(this, binding);
+ }
+ return null;
+ }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (i > 0) output.append('.');
+ output.append(tokens[i]);
+ }
+ return output;
+ }
+ public TypeBinding resolveType(BlockScope scope) {
+ // field and/or local are done before type lookups
+ // the only available value for the restrictiveFlag BEFORE
+ // the TC is Flag_Type Flag_LocalField and Flag_TypeLocalField
+ this.actualReceiverType = this.receiverType = scope.enclosingSourceType();
+ constant = Constant.NotAConstant;
+ if ((this.codegenBinding = this.binding = scope.getBinding(tokens, bits & RestrictiveFlagMASK, this))
+ .isValidBinding()) {
+ switch (bits & RestrictiveFlagMASK) {
+ case VARIABLE : //============only variable===========
+ case TYPE | VARIABLE :
+ if (binding instanceof LocalVariableBinding) {
+ if (!((LocalVariableBinding) binding).isFinal() && ((bits & DepthMASK) != 0))
+ scope.problemReporter().cannotReferToNonFinalOuterLocal(
+ (LocalVariableBinding) binding,
+ this);
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= LOCAL;
+ return this.resolvedType = getOtherFieldBindings(scope);
+ }
+ if (binding instanceof FieldBinding) {
+ // check for forward references
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ MethodScope methodScope = scope.methodScope();
+ if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
+ && methodScope.fieldDeclarationIndex != MethodScope.NotInFieldDecl
+ && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
+ if ((!fieldBinding.isStatic() || methodScope.isStatic)
+ && this.indexOfFirstFieldBinding == 1)
+ scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
+ }
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= FIELD;
+
+ // check for deprecated receiver type
+ // deprecation check for receiver type if not first token
+ if (indexOfFirstFieldBinding > 1) {
+ if (isTypeUseDeprecated(this.actualReceiverType, scope))
+ scope.problemReporter().deprecatedType(this.actualReceiverType, this);
+ }
+
+ return this.resolvedType = getOtherFieldBindings(scope);
+ }
+ // thus it was a type
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= TYPE;
+ case TYPE : //=============only type ==============
+ if (isTypeUseDeprecated((TypeBinding) binding, scope))
+ scope.problemReporter().deprecatedType((TypeBinding) binding, this);
+ return this.resolvedType = (TypeBinding) binding;
+ }
+ }
+ //========error cases===============
+ return this.resolvedType = this.reportError(scope);
+ }
+ public void setFieldIndex(int index) {
+ this.indexOfFirstFieldBinding = index;
+ }
+ public String toStringExpression() {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < tokens.length; i++) {
+ buffer.append(tokens[i]);
+ if (i < (tokens.length - 1)) {
+ buffer.append("."); //$NON-NLS-1$
+ }
+ }
+ return buffer.toString();
+ }
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+ public String unboundReferenceErrorName() {
+ return new String(tokens[0]);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedSuperReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedSuperReference.java
new file mode 100644
index 0000000..c3a35aa
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedSuperReference.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class QualifiedSuperReference extends QualifiedThisReference {
+
+ public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
+ super(name, pos, sourceEnd);
+ }
+
+ public boolean isSuper() {
+
+ return true;
+ }
+
+ public boolean isThis() {
+
+ return false;
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ if ((this.bits & ParenthesizedMASK) != 0) {
+ scope.problemReporter().invalidParenthesizedExpression(this);
+ return null;
+ }
+ super.resolveType(scope);
+ if (currentCompatibleType == null)
+ return null; // error case
+
+ if (scope.isJavaLangObject(currentCompatibleType)) {
+ scope.problemReporter().cannotUseSuperInJavaLangObject(this);
+ return null;
+ }
+ return this.resolvedType = currentCompatibleType.superclass();
+ }
+
+ public String toStringExpression() {
+
+ return qualification.toString(0) + ".super"; //$NON-NLS-1$
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ qualification.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedThisReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedThisReference.java
new file mode 100644
index 0000000..5dd3156
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedThisReference.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class QualifiedThisReference extends ThisReference {
+
+ public TypeReference qualification;
+ ReferenceBinding currentCompatibleType;
+
+ public QualifiedThisReference(TypeReference name, int sourceStart, int sourceEnd) {
+ super(sourceStart, sourceEnd);
+ qualification = name;
+ this.sourceStart = name.sourceStart;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ return flowInfo;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo,
+ boolean valueRequired) {
+
+ return flowInfo;
+ }
+
+ /**
+ * Code generation for QualifiedThisReference
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// if (valueRequired) {
+// if ((bits & DepthMASK) != 0) {
+// Object[] emulationPath =
+// currentScope.getEmulationPath(this.currentCompatibleType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(emulationPath, this, this.currentCompatibleType, currentScope);
+// } else {
+// // nothing particular after all
+// codeStream.aload_0();
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ constant = NotAConstant;
+ this.resolvedType = qualification.resolveType(scope);
+ if (this.resolvedType == null) return null;
+
+ // the qualification MUST exactly match some enclosing type name
+ // Its possible to qualify 'this' by the name of the current class
+ int depth = 0;
+ this.currentCompatibleType = scope.referenceType().binding;
+ while (this.currentCompatibleType != null
+ && this.currentCompatibleType != this.resolvedType) {
+ depth++;
+ this.currentCompatibleType = this.currentCompatibleType.isStatic() ? null : this.currentCompatibleType.enclosingType();
+ }
+ bits &= ~DepthMASK; // flush previous depth if any
+ bits |= (depth & 0xFF) << DepthSHIFT; // encoded depth into 8 bits
+
+ if (this.currentCompatibleType == null) {
+ scope.problemReporter().noSuchEnclosingInstance(this.resolvedType, this, false);
+ return this.resolvedType;
+ }
+
+ // Ensure one cannot write code like: B() { super(B.this); }
+ if (depth == 0) {
+ checkAccess(scope.methodScope());
+ } // if depth>0, path emulation will diagnose bad scenarii
+ return this.resolvedType;
+ }
+
+ public String toStringExpression() {
+
+ return qualification.toString(0) + ".this"; //$NON-NLS-1$
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ qualification.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedTypeReference.java
new file mode 100644
index 0000000..102804e
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/QualifiedTypeReference.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class QualifiedTypeReference extends TypeReference {
+ public char[][] tokens;
+ public long[] sourcePositions;
+public QualifiedTypeReference(char[][] sources , long[] poss) {
+ tokens = sources ;
+ sourcePositions = poss ;
+ sourceStart = (int) (sourcePositions[0]>>>32) ;
+ sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
+}
+public QualifiedTypeReference(char[][] sources , TypeBinding type , long[] poss) {
+ this(sources,poss);
+ this.resolvedType = type;
+}
+public TypeReference copyDims(int dim){
+ //return a type reference copy of me with some dimensions
+ //warning : the new type ref has a null binding
+
+ return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ return scope.getType(tokens);
+}
+public char[][] getTypeName(){
+
+ return tokens;
+}
+public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ for (int i = 0; i < tokens.length; i++) {
+ if (i > 0) output.append('.');
+ output.append(tokens[i]);
+ }
+ return output;
+}
+public String toStringExpression(int tab) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < tokens.length; i++) {
+ buffer.append(tokens[i]);
+ if (i < (tokens.length - 1)) {
+ buffer.append("."); //$NON-NLS-1$
+ }
+ }
+ return buffer.toString();
+}
+public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Reference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Reference.java
new file mode 100644
index 0000000..035cee0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Reference.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+
+public abstract class Reference extends Expression {
+/**
+ * BaseLevelReference constructor comment.
+ */
+public Reference() {
+ super();
+}
+public abstract FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound);
+
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return flowInfo;
+}
+public FieldBinding fieldBinding() {
+ //this method should be sent one FIELD-tagged references
+ // (ref.bits & BindingIds.FIELD != 0)()
+ return null ;
+}
+//public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
+//
+// if (fieldBinding.isStatic()) {
+// if (valueRequired) {
+// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+// codeStream.dup2();
+// } else {
+// codeStream.dup();
+// }
+// }
+// if (syntheticWriteAccessor == null) {
+// codeStream.putstatic(fieldBinding);
+// } else {
+// codeStream.invokestatic(syntheticWriteAccessor);
+// }
+// } else { // Stack: [owner][new field value] ---> [new field value][owner][new field value]
+// if (valueRequired) {
+// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+// codeStream.dup2_x1();
+// } else {
+// codeStream.dup_x1();
+// }
+// }
+// if (syntheticWriteAccessor == null) {
+// codeStream.putfield(fieldBinding);
+// } else {
+// codeStream.invokestatic(syntheticWriteAccessor);
+// }
+// }
+//}
+//public abstract void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired);
+//
+//public abstract void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired);
+//
+//public abstract void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired);
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ReturnStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ReturnStatement.java
new file mode 100644
index 0000000..149f034
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ReturnStatement.java
@@ -0,0 +1,265 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ReturnStatement extends Statement {
+ public Expression expression;
+
+ public TypeBinding expressionType;
+
+ public boolean isSynchronized;
+
+ public ASTNode[] subroutines;
+
+ public LocalVariableBinding saveValueVariable;
+
+ public ReturnStatement(Expression expr, int s, int e) {
+ sourceStart = s;
+ sourceEnd = e;
+ expression = expr;
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { // here requires to generate a
+ // sequence of finally blocks
+ // invocations depending
+ // corresponding
+ // to each of the traversed try statements, so that execution will terminate properly.
+
+ // lookup the label, this should answer the returnContext
+
+ if (expression != null) {
+ flowInfo = expression.analyseCode(currentScope, flowContext, flowInfo);
+ }
+ // compute the return sequence (running the finally blocks)
+ FlowContext traversedContext = flowContext;
+ int subIndex = 0, maxSub = 5;
+ boolean saveValueNeeded = false;
+ boolean hasValueToSave = expression != null && expression.constant == NotAConstant;
+ do {
+ ASTNode sub;
+ if ((sub = traversedContext.subRoutine()) != null) {
+ if (this.subroutines == null) {
+ this.subroutines = new ASTNode[maxSub];
+ }
+ if (subIndex == maxSub) {
+ System.arraycopy(this.subroutines, 0, (this.subroutines = new ASTNode[maxSub *= 2]), 0, subIndex); // grow
+ }
+ this.subroutines[subIndex++] = sub;
+ if (sub.cannotReturn()) {
+ saveValueNeeded = false;
+ break;
+ }
+ }
+ traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
+
+ ASTNode node = traversedContext.associatedNode;
+// if ((node = traversedContext.associatedNode) instanceof SynchronizedStatement) {
+// isSynchronized = true;
+//
+// } else
+ if (node instanceof TryStatement) {
+ TryStatement tryStatement = (TryStatement) node;
+ flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
+ if (hasValueToSave) {
+ if (this.saveValueVariable == null) { // closest subroutine secret variable is used
+ prepareSaveValueLocation(tryStatement);
+ }
+ saveValueNeeded = true;
+ }
+
+ } else if (traversedContext instanceof InitializationFlowContext) {
+ currentScope.problemReporter().cannotReturnInInitializer(this);
+ return FlowInfo.DEAD_END;
+ }
+ } while ((traversedContext = traversedContext.parent) != null);
+
+ // resize subroutines
+ if ((subroutines != null) && (subIndex != maxSub)) {
+ System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
+ }
+
+ // secret local variable for return value (note that this can only occur in a real method)
+ if (saveValueNeeded) {
+ if (this.saveValueVariable != null) {
+ this.saveValueVariable.useFlag = LocalVariableBinding.USED;
+ }
+ } else {
+ this.saveValueVariable = null;
+ if ((!isSynchronized) && (expressionType == BooleanBinding)) {
+ this.expression.bits |= ValueForReturnMASK;
+ }
+ }
+ return FlowInfo.DEAD_END;
+ }
+
+ /**
+ * Retrun statement code generation
+ *
+ * generate the finallyInvocationSequence.
+ *
+ * @param currentScope
+ * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream
+ * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+ //public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // int pc = codeStream.position;
+ // // generate the expression
+ // if ((expression != null) && (expression.constant == NotAConstant)) {
+ // expression.generateCode(currentScope, codeStream, needValue()); // no value needed if non-returning subroutine
+ // generateStoreSaveValueIfNecessary(codeStream);
+ // }
+ //
+ // // generation of code responsible for invoking the finally blocks in sequence
+ // if (subroutines != null) {
+ // for (int i = 0, max = subroutines.length; i < max; i++) {
+ // ASTNode sub;
+ // if ((sub = subroutines[i]) instanceof SynchronizedStatement) {
+ // codeStream.load(((SynchronizedStatement) sub).synchroVariable);
+ // codeStream.monitorexit();
+ // } else {
+ // TryStatement trySub = (TryStatement) sub;
+ // if (trySub.subRoutineCannotReturn) {
+ // codeStream.goto_(trySub.subRoutineStartLabel);
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // return;
+ // } else {
+ // codeStream.jsr(trySub.subRoutineStartLabel);
+ // }
+ // }
+ // }
+ // }
+ // if (saveValueVariable != null) codeStream.load(saveValueVariable);
+ //
+ // if ((expression != null) && (expression.constant != NotAConstant)) {
+ // codeStream.generateConstant(expression.constant, expression.implicitConversion);
+ // generateStoreSaveValueIfNecessary(codeStream);
+ // }
+ // // output the suitable return bytecode or wrap the value inside a descriptor for doits
+ // this.generateReturnBytecode(codeStream);
+ //
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ //}
+ /**
+ * Dump the suitable return bytecode for a return statement
+ *
+ */
+ //public void generateReturnBytecode(CodeStream codeStream) {
+ //
+ // if (expression == null) {
+ // codeStream.return_();
+ // } else {
+ // switch (expression.implicitConversion >> 4) {
+ // case T_boolean :
+ // case T_int :
+ // codeStream.ireturn();
+ // break;
+ // case T_float :
+ // codeStream.freturn();
+ // break;
+ // case T_long :
+ // codeStream.lreturn();
+ // break;
+ // case T_double :
+ // codeStream.dreturn();
+ // break;
+ // default :
+ // codeStream.areturn();
+ // }
+ // }
+ //}
+ //public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
+ // if (saveValueVariable != null) codeStream.store(saveValueVariable, false);
+ //}
+ public boolean needValue() {
+ return (subroutines == null) || (saveValueVariable != null) || isSynchronized;
+ }
+
+ public void prepareSaveValueLocation(TryStatement targetTryStatement) {
+
+ this.saveValueVariable = targetTryStatement.secretReturnValue;
+ }
+
+ public void resolve(BlockScope scope) {
+ MethodScope methodScope = scope.methodScope();
+ MethodBinding methodBinding;
+ TypeBinding methodType = (methodScope.referenceContext instanceof AbstractMethodDeclaration) ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null ? null
+ : methodBinding.returnType)
+ : VoidBinding;
+ if (methodType == VoidBinding) {
+ // the expression should be null
+ if (expression == null)
+ return;
+ if ((expressionType = expression.resolveType(scope)) != null)
+ scope.problemReporter().attemptToReturnNonVoidExpression(this, expressionType);
+ return;
+ }
+ if (expression == null) {
+ if (methodType != null)
+ scope.problemReporter().shouldReturn(methodType, this);
+ return;
+ }
+ if ((expressionType = expression.resolveType(scope)) == null)
+ return;
+
+ if (methodType != null && expression.isConstantValueOfTypeAssignableToType(expressionType, methodType)) {
+ // dealing with constant
+ expression.implicitWidening(methodType, expressionType);
+ return;
+ }
+ if (expressionType == VoidBinding) {
+ scope.problemReporter().attemptToReturnVoidValue(this);
+ return;
+ }
+ if (methodType != null && expressionType.isCompatibleWith(methodType)) {
+ expression.implicitWidening(methodType, expressionType);
+ return;
+ }
+ if (methodType != null) {
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionType, methodType);
+ }
+ }
+
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("return "); //$NON-NLS-1$
+ if (expression != null)
+ expression.printExpression(0, output);
+ return output.append(';');
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s = s + "return "; //$NON-NLS-1$
+ if (expression != null)
+ s = s + expression.toStringExpression();
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (expression != null)
+ expression.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, scope);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleNameReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleNameReference.java
new file mode 100644
index 0000000..e681c4c
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleNameReference.java
@@ -0,0 +1,677 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ProblemFieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
+
+public class SingleNameReference extends NameReference implements OperatorIds {
+ public char[] token;
+
+ public MethodBinding[] syntheticAccessors; // [0]=read accessor [1]=write accessor
+ public static final int READ = 0;
+ public static final int WRITE = 1;
+
+public SingleNameReference(char[] source, long pos) {
+ super();
+ token = source;
+ sourceStart = (int) (pos >>> 32);
+ sourceEnd = (int) pos;
+}
+public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
+
+ // compound assignment extra work
+ if (isCompound) { // check the variable part is initialized if blank final
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isBlankFinal()
+ && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
+ if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
+ currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
+ }
+ }
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ break;
+// case LOCAL : // reading a local variable
+// // check if assigning a final blank field
+// LocalVariableBinding localBinding;
+// if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+// // we could improve error msg here telling "cannot use compound assignment on final local variable"
+// }
+// if (flowInfo.isReachable()) {
+// localBinding.useFlag = LocalVariableBinding.USED;
+// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+// }
+ }
+ }
+ if (assignment.expression != null) {
+ flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ }
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // assigning to a field
+ manageSyntheticWriteAccessIfNecessary(currentScope);
+
+ // check if assigning a final field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isFinal()) {
+ // inside a context where allowed
+ if (!isCompound && fieldBinding.isBlankFinal() && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
+ if (flowInfo.isPotentiallyAssigned(fieldBinding)) {
+ currentScope.problemReporter().duplicateInitializationOfBlankFinalField(fieldBinding, this);
+ } else {
+ flowContext.recordSettingFinal(fieldBinding, this);
+ }
+ flowInfo.markAsDefinitelyAssigned(fieldBinding);
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalField(fieldBinding, this);
+ }
+ }
+ break;
+ case LOCAL : // assigning to a local variable
+ LocalVariableBinding localBinding = (LocalVariableBinding) binding;
+ if (!flowInfo.isDefinitelyAssigned(localBinding)){// for local variable debug attributes
+ bits |= FirstAssignmentToLocalMASK;
+ } else {
+ bits &= ~FirstAssignmentToLocalMASK;
+ }
+ if (localBinding.isFinal()) {
+ if ((bits & DepthMASK) == 0) {
+ if (isCompound || !localBinding.isBlankFinal()){
+ currentScope.problemReporter().cannotAssignToFinalLocal(localBinding, this);
+ } else if (flowInfo.isPotentiallyAssigned(localBinding)) {
+ currentScope.problemReporter().duplicateInitializationOfFinalLocal(localBinding, this);
+ } else {
+ flowContext.recordSettingFinal(localBinding, this);
+ }
+ } else {
+ currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
+ }
+ }
+ flowInfo.markAsDefinitelyAssigned(localBinding);
+ }
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ return flowInfo;
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return analyseCode(currentScope, flowContext, flowInfo, true);
+}
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+
+ switch (bits & RestrictiveFlagMASK) {
+ case FIELD : // reading a field
+ if (valueRequired) {
+ manageSyntheticReadAccessIfNecessary(currentScope);
+ }
+ // check if reading a final blank field
+ FieldBinding fieldBinding;
+ if ((fieldBinding = (FieldBinding) binding).isBlankFinal()
+ && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
+ if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
+ currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
+ }
+ }
+ break;
+// case LOCAL : // reading a local variable
+// LocalVariableBinding localBinding;
+// if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+// }
+// if (flowInfo.isReachable()) {
+// localBinding.useFlag = LocalVariableBinding.USED;
+// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+// }
+ }
+ if (valueRequired) {
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+ }
+ return flowInfo;
+}
+public TypeBinding checkFieldAccess(BlockScope scope) {
+
+ FieldBinding fieldBinding = (FieldBinding) binding;
+
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= FIELD;
+ if (!((FieldBinding) binding).isStatic()) {
+ // must check for the static status....
+ if (scope.methodScope().isStatic) {
+ scope.problemReporter().staticFieldAccessToNonStaticVariable(this, fieldBinding);
+ constant = NotAConstant;
+ return fieldBinding.type;
+ }
+ }
+ constant = FieldReference.getConstantFor(fieldBinding, this, true, scope);
+
+ if (isFieldUseDeprecated(fieldBinding, scope))
+ scope.problemReporter().deprecatedField(fieldBinding, this);
+
+ MethodScope ms = scope.methodScope();
+ if ((this.bits & IsStrictlyAssignedMASK) == 0
+ && ms.enclosingSourceType() == fieldBinding.declaringClass
+ && ms.fieldDeclarationIndex != MethodScope.NotInFieldDecl
+ && fieldBinding.id >= ms.fieldDeclarationIndex) {
+ //if the field is static and ms is not .... then it is valid
+ if (!fieldBinding.isStatic() || ms.isStatic)
+ scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
+ }
+ //====================================================
+
+ return fieldBinding.type;
+
+}
+//public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
+//
+// // optimizing assignment like: i = i + 1 or i = 1 + i
+// if (assignment.expression.isCompactableOperation()) {
+// BinaryExpression operation = (BinaryExpression) assignment.expression;
+// SingleNameReference variableReference;
+// if ((operation.left instanceof SingleNameReference) && ((variableReference = (SingleNameReference) operation.left).binding == binding)) {
+// // i = i + value, then use the variable on the right hand side, since it has the correct implicit conversion
+// variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.right, (operation.bits & OperatorMASK) >> OperatorSHIFT, operation.left.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
+// return;
+// }
+// int operator = (operation.bits & OperatorMASK) >> OperatorSHIFT;
+// if ((operation.right instanceof SingleNameReference)
+// && ((operator == PLUS) || (operator == MULTIPLY)) // only commutative operations
+// && ((variableReference = (SingleNameReference) operation.right).binding == binding)
+// && (operation.left.constant != NotAConstant) // exclude non constant expressions, since could have side-effect
+// && ((operation.left.implicitConversion >> 4) != T_String) // exclude string concatenation which would occur backwards
+// && ((operation.right.implicitConversion >> 4) != T_String)) { // exclude string concatenation which would occur backwards
+// // i = value + i, then use the variable on the right hand side, since it has the correct implicit conversion
+// variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.left, operator, operation.right.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
+// return;
+// }
+// }
+// switch (bits & RestrictiveFlagMASK) {
+// case FIELD : // assigning to a field
+// FieldBinding fieldBinding;
+// if (!(fieldBinding = (FieldBinding) this.codegenBinding).isStatic()) { // need a receiver?
+// if ((bits & DepthMASK) != 0) {
+// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
+// } else {
+// this.generateReceiver(codeStream);
+// }
+// }
+// assignment.expression.generateCode(currentScope, codeStream, true);
+// fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], valueRequired);
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(assignment.implicitConversion);
+// }
+// return;
+// case LOCAL : // assigning to a local variable
+// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
+// if (localBinding.resolvedPosition != -1) {
+// assignment.expression.generateCode(currentScope, codeStream, true);
+// } else {
+// if (assignment.expression.constant != NotAConstant) {
+// // assigning an unused local to a constant value = no actual assignment is necessary
+// if (valueRequired) {
+// codeStream.generateConstant(assignment.expression.constant, assignment.implicitConversion);
+// }
+// } else {
+// assignment.expression.generateCode(currentScope, codeStream, true);
+// /* Even though the value may not be required, we force it to be produced, and discard it later
+// on if it was actually not necessary, so as to provide the same behavior as JDK1.2beta3. */
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(assignment.implicitConversion); // implicit conversion
+// } else {
+// if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
+// codeStream.pop2();
+// } else {
+// codeStream.pop();
+// }
+// }
+// }
+// return;
+// }
+// // 26903, need extra cast to store null in array local var
+// if (localBinding.type.isArrayType()
+// && (assignment.expression.resolvedType == NullBinding // arrayLoc = null
+// || ((assignment.expression instanceof CastExpression) // arrayLoc = (type[])null
+// && (((CastExpression)assignment.expression).innermostCastedExpression().resolvedType == NullBinding)))){
+// codeStream.checkcast(localBinding.type);
+// }
+//
+// // normal local assignment (since cannot store in outer local which are final locations)
+// codeStream.store(localBinding, valueRequired);
+// if ((bits & FirstAssignmentToLocalMASK) != 0) { // for local variable debug attributes
+// localBinding.recordInitializationStartPC(codeStream.position);
+// }
+// // implicit conversion
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(assignment.implicitConversion);
+// }
+// }
+//}
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (constant != NotAConstant) {
+// if (valueRequired) {
+// codeStream.generateConstant(constant, implicitConversion);
+// }
+// } else {
+// switch (bits & RestrictiveFlagMASK) {
+// case FIELD : // reading a field
+// FieldBinding fieldBinding;
+// if (valueRequired) {
+// if ((fieldBinding = (FieldBinding) this.codegenBinding).constant == NotAConstant) { // directly use inlined value for constant fields
+// boolean isStatic;
+// if (!(isStatic = fieldBinding.isStatic())) {
+// if ((bits & DepthMASK) != 0) {
+// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
+// } else {
+// generateReceiver(codeStream);
+// }
+// }
+// // managing private access
+// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+// if (isStatic) {
+// codeStream.getstatic(fieldBinding);
+// } else {
+// codeStream.getfield(fieldBinding);
+// }
+// } else {
+// codeStream.invokestatic(syntheticAccessors[READ]);
+// }
+// codeStream.generateImplicitConversion(implicitConversion);
+// } else { // directly use the inlined value
+// codeStream.generateConstant(fieldBinding.constant, implicitConversion);
+// }
+// }
+// break;
+// case LOCAL : // reading a local
+// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
+// if (valueRequired) {
+// // outer local?
+// if ((bits & DepthMASK) != 0) {
+// // outer local can be reached either through a synthetic arg or a synthetic field
+// VariableBinding[] path = currentScope.getEmulationPath(localBinding);
+// codeStream.generateOuterAccess(path, this, localBinding, currentScope);
+// } else {
+// // regular local variable read
+// codeStream.load(localBinding);
+// }
+// codeStream.generateImplicitConversion(implicitConversion);
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+///*
+// * Regular API for compound assignment, relies on the fact that there is only one reference to the
+// * variable, which carries both synthetic read/write accessors.
+// * The APIs with an extra argument is used whenever there are two references to the same variable which
+// * are optimized in one access: e.g "a = a + 1" optimized into "a++".
+// */
+//public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+//
+// this.generateCompoundAssignment(
+// currentScope,
+// codeStream,
+// syntheticAccessors == null ? null : syntheticAccessors[WRITE],
+// expression,
+// operator,
+// assignmentImplicitConversion,
+// valueRequired);
+//}
+///*
+// * The APIs with an extra argument is used whenever there are two references to the same variable which
+// * are optimized in one access: e.g "a = a + 1" optimized into "a++".
+// */
+//public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, MethodBinding writeAccessor, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
+// switch (bits & RestrictiveFlagMASK) {
+// case FIELD : // assigning to a field
+// FieldBinding fieldBinding;
+// if ((fieldBinding = (FieldBinding) this.codegenBinding).isStatic()) {
+// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+// codeStream.getstatic(fieldBinding);
+// } else {
+// codeStream.invokestatic(syntheticAccessors[READ]);
+// }
+// } else {
+// if ((bits & DepthMASK) != 0) {
+// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
+// } else {
+// codeStream.aload_0();
+// }
+// codeStream.dup();
+// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+// codeStream.getfield(fieldBinding);
+// } else {
+// codeStream.invokestatic(syntheticAccessors[READ]);
+// }
+// }
+// break;
+// case LOCAL : // assigning to a local variable (cannot assign to outer local)
+// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
+// Constant assignConstant;
+// int increment;
+// // using incr bytecode if possible
+// switch (localBinding.type.id) {
+// case T_String :
+// codeStream.generateStringAppend(currentScope, this, expression);
+// if (valueRequired) {
+// codeStream.dup();
+// }
+// codeStream.store(localBinding, false);
+// return;
+// case T_int :
+// if (((assignConstant = expression.constant) != NotAConstant)
+// && (assignConstant.typeID() != T_float) // only for integral types
+// && (assignConstant.typeID() != T_double)
+// && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value
+// switch (operator) {
+// case PLUS :
+// codeStream.iinc(localBinding.resolvedPosition, increment);
+// if (valueRequired) {
+// codeStream.load(localBinding);
+// }
+// return;
+// case MINUS :
+// codeStream.iinc(localBinding.resolvedPosition, -increment);
+// if (valueRequired) {
+// codeStream.load(localBinding);
+// }
+// return;
+// }
+// }
+// default :
+// codeStream.load(localBinding);
+// }
+// }
+// // perform the actual compound operation
+// int operationTypeID;
+// if ((operationTypeID = implicitConversion >> 4) == T_String || operationTypeID == T_Object) {
+// // we enter here if the single name reference is a field of type java.lang.String or if the type of the
+// // operation is java.lang.Object
+// // For example: o = o + ""; // where the compiled type of o is java.lang.Object.
+// codeStream.generateStringAppend(currentScope, null, expression);
+// } else {
+// // promote the array reference to the suitable operation type
+// codeStream.generateImplicitConversion(implicitConversion);
+// // generate the increment value (will by itself be promoted to the operation value)
+// if (expression == IntLiteral.One){ // prefix operation
+// codeStream.generateConstant(expression.constant, implicitConversion);
+// } else {
+// expression.generateCode(currentScope, codeStream, true);
+// }
+// // perform the operation
+// codeStream.sendOperator(operator, operationTypeID);
+// // cast the value back to the array reference type
+// codeStream.generateImplicitConversion(assignmentImplicitConversion);
+// }
+// // store the result back into the variable
+// switch (bits & RestrictiveFlagMASK) {
+// case FIELD : // assigning to a field
+// fieldStore(codeStream, (FieldBinding) this.codegenBinding, writeAccessor, valueRequired);
+// return;
+// case LOCAL : // assigning to a local variable
+// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
+// if (valueRequired) {
+// if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
+// codeStream.dup2();
+// } else {
+// codeStream.dup();
+// }
+// }
+// codeStream.store(localBinding, false);
+// }
+//}
+//public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
+// switch (bits & RestrictiveFlagMASK) {
+// case FIELD : // assigning to a field
+// FieldBinding fieldBinding;
+// if ((fieldBinding = (FieldBinding) this.codegenBinding).isStatic()) {
+// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+// codeStream.getstatic(fieldBinding);
+// } else {
+// codeStream.invokestatic(syntheticAccessors[READ]);
+// }
+// } else {
+// if ((bits & DepthMASK) != 0) {
+// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
+// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
+// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
+// } else {
+// codeStream.aload_0();
+// }
+// codeStream.dup();
+// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
+// codeStream.getfield(fieldBinding);
+// } else {
+// codeStream.invokestatic(syntheticAccessors[READ]);
+// }
+// }
+// if (valueRequired) {
+// if (fieldBinding.isStatic()) {
+// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+// codeStream.dup2();
+// } else {
+// codeStream.dup();
+// }
+// } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
+// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
+// codeStream.dup2_x1();
+// } else {
+// codeStream.dup_x1();
+// }
+// }
+// }
+// codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
+// codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id);
+// codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
+// fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], false);
+// return;
+// case LOCAL : // assigning to a local variable
+// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
+// // using incr bytecode if possible
+// if (localBinding.type == IntBinding) {
+// if (valueRequired) {
+// codeStream.load(localBinding);
+// }
+// if (postIncrement.operator == PLUS) {
+// codeStream.iinc(localBinding.resolvedPosition, 1);
+// } else {
+// codeStream.iinc(localBinding.resolvedPosition, -1);
+// }
+// } else {
+// codeStream.load(localBinding);
+// if (valueRequired){
+// if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
+// codeStream.dup2();
+// } else {
+// codeStream.dup();
+// }
+// }
+// codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
+// codeStream.sendOperator(postIncrement.operator, localBinding.type.id);
+// codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
+//
+// codeStream.store(localBinding, false);
+// }
+// }
+//}
+//public void generateReceiver(CodeStream codeStream) {
+// codeStream.aload_0();
+//}
+public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+
+ //If inlinable field, forget the access emulation, the code gen will directly target it
+ if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) return;
+
+ if ((bits & RestrictiveFlagMASK) == LOCAL) {
+ currentScope.emulateOuterAccess((LocalVariableBinding) binding);
+ }
+}
+public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope) {
+
+ //If inlinable field, forget the access emulation, the code gen will directly target it
+ if (constant != NotAConstant)
+ return;
+
+ if ((bits & FIELD) != 0) {
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ if (((bits & DepthMASK) != 0)
+ && (fieldBinding.isPrivate() // private access
+ || (fieldBinding.isProtected() // implicit protected access
+ && fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage()))) {
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[READ] =
+ ((SourceTypeBinding)currentScope.enclosingSourceType().
+ enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
+ addSyntheticMethod(fieldBinding, true);
+ currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
+ return;
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
+ // and not from Object or implicit static field access.
+// if (fieldBinding.declaringClass != this.actualReceiverType
+// && !this.actualReceiverType.isArrayType()
+// && fieldBinding.declaringClass != null
+// && fieldBinding.constant == NotAConstant
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && !fieldBinding.isStatic()
+// && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
+// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
+// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);
+// }
+ }
+}
+public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope) {
+
+ if ((bits & FIELD) != 0) {
+ FieldBinding fieldBinding = (FieldBinding) binding;
+ if (((bits & DepthMASK) != 0)
+ && (fieldBinding.isPrivate() // private access
+ || (fieldBinding.isProtected() // implicit protected access
+ && fieldBinding.declaringClass.getPackage()
+ != currentScope.enclosingSourceType().getPackage()))) {
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[WRITE] =
+ ((SourceTypeBinding)currentScope.enclosingSourceType().
+ enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
+ addSyntheticMethod(fieldBinding, false);
+ currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ return;
+ }
+ // if the binding declaring class is not visible, need special action
+ // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
+ // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
+ // and not from Object or implicit static field access.
+// if (fieldBinding.declaringClass != this.actualReceiverType
+// && !this.actualReceiverType.isArrayType()
+// && fieldBinding.declaringClass != null
+// && fieldBinding.constant == NotAConstant
+// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
+// && !fieldBinding.isStatic()
+// && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
+// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
+// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);
+// }
+ }
+}
+public TypeBinding reportError(BlockScope scope) {
+ //=====error cases=======
+ constant = Constant.NotAConstant;
+ if (binding instanceof ProblemFieldBinding) {
+ scope.problemReporter().invalidField(this, (FieldBinding) binding);
+ } else if (binding instanceof ProblemReferenceBinding) {
+ scope.problemReporter().invalidType(this, (TypeBinding) binding);
+ } else {
+ scope.problemReporter().unresolvableReference(this, binding);
+ }
+ return null;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // for code gen, harm the restrictiveFlag
+
+ this.actualReceiverType = this.receiverType = scope.enclosingSourceType();
+
+ if ((this.codegenBinding = this.binding = scope.getBinding(token, bits & RestrictiveFlagMASK, this)).isValidBinding()) {
+ switch (bits & RestrictiveFlagMASK) {
+ case VARIABLE : // =========only variable============
+ case VARIABLE | TYPE : //====both variable and type============
+ if (binding instanceof VariableBinding) {
+ VariableBinding variable = (VariableBinding) binding;
+ if (binding instanceof LocalVariableBinding) {
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= LOCAL;
+ if ((this.bits & IsStrictlyAssignedMASK) == 0) {
+ constant = variable.constant;
+ } else {
+ constant = NotAConstant;
+ }
+ if ((!variable.isFinal()) && ((bits & DepthMASK) != 0)) {
+ scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)variable, this);
+ }
+ return this.resolvedType = variable.type;
+ }
+ // a field
+ return this.resolvedType = checkFieldAccess(scope);
+ }
+
+ // thus it was a type
+ bits &= ~RestrictiveFlagMASK; // clear bits
+ bits |= TYPE;
+ case TYPE : //========only type==============
+ constant = Constant.NotAConstant;
+ //deprecated test
+ if (isTypeUseDeprecated((TypeBinding) binding, scope))
+ scope.problemReporter().deprecatedType((TypeBinding) binding, this);
+ return this.resolvedType = (TypeBinding) binding;
+ }
+ }
+
+ // error scenarii
+ return this.resolvedType = this.reportError(scope);
+}
+public StringBuffer printExpression(int indent, StringBuffer output){
+
+ return output.append(token);
+ }
+public String toStringExpression(){
+
+ return new String(token);}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public String unboundReferenceErrorName(){
+
+ return new String(token);}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleTypeReference.java
new file mode 100644
index 0000000..3ebd595
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SingleTypeReference.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class SingleTypeReference extends TypeReference {
+ public char[] token;
+
+
+public SingleTypeReference(char[] source, long pos) {
+ token = source;
+ sourceStart = (int) (pos>>>32) ;
+ sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
+
+}
+public SingleTypeReference(char[] source ,TypeBinding type, long pos) {
+ this(source, pos) ;
+ this.resolvedType = type ;
+}
+public TypeReference copyDims(int dim){
+ //return a type reference copy of me with some dimensions
+ //warning : the new type ref has a null binding
+
+ return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
+}
+public TypeBinding getTypeBinding(Scope scope) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ return scope.getType(token);
+}
+public char [][] getTypeName() {
+ return new char[][] { token };
+}
+public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
+ ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
+ if (!memberTb.isValidBinding()) {
+ scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
+ return null;
+ }
+ if (isTypeUseDeprecated(memberTb, scope))
+ scope.problemReporter().deprecatedType(memberTb, this);
+ return this.resolvedType = memberTb;
+}
+public StringBuffer printExpression(int indent, StringBuffer output){
+
+ return output.append(token);
+}
+public String toStringExpression(int tab){
+ return new String(token) ;
+}
+public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Statement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Statement.java
new file mode 100644
index 0000000..08b01e4
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Statement.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public abstract class Statement extends ASTNode {
+
+ /**
+ * Statement constructor comment.
+ */
+ public Statement() {
+ super();
+ }
+
+ public abstract FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo);
+
+// public abstract void generateCode(BlockScope currentScope, CodeStream codeStream);
+
+ public boolean isEmptyBlock() {
+ return false;
+ }
+
+ public boolean isValidJavaStatement() {
+ //the use of this method should be avoid in most cases
+ //and is here mostly for documentation purpose.....
+ //while the parser is responsable for creating
+ //welled formed expression statement, which results
+ //in the fact that java-non-semantic-expression-used-as-statement
+ //should not be parsable...thus not being built.
+ //It sounds like the java grammar as help the compiler job in removing
+ //-by construction- some statement that would have no effect....
+ //(for example all expression that may do side-effects are valid statement
+ // -this is an appromative idea.....-)
+
+ return true;
+ }
+ public StringBuffer print(int indent, StringBuffer output) {
+ return printStatement(indent, output);
+ }
+ public abstract StringBuffer printStatement(int indent, StringBuffer output);
+
+ public abstract void resolve(BlockScope scope);
+
+ public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
+ // statement within a switch that are not case are treated as normal statement....
+
+ resolve(scope);
+ return null;
+ }
+
+ public void resetStateForCodeGeneration() {
+ }
+
+ /**
+ * INTERNAL USE ONLY.
+ * Do nothing by default. This is used to redirect inter-statements jumps.
+ */
+ public void branchChainTo(Label label) {
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java
new file mode 100644
index 0000000..24892a2
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java
@@ -0,0 +1,147 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class StringLiteral extends Literal {
+
+ char[] source;
+
+ public StringLiteral(char[] token, int s, int e) {
+
+ this(s, e);
+ source = token;
+ }
+
+ public StringLiteral(int s, int e) {
+
+ super(s, e);
+ }
+
+ public void computeConstant() {
+
+ constant = Constant.fromValue(String.valueOf(source));
+ }
+
+// public ExtendedStringLiteral extendWith(CharLiteral lit) {
+//
+// //add the lit source to mine, just as if it was mine
+// return new ExtendedStringLiteral(this, lit);
+// }
+
+ public ExtendedStringLiteral extendWith(StringLiteral lit) {
+
+ //add the lit source to mine, just as if it was mine
+ return new ExtendedStringLiteral(this, lit);
+ }
+
+ /**
+ * Code generation for string literal
+ */
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // if (valueRequired)
+ // codeStream.ldc(constant.stringValue());
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ public TypeBinding literalType(BlockScope scope) {
+
+ return scope.getJavaLangString();
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ // handle some special char.....
+ output.append('\"');
+ for (int i = 0; i < source.length; i++) {
+ switch (source[i]) {
+ case '\b':
+ output.append("\\b"); //$NON-NLS-1$
+ break;
+ case '\t':
+ output.append("\\t"); //$NON-NLS-1$
+ break;
+ case '\n':
+ output.append("\\n"); //$NON-NLS-1$
+ break;
+ case '\f':
+ output.append("\\f"); //$NON-NLS-1$
+ break;
+ case '\r':
+ output.append("\\r"); //$NON-NLS-1$
+ break;
+ case '\"':
+ output.append("\\\""); //$NON-NLS-1$
+ break;
+ case '\'':
+ output.append("\\'"); //$NON-NLS-1$
+ break;
+ case '\\': //take care not to display the escape as a potential real char
+ output.append("\\\\"); //$NON-NLS-1$
+ break;
+ default:
+ output.append(source[i]);
+ }
+ }
+ output.append('\"');
+ return output;
+ }
+
+ public char[] source() {
+
+ return source;
+ }
+
+ public String toStringExpression() {
+
+ // handle some special char.....
+ StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
+ for (int i = 0; i < source.length; i++) {
+ switch (source[i]) {
+ case '\b':
+ result.append("\\b"); //$NON-NLS-1$
+ break;
+ case '\t':
+ result.append("\\t"); //$NON-NLS-1$
+ break;
+ case '\n':
+ result.append("\\n"); //$NON-NLS-1$
+ break;
+ case '\f':
+ result.append("\\f"); //$NON-NLS-1$
+ break;
+ case '\r':
+ result.append("\\r"); //$NON-NLS-1$
+ break;
+ case '\"':
+ result.append("\\\""); //$NON-NLS-1$
+ break;
+ case '\'':
+ result.append("\\'"); //$NON-NLS-1$
+ break;
+ case '\\': //take care not to display the escape as a potential real char
+ result.append("\\\\"); //$NON-NLS-1$
+ break;
+ default:
+ result.append(source[i]);
+ }
+ }
+ result.append("\""); //$NON-NLS-1$
+ return result.toString();
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralDQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralDQ.java
new file mode 100644
index 0000000..88ce3e6
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralDQ.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+/**
+ *
+ * double quoted string literal
+ */
+public class StringLiteralDQ extends StringLiteral {
+
+ public StringLiteralDQ(char[] token, int s, int e) {
+ super(token, s, e);
+ }
+
+ public StringLiteralDQ(int s, int e) {
+ super(s, e);
+ }
+
+ public String toStringExpression() {
+
+ // handle some special char.....
+ StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
+ for (int i = 0; i < source.length; i++) {
+ switch (source[i]) {
+ case '\b':
+ result.append("\\b"); //$NON-NLS-1$
+ break;
+ case '\t':
+ result.append("\\t"); //$NON-NLS-1$
+ break;
+ case '\n':
+ result.append("\\n"); //$NON-NLS-1$
+ break;
+ case '\f':
+ result.append("\\f"); //$NON-NLS-1$
+ break;
+ case '\r':
+ result.append("\\r"); //$NON-NLS-1$
+ break;
+ case '\"':
+ result.append("\\\""); //$NON-NLS-1$
+ break;
+ case '\'':
+ result.append("\\'"); //$NON-NLS-1$
+ break;
+ case '\\': //take care not to display the escape as a potential real char
+ result.append("\\\\"); //$NON-NLS-1$
+ break;
+ default:
+ result.append(source[i]);
+ }
+ }
+ result.append("\""); //$NON-NLS-1$
+ return result.toString();
+ }
+
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralSQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralSQ.java
new file mode 100644
index 0000000..98d3244
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteralSQ.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+/**
+ *
+ * single quoted string literal
+ */
+public class StringLiteralSQ extends StringLiteral {
+ public StringLiteralSQ(char[] token, int s, int e) {
+ super(token, s, e);
+ }
+
+ public StringLiteralSQ(int s, int e) {
+
+ super(s, e);
+ }
+
+ public String toStringExpression() {
+
+ // handle some special char.....
+ StringBuffer result = new StringBuffer("\'"); //$NON-NLS-1$
+ for (int i = 0; i < source.length; i++) {
+ switch (source[i]) {
+ case '\b':
+ result.append("\\b"); //$NON-NLS-1$
+ break;
+ case '\t':
+ result.append("\\t"); //$NON-NLS-1$
+ break;
+ case '\n':
+ result.append("\\n"); //$NON-NLS-1$
+ break;
+ case '\f':
+ result.append("\\f"); //$NON-NLS-1$
+ break;
+ case '\r':
+ result.append("\\r"); //$NON-NLS-1$
+ break;
+ case '\"':
+ result.append("\\\""); //$NON-NLS-1$
+ break;
+ case '\'':
+ result.append("\\'"); //$NON-NLS-1$
+ break;
+ case '\\': //take care not to display the escape as a potential real char
+ result.append("\\\\"); //$NON-NLS-1$
+ break;
+ default:
+ result.append(source[i]);
+ }
+ }
+ result.append("\'"); //$NON-NLS-1$
+ return result.toString();
+ }
+
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SuperReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SuperReference.java
new file mode 100644
index 0000000..60d2df4
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SuperReference.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class SuperReference extends ThisReference {
+
+public SuperReference(int sourceStart, int sourceEnd) {
+ super(sourceStart, sourceEnd);
+}
+public static ExplicitConstructorCall implicitSuperConstructorCall() {
+ return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
+}
+public boolean isImplicitThis() {
+
+ return false;
+}
+public boolean isSuper() {
+
+ return true;
+}
+public boolean isThis() {
+
+ return false ;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ constant = NotAConstant;
+ if (!checkAccess(scope.methodScope()))
+ return null;
+ SourceTypeBinding enclosingTb = scope.enclosingSourceType();
+ if (scope.isJavaLangObject(enclosingTb)) {
+ scope.problemReporter().cannotUseSuperInJavaLangObject(this);
+ return null;
+ }
+ return this.resolvedType = enclosingTb.superclass;
+}
+public String toStringExpression(){
+
+ return "super"; //$NON-NLS-1$
+
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+ visitor.visit(this, blockScope);
+ visitor.endVisit(this, blockScope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java
new file mode 100644
index 0000000..91984b0
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java
@@ -0,0 +1,343 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.SwitchFlowContext;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class SwitchStatement extends Statement {
+ public Expression expression;
+ public Statement[] statements;
+ public BlockScope scope;
+ public int explicitDeclarations;
+ public Label breakLabel;
+ public CaseStatement[] cases;
+ public DefaultCase defaultCase;
+ public int caseCount = 0;
+
+ // for local variables table attributes
+ int preSwitchInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+ /**
+ * SwitchStatement constructor comment.
+ */
+ public SwitchStatement() {
+ super();
+ }
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+ flowInfo = expression.analyseCode(currentScope, flowContext, flowInfo);
+ SwitchFlowContext switchContext =
+ new SwitchFlowContext(flowContext, this, (breakLabel = new Label()));
+
+ // analyse the block by considering specially the case/default statements (need to bind them
+ // to the entry point)
+ FlowInfo caseInits = FlowInfo.DEAD_END;
+ // in case of statements before the first case
+ preSwitchInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(flowInfo);
+ int caseIndex = 0;
+ if (statements != null) {
+ boolean didAlreadyComplain = false;
+ for (int i = 0, max = statements.length; i < max; i++) {
+ Statement statement = statements[i];
+ if ((caseIndex < caseCount) && (statement == cases[caseIndex])) { // statement is a case
+ caseIndex++;
+ caseInits = caseInits.mergedWith(flowInfo.copy().unconditionalInits());
+ didAlreadyComplain = false; // reset complaint
+ } else if (statement == defaultCase) { // statement is the default case
+ caseInits = caseInits.mergedWith(flowInfo.copy().unconditionalInits());
+ didAlreadyComplain = false; // reset complaint
+ }
+ if (!caseInits.complainIfUnreachable(statement, scope, didAlreadyComplain)) {
+ caseInits = statement.analyseCode(scope, switchContext, caseInits);
+ } else {
+ didAlreadyComplain = true;
+ }
+ }
+ }
+
+ // if no default case, then record it may jump over the block directly to the end
+ if (defaultCase == null) {
+ // only retain the potential initializations
+ flowInfo.addPotentialInitializationsFrom(
+ caseInits.mergedWith(switchContext.initsOnBreak));
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(flowInfo);
+ return flowInfo;
+ }
+
+ // merge all branches inits
+ FlowInfo mergedInfo = caseInits.mergedWith(switchContext.initsOnBreak);
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+ /**
+ * Switch code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+// int[] sortedIndexes = new int[caseCount];
+// int[] localKeysCopy;
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+//
+// // prepare the labels and constants
+// breakLabel.codeStream = codeStream;
+// CaseLabel[] caseLabels = new CaseLabel[caseCount];
+// int[] constants = new int[caseCount];
+// boolean needSwitch = caseCount != 0;
+// for (int i = 0; i < caseCount; i++) {
+// constants[i] = cases[i].constantExpression.constant.intValue();
+// cases[i].targetLabel = (caseLabels[i] = new CaseLabel(codeStream));
+// }
+//
+// // we sort the keys to be able to generate the code for tableswitch or lookupswitch
+// for (int i = 0; i < caseCount; i++) {
+// sortedIndexes[i] = i;
+// }
+// System.arraycopy(
+// constants,
+// 0,
+// (localKeysCopy = new int[caseCount]),
+// 0,
+// caseCount);
+// CodeStream.sort(localKeysCopy, 0, caseCount - 1, sortedIndexes);
+// CaseLabel defaultLabel = new CaseLabel(codeStream);
+// if (defaultCase != null) {
+// defaultCase.targetLabel = defaultLabel;
+// }
+// // generate expression testes
+// testExpression.generateCode(currentScope, codeStream, needSwitch);
+//
+// // generate the appropriate switch table/lookup bytecode
+// if (needSwitch) {
+// int max = localKeysCopy[caseCount - 1];
+// int min = localKeysCopy[0];
+// if ((long) (caseCount * 2.5) > ((long) max - (long) min)) {
+//
+// // work-around 1.3 VM bug, if max>0x7FFF0000, must use lookup bytecode
+// // see http://dev.eclipse.org/bugs/show_bug.cgi?id=21557
+// if (max > 0x7FFF0000 && currentScope.environment().options.complianceLevel < CompilerOptions.JDK1_4) {
+// codeStream.lookupswitch(defaultLabel, constants, sortedIndexes, caseLabels);
+//
+// } else {
+// codeStream.tableswitch(
+// defaultLabel,
+// min,
+// max,
+// constants,
+// sortedIndexes,
+// caseLabels);
+// }
+// } else {
+// codeStream.lookupswitch(defaultLabel, constants, sortedIndexes, caseLabels);
+// }
+// codeStream.updateLastRecordedEndPC(codeStream.position);
+// }
+//
+// // generate the switch block statements
+// int caseIndex = 0;
+// if (statements != null) {
+// for (int i = 0, maxCases = statements.length; i < maxCases; i++) {
+// Statement statement = statements[i];
+// if ((caseIndex < caseCount)
+// && (statement == cases[caseIndex])) { // statements[i] is a case
+// if (preSwitchInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// preSwitchInitStateIndex);
+// caseIndex++;
+// }
+// } else {
+// if (statement == defaultCase) { // statements[i] is a case or a default case
+// if (preSwitchInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// preSwitchInitStateIndex);
+// }
+// }
+// }
+// statement.generateCode(scope, codeStream);
+// }
+// }
+// // place the trailing labels (for break and default case)
+// breakLabel.place();
+// if (defaultCase == null) {
+// defaultLabel.place();
+// }
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+// }
+// if (scope != currentScope) {
+// codeStream.exitUserScope(scope);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+
+ public void resetStateForCodeGeneration() {
+ if (this.breakLabel != null) {
+ this.breakLabel.resetStateForCodeGeneration();
+ }
+ }
+
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output).append("switch ("); //$NON-NLS-1$
+ expression.printExpression(0, output).append(") {"); //$NON-NLS-1$
+ if (statements != null) {
+ for (int i = 0; i < statements.length; i++) {
+ output.append('\n');
+ if (statements[i] instanceof CaseStatement) {
+ statements[i].printStatement(indent, output);
+ } else {
+ statements[i].printStatement(indent+2, output);
+ }
+ }
+ }
+ output.append("\n"); //$NON-NLS-1$
+ return printIndent(indent, output).append('}');
+ }
+ public void resolve(BlockScope upperScope) {
+
+ TypeBinding testType = expression.resolveType(upperScope);
+ if (testType == null)
+ return;
+ expression.implicitWidening(testType, testType);
+ if (!(expression.isConstantValueOfTypeAssignableToType(testType, IntBinding))) {
+ if (!testType.isCompatibleWith(IntBinding)) {
+ upperScope.problemReporter().incorrectSwitchType(expression, testType);
+ return;
+ }
+ }
+ if (statements != null) {
+ scope = explicitDeclarations == 0 ? upperScope : new BlockScope(upperScope);
+ int length;
+ // collection of cases is too big but we will only iterate until caseCount
+ cases = new CaseStatement[length = statements.length];
+ int[] casesValues = new int[length];
+ int counter = 0;
+ for (int i = 0; i < length; i++) {
+ Constant cst;
+ if ((cst = statements[i].resolveCase(scope, testType, this)) != null) {
+ //----check for duplicate case statement------------
+ if (cst != NotAConstant) {
+ int key = cst.intValue();
+ for (int j = 0; j < counter; j++) {
+ if (casesValues[j] == key) {
+ scope.problemReporter().duplicateCase((CaseStatement) statements[i], cst); //TODO: (philippe) could improve diagnosis to indicate colliding case
+ }
+ }
+ casesValues[counter++] = key;
+ }
+ }
+ }
+ }
+ }
+ public String toString(int tab) {
+
+ String inFront, s = tabString(tab);
+ inFront = s;
+ s = s + "switch (" + expression.toStringExpression() + ") "; //$NON-NLS-1$ //$NON-NLS-2$
+ if (statements == null) {
+ s = s + "{}"; //$NON-NLS-1$
+ return s;
+ } else
+ s = s + "{"; //$NON-NLS-1$
+ s = s
+ + (explicitDeclarations != 0
+ ? "// ---scope needed for " //$NON-NLS-1$
+ + String.valueOf(explicitDeclarations)
+ + " locals------------ \n"//$NON-NLS-1$
+ : "// ---NO scope needed------ \n"); //$NON-NLS-1$
+
+ int i = 0;
+ String tabulation = " "; //$NON-NLS-1$
+ try {
+ while (true) {
+ //use instanceof in order not to polluate classes with behavior only needed for printing purpose.
+ if (statements[i] instanceof Expression)
+ s = s + "\n" + inFront + tabulation; //$NON-NLS-1$
+ if (statements[i] instanceof BreakStatement)
+ s = s + statements[i].toString(0);
+ else
+ s = s + "\n" + statements[i].toString(tab + 2); //$NON-NLS-1$
+ //=============
+ if ((statements[i] instanceof CaseStatement)
+ || (statements[i] instanceof DefaultCase)) {
+ i++;
+ while (!((statements[i] instanceof CaseStatement)
+ || (statements[i] instanceof DefaultCase))) {
+ if ((statements[i] instanceof Expression) || (statements[i] instanceof BreakStatement))
+ s = s + statements[i].toString(0) + " ; "; //$NON-NLS-1$
+ else
+ s = s + "\n" + statements[i].toString(tab + 6) + " ; "; //$NON-NLS-1$ //$NON-NLS-2$
+ i++;
+ }
+ } else {
+ s = s + " ;"; //$NON-NLS-1$
+ i++;
+ }
+ }
+ } catch (IndexOutOfBoundsException e) {
+ };
+ s = s + "}"; //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ expression.traverse(visitor, scope);
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ }
+
+ /**
+ * Dispatch the call on its last statement.
+ */
+ public void branchChainTo(Label label) {
+
+ // in order to improve debug attributes for stepping (11431)
+ // we want to inline the jumps to #breakLabel which already got
+ // generated (if any), and have them directly branch to a better
+ // location (the argument label).
+ // we know at this point that the breakLabel already got placed
+ if (this.breakLabel.hasForwardReferences()) {
+ label.appendForwardReferencesFrom(this.breakLabel);
+ }
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThisReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThisReference.java
new file mode 100644
index 0000000..38e2352
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThisReference.java
@@ -0,0 +1,127 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ThisReference extends Reference {
+
+ public static ThisReference implicitThis() {
+
+ ThisReference implicitThis = new ThisReference(0, 0);
+ implicitThis.bits |= IsImplicitThisMask;
+ return implicitThis;
+ }
+
+ public ThisReference(int sourceStart, int sourceEnd) {
+
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+
+ /*
+ * @see Reference#analyseAssignment(...)
+ */
+ public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment,
+ boolean isCompound) {
+
+ return flowInfo; // this cannot be assigned
+ }
+
+ public boolean checkAccess(MethodScope methodScope) {
+
+ // this/super cannot be used in constructor call
+ if (methodScope.isConstructorCall) {
+ methodScope.problemReporter().fieldsOrThisBeforeConstructorInvocation(this);
+ return false;
+ }
+
+ // static may not refer to this/super
+ if (methodScope.isStatic) {
+ methodScope.problemReporter().errorThisSuperInStatic(this);
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * @see Reference#generateAssignment(...)
+ */
+ // public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
+ //
+ // // this cannot be assigned
+ // }
+ //
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // if (valueRequired)
+ // codeStream.aload_0();
+ // if ((this.bits & IsImplicitThisMask) == 0) codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ //
+ // /*
+ // * @see Reference#generateCompoundAssignment(...)
+ // */
+ // public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int
+ // assignmentImplicitConversion, boolean valueRequired) {
+ //
+ // // this cannot be assigned
+ // }
+ //
+ // /*
+ // * @see net.sourceforge.phpdt.internal.compiler.ast.Reference#generatePostIncrement()
+ // */
+ // public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean
+ // valueRequired) {
+ //
+ // // this cannot be assigned
+ // }
+ public boolean isImplicitThis() {
+
+ return (this.bits & IsImplicitThisMask) != 0;
+ }
+
+ public boolean isThis() {
+
+ return true;
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ constant = NotAConstant;
+ if (!this.isImplicitThis() && !checkAccess(scope.methodScope()))
+ return null;
+ return this.resolvedType = scope.enclosingSourceType();
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+
+ if (this.isImplicitThis())
+ return output;
+ return output.append("this"); //$NON-NLS-1$
+ }
+
+ public String toStringExpression() {
+
+ if (this.isImplicitThis())
+ return ""; //$NON-NLS-1$
+ return "this"; //$NON-NLS-1$
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
+
+ visitor.visit(this, blockScope);
+ visitor.endVisit(this, blockScope);
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java
new file mode 100644
index 0000000..b6c5e29
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThrowStatement.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class ThrowStatement extends Statement {
+ public Expression exception;
+ public TypeBinding exceptionType;
+
+ public ThrowStatement(Expression exception, int startPosition) {
+ this.exception = exception;
+ this.sourceStart = startPosition;
+ this.sourceEnd = exception.sourceEnd;
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ exception.analyseCode(currentScope, flowContext, flowInfo);
+ // need to check that exception thrown is actually caught somewhere
+ flowContext.checkExceptionHandlers(exceptionType, this, flowInfo, currentScope);
+ return FlowInfo.DEAD_END;
+ }
+
+ /**
+ * Throw code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0)
+// return;
+// int pc = codeStream.position;
+// exception.generateCode(currentScope, codeStream, true);
+// codeStream.athrow();
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public void resolve(BlockScope scope) {
+
+ exceptionType = exception.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
+
+// if (exceptionType == NullBinding
+// && scope.environment().options.complianceLevel <= CompilerOptions.JDK1_3){
+// // if compliant with 1.4, this problem will not be reported
+// scope.problemReporter().cannotThrowNull(this);
+// }
+ exception.implicitWidening(exceptionType, exceptionType);
+ }
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+
+ printIndent(indent, output).append("throw "); //$NON-NLS-1$
+ exception.printExpression(0, output);
+ return output.append(';');
+ }
+ public String toString(int tab) {
+ String s = tabString(tab);
+ s = s + "throw "; //$NON-NLS-1$
+ s = s + exception.toStringExpression();
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
+ if (visitor.visit(this, blockScope))
+ exception.traverse(visitor, blockScope);
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java
new file mode 100644
index 0000000..181a99f
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class TrueLiteral extends MagicLiteral {
+ static final char[] source = {'t' , 'r' , 'u' , 'e'};
+public TrueLiteral(int s , int e) {
+ super(s,e);
+}
+public void computeConstant() {
+
+ constant = Constant.fromValue(true);}
+/**
+ * Code generation for the true literal
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+// int pc = codeStream.position;
+// if (valueRequired)
+// codeStream.iconst_1();
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+//public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
+//
+// // trueLabel being not nil means that we will not fall through into the TRUE case
+//
+// int pc = codeStream.position;
+// // constant == true
+// if (valueRequired) {
+// if (falseLabel == null) {
+// // implicit falling through the FALSE case
+// if (trueLabel != null) {
+// codeStream.goto_(trueLabel);
+// }
+// }
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+//}
+public TypeBinding literalType(BlockScope scope) {
+ return BooleanBinding;
+}
+/**
+ *
+ */
+public char[] source() {
+ return source;
+}
+public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+}
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TryStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TryStatement.java
new file mode 100644
index 0000000..59a804d
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TryStatement.java
@@ -0,0 +1,566 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FinallyFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InsideSubRoutineFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public class TryStatement extends Statement {
+
+ public Block tryBlock;
+ public Block[] catchBlocks;
+ public Argument[] catchArguments;
+ public Block finallyBlock;
+ BlockScope scope;
+
+ public boolean subRoutineCannotReturn = true;
+ public UnconditionalFlowInfo subRoutineInits;
+
+ // should rename into subRoutineComplete to be set to false by default
+
+ ReferenceBinding[] caughtExceptionTypes;
+ boolean tryBlockExit;
+ boolean[] catchExits;
+ public int[] preserveExceptionHandler;
+
+ Label subRoutineStartLabel;
+ public LocalVariableBinding anyExceptionVariable,
+ returnAddressVariable,
+ secretReturnValue;
+
+ public final static char[] SecretReturnName = " returnAddress".toCharArray(); //$NON-NLS-1$
+ public final static char[] SecretAnyHandlerName = " anyExceptionHandler".toCharArray(); //$NON-NLS-1$
+ public static final char[] SecretLocalDeclarationName = " returnValue".toCharArray(); //$NON-NLS-1$
+
+ // for local variables table attributes
+ int preTryInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ // Consider the try block and catch block so as to compute the intersection of initializations and
+ // the minimum exit relative depth amongst all of them. Then consider the subroutine, and append its
+ // initialization to the try/catch ones, if the subroutine completes normally. If the subroutine does not
+ // complete, then only keep this result for the rest of the analysis
+
+ // process the finally block (subroutine) - create a context for the subroutine
+
+ preTryInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(flowInfo);
+
+ if (anyExceptionVariable != null) {
+ anyExceptionVariable.useFlag = LocalVariableBinding.USED;
+ }
+ if (returnAddressVariable != null) {
+ returnAddressVariable.useFlag = LocalVariableBinding.USED;
+ }
+ InsideSubRoutineFlowContext insideSubContext;
+ FinallyFlowContext finallyContext;
+ UnconditionalFlowInfo subInfo;
+ if (subRoutineStartLabel == null) {
+ // no finally block
+ insideSubContext = null;
+ finallyContext = null;
+ subInfo = null;
+ } else {
+ // analyse finally block first
+ insideSubContext = new InsideSubRoutineFlowContext(flowContext, this);
+ subInfo =
+ finallyBlock
+ .analyseCode(
+ currentScope,
+ finallyContext = new FinallyFlowContext(flowContext, finallyBlock),
+ flowInfo.copy())
+ .unconditionalInits();
+ if (subInfo.isReachable()) {
+ subRoutineCannotReturn = false;
+ }
+ this.subRoutineInits = subInfo;
+ }
+ // process the try block in a context handling the local exceptions.
+ ExceptionHandlingFlowContext handlingContext =
+ new ExceptionHandlingFlowContext(
+ insideSubContext == null ? flowContext : insideSubContext,
+ tryBlock,
+ caughtExceptionTypes,
+ scope,
+ flowInfo.unconditionalInits());
+
+ FlowInfo tryInfo;
+ if (tryBlock.statements == null) {
+ tryInfo = flowInfo;
+ tryBlockExit = false;
+ } else {
+ tryInfo = tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy());
+ tryBlockExit = !tryInfo.isReachable();
+ }
+
+ // check unreachable catch blocks
+// handlingContext.complainIfUnusedExceptionHandlers(catchBlocks, scope, this);
+
+ // process the catch blocks - computing the minimal exit depth amongst try/catch
+ if (catchArguments != null) {
+ int catchCount;
+ catchExits = new boolean[catchCount = catchBlocks.length];
+ for (int i = 0; i < catchCount; i++) {
+ // keep track of the inits that could potentially have led to this exception handler (for final assignments diagnosis)
+ FlowInfo catchInfo =
+ flowInfo
+ .copy()
+ .unconditionalInits()
+ .addPotentialInitializationsFrom(
+ handlingContext.initsOnException(caughtExceptionTypes[i]).unconditionalInits())
+ .addPotentialInitializationsFrom(tryInfo.unconditionalInits())
+ .addPotentialInitializationsFrom(handlingContext.initsOnReturn);
+
+ // catch var is always set
+ catchInfo.markAsDefinitelyAssigned(catchArguments[i].binding);
+ /*
+ "If we are about to consider an unchecked exception handler, potential inits may have occured inside
+ the try block that need to be detected , e.g.
+ try { x = 1; throwSomething();} catch(Exception e){ x = 2} "
+ "(uncheckedExceptionTypes notNil and: [uncheckedExceptionTypes at: index])
+ ifTrue: [catchInits addPotentialInitializationsFrom: tryInits]."
+ */
+ // TODO: should only tag as unreachable if the catchblock cannot be reached
+ //??? if (!handlingContext.initsOnException(caughtExceptionTypes[i]).isReachable()){
+ if (tryBlock.statements == null) {
+ catchInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ catchInfo =
+ catchBlocks[i].analyseCode(
+ currentScope,
+ insideSubContext == null ? flowContext : insideSubContext,
+ catchInfo);
+ catchExits[i] = !catchInfo.isReachable();
+ tryInfo = tryInfo.mergedWith(catchInfo.unconditionalInits());
+ }
+ }
+ if (subRoutineStartLabel == null) {
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(tryInfo);
+ return tryInfo;
+ }
+
+
+ // we also need to check potential multiple assignments of final variables inside the finally block
+ // need to include potential inits from returns inside the try/catch parts - 1GK2AOF
+ finallyContext.complainOnRedundantFinalAssignments(
+ tryInfo.isReachable()
+ ? (tryInfo.addPotentialInitializationsFrom(insideSubContext.initsOnReturn))
+ : insideSubContext.initsOnReturn,
+ currentScope);
+ if (subInfo == FlowInfo.DEAD_END) {
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(subInfo);
+ return subInfo;
+ } else {
+ FlowInfo mergedInfo = tryInfo.addInitializationsFrom(subInfo);
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+ }
+
+ public boolean cannotReturn() {
+
+ return subRoutineCannotReturn;
+ }
+
+ /**
+ * Try statement code generation
+ *
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// if (tryBlock.isEmptyBlock()) {
+// if (subRoutineStartLabel != null) {
+// // since not passing the finallyScope, the block generation will exitUserScope(finallyScope)
+// finallyBlock.generateCode(scope, codeStream);
+// }
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// // no local bytecode produced so no need for position remembering
+// return;
+// }
+// int pc = codeStream.position;
+// Label endLabel = new Label(codeStream);
+// boolean requiresNaturalJsr = false;
+//
+// // preparing exception labels
+// int maxCatches;
+// ExceptionLabel[] exceptionLabels =
+// new ExceptionLabel[maxCatches =
+// catchArguments == null ? 0 : catchArguments.length];
+// for (int i = 0; i < maxCatches; i++) {
+// boolean preserveCurrentHandler =
+// (preserveExceptionHandler[i
+// / ExceptionHandlingFlowContext.BitCacheSize]
+// & (1 << (i % ExceptionHandlingFlowContext.BitCacheSize)))
+// != 0;
+// if (preserveCurrentHandler) {
+// exceptionLabels[i] =
+// new ExceptionLabel(
+// codeStream,
+// (ReferenceBinding) catchArguments[i].binding.type);
+// }
+// }
+// ExceptionLabel anyExceptionLabel = null;
+// if (subRoutineStartLabel != null) {
+// subRoutineStartLabel.codeStream = codeStream;
+// anyExceptionLabel = new ExceptionLabel(codeStream, null);
+// }
+// // generate the try block
+// tryBlock.generateCode(scope, codeStream);
+// boolean tryBlockHasSomeCode = codeStream.position != pc;
+// // flag telling if some bytecodes were issued inside the try block
+//
+// // natural exit: only if necessary
+// boolean nonReturningSubRoutine =
+// (subRoutineStartLabel != null) && subRoutineCannotReturn;
+// if ((!tryBlockExit) && tryBlockHasSomeCode) {
+// int position = codeStream.position;
+// if (nonReturningSubRoutine) {
+// codeStream.goto_(subRoutineStartLabel);
+// } else {
+// requiresNaturalJsr = true;
+// codeStream.goto_(endLabel);
+// }
+// codeStream.updateLastRecordedEndPC(position);
+// //goto is tagged as part of the try block
+// }
+// // place end positions of user-defined exception labels
+// if (tryBlockHasSomeCode) {
+// for (int i = 0; i < maxCatches; i++) {
+// boolean preserveCurrentHandler =
+// (preserveExceptionHandler[i / ExceptionHandlingFlowContext.BitCacheSize]
+// & (1 << (i % ExceptionHandlingFlowContext.BitCacheSize)))
+// != 0;
+// if (preserveCurrentHandler) {
+// exceptionLabels[i].placeEnd();
+// }
+// }
+// /* generate sequence of handler, all starting by storing the TOS (exception
+// thrown) into their own catch variables, the one specified in the source
+// that must denote the handled exception.
+// */
+// if (catchArguments == null) {
+// if (anyExceptionLabel != null) {
+// anyExceptionLabel.placeEnd();
+// }
+// } else {
+// for (int i = 0; i < maxCatches; i++) {
+// boolean preserveCurrentHandler =
+// (preserveExceptionHandler[i / ExceptionHandlingFlowContext.BitCacheSize]
+// & (1 << (i % ExceptionHandlingFlowContext.BitCacheSize)))
+// != 0;
+// if (preserveCurrentHandler) {
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (preTryInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// preTryInitStateIndex);
+// }
+// exceptionLabels[i].place();
+// codeStream.incrStackSize(1);
+// // optimizing the case where the exception variable is not actually used
+// LocalVariableBinding catchVar;
+// int varPC = codeStream.position;
+// if ((catchVar = catchArguments[i].binding).resolvedPosition != -1) {
+// codeStream.store(catchVar, false);
+// catchVar.recordInitializationStartPC(codeStream.position);
+// codeStream.addVisibleLocalVariable(catchVar);
+// } else {
+// codeStream.pop();
+// }
+// codeStream.recordPositionsFrom(varPC, catchArguments[i].sourceStart);
+// // Keep track of the pcs at diverging point for computing the local attribute
+// // since not passing the catchScope, the block generation will exitUserScope(catchScope)
+// catchBlocks[i].generateCode(scope, codeStream);
+// }
+// if (i == maxCatches - 1) {
+// if (anyExceptionLabel != null) {
+// anyExceptionLabel.placeEnd();
+// }
+// if (subRoutineStartLabel != null) {
+// if (!catchExits[i] && preserveCurrentHandler) {
+// requiresNaturalJsr = true;
+// codeStream.goto_(endLabel);
+// }
+// }
+// } else {
+// if (!catchExits[i] && preserveCurrentHandler) {
+// if (nonReturningSubRoutine) {
+// codeStream.goto_(subRoutineStartLabel);
+// } else {
+// requiresNaturalJsr = true;
+// codeStream.goto_(endLabel);
+// }
+// }
+// }
+// }
+// }
+// // addition of a special handler so as to ensure that any uncaught exception (or exception thrown
+// // inside catch blocks) will run the finally block
+// int finallySequenceStartPC = codeStream.position;
+// if (subRoutineStartLabel != null) {
+// // the additional handler is doing: jsr finallyBlock and rethrow TOS-exception
+// anyExceptionLabel.place();
+//
+// if (preTryInitStateIndex != -1) {
+// // reset initialization state, as for a normal catch block
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// preTryInitStateIndex);
+// }
+//
+// codeStream.incrStackSize(1);
+// if (nonReturningSubRoutine) {
+// codeStream.pop();
+// // "if subroutine cannot return, no need to jsr/jump to subroutine since it will be entered in sequence
+// } else {
+// codeStream.store(anyExceptionVariable, false);
+// codeStream.jsr(subRoutineStartLabel);
+// codeStream.load(anyExceptionVariable);
+// codeStream.athrow();
+// }
+// }
+// // end of catch sequence, place label that will correspond to the finally block beginning, or end of statement
+// endLabel.place();
+// if (subRoutineStartLabel != null) {
+// if (nonReturningSubRoutine) {
+// requiresNaturalJsr = false;
+// }
+// Label veryEndLabel = new Label(codeStream);
+// if (requiresNaturalJsr) {
+// codeStream.jsr(subRoutineStartLabel);
+// codeStream.goto_(veryEndLabel);
+// }
+// subRoutineStartLabel.place();
+// if (!nonReturningSubRoutine) {
+// codeStream.incrStackSize(1);
+// codeStream.store(returnAddressVariable, false);
+// }
+// codeStream.recordPositionsFrom(
+// finallySequenceStartPC,
+// finallyBlock.sourceStart);
+// // entire sequence for finally is associated to finally block
+// finallyBlock.generateCode(scope, codeStream);
+// if (!nonReturningSubRoutine) {
+// int position = codeStream.position;
+// codeStream.ret(returnAddressVariable.resolvedPosition);
+// codeStream.updateLastRecordedEndPC(position);
+// // the ret bytecode is part of the subroutine
+// }
+// if (requiresNaturalJsr) {
+// veryEndLabel.place();
+// }
+// }
+// } else {
+// // try block had no effect, only generate the body of the finally block if any
+// if (subRoutineStartLabel != null) {
+// finallyBlock.generateCode(scope, codeStream);
+// }
+// }
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public void resetStateForCodeGeneration() {
+ if (this.subRoutineStartLabel != null) {
+ this.subRoutineStartLabel.resetStateForCodeGeneration();
+ }
+ }
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+ printIndent(indent, output).append("try \n"); //$NON-NLS-1$
+ tryBlock.printStatement(indent + 1, output); //$NON-NLS-1$
+
+ //catches
+ if (catchBlocks != null)
+ for (int i = 0; i < catchBlocks.length; i++) {
+ output.append('\n');
+ printIndent(indent, output).append("catch ("); //$NON-NLS-1$
+ catchArguments[i].print(0, output).append(") "); //$NON-NLS-1$
+ catchBlocks[i].printStatement(indent + 1, output);
+ }
+ //finally
+ if (finallyBlock != null) {
+ output.append('\n');
+ printIndent(indent, output).append("finally\n"); //$NON-NLS-1$
+ finallyBlock.printStatement(indent + 1, output);
+ }
+
+ return output;
+ }
+ public void resolve(BlockScope upperScope) {
+
+ // special scope for secret locals optimization.
+ this.scope = new BlockScope(upperScope);
+
+ BlockScope tryScope = new BlockScope(scope);
+ BlockScope finallyScope = null;
+
+ if (finallyBlock != null
+ && finallyBlock.statements != null) {
+
+ finallyScope = new BlockScope(scope, false); // don't add it yet to parent scope
+
+ // provision for returning and forcing the finally block to run
+ MethodScope methodScope = scope.methodScope();
+
+ // the type does not matter as long as it is not a base type
+ this.returnAddressVariable =
+ new LocalVariableBinding(SecretReturnName, upperScope.getJavaLangObject(), AccDefault, false);
+ finallyScope.addLocalVariable(returnAddressVariable);
+ this.returnAddressVariable.constant = NotAConstant; // not inlinable
+ this.subRoutineStartLabel = new Label();
+
+ this.anyExceptionVariable =
+ new LocalVariableBinding(SecretAnyHandlerName, scope.getJavaLangThrowable(), AccDefault, false);
+ finallyScope.addLocalVariable(this.anyExceptionVariable);
+ this.anyExceptionVariable.constant = NotAConstant; // not inlinable
+
+ if (!methodScope.isInsideInitializer()) {
+ MethodBinding methodBinding =
+ ((AbstractMethodDeclaration) methodScope.referenceContext).binding;
+ if (methodBinding != null) {
+ TypeBinding methodReturnType = methodBinding.returnType;
+ if (methodReturnType.id != T_void) {
+ this.secretReturnValue =
+ new LocalVariableBinding(
+ SecretLocalDeclarationName,
+ methodReturnType,
+ AccDefault,
+ false);
+ finallyScope.addLocalVariable(this.secretReturnValue);
+ this.secretReturnValue.constant = NotAConstant; // not inlinable
+ }
+ }
+ }
+ finallyBlock.resolveUsing(finallyScope);
+ // force the finally scope to have variable positions shifted after its try scope and catch ones
+ finallyScope.shiftScopes = new BlockScope[catchArguments == null ? 1 : catchArguments.length+1];
+ finallyScope.shiftScopes[0] = tryScope;
+ }
+ this.tryBlock.resolveUsing(tryScope);
+
+ // arguments type are checked against JavaLangThrowable in resolveForCatch(..)
+ if (this.catchBlocks != null) {
+ int length = this.catchArguments.length;
+ TypeBinding[] argumentTypes = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ BlockScope catchScope = new BlockScope(scope);
+ if (finallyScope != null){
+ finallyScope.shiftScopes[i+1] = catchScope;
+ }
+ // side effect on catchScope in resolveForCatch(..)
+ if ((argumentTypes[i] = catchArguments[i].resolveForCatch(catchScope)) == null)
+ return;
+ catchBlocks[i].resolveUsing(catchScope);
+ }
+
+ // Verify that the catch clause are ordered in the right way:
+ // more specialized first.
+ this.caughtExceptionTypes = new ReferenceBinding[length];
+ for (int i = 0; i < length; i++) {
+ caughtExceptionTypes[i] = (ReferenceBinding) argumentTypes[i];
+ for (int j = 0; j < i; j++) {
+ if (caughtExceptionTypes[i].isCompatibleWith(argumentTypes[j])) {
+ scope.problemReporter().wrongSequenceOfExceptionTypesError(this, i, j);
+ // cannot return - since may still proceed if unreachable code is ignored (21203)
+ }
+ }
+ }
+ } else {
+ caughtExceptionTypes = new ReferenceBinding[0];
+ }
+
+ if (finallyScope != null){
+ // add finallyScope as last subscope, so it can be shifted behind try/catch subscopes.
+ // the shifting is necessary to achieve no overlay in between the finally scope and its
+ // sibling in term of local variable positions.
+ this.scope.addSubscope(finallyScope);
+ }
+ }
+
+ public String toString(int tab) {
+ String s = tabString(tab);
+ //try
+ s = s + "try "; //$NON-NLS-1$
+ if (tryBlock == Block.None)
+ s = s + "{}"; //$NON-NLS-1$
+ else
+ s = s + "\n" + tryBlock.toString(tab + 1); //$NON-NLS-1$
+
+ //catches
+ if (catchBlocks != null)
+ for (int i = 0; i < catchBlocks.length; i++)
+ s = s + "\n" + tabString(tab) + "catch (" //$NON-NLS-2$ //$NON-NLS-1$
+ +catchArguments[i].toString(0) + ") " //$NON-NLS-1$
+ +catchBlocks[i].toString(tab + 1);
+ //finally
+ if (finallyBlock != null) {
+ if (finallyBlock == Block.None)
+ s = s + "\n" + tabString(tab) + "finally {}"; //$NON-NLS-2$ //$NON-NLS-1$
+ else
+ s = s + "\n" + tabString(tab) + "finally\n" + //$NON-NLS-2$ //$NON-NLS-1$
+ finallyBlock.toString(tab + 1);
+ }
+
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ tryBlock.traverse(visitor, scope);
+ if (catchArguments != null) {
+ for (int i = 0, max = catchBlocks.length; i < max; i++) {
+ catchArguments[i].traverse(visitor, scope);
+ catchBlocks[i].traverse(visitor, scope);
+ }
+ }
+ if (finallyBlock != null)
+ finallyBlock.traverse(visitor, scope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeDeclaration.java
new file mode 100644
index 0000000..ca49457
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeDeclaration.java
@@ -0,0 +1,1089 @@
+/***********************************************************************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ **********************************************************************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MemberTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.NestedTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+import net.sourceforge.phpdt.internal.compiler.parser.Parser;
+import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
+import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
+import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
+
+public class TypeDeclaration extends Statement implements ProblemSeverities, ReferenceContext {
+
+ public int modifiers;
+
+ public int modifiersSourceStart;
+
+ public char[] name;
+
+ public TypeReference superclass;
+
+ public TypeReference[] superInterfaces;
+
+ public FieldDeclaration[] fields;
+
+ public AbstractMethodDeclaration[] methods;
+
+ public TypeDeclaration[] memberTypes;
+
+ public SourceTypeBinding binding;
+
+ public ClassScope scope;
+
+ public MethodScope initializerScope;
+
+ public MethodScope staticInitializerScope;
+
+ public boolean ignoreFurtherInvestigation = false;
+
+ public int maxFieldCount;
+
+ public int declarationSourceStart;
+
+ public int declarationSourceEnd;
+
+ public int bodyStart;
+
+ public int bodyEnd; // doesn't include the trailing comment if any.
+
+ protected boolean hasBeenGenerated = false;
+
+ public CompilationResult compilationResult;
+
+ private MethodDeclaration[] missingAbstractMethods;
+
+ public TypeDeclaration(CompilationResult compilationResult) {
+ this.compilationResult = compilationResult;
+ }
+
+ /*
+ * We cause the compilation task to abort to a given extent.
+ */
+ public void abort(int abortLevel) {
+
+ if (scope == null) {
+ throw new AbortCompilation(); // cannot do better
+ }
+
+ CompilationResult compilationResult = scope.referenceCompilationUnit().compilationResult;
+
+ switch (abortLevel) {
+ case AbortCompilation:
+ throw new AbortCompilation(compilationResult);
+ case AbortCompilationUnit:
+ throw new AbortCompilationUnit(compilationResult);
+ case AbortMethod:
+ throw new AbortMethod(compilationResult);
+ default:
+ throw new AbortType(compilationResult);
+ }
+ }
+
+ /**
+ * This method is responsible for adding a method declaration to the type method collections. Note that this
+ * implementation is inserting it in first place (as VAJ or javac), and that this impacts the behavior of the method
+ * ConstantPool.resetForClinit(int. int), in so far as the latter will have to reset the constant pool state accordingly (if it
+ * was added first, it does not need to preserve some of the method specific cached entries since this will be the first method).
+ * inserts the clinit method declaration in the first position.
+ *
+ * @see net.sourceforge.phpdt.internal.compiler.codegen.ConstantPool#resetForClinit(int, int)
+ */
+ public final void addClinit() {
+
+ //see comment on needClassInitMethod
+ if (needClassInitMethod()) {
+ int length;
+ AbstractMethodDeclaration[] methods;
+ if ((methods = this.methods) == null) {
+ length = 0;
+ methods = new AbstractMethodDeclaration[1];
+ } else {
+ length = methods.length;
+ System.arraycopy(methods, 0, (methods = new AbstractMethodDeclaration[length + 1]), 1, length);
+ }
+ Clinit clinit = new Clinit(this.compilationResult);
+ methods[0] = clinit;
+ // clinit is added in first location, so as to minimize the use of ldcw (big consumer of constant inits)
+ clinit.declarationSourceStart = clinit.sourceStart = sourceStart;
+ clinit.declarationSourceEnd = clinit.sourceEnd = sourceEnd;
+ clinit.bodyEnd = sourceEnd;
+ this.methods = methods;
+ }
+ }
+
+ /**
+ * Flow analysis for a local innertype
+ *
+ */
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ if (ignoreFurtherInvestigation)
+ return flowInfo;
+ try {
+ bits |= IsReachableMASK;
+ LocalTypeBinding localType = (LocalTypeBinding) binding;
+
+ localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+
+ updateMaxFieldCount(); // propagate down the max field count
+ internalAnalyseCode(flowContext, flowInfo);
+ } catch (AbortType e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ return flowInfo;
+ }
+
+ /**
+ * Flow analysis for a member innertype
+ *
+ */
+ public void analyseCode(ClassScope enclosingClassScope) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ // propagate down the max field count
+ updateMaxFieldCount();
+ internalAnalyseCode(null, FlowInfo.initial(maxFieldCount));
+ } catch (AbortType e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ /**
+ * Flow analysis for a local member innertype
+ *
+ */
+ public void analyseCode(ClassScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ bits |= IsReachableMASK;
+ LocalTypeBinding localType = (LocalTypeBinding) binding;
+
+ localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
+ manageEnclosingInstanceAccessIfNecessary(currentScope);
+
+ updateMaxFieldCount(); // propagate down the max field count
+ internalAnalyseCode(flowContext, flowInfo);
+ } catch (AbortType e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ /**
+ * Flow analysis for a package member type
+ *
+ */
+ public void analyseCode(CompilationUnitScope unitScope) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ internalAnalyseCode(null, FlowInfo.initial(maxFieldCount));
+ } catch (AbortType e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ /*
+ * Check for constructor vs. method with no return type. Answers true if at least one constructor is defined
+ */
+ public boolean checkConstructors(Parser parser) {
+
+ //if a constructor has not the name of the type,
+ //convert it into a method with 'null' as its return type
+ boolean hasConstructor = false;
+ if (methods != null) {
+ for (int i = methods.length; --i >= 0;) {
+ AbstractMethodDeclaration am;
+ if ((am = methods[i]).isConstructor()) {
+ if (!CharOperation.equals(am.selector, name)) {
+ // the constructor was in fact a method with no return type
+ // unless an explicit constructor call was supplied
+ ConstructorDeclaration c = (ConstructorDeclaration) am;
+ if ((c.constructorCall == null) || (c.constructorCall.isImplicitSuper())) { //changed to a method
+ MethodDeclaration m = new MethodDeclaration(this.compilationResult);
+ m.sourceStart = c.sourceStart;
+ m.sourceEnd = c.sourceEnd;
+ m.bodyStart = c.bodyStart;
+ m.bodyEnd = c.bodyEnd;
+ m.declarationSourceEnd = c.declarationSourceEnd;
+ m.declarationSourceStart = c.declarationSourceStart;
+ m.selector = c.selector;
+ m.statements = c.statements;
+ m.modifiers = c.modifiers;
+ m.arguments = c.arguments;
+ m.thrownExceptions = c.thrownExceptions;
+ m.explicitDeclarations = c.explicitDeclarations;
+ m.returnType = null;
+ methods[i] = m;
+ }
+ } else {
+ if (this.isInterface()) {
+ // report the problem and continue the parsing
+ parser.problemReporter().interfaceCannotHaveConstructors((ConstructorDeclaration) am);
+ }
+ hasConstructor = true;
+ }
+ }
+ }
+ }
+ return hasConstructor;
+ }
+
+ public CompilationResult compilationResult() {
+
+ return this.compilationResult;
+ }
+
+ public ConstructorDeclaration createsInternalConstructor(boolean needExplicitConstructorCall, boolean needToInsert) {
+
+ //Add to method'set, the default constuctor that just recall the
+ //super constructor with no arguments
+ //The arguments' type will be positionned by the TC so just use
+ //the default int instead of just null (consistency purpose)
+
+ //the constructor
+ ConstructorDeclaration constructor = new ConstructorDeclaration(this.compilationResult);
+ constructor.isDefaultConstructor = true;
+ constructor.selector = name;
+ if (modifiers != AccDefault) {
+ constructor.modifiers = ((this instanceof MemberTypeDeclaration) && (modifiers & AccPrivate) != 0) ? AccDefault : modifiers
+ & AccVisibilityMASK;
+ }
+
+ //if you change this setting, please update the
+ //SourceIndexer2.buildTypeDeclaration(TypeDeclaration,char[]) method
+ constructor.declarationSourceStart = constructor.sourceStart = sourceStart;
+ constructor.declarationSourceEnd = constructor.sourceEnd = constructor.bodyEnd = sourceEnd;
+
+ //the super call inside the constructor
+ if (needExplicitConstructorCall) {
+ constructor.constructorCall = SuperReference.implicitSuperConstructorCall();
+ constructor.constructorCall.sourceStart = sourceStart;
+ constructor.constructorCall.sourceEnd = sourceEnd;
+ }
+
+ //adding the constructor in the methods list
+ if (needToInsert) {
+ if (methods == null) {
+ methods = new AbstractMethodDeclaration[] { constructor };
+ } else {
+ AbstractMethodDeclaration[] newMethods;
+ System.arraycopy(methods, 0, newMethods = new AbstractMethodDeclaration[methods.length + 1], 1, methods.length);
+ newMethods[0] = constructor;
+ methods = newMethods;
+ }
+ }
+ return constructor;
+ }
+
+ /**
+ * INTERNAL USE ONLY - Creates a fake method declaration for the corresponding binding. It is used to report errors for missing
+ * abstract methods.
+ */
+ public MethodDeclaration addMissingAbstractMethodFor(MethodBinding methodBinding) {
+ TypeBinding[] argumentTypes = methodBinding.parameters;
+ int argumentsLength = argumentTypes.length;
+ //the constructor
+ MethodDeclaration methodDeclaration = new MethodDeclaration(this.compilationResult);
+ methodDeclaration.selector = methodBinding.selector;
+ methodDeclaration.sourceStart = sourceStart;
+ methodDeclaration.sourceEnd = sourceEnd;
+ methodDeclaration.modifiers = methodBinding.getAccessFlags() & ~AccAbstract;
+
+ if (argumentsLength > 0) {
+ String baseName = "arg";//$NON-NLS-1$
+ Argument[] arguments = (methodDeclaration.arguments = new Argument[argumentsLength]);
+ for (int i = argumentsLength; --i >= 0;) {
+ arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /* type ref */, AccDefault);
+ }
+ }
+
+ //adding the constructor in the methods list
+ if (this.missingAbstractMethods == null) {
+ this.missingAbstractMethods = new MethodDeclaration[] { methodDeclaration };
+ } else {
+ MethodDeclaration[] newMethods;
+ System.arraycopy(this.missingAbstractMethods, 0, newMethods = new MethodDeclaration[this.missingAbstractMethods.length + 1],
+ 1, this.missingAbstractMethods.length);
+ newMethods[0] = methodDeclaration;
+ this.missingAbstractMethods = newMethods;
+ }
+
+ //============BINDING UPDATE==========================
+ methodDeclaration.binding = new MethodBinding(methodDeclaration.modifiers, //methodDeclaration
+ methodBinding.selector, methodBinding.returnType, argumentsLength == 0 ? NoParameters : argumentTypes, //arguments bindings
+ methodBinding.thrownExceptions, //exceptions
+ binding); //declaringClass
+
+ methodDeclaration.scope = new MethodScope(scope, methodDeclaration, true);
+ methodDeclaration.bindArguments();
+
+ /*
+ * if (binding.methods == null) { binding.methods = new MethodBinding[] { methodDeclaration.binding }; } else { MethodBinding[]
+ * newMethods; System.arraycopy( binding.methods, 0, newMethods = new MethodBinding[binding.methods.length + 1], 1,
+ * binding.methods.length); newMethods[0] = methodDeclaration.binding; binding.methods = newMethods; }
+ */
+ //===================================================
+ return methodDeclaration;
+ }
+
+ /*
+ * Find the matching parse node, answers null if nothing found
+ */
+ public FieldDeclaration declarationOf(FieldBinding fieldBinding) {
+
+ if (fieldBinding != null) {
+ for (int i = 0, max = this.fields.length; i < max; i++) {
+ FieldDeclaration fieldDecl;
+ if ((fieldDecl = this.fields[i]).binding == fieldBinding)
+ return fieldDecl;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Find the matching parse node, answers null if nothing found
+ */
+ public TypeDeclaration declarationOf(MemberTypeBinding memberTypeBinding) {
+
+ if (memberTypeBinding != null) {
+ for (int i = 0, max = this.memberTypes.length; i < max; i++) {
+ TypeDeclaration memberTypeDecl;
+ if ((memberTypeDecl = this.memberTypes[i]).binding == memberTypeBinding)
+ return memberTypeDecl;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Find the matching parse node, answers null if nothing found
+ */
+ public AbstractMethodDeclaration declarationOf(MethodBinding methodBinding) {
+
+ if (methodBinding != null) {
+ for (int i = 0, max = this.methods.length; i < max; i++) {
+ AbstractMethodDeclaration methodDecl;
+
+ if ((methodDecl = this.methods[i]).binding == methodBinding)
+ return methodDecl;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Finds the matching type amoung this type's member types. Returns null if no type with this name is found. The type name is a
+ * compound name relative to this type eg. if this type is X and we're looking for Y.X.A.B then a type name would be {X, A, B}
+ */
+ public TypeDeclaration declarationOfType(char[][] typeName) {
+
+ int typeNameLength = typeName.length;
+ if (typeNameLength < 1 || !CharOperation.equals(typeName[0], this.name)) {
+ return null;
+ }
+ if (typeNameLength == 1) {
+ return this;
+ }
+ char[][] subTypeName = new char[typeNameLength - 1][];
+ System.arraycopy(typeName, 1, subTypeName, 0, typeNameLength - 1);
+ for (int i = 0; i < this.memberTypes.length; i++) {
+ TypeDeclaration typeDecl = this.memberTypes[i].declarationOfType(subTypeName);
+ if (typeDecl != null) {
+ return typeDecl;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Generic bytecode generation for type
+ */
+ // public void generateCode(ClassFile enclosingClassFile) {
+ //
+ // if (hasBeenGenerated)
+ // return;
+ // hasBeenGenerated = true;
+ // if (ignoreFurtherInvestigation) {
+ // if (binding == null)
+ // return;
+ // ClassFile.createProblemType(
+ // this,
+ // scope.referenceCompilationUnit().compilationResult);
+ // return;
+ // }
+ // try {
+ // // create the result for a compiled type
+ // ClassFile classFile = new ClassFile(binding, enclosingClassFile, false);
+ // // generate all fiels
+ // classFile.addFieldInfos();
+ //
+ // // record the inner type inside its own .class file to be able
+ // // to generate inner classes attributes
+ // if (binding.isMemberType())
+ // classFile.recordEnclosingTypeAttributes(binding);
+ // if (binding.isLocalType()) {
+ // enclosingClassFile.recordNestedLocalAttribute(binding);
+ // classFile.recordNestedLocalAttribute(binding);
+ // }
+ // if (memberTypes != null) {
+ // for (int i = 0, max = memberTypes.length; i < max; i++) {
+ // // record the inner type inside its own .class file to be able
+ // // to generate inner classes attributes
+ // classFile.recordNestedMemberAttribute(memberTypes[i].binding);
+ // memberTypes[i].generateCode(scope, classFile);
+ // }
+ // }
+ // // generate all methods
+ // classFile.setForMethodInfos();
+ // if (methods != null) {
+ // for (int i = 0, max = methods.length; i < max; i++) {
+ // methods[i].generateCode(scope, classFile);
+ // }
+ // }
+ //
+ // classFile.generateMissingAbstractMethods(this.missingAbstractMethods, scope.referenceCompilationUnit().compilationResult);
+ //
+ // // generate all methods
+ // classFile.addSpecialMethods();
+ //
+ // if (ignoreFurtherInvestigation) { // trigger problem type generation for code gen errors
+ // throw new AbortType(scope.referenceCompilationUnit().compilationResult);
+ // }
+ //
+ // // finalize the compiled type result
+ // classFile.addAttributes();
+ // scope.referenceCompilationUnit().compilationResult.record(
+ // binding.constantPoolName(),
+ // classFile);
+ // } catch (AbortType e) {
+ // if (binding == null)
+ // return;
+ // ClassFile.createProblemType(
+ // this,
+ // scope.referenceCompilationUnit().compilationResult);
+ // }
+ // }
+ /**
+ * Bytecode generation for a local inner type (API as a normal statement code gen)
+ */
+ // public void generateCode(BlockScope blockScope, CodeStream codeStream) {
+ //
+ // if (hasBeenGenerated) return;
+ // int pc = codeStream.position;
+ // if (binding != null) ((NestedTypeBinding) binding).computeSyntheticArgumentSlotSizes();
+ // generateCode(codeStream.classFile);
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ /**
+ * Bytecode generation for a member inner type
+ */
+ // public void generateCode(ClassScope classScope, ClassFile enclosingClassFile) {
+ //
+ // if (hasBeenGenerated) return;
+ // if (binding != null) ((NestedTypeBinding) binding).computeSyntheticArgumentSlotSizes();
+ // generateCode(enclosingClassFile);
+ // }
+ /**
+ * Bytecode generation for a package member
+ */
+ // public void generateCode(CompilationUnitScope unitScope) {
+ //
+ // generateCode((ClassFile) null);
+ // }
+ public boolean hasErrors() {
+ return this.ignoreFurtherInvestigation;
+ }
+
+ /**
+ * Common flow analysis for all types
+ *
+ */
+ public void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) {
+
+ if (this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
+ if (!scope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
+ scope.problemReporter().unusedPrivateType(this);
+ }
+ }
+
+ ReferenceBinding[] defaultHandledExceptions = new ReferenceBinding[] { scope.getJavaLangThrowable() }; // tolerate any kind of
+ // exception
+ InitializationFlowContext initializerContext = new InitializationFlowContext(null, this, initializerScope);
+ InitializationFlowContext staticInitializerContext = new InitializationFlowContext(null, this, staticInitializerScope);
+ FlowInfo nonStaticFieldInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
+ FlowInfo staticFieldInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
+ if (fields != null) {
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldDeclaration field = fields[i];
+ if (field.isStatic()) {
+ /*
+ * if (field.isField()){ staticInitializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2 }
+ * else {
+ */
+ staticInitializerContext.handledExceptions = defaultHandledExceptions; // tolerate them all, and record them
+ /* } */
+ staticFieldInfo = field.analyseCode(staticInitializerScope, staticInitializerContext, staticFieldInfo);
+ // in case the initializer is not reachable, use a reinitialized flowInfo and enter a fake reachable
+ // branch, since the previous initializer already got the blame.
+ if (staticFieldInfo == FlowInfo.DEAD_END) {
+ staticInitializerScope.problemReporter().initializerMustCompleteNormally(field);
+ staticFieldInfo = FlowInfo.initial(maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
+ }
+ } else {
+ /*
+ * if (field.isField()){ initializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2 } else {
+ */
+ initializerContext.handledExceptions = defaultHandledExceptions; // tolerate them all, and record them
+ /* } */
+ nonStaticFieldInfo = field.analyseCode(initializerScope, initializerContext, nonStaticFieldInfo);
+ // in case the initializer is not reachable, use a reinitialized flowInfo and enter a fake reachable
+ // branch, since the previous initializer already got the blame.
+ if (nonStaticFieldInfo == FlowInfo.DEAD_END) {
+ initializerScope.problemReporter().initializerMustCompleteNormally(field);
+ nonStaticFieldInfo = FlowInfo.initial(maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
+ }
+ }
+ }
+ }
+ if (memberTypes != null) {
+ for (int i = 0, count = memberTypes.length; i < count; i++) {
+ if (flowContext != null) { // local type
+ memberTypes[i].analyseCode(scope, flowContext, nonStaticFieldInfo.copy());
+ } else {
+ memberTypes[i].analyseCode(scope);
+ }
+ }
+ }
+ if (methods != null) {
+ UnconditionalFlowInfo outerInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
+ FlowInfo constructorInfo = nonStaticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(
+ outerInfo);
+ for (int i = 0, count = methods.length; i < count; i++) {
+ AbstractMethodDeclaration method = methods[i];
+ if (method.ignoreFurtherInvestigation)
+ continue;
+ if (method.isInitializationMethod()) {
+ if (method.isStatic()) { //
+ method.analyseCode(scope, staticInitializerContext, staticFieldInfo.unconditionalInits()
+ .discardNonFieldInitializations().addInitializationsFrom(outerInfo));
+ } else { // constructor
+ method.analyseCode(scope, initializerContext, constructorInfo.copy());
+ }
+ } else { // regular method
+ method.analyseCode(scope, null, flowInfo.copy());
+ }
+ }
+ }
+ }
+
+ public boolean isInterface() {
+
+ return (modifiers & AccInterface) != 0;
+ }
+
+ /*
+ * Access emulation for a local type force to emulation of access to direct enclosing instance. By using the initializer scope, we
+ * actually only request an argument emulation, the field is not added until actually used. However we will force allocations to
+ * be qualified with an enclosing instance. 15.9.2
+ */
+ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
+
+ NestedTypeBinding nestedType = (NestedTypeBinding) binding;
+
+ MethodScope methodScope = currentScope.methodScope();
+ if (!methodScope.isStatic && !methodScope.isConstructorCall) {
+
+ nestedType.addSyntheticArgumentAndField(binding.enclosingType());
+ }
+ // add superclass enclosing instance arg for anonymous types (if necessary)
+ if (binding.isAnonymousType()) {
+ ReferenceBinding superclass = binding.superclass;
+ if (superclass.enclosingType() != null && !superclass.isStatic()) {
+ if (!binding.superclass.isLocalType()
+ || ((NestedTypeBinding) binding.superclass).getSyntheticField(superclass.enclosingType(), true) != null) {
+
+ nestedType.addSyntheticArgument(superclass.enclosingType());
+ }
+ }
+ }
+ }
+
+ /*
+ * Access emulation for a local member type force to emulation of access to direct enclosing instance. By using the initializer
+ * scope, we actually only request an argument emulation, the field is not added until actually used. However we will force
+ * allocations to be qualified with an enclosing instance.
+ *
+ * Local member cannot be static.
+ */
+ public void manageEnclosingInstanceAccessIfNecessary(ClassScope currentScope) {
+
+ NestedTypeBinding nestedType = (NestedTypeBinding) binding;
+ nestedType.addSyntheticArgumentAndField(binding.enclosingType());
+ }
+
+ /**
+ * A will be requested as soon as static fields or assertions are present. It will be eliminated during classfile creation
+ * if no bytecode was actually produced based on some optimizations/compiler settings.
+ */
+ public final boolean needClassInitMethod() {
+
+ // always need a when assertions are present
+ if ((this.bits & AddAssertionMASK) != 0)
+ return true;
+ if (fields == null)
+ return false;
+ if (isInterface())
+ return true; // fields are implicitly statics
+ for (int i = fields.length; --i >= 0;) {
+ FieldDeclaration field = fields[i];
+ //need to test the modifier directly while there is no binding yet
+ if ((field.modifiers & AccStatic) != 0)
+ return true;
+ }
+ return false;
+ }
+
+ public void parseMethod(UnitParser parser, CompilationUnitDeclaration unit) {
+
+ //connect method bodies
+ if (unit.ignoreMethodBodies)
+ return;
+
+ // no scope were created, so cannot report further errors
+ // if (binding == null)
+ // return;
+
+ //members
+ if (memberTypes != null) {
+ int length = memberTypes.length;
+ for (int i = 0; i < length; i++)
+ memberTypes[i].parseMethod(parser, unit);
+ }
+
+ //methods
+ if (methods != null) {
+ int length = methods.length;
+ for (int i = 0; i < length; i++)
+ methods[i].parseStatements(parser, unit);
+ }
+
+ //initializers
+ if (fields != null) {
+ int length = fields.length;
+ for (int i = 0; i < length; i++) {
+ if (fields[i] instanceof Initializer) {
+ ((Initializer) fields[i]).parseStatements(parser, this, unit);
+ }
+ }
+ }
+ }
+
+ public void resolve() {
+
+ if (binding == null) {
+ ignoreFurtherInvestigation = true;
+ return;
+ }
+
+ try {
+ // check superclass & interfaces
+ if (binding.superclass != null) // watch out for Object ! (and other roots)
+ if (isTypeUseDeprecated(binding.superclass, scope))
+ scope.problemReporter().deprecatedType(binding.superclass, superclass);
+ if (superInterfaces != null)
+ for (int i = superInterfaces.length; --i >= 0;)
+ if (superInterfaces[i].resolvedType != null)
+ if (isTypeUseDeprecated(superInterfaces[i].resolvedType, scope))
+ scope.problemReporter().deprecatedType(superInterfaces[i].resolvedType, superInterfaces[i]);
+ maxFieldCount = 0;
+ int lastFieldID = -1;
+ if (fields != null) {
+ for (int i = 0, count = fields.length; i < count; i++) {
+ FieldDeclaration field = fields[i];
+ if (field.isField()) {
+ if (field.binding == null) {
+ // still discover secondary errors
+ if (field.initialization != null)
+ field.initialization.resolve(field.isStatic() ? staticInitializerScope : initializerScope);
+ ignoreFurtherInvestigation = true;
+ continue;
+ }
+ maxFieldCount++;
+ lastFieldID = field.binding.id;
+ } else { // initializer
+ ((Initializer) field).lastFieldID = lastFieldID + 1;
+ }
+ field.resolve(field.isStatic() ? staticInitializerScope : initializerScope);
+ }
+ }
+ if (memberTypes != null) {
+ for (int i = 0, count = memberTypes.length; i < count; i++) {
+ memberTypes[i].resolve(scope);
+ }
+ }
+ int missingAbstractMethodslength = this.missingAbstractMethods == null ? 0 : this.missingAbstractMethods.length;
+ int methodsLength = this.methods == null ? 0 : methods.length;
+ if ((methodsLength + missingAbstractMethodslength) > 0xFFFF) {
+ scope.problemReporter().tooManyMethods(this);
+ }
+
+ if (methods != null) {
+ for (int i = 0, count = methods.length; i < count; i++) {
+ methods[i].resolve(scope);
+ }
+ }
+ } catch (AbortType e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+ ;
+ }
+
+ public void resolve(BlockScope blockScope) {
+ // local type declaration
+
+ // need to build its scope first and proceed with binding's creation
+ blockScope.addLocalType(this);
+
+ // and TC....
+ if (binding != null) {
+ // remember local types binding for innerclass emulation propagation
+ blockScope.referenceCompilationUnit().record((LocalTypeBinding) binding);
+
+ // binding is not set if the receiver could not be created
+ resolve();
+ updateMaxFieldCount();
+ }
+ }
+
+ public void resolve(ClassScope upperScope) {
+ // member scopes are already created
+ // request the construction of a binding if local member type
+
+ if (binding != null && binding instanceof LocalTypeBinding) {
+ // remember local types binding for innerclass emulation propagation
+ upperScope.referenceCompilationUnit().record((LocalTypeBinding) binding);
+ }
+ resolve();
+ updateMaxFieldCount();
+ }
+
+ public void resolve(CompilationUnitScope upperScope) {
+ // top level : scope are already created
+
+ resolve();
+ updateMaxFieldCount();
+ }
+
+ public void tagAsHavingErrors() {
+ ignoreFurtherInvestigation = true;
+ }
+
+ public StringBuffer print(int indent, StringBuffer output) {
+
+ // if ((this.bits & IsAnonymousTypeMASK) == 0) {
+ printIndent(indent, output);
+ printHeader(0, output);
+ // }
+ return printBody(indent, output);
+ }
+
+ public StringBuffer printBody(int indent, StringBuffer output) {
+
+ output.append(" {"); //$NON-NLS-1$
+ if (memberTypes != null) {
+ for (int i = 0; i < memberTypes.length; i++) {
+ if (memberTypes[i] != null) {
+ output.append('\n');
+ memberTypes[i].print(indent + 1, output);
+ }
+ }
+ }
+ if (fields != null) {
+ for (int fieldI = 0; fieldI < fields.length; fieldI++) {
+ if (fields[fieldI] != null) {
+ output.append('\n');
+ fields[fieldI].print(indent + 1, output);
+ }
+ }
+ }
+ if (methods != null) {
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i] != null) {
+ output.append('\n');
+ methods[i].print(indent + 1, output);
+ }
+ }
+ }
+ output.append('\n');
+ return printIndent(indent, output).append('}');
+ }
+
+ public StringBuffer printHeader(int indent, StringBuffer output) {
+
+ printModifiers(this.modifiers, output);
+ output.append(isInterface() ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$
+ output.append(name);
+ if (superclass != null) {
+ output.append(" extends "); //$NON-NLS-1$
+ superclass.print(0, output);
+ }
+ if (superInterfaces != null && superInterfaces.length > 0) {
+ output.append(isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
+ for (int i = 0; i < superInterfaces.length; i++) {
+ if (i > 0)
+ output.append(", "); //$NON-NLS-1$
+ superInterfaces[i].print(0, output);
+ }
+ }
+ return output;
+ }
+
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+ return print(tab, output);
+ }
+
+ public String toString(int tab) {
+
+ return tabString(tab) + toStringHeader() + toStringBody(tab);
+ }
+
+ public String toStringBody(int tab) {
+
+ String s = " {"; //$NON-NLS-1$
+ if (memberTypes != null) {
+ for (int i = 0; i < memberTypes.length; i++) {
+ if (memberTypes[i] != null) {
+ s += "\n" + memberTypes[i].toString(tab + 1); //$NON-NLS-1$
+ }
+ }
+ }
+ if (fields != null) {
+ for (int fieldI = 0; fieldI < fields.length; fieldI++) {
+ if (fields[fieldI] != null) {
+ s += "\n" + fields[fieldI].toString(tab + 1); //$NON-NLS-1$
+ if (fields[fieldI].isField())
+ s += ";"; //$NON-NLS-1$
+ }
+ }
+ }
+ if (methods != null) {
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i] != null) {
+ s += "\n" + methods[i].toString(tab + 1); //$NON-NLS-1$
+ }
+ }
+ }
+ s += "\n" + tabString(tab) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
+ return s;
+ }
+
+ public String toStringHeader() {
+
+ String s = ""; //$NON-NLS-1$
+ if (modifiers != AccDefault) {
+ s += modifiersString(modifiers);
+ }
+ s += (isInterface() ? "interface " : "class ") + new String(name);//$NON-NLS-1$ //$NON-NLS-2$
+ if (superclass != null)
+ s += " extends " + superclass.toString(0); //$NON-NLS-1$
+ if (superInterfaces != null && superInterfaces.length > 0) {
+ s += (isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
+ for (int i = 0; i < superInterfaces.length; i++) {
+ s += superInterfaces[i].toString(0);
+ if (i != superInterfaces.length - 1)
+ s += ", "; //$NON-NLS-1$
+ }
+ ;
+ }
+ ;
+ return s;
+ }
+
+ /**
+ * Iteration for a local innertype
+ *
+ */
+ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, blockScope)) {
+ if (superclass != null)
+ superclass.traverse(visitor, scope);
+ if (superInterfaces != null) {
+ int superInterfaceLength = superInterfaces.length;
+ for (int i = 0; i < superInterfaceLength; i++)
+ superInterfaces[i].traverse(visitor, scope);
+ }
+ if (memberTypes != null) {
+ int memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ int fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ // local type cannot have static fields
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ int methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ } catch (AbortType e) {
+ // silent abort
+ }
+ }
+
+ /**
+ * Iteration for a member innertype
+ *
+ */
+ public void traverse(ASTVisitor visitor, ClassScope classScope) {
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, classScope)) {
+ if (superclass != null)
+ superclass.traverse(visitor, scope);
+ if (superInterfaces != null) {
+ int superInterfaceLength = superInterfaces.length;
+ for (int i = 0; i < superInterfaceLength; i++)
+ superInterfaces[i].traverse(visitor, scope);
+ }
+ if (memberTypes != null) {
+ int memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ int fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ field.traverse(visitor, staticInitializerScope);
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ int methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+ } catch (AbortType e) {
+ // silent abort
+ }
+ }
+
+ /**
+ * Iteration for a package member type
+ *
+ */
+ public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, unitScope)) {
+ if (superclass != null)
+ superclass.traverse(visitor, scope);
+ if (superInterfaces != null) {
+ int superInterfaceLength = superInterfaces.length;
+ for (int i = 0; i < superInterfaceLength; i++)
+ superInterfaces[i].traverse(visitor, scope);
+ }
+ if (memberTypes != null) {
+ int memberTypesLength = memberTypes.length;
+ for (int i = 0; i < memberTypesLength; i++)
+ memberTypes[i].traverse(visitor, scope);
+ }
+ if (fields != null) {
+ int fieldsLength = fields.length;
+ for (int i = 0; i < fieldsLength; i++) {
+ FieldDeclaration field;
+ if ((field = fields[i]).isStatic()) {
+ field.traverse(visitor, staticInitializerScope);
+ } else {
+ field.traverse(visitor, initializerScope);
+ }
+ }
+ }
+ if (methods != null) {
+ int methodsLength = methods.length;
+ for (int i = 0; i < methodsLength; i++)
+ methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, unitScope);
+ } catch (AbortType e) {
+ }
+ }
+
+ /**
+ * MaxFieldCount's computation is necessary so as to reserve space for the flow info field portions. It corresponds to the maximum
+ * amount of fields this class or one of its innertypes have.
+ *
+ * During name resolution, types are traversed, and the max field count is recorded on the outermost type. It is then propagated
+ * down during the flow analysis.
+ *
+ * This method is doing either up/down propagation.
+ */
+ void updateMaxFieldCount() {
+
+ if (binding == null)
+ return; // error scenario
+ TypeDeclaration outerMostType = scope.outerMostClassScope().referenceType();
+ if (maxFieldCount > outerMostType.maxFieldCount) {
+ outerMostType.maxFieldCount = maxFieldCount; // up
+ } else {
+ maxFieldCount = outerMostType.maxFieldCount; // down
+ }
+ }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeReference.java
new file mode 100644
index 0000000..0450380
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TypeReference.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+public abstract class TypeReference extends Expression {
+
+public TypeReference() {
+ super () ;
+ }
+
+public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ return flowInfo;
+}
+
+// allows us to trap completion & selection nodes
+public void aboutToResolve(Scope scope) {}
+/*
+ * Answer a base type reference (can be an array of base type).
+ */
+//public static final TypeReference baseTypeReference(int baseType, int dim) {
+//
+// if (dim == 0) {
+// switch (baseType) {
+// case (T_void) :
+// return new SingleTypeReference(VoidBinding.simpleName, 0);
+// case (T_boolean) :
+// return new SingleTypeReference(BooleanBinding.simpleName, 0);
+// case (T_char) :
+// return new SingleTypeReference(CharBinding.simpleName, 0);
+// case (T_float) :
+// return new SingleTypeReference(FloatBinding.simpleName, 0);
+// case (T_double) :
+// return new SingleTypeReference(DoubleBinding.simpleName, 0);
+// case (T_byte) :
+// return new SingleTypeReference(ByteBinding.simpleName, 0);
+// case (T_short) :
+// return new SingleTypeReference(ShortBinding.simpleName, 0);
+// case (T_int) :
+// return new SingleTypeReference(IntBinding.simpleName, 0);
+// default : //T_long
+// return new SingleTypeReference(LongBinding.simpleName, 0);
+// }
+// }
+// switch (baseType) {
+// case (T_void) :
+// return new ArrayTypeReference(VoidBinding.simpleName, dim, 0);
+// case (T_boolean) :
+// return new ArrayTypeReference(BooleanBinding.simpleName, dim, 0);
+// case (T_char) :
+// return new ArrayTypeReference(CharBinding.simpleName, dim, 0);
+// case (T_float) :
+// return new ArrayTypeReference(FloatBinding.simpleName, dim, 0);
+// case (T_double) :
+// return new ArrayTypeReference(DoubleBinding.simpleName, dim, 0);
+// case (T_byte) :
+// return new ArrayTypeReference(ByteBinding.simpleName, dim, 0);
+// case (T_short) :
+// return new ArrayTypeReference(ShortBinding.simpleName, dim, 0);
+// case (T_int) :
+// return new ArrayTypeReference(IntBinding.simpleName, dim, 0);
+// default : //T_long
+// return new ArrayTypeReference(LongBinding.simpleName, dim, 0);
+// }
+//}
+public abstract TypeReference copyDims(int dim);
+public int dimensions() {
+ return 0;
+}
+public abstract TypeBinding getTypeBinding(Scope scope);
+/**
+ * @return char[][]
+ */
+public abstract char [][] getTypeName() ;
+public boolean isTypeReference() {
+ return true;
+}
+public TypeBinding resolveType(BlockScope scope) {
+ // handle the error here
+ constant = NotAConstant;
+ if (this.resolvedType != null) { // is a shared type reference which was already resolved
+ if (!this.resolvedType.isValidBinding())
+ return null; // already reported error
+ } else {
+ this.resolvedType = getTypeBinding(scope);
+ if (!this.resolvedType.isValidBinding()) {
+ scope.problemReporter().invalidType(this, this.resolvedType);
+ return null;
+ }
+ if (isTypeUseDeprecated(this.resolvedType, scope))
+ scope.problemReporter().deprecatedType(this.resolvedType, this);
+ }
+ return this.resolvedType;
+}
+public abstract void traverse(ASTVisitor visitor, ClassScope classScope);
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/UnaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/UnaryExpression.java
new file mode 100644
index 0000000..d21dc2e
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/UnaryExpression.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class UnaryExpression extends OperatorExpression {
+
+ public Expression expression;
+ public Constant optimizedBooleanConstant;
+
+ public UnaryExpression(Expression expression, int operator) {
+ this.expression = expression;
+ this.bits |= operator << OperatorSHIFT; // encode operator
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
+ return this.expression
+ .analyseCode(currentScope, flowContext, flowInfo)
+ .asNegatedCondition();
+ } else {
+ return this.expression.analyseCode(currentScope, flowContext, flowInfo);
+ }
+ }
+
+ public Constant optimizedBooleanConstant() {
+
+ return this.optimizedBooleanConstant == null
+ ? this.constant
+ : this.optimizedBooleanConstant;
+ }
+
+ /**
+ * Code generation for an unary operation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired boolean
+ */
+// public void generateCode(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// boolean valueRequired) {
+//
+// int pc = codeStream.position;
+// Label falseLabel, endifLabel;
+// if (this.constant != Constant.NotAConstant) {
+// // inlined value
+// if (valueRequired) {
+// codeStream.generateConstant(this.constant, this.implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// return;
+// }
+// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+// case NOT :
+// switch (this.expression.implicitConversion >> 4) /* runtime type */ {
+// case T_boolean :
+// // !
+// // Generate code for the condition
+// this.expression.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// (falseLabel = new Label(codeStream)),
+// valueRequired);
+// if (valueRequired) {
+// codeStream.iconst_0();
+// if (falseLabel.hasForwardReferences()) {
+// codeStream.goto_(endifLabel = new Label(codeStream));
+// codeStream.decrStackSize(1);
+// falseLabel.place();
+// codeStream.iconst_1();
+// endifLabel.place();
+// }
+// } else { // 6596: if (!(a && b)){} - must still place falseLabel
+// falseLabel.place();
+// }
+// break;
+// }
+// break;
+// case TWIDDLE :
+// switch (this.expression.implicitConversion >> 4 /* runtime */
+// ) {
+// case T_int :
+// // ~int
+// this.expression.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// codeStream.iconst_m1();
+// codeStream.ixor();
+// }
+// break;
+// case T_long :
+// this.expression.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// codeStream.ldc2_w(-1L);
+// codeStream.lxor();
+// }
+// }
+// break;
+// case MINUS :
+// // -
+// if (this.constant != NotAConstant) {
+// if (valueRequired) {
+// switch (this.expression.implicitConversion >> 4){ /* runtime */
+// case T_int :
+// codeStream.generateInlinedValue(this.constant.intValue() * -1);
+// break;
+// case T_float :
+// codeStream.generateInlinedValue(this.constant.floatValue() * -1.0f);
+// break;
+// case T_long :
+// codeStream.generateInlinedValue(this.constant.longValue() * -1L);
+// break;
+// case T_double :
+// codeStream.generateInlinedValue(this.constant.doubleValue() * -1.0);
+// }
+// }
+// } else {
+// this.expression.generateCode(currentScope, codeStream, valueRequired);
+// if (valueRequired) {
+// switch (expression.implicitConversion >> 4){ /* runtime type */
+// case T_int :
+// codeStream.ineg();
+// break;
+// case T_float :
+// codeStream.fneg();
+// break;
+// case T_long :
+// codeStream.lneg();
+// break;
+// case T_double :
+// codeStream.dneg();
+// }
+// }
+// }
+// break;
+// case PLUS :
+// this.expression.generateCode(currentScope, codeStream, valueRequired);
+// }
+// if (valueRequired) {
+// codeStream.generateImplicitConversion(this.implicitConversion);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+//
+// /**
+// * Boolean operator code generation
+// * Optimized operations are: &&, ||, <, <=, >, >=, &, |, ^
+// */
+// public void generateOptimizedBoolean(
+// BlockScope currentScope,
+// CodeStream codeStream,
+// Label trueLabel,
+// Label falseLabel,
+// boolean valueRequired) {
+//
+// if ((this.constant != Constant.NotAConstant) && (this.constant.typeID() == T_boolean)) {
+// super.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// return;
+// }
+// if (((this.bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
+// this.expression.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// falseLabel,
+// trueLabel,
+// valueRequired);
+// } else {
+// super.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// trueLabel,
+// falseLabel,
+// valueRequired);
+// }
+// }
+
+ public TypeBinding resolveType(BlockScope scope) {
+
+ TypeBinding expressionType = this.expression.resolveType(scope);
+ if (expressionType == null) {
+ this.constant = NotAConstant;
+ return null;
+ }
+ int expressionId = expressionType.id;
+ if (expressionId > 15) {
+ this.constant = NotAConstant;
+ scope.problemReporter().invalidOperator(this, expressionType);
+ return null;
+ }
+
+ int tableId;
+ switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+ case NOT :
+ tableId = AND_AND;
+ break;
+ case TWIDDLE :
+ tableId = LEFT_SHIFT;
+ break;
+ default :
+ tableId = MINUS;
+ } //+ and - cases
+
+ // the code is an int
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
+ int result = ResolveTypeTables[tableId][(expressionId << 4) + expressionId];
+ this.expression.implicitConversion = result >>> 12;
+ this.bits |= result & 0xF;
+ switch (result & 0xF) { // only switch on possible result type.....
+ case T_boolean :
+ this.resolvedType = BooleanBinding;
+ break;
+ case T_byte :
+ this.resolvedType = ByteBinding;
+ break;
+ case T_char :
+ this.resolvedType = CharBinding;
+ break;
+ case T_double :
+ this.resolvedType = DoubleBinding;
+ break;
+ case T_float :
+ this.resolvedType = FloatBinding;
+ break;
+ case T_int :
+ this.resolvedType = IntBinding;
+ break;
+ case T_long :
+ this.resolvedType = LongBinding;
+ break;
+ default : //error........
+ this.constant = Constant.NotAConstant;
+ if (expressionId != T_undefined)
+ scope.problemReporter().invalidOperator(this, expressionType);
+ return null;
+ }
+ // compute the constant when valid
+ if (this.expression.constant != Constant.NotAConstant) {
+ this.constant =
+ Constant.computeConstantOperation(
+ this.expression.constant,
+ expressionId,
+ (bits & OperatorMASK) >> OperatorSHIFT);
+ } else {
+ this.constant = Constant.NotAConstant;
+ if (((bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
+ Constant cst = expression.optimizedBooleanConstant();
+ if (cst != Constant.NotAConstant)
+ this.optimizedBooleanConstant = Constant.fromValue(!cst.booleanValue());
+ }
+ }
+ return this.resolvedType;
+ }
+ public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+
+ output.append(operatorToString()).append(' ');
+ return this.expression.printExpression(0, output);
+ }
+ public String toStringExpressionNoParenthesis() {
+
+ return operatorToString() + " " + this.expression.toStringExpression(); //$NON-NLS-1$
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ this.expression.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/WhileStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/WhileStatement.java
new file mode 100644
index 0000000..d1eb28b
--- /dev/null
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/WhileStatement.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
+import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
+import net.sourceforge.phpdt.internal.compiler.flow.LoopingFlowContext;
+import net.sourceforge.phpdt.internal.compiler.impl.Constant;
+import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
+import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
+
+
+public class WhileStatement extends Statement {
+
+ public Expression condition;
+ public Statement action;
+ private Label breakLabel, continueLabel;
+ int preCondInitStateIndex = -1;
+ int condIfTrueInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public WhileStatement(Expression condition, Statement action, int s, int e) {
+
+ this.condition = condition;
+ this.action = action;
+ sourceStart = s;
+ sourceEnd = e;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+
+ breakLabel = new Label();
+ continueLabel = new Label();
+
+ Constant cst = this.condition.constant;
+ boolean isConditionTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isConditionFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ cst = this.condition.optimizedBooleanConstant();
+ boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
+ boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+
+ preCondInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(flowInfo);
+ LoopingFlowContext condLoopContext;
+ FlowInfo postCondInfo =
+ this.condition.analyseCode(
+ currentScope,
+ (condLoopContext =
+ new LoopingFlowContext(flowContext, this, null, null, currentScope)),
+ flowInfo);
+
+ LoopingFlowContext loopingContext;
+ FlowInfo actionInfo;
+// if (action == null
+// || (action.isEmptyBlock() && currentScope.environment().options.complianceLevel <= CompilerOptions.JDK1_3)) {
+// condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo);
+// if (isConditionTrue) {
+// return FlowInfo.DEAD_END;
+// } else {
+// FlowInfo mergedInfo = postCondInfo.initsWhenFalse().unconditionalInits();
+// if (isConditionOptimizedTrue){
+// mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
+// }
+// mergedInitStateIndex =
+// currentScope.methodScope().recordInitializationStates(mergedInfo);
+// return mergedInfo;
+// }
+// } else {
+ // in case the condition was inlined to false, record the fact that there is no way to reach any
+ // statement inside the looping action
+ loopingContext =
+ new LoopingFlowContext(
+ flowContext,
+ this,
+ breakLabel,
+ continueLabel,
+ currentScope);
+ if (isConditionFalse) {
+ actionInfo = FlowInfo.DEAD_END;
+ } else {
+ actionInfo = postCondInfo.initsWhenTrue().copy();
+ if (isConditionOptimizedFalse){
+ actionInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ }
+
+ // for computing local var attributes
+ condIfTrueInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(
+ postCondInfo.initsWhenTrue());
+
+ if (!actionInfo.complainIfUnreachable(action, currentScope, false)) {
+ actionInfo = action.analyseCode(currentScope, loopingContext, actionInfo);
+ }
+
+ // code generation can be optimized when no need to continue in the loop
+ if (!actionInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
+ continueLabel = null;
+ } else {
+ // TODO: (philippe) should simplify in one Loop context
+ condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo);
+ loopingContext.complainOnFinalAssignmentsInLoop(currentScope, actionInfo);
+ }
+// }
+
+ // infinite loop
+ FlowInfo mergedInfo;
+ if (isConditionOptimizedTrue) {
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(
+ mergedInfo = loopingContext.initsOnBreak);
+ return mergedInfo;
+ }
+
+ // end of loop: either condition false or break
+ mergedInfo =
+ postCondInfo.initsWhenFalse().unconditionalInits().mergedWith(
+ loopingContext.initsOnBreak);
+ if (isConditionOptimizedTrue && continueLabel == null){
+ mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
+ }
+ mergedInitStateIndex =
+ currentScope.methodScope().recordInitializationStates(mergedInfo);
+ return mergedInfo;
+ }
+
+ /**
+ * While code generation
+ *
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ */
+// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+//
+// if ((bits & IsReachableMASK) == 0) {
+// return;
+// }
+// int pc = codeStream.position;
+// breakLabel.codeStream = codeStream;
+//
+// // generate condition
+// if (continueLabel == null) {
+// // no need to reverse condition
+// if (condition.constant == NotAConstant) {
+// condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// null,
+// breakLabel,
+// true);
+// }
+// } else {
+// continueLabel.codeStream = codeStream;
+// if (!(((condition.constant != NotAConstant)
+// && (condition.constant.booleanValue() == true))
+// || (action == null)
+// || action.isEmptyBlock())) {
+// int jumpPC = codeStream.position;
+// codeStream.goto_(continueLabel);
+// codeStream.recordPositionsFrom(jumpPC, condition.sourceStart);
+// }
+// }
+// // generate the action
+// Label actionLabel;
+// (actionLabel = new Label(codeStream)).place();
+// if (action != null) {
+// // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
+// if (condIfTrueInitStateIndex != -1) {
+// // insert all locals initialized inside the condition into the action generated prior to the condition
+// codeStream.addDefinitelyAssignedVariables(
+// currentScope,
+// condIfTrueInitStateIndex);
+// }
+// action.generateCode(currentScope, codeStream);
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (preCondInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// preCondInitStateIndex);
+// }
+//
+// }
+// // output condition and branch back to the beginning of the repeated action
+// if (continueLabel != null) {
+// continueLabel.place();
+// condition.generateOptimizedBoolean(
+// currentScope,
+// codeStream,
+// actionLabel,
+// null,
+// true);
+// }
+// breakLabel.place();
+//
+// // May loose some local variable initializations : affecting the local variable attributes
+// if (mergedInitStateIndex != -1) {
+// codeStream.removeNotDefinitelyAssignedVariables(
+// currentScope,
+// mergedInitStateIndex);
+// }
+// codeStream.recordPositionsFrom(pc, this.sourceStart);
+// }
+
+ public void resetStateForCodeGeneration() {
+ if (this.breakLabel != null) {
+ this.breakLabel.resetStateForCodeGeneration();
+ }
+ if (this.continueLabel != null) {
+ this.continueLabel.resetStateForCodeGeneration();
+ }
+ }
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("while ("); //$NON-NLS-1$
+ condition.printExpression(0, output).append(')');
+ if (action == null)
+ output.append(';');
+ else
+ action.printStatement(tab + 1, output);
+ return output;
+ }
+ public void resolve(BlockScope scope) {
+
+ TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
+ condition.implicitWidening(type, type);
+ if (action != null)
+ action.resolve(scope);
+ }
+
+ public String toString(int tab) {
+
+ String s = tabString(tab);
+ s = s + "while (" + condition.toStringExpression() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (action == null)
+ s = s + " {} ;"; //$NON-NLS-1$
+ else if (action instanceof Block)
+ s = s + "\n" + action.toString(tab + 1); //$NON-NLS-1$
+ else
+ s = s + " {\n" + action.toString(tab + 1) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ condition.traverse(visitor, blockScope);
+ if (action != null)
+ action.traverse(visitor, blockScope);
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/ExceptionHandlingFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
index 5a2b072..0ddf6ab 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
@@ -12,12 +12,12 @@ package net.sourceforge.phpdt.internal.compiler.flow;
import java.util.ArrayList;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.codegen.ObjectCache;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FinallyFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FinallyFlowContext.java
index 21644b3..9adb823 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FinallyFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FinallyFlowContext.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.Reference;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Reference;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java
index 5cefb30..dca4536 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowContext.java
@@ -11,6 +11,10 @@
package net.sourceforge.phpdt.internal.compiler.flow;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Reference;
+import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
import net.sourceforge.phpdt.internal.compiler.codegen.Label;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
@@ -18,10 +22,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants;
import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Reference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowInfo.java
index 8226796..dfa74a9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowInfo.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/FlowInfo.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
+import net.sourceforge.phpdt.internal.compiler.ast.Statement;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Statement;
public abstract class FlowInfo {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InitializationFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InitializationFlowContext.java
index 11a8759..10e348e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InitializationFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InitializationFlowContext.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java
index e927a45..b124402 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/InsideSubRoutineFlowContext.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LabelFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LabelFlowContext.java
index 97d94ed..47ca611 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LabelFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LabelFlowContext.java
@@ -11,9 +11,9 @@
package net.sourceforge.phpdt.internal.compiler.flow;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.codegen.Label;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java
index 21239c1..130fd4e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/LoopingFlowContext.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.Reference;
import net.sourceforge.phpdt.internal.compiler.codegen.Label;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Reference;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java
index e07bb19..fc455c7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/SwitchFlowContext.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.flow;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
/**
* Reflects the context of code analysis, keeping track of enclosing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/Constant.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/Constant.java
index c1b8d7e..53e0d0a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/Constant.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/Constant.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.impl;
+import net.sourceforge.phpdt.internal.compiler.ast.OperatorIds;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeIds;
import net.sourceforge.phpdt.internal.compiler.problem.ShouldNotImplement;
import net.sourceforge.phpdt.internal.compiler.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.OperatorIds;
public abstract class Constant implements TypeIds, OperatorIds {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BinaryTypeBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BinaryTypeBinding.java
index 04dd47d..127acbe 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -11,12 +11,12 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryField;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryMethod;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryNestedType;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryType;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
/*
Not all fields defined by this type are initialized when it is created.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BlockScope.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BlockScope.java
index 6ae9a68..b6cc496 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BlockScope.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BlockScope.java
@@ -11,10 +11,10 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
public class BlockScope extends Scope {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ClassScope.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ClassScope.java
index 6e26e42..4fd2e45 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ClassScope.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ClassScope.java
@@ -11,14 +11,14 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfObject;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Clinit;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
public class ClassScope extends Scope {
public TypeDeclaration referenceContext;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java
index 49b458d..b07c8f8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -13,15 +13,15 @@ package net.sourceforge.phpdt.internal.compiler.lookup;
import java.util.ArrayList;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.util.CompoundNameVector;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfObject;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfType;
import net.sourceforge.phpdt.internal.compiler.util.ObjectVector;
import net.sourceforge.phpdt.internal.compiler.util.SimpleNameVector;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/FieldBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/FieldBinding.java
index 1884c48..598715f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/FieldBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/FieldBinding.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.lookup;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ImportBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ImportBinding.java
index 22a123a..b226412 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ImportBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/ImportBinding.java
@@ -11,7 +11,7 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
public class ImportBinding extends Binding {
public char[][] compoundName;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalTypeBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalTypeBinding.java
index 73c9e06..438e006 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalTypeBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalTypeBinding.java
@@ -11,8 +11,8 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
public final class LocalTypeBinding extends NestedTypeBinding {
final static char[] LocalTypePrefix = { '$', 'L', 'o', 'c', 'a', 'l', '$' };
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalVariableBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalVariableBinding.java
index eba475f..c69d11b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalVariableBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LocalVariableBinding.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.lookup;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
public class LocalVariableBinding extends VariableBinding {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LookupEnvironment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LookupEnvironment.java
index 249d948..54e6de2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/LookupEnvironment.java
@@ -11,6 +11,7 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.env.IBinaryType;
import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer;
@@ -18,7 +19,6 @@ import net.sourceforge.phpdt.internal.compiler.impl.ITypeRequestor;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfPackage;
import net.sourceforge.phpdt.internal.compiler.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
public class LookupEnvironment implements BaseTypes, ProblemReasons, TypeConstants {
// public CompilerOptions options;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodBinding.java
index bf7a59d..0d91862 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodBinding.java
@@ -11,8 +11,8 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
public class MethodBinding extends Binding implements BaseTypes, TypeConstants {
public int modifiers;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodScope.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodScope.java
index a34e3f1..b4d38bf 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodScope.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodScope.java
@@ -10,15 +10,15 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.lookup;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
/**
* Particular block scope used for methods, constructors or clinits, representing
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodVerifier.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodVerifier.java
index 75f862c..cf46cd2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodVerifier.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/MethodVerifier.java
@@ -11,10 +11,10 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.util.HashtableOfObject;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
public final class MethodVerifier implements TagBits, TypeConstants {
SourceTypeBinding type;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/Scope.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/Scope.java
index 9ad53e7..2957f65 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/Scope.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/Scope.java
@@ -11,13 +11,13 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.util.ObjectVector;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
public abstract class Scope
implements
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java
index 97f6ed8..87fd4e9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -14,16 +14,16 @@ import java.util.Enumeration;
import java.util.Hashtable;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.AssertStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AssertStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
public class SourceTypeBinding extends ReferenceBinding {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java
index 7b729e9..852739a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java
@@ -11,8 +11,8 @@
package net.sourceforge.phpdt.internal.compiler.lookup;
import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
public class SyntheticAccessMethodBinding extends MethodBinding {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/NLSLine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/NLSLine.java
index f6bb64a..18f7135 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/NLSLine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/NLSLine.java
@@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
public class NLSLine {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
index 12e3dfb..c34ca1d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
@@ -14,6 +14,33 @@ import java.util.HashSet;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
+import net.sourceforge.phpdt.internal.compiler.ast.AND_AND_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Block;
+import net.sourceforge.phpdt.internal.compiler.ast.BreakStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ContinueStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
+import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.OperatorIds;
+import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Statement;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteralDQ;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteralSQ;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilerModifiers;
@@ -23,33 +50,6 @@ import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
import net.sourceforge.phpdt.internal.compiler.util.Util;
import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AND_AND_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BreakStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConditionalExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ContinueStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IfStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.OR_OR_Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.OperatorIds;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Statement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteralDQ;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteralSQ;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
import org.eclipse.core.resources.IFile;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java
index 4a3cac8..169bebd 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/RecoveredElement.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.parser;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Block;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Statement;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.Block;
+import net.sourceforge.phpdt.internal.compiler.ast.Statement;
/**
* Internal structure for parsing recovery
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
index 0b12fc7..e4ed1ce 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
@@ -2,7 +2,7 @@
* Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Common Public License v0.5 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/cpl-v05.html
- *
+ *
* Contributors: IBM Corporation - initial API and implementation
**********************************************************************************************************************************/
package net.sourceforge.phpdt.internal.compiler.parser;
@@ -15,8 +15,8 @@ import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.IScanner;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
+import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
-import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
public class Scanner implements IScanner, ITerminalSymbols {
/*
@@ -144,7 +144,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
static final int[] ObviousIdentCharNatures = new int[MAX_OBVIOUS];
public final static int C_DOLLAR = 8;
-
+
public final static int C_LETTER = 4;
public final static int C_DIGIT = 3;
@@ -165,7 +165,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
ObviousIdentCharNatures[i] = C_LETTER;
ObviousIdentCharNatures['$'] = C_DOLLAR;
-
+
ObviousIdentCharNatures[10] = C_SPACE; // \ u000a: LINE FEED
ObviousIdentCharNatures[12] = C_SPACE; // \ u000c: FORM FEED
ObviousIdentCharNatures[13] = C_SPACE; // \ u000d: CARRIAGE RETURN
@@ -278,10 +278,10 @@ public class Scanner implements IScanner, ITerminalSymbols {
/**
* Determines if the specified character is permissible as the first character
* in a PHP identifier or variable
- *
+ *
* The '$' character for PHP variables is regarded as a correct first
* character !
- *
+ *
*/
public static boolean isPHPIdentOrVarStart(char ch) {
if (ch < MAX_OBVIOUS) {
@@ -294,7 +294,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
/**
* Determines if the specified character is permissible as the first character
* in a PHP identifier.
- *
+ *
* The '$' character for PHP variables isn't regarded as the first character !
*/
public static boolean isPHPIdentifierStart(char ch) {
@@ -323,7 +323,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
}
return false;
}
-
+
public final boolean atEnd() {
// This code is not relevant if source is
// Only a part of the real stream input
@@ -430,6 +430,11 @@ public class Scanner implements IScanner, ITerminalSymbols {
return this.startPosition;
}
+ public final String getCurrentStringLiteral() {
+ char[] result = getCurrentStringLiteralSource();
+ return new String(result);
+ }
+
public final char[] getCurrentStringLiteralSource() {
// Return the token REAL source (aka unicodes are precomputed)
if (startPosition + 1 >= currentPosition) {
@@ -453,10 +458,10 @@ public class Scanner implements IScanner, ITerminalSymbols {
/*
* Search the source position corresponding to the end of a given line number
- *
+ *
* Line numbers are 1-based, and relative to the scanner initialPosition.
* Character positions are 0-based.
- *
+ *
* In case the given line number is inconsistent, answers -1.
*/
public final int getLineEnd(int lineNumber) {
@@ -475,12 +480,12 @@ public class Scanner implements IScanner, ITerminalSymbols {
/**
* Search the source position corresponding to the beginning of a given line
* number
- *
+ *
* Line numbers are 1-based, and relative to the scanner initialPosition.
* Character positions are 0-based.
- *
+ *
* e.g. getLineStart(1) --> 0 i.e. first line starts at character 0.
- *
+ *
* In case the given line number is inconsistent, answers -1.
*/
public final int getLineStart(int lineNumber) {
@@ -3760,7 +3765,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
/**
* Search the line number corresponding to a specific position
- *
+ *
*/
public final int getLineNumber(int position) {
if (lineEnds == null)
@@ -3967,7 +3972,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
case TokenNameStringInterpolated:
return "StringInterpolated(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
case TokenNameEncapsedString0:
- return "`"; //$NON-NLS-1$
+ return "`"; //$NON-NLS-1$
// case TokenNameEncapsedString1:
// return "\'"; //$NON-NLS-1$
// case TokenNameEncapsedString2:
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SourceTypeConverter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SourceTypeConverter.java
index 4452e00..e32922d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SourceTypeConverter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/SourceTypeConverter.java
@@ -27,25 +27,25 @@ import java.util.ArrayList;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayQualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
+import net.sourceforge.phpdt.internal.compiler.ast.MemberTypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.compiler.env.ISourceField;
import net.sourceforge.phpdt.internal.compiler.env.ISourceMethod;
import net.sourceforge.phpdt.internal.compiler.env.ISourceType;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilerModifiers;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayQualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MemberTypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
public class SourceTypeConverter implements CompilerModifiers {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java
index 9785834..06855a0 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java
@@ -4,16 +4,16 @@ package net.sourceforge.phpdt.internal.compiler.parser;
import net.sourceforge.phpdt.core.IJavaModelMarker;
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Initializer;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/VariableInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/VariableInfo.java
index ce09406..4f79776 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/VariableInfo.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/VariableInfo.java
@@ -1,6 +1,6 @@
package net.sourceforge.phpdt.internal.compiler.parser;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
public class VariableInfo {
static final public int LEVEL_UNDEFINED = 0;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java
index d1a5444..d2842a0 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java
@@ -13,6 +13,46 @@ import net.sourceforge.phpdt.core.compiler.InvalidInputException;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
import net.sourceforge.phpdt.internal.compiler.IErrorHandlingPolicy;
import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
+import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractVariableDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.AllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayAllocationExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ArrayReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Assignment;
+import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.CaseStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
+import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase;
+import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
+import net.sourceforge.phpdt.internal.compiler.ast.Expression;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
+import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
+import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.Literal;
+import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
+import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.NameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.NumberLiteral;
+import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Reference;
+import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
+import net.sourceforge.phpdt.internal.compiler.ast.Statement;
+import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
+import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
+import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
import net.sourceforge.phpdt.internal.compiler.env.IConstants;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
@@ -32,46 +72,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants;
import net.sourceforge.phpdt.internal.compiler.parser.Parser;
import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
import net.sourceforge.phpdt.internal.compiler.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractVariableDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.DefaultCase;
-import net.sourceforge.phpeclipse.internal.compiler.ast.EqualExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Expression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
-import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Literal;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LocalDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.LongLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MessageSend;
-import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.NumberLiteral;
-import net.sourceforge.phpeclipse.internal.compiler.ast.QualifiedNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Reference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ReturnStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.SingleNameReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Statement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThisReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ThrowStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TryStatement;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression;
public class ProblemReporter extends ProblemHandler implements ProblemReasons {
public ReferenceContext referenceContext;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
index d150dd3..a17cf19 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnit.java
@@ -43,11 +43,11 @@ import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.jdom.IDOMNode;
import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
import net.sourceforge.phpdt.internal.compiler.SourceElementParser;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.core.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
index 9e1482f..243ddc2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java
@@ -30,6 +30,7 @@ import net.sourceforge.phpdt.internal.compiler.DefaultErrorHandlingPolicies;
import net.sourceforge.phpdt.internal.compiler.ICompilerRequestor;
import net.sourceforge.phpdt.internal.compiler.IErrorHandlingPolicy;
import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
import net.sourceforge.phpdt.internal.compiler.env.ISourceType;
import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding;
@@ -38,7 +39,6 @@ import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
import net.sourceforge.phpdt.internal.core.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
index 64e55bf..09ea48e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
@@ -16,8 +16,8 @@ import net.sourceforge.phpdt.core.IJavaModelStatusConstants;
import net.sourceforge.phpdt.core.IProblemRequestor;
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.WorkingCopyOwner;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.core.util.Util;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
/**
* Reconcile a working copy and signal the changes through a delta.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java
index 5acdf98..571ced2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/ASTNodeFinder.java
@@ -18,14 +18,14 @@ import net.sourceforge.phpdt.core.IMethod;
import net.sourceforge.phpdt.core.IType;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
+import net.sourceforge.phpdt.internal.compiler.ast.AbstractMethodDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.Argument;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
/**
* Finds an ASTNode given an IJavaElement in a CompilationUnitDeclaration
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
index bd4e0cc..25ff589 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/CommentRecorderParser.java
@@ -10,11 +10,11 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.core.util;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
/**
* Internal parser used for parsing source to create DOM AST nodes.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
index 0cf32b2..ccfbc90 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/util/Util.java
@@ -30,10 +30,10 @@ import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.Signature;
import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.internal.compiler.ast.TypeReference;
import net.sourceforge.phpdt.internal.core.Assert;
import net.sourceforge.phpdt.internal.core.PackageFragmentRoot;
import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
-import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AND_AND_Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AND_AND_Expression.java
deleted file mode 100644
index a0ae11f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AND_AND_Expression.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-//dedicated treatment for the &&
-public class AND_AND_Expression extends BinaryExpression {
-
- int rightInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public AND_AND_Expression(Expression left, Expression right, int operator) {
- super(left, right, operator);
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- Constant cst = this.left.optimizedBooleanConstant();
- boolean isLeftOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isLeftOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- if (isLeftOptimizedTrue) {
- // TRUE && anything
- // need to be careful of scenario:
- // (x && y) && !z, if passing the left info to the right, it would be swapped by the !
- FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- mergedInfo = right.analyseCode(currentScope, flowContext, mergedInfo);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- FlowInfo leftInfo = left.analyseCode(currentScope, flowContext, flowInfo);
- // need to be careful of scenario:
- // (x && y) && !z, if passing the left info to the right, it would be swapped by the !
- FlowInfo rightInfo = leftInfo.initsWhenTrue().unconditionalInits().copy();
- rightInitStateIndex =
- currentScope.methodScope().recordInitializationStates(rightInfo);
-
- int previousMode = rightInfo.reachMode();
- if (isLeftOptimizedFalse){
- rightInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- rightInfo = right.analyseCode(currentScope, flowContext, rightInfo);
- FlowInfo trueMergedInfo = rightInfo.initsWhenTrue().copy();
- rightInfo.setReachMode(previousMode); // reset after trueMergedInfo got extracted
-
- FlowInfo mergedInfo =
- FlowInfo.conditional(
- trueMergedInfo,
- leftInfo.initsWhenFalse().copy().unconditionalInits().mergedWith(
- rightInfo.initsWhenFalse().copy().unconditionalInits()));
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- /**
- * Code generation for a binary operation
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Label falseLabel, endLabel;
-// if (constant != Constant.NotAConstant) {
-// // inlined value
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// bits |= OnlyValueRequiredMASK;
-// generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 && false
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-
- /**
- * Boolean operator code generation
- * Optimized operations are: &&
- */
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// if (constant != Constant.NotAConstant) {
-// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// return;
-// }
-// Constant condConst;
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // && x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// } else {
-// // && x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x &&
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// } else {
-// // x &&
-// Label internalTrueLabel = new Label(codeStream);
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// internalTrueLabel, // will be false in the end
-// null,
-// false);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// internalTrueLabel.place();
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// return;
-// }
-// // default case
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// Label internalFalseLabel = new Label(codeStream);
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// internalFalseLabel,
-// true);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// null,
-// valueRequired);
-// internalFalseLabel.place();
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// left.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, true);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// falseLabel,
-// valueRequired);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// }
-
- public boolean isCompactableOperation() {
- return false;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- left.traverse(visitor, scope);
- right.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ASTNode.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ASTNode.java
deleted file mode 100644
index 2d7dd88..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ASTNode.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypes;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.CompilerModifiers;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeIds;
-
-
-public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConstants, TypeIds {
-
- public int sourceStart, sourceEnd;
-
- //some global provision for the hierarchy
- public final static Constant NotAConstant = Constant.NotAConstant;
-
- // storage for internal flags (32 bits) BIT USAGE
- public final static int Bit1 = 0x1; // return type (operators) | name reference kind (name ref) | add assertion (type decl)
- public final static int Bit2 = 0x2; // return type (operators) | name reference kind (name ref) | has local type (type, method, field decl)
- public final static int Bit3 = 0x4; // return type (operators) | name reference kind (name ref) | implicit this (this ref)
- public final static int Bit4 = 0x8; // return type (operators) | first assignment to local (local decl)
- public final static int Bit5 = 0x10; // value for return (binary expression) |
- public final static int Bit6 = 0x20; // depth (name ref, msg) | only value required (binary expression)
- public final static int Bit7 = 0x40; // depth (name ref, msg) | operator (operators)
- public final static int Bit8 = 0x80; // depth (name ref, msg) | operator (operators)
- public final static int Bit9 = 0x100; // depth (name ref, msg) | operator (operators)
- public final static int Bit10= 0x200; // depth (name ref, msg) | operator (operators)
- public final static int Bit11 = 0x400; // depth (name ref, msg) | operator (operators)
- public final static int Bit12 = 0x800; // depth (name ref, msg) | operator (operators)
- public final static int Bit13 = 0x1000; // depth (name ref, msg)
- public final static int Bit14 = 0x2000; // assigned (reference lhs)
- public final static int Bit15 = 0x4000;
- public final static int Bit16 = 0x8000;
- public final static int Bit17 = 0x10000;
- public final static int Bit18 = 0x20000;
- public final static int Bit19 = 0x40000;
- public final static int Bit20 = 0x80000;
- public final static int Bit21 = 0x100000;
- public final static int Bit22 = 0x200000; // parenthesis count (expression)
- public final static int Bit23 = 0x400000; // parenthesis count (expression)
- public final static int Bit24 = 0x800000; // parenthesis count (expression)
- public final static int Bit25 = 0x1000000; // parenthesis count (expression)
- public final static int Bit26 = 0x2000000; // parenthesis count (expression)
- public final static int Bit27 = 0x4000000; // parenthesis count (expression)
- public final static int Bit28 = 0x8000000; // parenthesis count (expression)
- public final static int Bit29 = 0x10000000; // parenthesis count (expression)
- public final static int Bit30 = 0x20000000; // assignment with no effect (assignment)
- public final static int Bit31 = 0x40000000; // local declaration reachable (local decl)
- public final static int Bit32 = 0x80000000; // reachable (statement)
-
- public int bits = IsReachableMASK; // reachable by default
-
- // for operators
- public static final int ReturnTypeIDMASK = Bit1|Bit2|Bit3|Bit4;
- public static final int OperatorSHIFT = 6; // Bit7 -> Bit12
- public static final int OperatorMASK = Bit7|Bit8|Bit9|Bit10|Bit11|Bit12; // 6 bits for operator ID
-
- // for binary expressions
- public static final int ValueForReturnMASK = Bit5;
- public static final int OnlyValueRequiredMASK = Bit6;
-
- // for name references
- public static final int RestrictiveFlagMASK = Bit1|Bit2|Bit3;
- public static final int FirstAssignmentToLocalMASK = Bit4;
-
- // for this reference
- public static final int IsImplicitThisMask = Bit3;
-
- // for single name references
- public static final int DepthSHIFT = 5; // Bit6 -> Bit13
- public static final int DepthMASK = Bit6|Bit7|Bit8|Bit9|Bit10|Bit11|Bit12|Bit13; // 8 bits for actual depth value (max. 255)
-
- // for statements
- public static final int IsReachableMASK = Bit32;
- public static final int IsLocalDeclarationReachableMASK = Bit31;
-
- // for type declaration
- public static final int AddAssertionMASK = Bit1;
- public static final int IsMemberTypeMASK = Bit11; // local member do not know it is local at parse time (need to look at binding)
-
- // for type, method and field declarations
- public static final int HasLocalTypeMASK = Bit2; // cannot conflict with AddAssertionMASK
-
- // for expression
- public static final int ParenthesizedSHIFT = 21; // Bit22 -> Bit29
- public static final int ParenthesizedMASK = Bit22|Bit23|Bit24|Bit25|Bit26|Bit27|Bit28|Bit29; // 8 bits for parenthesis count value (max. 255)
-
- // for assignment
- public static final int IsAssignmentWithNoEffectMASK = Bit30;
-
- // for references on lhs of assignment (set only for true assignments, as opposed to compound ones)
- public static final int IsStrictlyAssignedMASK = Bit14;
- public static final int IsCompoundAssignedMASK = Bit17; // set only for compound assignments, as opposed to other ones
-
- // for empty statement
- public static final int IsUsefulEmptyStatementMASK = Bit1;
-
- // for block and method declaration
- public static final int UndocumentedEmptyBlockMASK = Bit4;
-
- // for compilation unit
- public static final int HasAllMethodBodies = Bit5;
-
- // for references in Javadoc comments
- public static final int InsideJavadoc = Bit16;
-
- // for if statement
- public static final int IsElseIfStatement = Bit30;
-
- public ASTNode() {
-
- super();
- }
-
- public boolean cannotReturn() {
- return false;
- }
-
- public ASTNode concreteStatement() {
- return this;
- }
-
- /* Answer true if the field use is considered deprecated.
- * An access in the same compilation unit is allowed.
- */
- public final boolean isFieldUseDeprecated(FieldBinding field, Scope scope) {
-
- if (field.isPrivate() && !scope.isDefinedInField(field)) {
- // ignore cases where field is used from within inside itself
- field.modifiers |= AccPrivateUsed;
- }
-
- if (!field.isViewedAsDeprecated()) return false;
-
- // inside same unit - no report
- if (scope.isDefinedInSameUnit(field.declaringClass)) return false;
-
- // if context is deprecated, may avoid reporting
-// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
- return true;
- }
-
- public boolean isImplicitThis() {
-
- return false;
- }
-
- /* Answer true if the method use is considered deprecated.
- * An access in the same compilation unit is allowed.
- */
- public final boolean isMethodUseDeprecated(MethodBinding method, Scope scope) {
-
- if (method.isPrivate() && !scope.isDefinedInMethod(method)) {
- // ignore cases where method is used from within inside itself (e.g. direct recursions)
- method.modifiers |= AccPrivateUsed;
- }
-
- if (!method.isViewedAsDeprecated()) return false;
-
- // inside same unit - no report
- if (scope.isDefinedInSameUnit(method.declaringClass)) return false;
-
- // if context is deprecated, may avoid reporting
-// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
- return true;
- }
-
- public boolean isSuper() {
-
- return false;
- }
-
- public boolean isThis() {
-
- return false;
- }
-
- /* Answer true if the type use is considered deprecated.
- * An access in the same compilation unit is allowed.
- */
- public final boolean isTypeUseDeprecated(TypeBinding type, Scope scope) {
-
- if (type.isArrayType())
- type = ((ArrayBinding) type).leafComponentType;
- if (type.isBaseType())
- return false;
-
- ReferenceBinding refType = (ReferenceBinding) type;
-
- if (refType.isPrivate() && !scope.isDefinedInType(refType)) {
- // ignore cases where type is used from within inside itself
- refType.modifiers |= AccPrivateUsed;
- }
-
- if (!refType.isViewedAsDeprecated()) return false;
-
- // inside same unit - no report
- if (scope.isDefinedInSameUnit(refType)) return false;
-
- // if context is deprecated, may avoid reporting
-// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
- return true;
- }
-
- public static String modifiersString(int modifiers) {
-
- String s = ""; //$NON-NLS-1$
- if ((modifiers & AccPublic) != 0)
- s = s + "public "; //$NON-NLS-1$
- if ((modifiers & AccPrivate) != 0)
- s = s + "private "; //$NON-NLS-1$
- if ((modifiers & AccProtected) != 0)
- s = s + "protected "; //$NON-NLS-1$
- if ((modifiers & AccStatic) != 0)
- s = s + "static "; //$NON-NLS-1$
- if ((modifiers & AccFinal) != 0)
- s = s + "final "; //$NON-NLS-1$
-// if ((modifiers & AccSynchronized) != 0)
-// s = s + "synchronized "; //$NON-NLS-1$
-// if ((modifiers & AccVolatile) != 0)
-// s = s + "volatile "; //$NON-NLS-1$
-// if ((modifiers & AccTransient) != 0)
-// s = s + "transient "; //$NON-NLS-1$
-// if ((modifiers & AccNative) != 0)
-// s = s + "native "; //$NON-NLS-1$
- if ((modifiers & AccAbstract) != 0)
- s = s + "abstract "; //$NON-NLS-1$
- return s;
- }
-
- public abstract StringBuffer print(int indent, StringBuffer output);
-
- public static StringBuffer printIndent(int indent, StringBuffer output) {
-
- for (int i = indent; i > 0; i--) output.append(" "); //$NON-NLS-1$
- return output;
- }
-
- public static StringBuffer printModifiers(int modifiers, StringBuffer output) {
-
- if ((modifiers & AccPublic) != 0)
- output.append("public "); //$NON-NLS-1$
- if ((modifiers & AccPrivate) != 0)
- output.append("private "); //$NON-NLS-1$
- if ((modifiers & AccProtected) != 0)
- output.append("protected "); //$NON-NLS-1$
- if ((modifiers & AccStatic) != 0)
- output.append("static "); //$NON-NLS-1$
- if ((modifiers & AccFinal) != 0)
- output.append("final "); //$NON-NLS-1$
-// if ((modifiers & AccSynchronized) != 0)
-// output.append("synchronized "); //$NON-NLS-1$
-// if ((modifiers & AccVolatile) != 0)
-// output.append("volatile "); //$NON-NLS-1$
-// if ((modifiers & AccTransient) != 0)
-// output.append("transient "); //$NON-NLS-1$
-// if ((modifiers & AccNative) != 0)
-// output.append("native "); //$NON-NLS-1$
- if ((modifiers & AccAbstract) != 0)
- output.append("abstract "); //$NON-NLS-1$
- return output;
- }
- /**
- * @deprecated - use field instead
- */
- public int sourceEnd() {
- return sourceEnd;
- }
-
- /**
- * @deprecated - use field instead
- */
- public int sourceStart() {
- return sourceStart;
- }
-
- public static String tabString(int tab) {
-
- String s = ""; //$NON-NLS-1$
- for (int i = tab; i > 0; i--)
- s = s + " "; //$NON-NLS-1$
- return s;
- }
-
- public String toString() {
-
- return toString(0);
- }
-
- public String toString(int tab) {
-
- return "****" + super.toString() + "****"; //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractMethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractMethodDeclaration.java
deleted file mode 100644
index 217f853..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractMethodDeclaration.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
-import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
-import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
-
-
-public abstract class AbstractMethodDeclaration
- extends ASTNode
- implements ProblemSeverities, ReferenceContext {
-
- public MethodScope scope;
- //it is not relevent for constructor but it helps to have the name of the constructor here
- //which is always the name of the class.....parsing do extra work to fill it up while it do not have to....
- public char[] selector;
- public int declarationSourceStart;
- public int declarationSourceEnd;
- public int modifiers;
- public int modifiersSourceStart;
- public Argument[] arguments;
- public TypeReference[] thrownExceptions;
- public Statement[] statements;
- public int explicitDeclarations;
- public MethodBinding binding;
- public boolean ignoreFurtherInvestigation = false;
- public boolean needFreeReturn = false;
-
- public int bodyStart;
- public int bodyEnd = -1;
- public CompilationResult compilationResult;
-
- AbstractMethodDeclaration(CompilationResult compilationResult){
- this.compilationResult = compilationResult;
- }
-
- /*
- * We cause the compilation task to abort to a given extent.
- */
- public void abort(int abortLevel) {
-
- if (scope == null) {
- throw new AbortCompilation(); // cannot do better
- }
-
- CompilationResult compilationResult =
- scope.referenceCompilationUnit().compilationResult;
-
- switch (abortLevel) {
- case AbortCompilation :
- throw new AbortCompilation(compilationResult);
- case AbortCompilationUnit :
- throw new AbortCompilationUnit(compilationResult);
- case AbortType :
- throw new AbortType(compilationResult);
- default :
- throw new AbortMethod(compilationResult);
- }
- }
-
- public abstract void analyseCode(ClassScope scope, InitializationFlowContext initializationContext, FlowInfo info);
-
- /**
- * Bind and add argument's binding into the scope of the method
- */
- public void bindArguments() {
-
- if (arguments != null) {
- // by default arguments in abstract/native methods are considered to be used (no complaint is expected)
- boolean used = binding == null || binding.isAbstract();// || binding.isNative();
-
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- TypeBinding argType = binding == null ? null : binding.parameters[i];
- arguments[i].bind(scope, argType, used);
- }
- }
- }
-
- /**
- * Record the thrown exception type bindings in the corresponding type references.
- */
- public void bindThrownExceptions() {
-
- if (this.thrownExceptions != null
- && this.binding != null
- && this.binding.thrownExceptions != null) {
- int thrownExceptionLength = this.thrownExceptions.length;
- int length = this.binding.thrownExceptions.length;
- if (length == thrownExceptionLength) {
- for (int i = 0; i < length; i++) {
- this.thrownExceptions[i].resolvedType = this.binding.thrownExceptions[i];
- }
- } else {
- int bindingIndex = 0;
- for (int i = 0; i < thrownExceptionLength && bindingIndex < length; i++) {
- TypeReference thrownException = this.thrownExceptions[i];
- ReferenceBinding thrownExceptionBinding = this.binding.thrownExceptions[bindingIndex];
- char[][] bindingCompoundName = thrownExceptionBinding.compoundName;
- if (thrownException instanceof SingleTypeReference) {
- // single type reference
- int lengthName = bindingCompoundName.length;
- char[] thrownExceptionTypeName = thrownException.getTypeName()[0];
- if (CharOperation.equals(thrownExceptionTypeName, bindingCompoundName[lengthName - 1])) {
- thrownException.resolvedType = thrownExceptionBinding;
- bindingIndex++;
- }
- } else {
- // qualified type reference
- if (CharOperation.equals(thrownException.getTypeName(), bindingCompoundName)) {
- thrownException.resolvedType = thrownExceptionBinding;
- bindingIndex++;
- }
- }
- }
- }
- }
- }
-
- public CompilationResult compilationResult() {
-
- return this.compilationResult;
- }
-
- /**
- * Bytecode generation for a method
- */
-// public void generateCode(ClassScope classScope, ClassFile classFile) {
-//
-// int problemResetPC = 0;
-// classFile.codeStream.wideMode = false; // reset wideMode to false
-// if (ignoreFurtherInvestigation) {
-// // method is known to have errors, dump a problem method
-// if (this.binding == null)
-// return; // handle methods with invalid signature or duplicates
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemMethod(this, binding, problemsCopy);
-// return;
-// }
-// // regular code generation
-// try {
-// problemResetPC = classFile.contentsOffset;
-// this.generateCode(classFile);
-// } catch (AbortMethod e) {
-// // a fatal error was detected during code generation, need to restart code gen if possible
-// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
-// // a branch target required a goto_w, restart code gen in wide mode.
-// try {
-// this.traverse(new ResetStateForCodeGenerationVisitor(), classScope);
-// classFile.contentsOffset = problemResetPC;
-// classFile.methodCount--;
-// classFile.codeStream.wideMode = true; // request wide mode
-// this.generateCode(classFile); // restart method generation
-// } catch (AbortMethod e2) {
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getAllProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
-// }
-// } else {
-// // produce a problem method accounting for this fatal error
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getAllProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
-// }
-// }
-// }
-//
-// private void generateCode(ClassFile classFile) {
-//
-// classFile.generateMethodInfoHeader(binding);
-// int methodAttributeOffset = classFile.contentsOffset;
-// int attributeNumber = classFile.generateMethodInfoAttribute(binding);
-// if ((!binding.isNative()) && (!binding.isAbstract())) {
-// int codeAttributeOffset = classFile.contentsOffset;
-// classFile.generateCodeAttributeHeader();
-// CodeStream codeStream = classFile.codeStream;
-// codeStream.reset(this, classFile);
-// // initialize local positions
-// this.scope.computeLocalVariablePositions(binding.isStatic() ? 0 : 1, codeStream);
-//
-// // arguments initialization for local variable debug attributes
-// if (arguments != null) {
-// for (int i = 0, max = arguments.length; i < max; i++) {
-// LocalVariableBinding argBinding;
-// codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
-// argBinding.recordInitializationStartPC(0);
-// }
-// }
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++)
-// statements[i].generateCode(scope, codeStream);
-// }
-// if (this.needFreeReturn) {
-// codeStream.return_();
-// }
-// // local variable attributes
-// codeStream.exitUserScope(scope);
-// codeStream.recordPositionsFrom(0, this.declarationSourceEnd);
-// classFile.completeCodeAttribute(codeAttributeOffset);
-// attributeNumber++;
-// } else {
-// checkArgumentsSize();
-// }
-// classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
-//
-// // if a problem got reported during code gen, then trigger problem method creation
-// if (ignoreFurtherInvestigation) {
-// throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
-// }
-// }
-
-// private void checkArgumentsSize() {
-// TypeBinding[] parameters = binding.parameters;
-// int size = 1; // an abstact method or a native method cannot be static
-// for (int i = 0, max = parameters.length; i < max; i++) {
-// TypeBinding parameter = parameters[i];
-// if (parameter == LongBinding || parameter == DoubleBinding) {
-// size += 2;
-// } else {
-// size++;
-// }
-// if (size > 0xFF) {
-// scope.problemReporter().noMoreAvailableSpaceForArgument(scope.locals[i], scope.locals[i].declaration);
-// }
-// }
-// }
-
- public boolean hasErrors() {
- return this.ignoreFurtherInvestigation;
- }
-
- public boolean isAbstract() {
-
- if (binding != null)
- return binding.isAbstract();
- return (modifiers & AccAbstract) != 0;
- }
-
- public boolean isClinit() {
-
- return false;
- }
-
- public boolean isConstructor() {
-
- return false;
- }
-
- public boolean isDefaultConstructor() {
-
- return false;
- }
-
- public boolean isInitializationMethod() {
-
- return false;
- }
-
-// public boolean isNative() {
-//
-// if (binding != null)
-// return binding.isNative();
-// return (modifiers & AccNative) != 0;
-// }
-
- public boolean isStatic() {
-
- if (binding != null)
- return binding.isStatic();
- return (modifiers & AccStatic) != 0;
- }
-
- /**
- * Fill up the method body with statement
- */
- public abstract void parseStatements(
- UnitParser parser,
- CompilationUnitDeclaration unit);
- public StringBuffer print(int tab, StringBuffer output) {
-
- printIndent(tab, output);
- printModifiers(this.modifiers, output);
- printReturnType(0, output).append(this.selector).append('(');
- if (this.arguments != null) {
- for (int i = 0; i < this.arguments.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
- this.arguments[i].print(0, output);
- }
- }
- output.append(')');
- if (this.thrownExceptions != null) {
- output.append(" throws "); //$NON-NLS-1$
- for (int i = 0; i < this.thrownExceptions.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
- this.thrownExceptions[i].print(0, output);
- }
- }
- printBody(tab + 1, output);
- return output;
- }
-
- public StringBuffer printBody(int indent, StringBuffer output) {
-
- if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0)
- return output.append(';');
-
- output.append(" {"); //$NON-NLS-1$
- if (this.statements != null) {
- for (int i = 0; i < this.statements.length; i++) {
- output.append('\n');
- this.statements[i].printStatement(indent, output);
- }
- }
- output.append('\n'); //$NON-NLS-1$
- printIndent(indent == 0 ? 0 : indent - 1, output).append('}');
- return output;
- }
-
- public StringBuffer printReturnType(int indent, StringBuffer output) {
-
- return output;
- }
- public void resolve(ClassScope upperScope) {
-
- if (binding == null) {
- ignoreFurtherInvestigation = true;
- }
-
- try {
- bindArguments();
- bindThrownExceptions();
- resolveStatements();
- } catch (AbortMethod e) { // ========= abort on fatal error =============
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- public void resolveStatements() {
-
- if (statements != null) {
- int i = 0, length = statements.length;
- while (i < length)
- statements[i++].resolve(scope);
- }
- }
-
- public String returnTypeToString(int tab) {
-
- return ""; //$NON-NLS-1$
- }
-
- public void tagAsHavingErrors() {
-
- ignoreFurtherInvestigation = true;
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- if (modifiers != AccDefault) {
- s += modifiersString(modifiers);
- }
-
- s += returnTypeToString(0);
- s += new String(selector) + "("; //$NON-NLS-1$
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- s += arguments[i].toString(0);
- if (i != (arguments.length - 1))
- s = s + ", "; //$NON-NLS-1$
- };
- };
- s += ")"; //$NON-NLS-1$
- if (thrownExceptions != null) {
- s += " throws "; //$NON-NLS-1$
- for (int i = 0; i < thrownExceptions.length; i++) {
- s += thrownExceptions[i].toString(0);
- if (i != (thrownExceptions.length - 1))
- s = s + ", "; //$NON-NLS-1$
- };
- };
-
- s += toStringStatements(tab + 1);
- return s;
- }
-
- public String toStringStatements(int tab) {
-
- if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0)
- return ";"; //$NON-NLS-1$
-
- String s = " {"; //$NON-NLS-1$
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- s = s + "\n" + statements[i].toString(tab); //$NON-NLS-1$
- if (!(statements[i] instanceof Block)) {
- s += ";"; //$NON-NLS-1$
- }
- }
- }
- s += "\n" + tabString(tab == 0 ? 0 : tab - 1) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- ClassScope classScope) {
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractVariableDeclaration.java
deleted file mode 100644
index a426061..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AbstractVariableDeclaration.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public abstract class AbstractVariableDeclaration extends Statement {
- public int modifiers;
-
- public TypeReference type;
- public Expression initialization;
-
- public char[] name;
- public int declarationEnd;
- public int declarationSourceStart;
- public int declarationSourceEnd;
- public int modifiersSourceStart;
-
- public AbstractVariableDeclaration() {}
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return flowInfo;
- }
-
- public abstract String name();
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output);
- printModifiers(this.modifiers, output);
- type.print(0, output).append(' ').append(this.name);
- if (initialization != null) {
- output.append(" = "); //$NON-NLS-1$
- initialization.printExpression(indent, output);
- }
- return output.append(';');
- }
-
- public void resolve(BlockScope scope) {}
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- if (modifiers != AccDefault) {
- s += modifiersString(modifiers);
- }
- s += type.toString(0) + " " + new String(name()); //$NON-NLS-1$
- if (initialization != null)
- s += " = " + initialization.toStringExpression(tab); //$NON-NLS-1$
- return s;
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AllocationExpression.java
deleted file mode 100644
index 0264ea5..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AllocationExpression.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.NestedTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticArgumentBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class AllocationExpression
- extends Expression
- implements InvocationSite {
-
- public TypeReference type;
- public Expression[] arguments;
- public MethodBinding binding;
-
- MethodBinding syntheticAccessor;
-
- public AllocationExpression() {
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // check captured variables are initialized in current context (26134)
- checkCapturedLocalInitializationIfNecessary(this.binding.declaringClass, currentScope, flowInfo);
-
- // process arguments
- if (arguments != null) {
- for (int i = 0, count = arguments.length; i < count; i++) {
- flowInfo =
- arguments[i]
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
- }
- // record some dependency information for exception types
- ReferenceBinding[] thrownExceptions;
- if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
- // check exception handling
- flowContext.checkExceptionHandlers(
- thrownExceptions,
- this,
- flowInfo,
- currentScope);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- manageSyntheticAccessIfNecessary(currentScope);
-
- return flowInfo;
- }
-
- public void checkCapturedLocalInitializationIfNecessary(ReferenceBinding checkedType, BlockScope currentScope, FlowInfo flowInfo) {
-
- if (checkedType.isLocalType()
- && !checkedType.isAnonymousType()
- && !currentScope.isDefinedInType(checkedType)) { // only check external allocations
- NestedTypeBinding nestedType = (NestedTypeBinding) checkedType;
- SyntheticArgumentBinding[] syntheticArguments = nestedType.syntheticOuterLocalVariables();
- if (syntheticArguments != null)
- for (int i = 0, count = syntheticArguments.length; i < count; i++){
- SyntheticArgumentBinding syntheticArgument = syntheticArguments[i];
- LocalVariableBinding targetLocal;
- if ((targetLocal = syntheticArgument.actualOuterLocalVariable) == null) continue;
-// if (targetLocal.declaration != null && !flowInfo.isDefinitelyAssigned(targetLocal)){
-// currentScope.problemReporter().uninitializedLocalVariable(targetLocal, this);
-// }
- }
-
- }
- }
-
- public Expression enclosingInstance() {
- return null;
- }
-
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// ReferenceBinding allocatedType = binding.declaringClass;
-//
-// codeStream.new_(allocatedType);
-// if (valueRequired) {
-// codeStream.dup();
-// }
-// // better highlight for allocation: display the type individually
-// codeStream.recordPositionsFrom(pc, type.sourceStart);
-//
-// // handling innerclass instance allocation - enclosing instance arguments
-// if (allocatedType.isNestedType()) {
-// codeStream.generateSyntheticEnclosingInstanceValues(
-// currentScope,
-// allocatedType,
-// enclosingInstance(),
-// this);
-// }
-// // generate the arguments for constructor
-// if (arguments != null) {
-// for (int i = 0, count = arguments.length; i < count; i++) {
-// arguments[i].generateCode(currentScope, codeStream, true);
-// }
-// }
-// // handling innerclass instance allocation - outer local arguments
-// if (allocatedType.isNestedType()) {
-// codeStream.generateSyntheticOuterArgumentValues(
-// currentScope,
-// allocatedType,
-// this);
-// }
-// // invoke constructor
-// if (syntheticAccessor == null) {
-// codeStream.invokespecial(binding);
-// } else {
-// // synthetic accessor got some extra arguments appended to its signature, which need values
-// for (int i = 0,
-// max = syntheticAccessor.parameters.length - binding.parameters.length;
-// i < max;
-// i++) {
-// codeStream.aconst_null();
-// }
-// codeStream.invokespecial(syntheticAccessor);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public boolean isSuperAccess() {
-
- return false;
- }
-
- public boolean isTypeAccess() {
-
- return true;
- }
-
- /* Inner emulation consists in either recording a dependency
- * link only, or performing one level of propagation.
- *
- * Dependency mechanism is used whenever dealing with source target
- * types, since by the time we reach them, we might not yet know their
- * exact need.
- */
- public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
-
- ReferenceBinding allocatedType;
-
- // perform some emulation work in case there is some and we are inside a local type only
- if ((allocatedType = binding.declaringClass).isNestedType()
- && currentScope.enclosingSourceType().isLocalType()) {
-
- if (allocatedType.isLocalType()) {
- ((LocalTypeBinding) allocatedType).addInnerEmulationDependent(currentScope, false);
- // request cascade of accesses
- } else {
- // locally propagate, since we already now the desired shape for sure
- currentScope.propagateInnerEmulation(allocatedType, false);
- // request cascade of accesses
- }
- }
- }
-
- public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
-
- if (binding.isPrivate()
- && (currentScope.enclosingSourceType() != binding.declaringClass)) {
-
-// if (currentScope
-// .environment()
-// .options
-// .isPrivateConstructorAccessChangingVisibility) {
-// binding.tagForClearingPrivateModifier();
-// // constructor will not be dumped as private, no emulation required thus
-// } else {
- syntheticAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
-// }
- }
- }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- output.append("new "); //$NON-NLS-1$
- type.printExpression(0, output);
- output.append('(');
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
- arguments[i].printExpression(0, output);
- }
- }
- return output.append(')');
- }
- public TypeBinding resolveType(BlockScope scope) {
-
- // Propagate the type checking to the arguments, and check if the constructor is defined.
- constant = NotAConstant;
- this.resolvedType = type.resolveType(scope);
- // will check for null after args are resolved
-
- // buffering the arguments' types
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- boolean argHasError = false;
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null)
- argHasError = true;
- if (argHasError)
- return this.resolvedType;
- }
- if (this.resolvedType == null)
- return null;
-
- if (!this.resolvedType.canBeInstantiated()) {
- scope.problemReporter().cannotInstantiate(type, this.resolvedType);
- return this.resolvedType;
- }
- ReferenceBinding allocatedType = (ReferenceBinding) this.resolvedType;
- if (!(binding = scope.getConstructor(allocatedType, argumentTypes, this))
- .isValidBinding()) {
- if (binding.declaringClass == null)
- binding.declaringClass = allocatedType;
- scope.problemReporter().invalidConstructor(this, binding);
- return this.resolvedType;
- }
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(binding, this);
-
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
- return allocatedType;
- }
-
- public void setActualReceiverType(ReferenceBinding receiverType) {
- // ignored
- }
-
- public void setDepth(int i) {
- // ignored
- }
-
- public void setFieldIndex(int i) {
- // ignored
- }
-
- public String toStringExpression() {
-
- String s = "new " + type.toString(0); //$NON-NLS-1$
- if (arguments == null)
- s = s + "()"; //$NON-NLS-1$
- else {
- s = s + "("; //$NON-NLS-1$
- for (int i = 0; i < arguments.length; i++) {
- s = s + arguments[i].toStringExpression();
- if (i == (arguments.length - 1))
- s = s + ")"; //$NON-NLS-1$
- else
- s = s + ", "; //$NON-NLS-1$
- }
- }
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- int argumentsLength;
- type.traverse(visitor, scope);
- if (arguments != null) {
- argumentsLength = arguments.length;
- for (int i = 0; i < argumentsLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AnonymousLocalTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
deleted file mode 100644
index 9891351..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
-
-public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
-
- public static final char[] ANONYMOUS_EMPTY_NAME = new char[] {};
- public QualifiedAllocationExpression allocation;
-
- public AnonymousLocalTypeDeclaration(CompilationResult compilationResult) {
- super(compilationResult);
- modifiers = AccDefault;
- name = ANONYMOUS_EMPTY_NAME;
- }
-
- // use a default name in order to th name lookup
- // to operate just like a regular type (which has a name)
- //without checking systematically if the naem is null ....
- public MethodBinding createsInternalConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
-
- //Add to method'set, the default constuctor that just recall the
- //super constructor with the same arguments
- String baseName = "$anonymous"; //$NON-NLS-1$
- TypeBinding[] argumentTypes = inheritedConstructorBinding.parameters;
- int argumentsLength = argumentTypes.length;
- //the constructor
- ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationResult);
- cd.selector = new char[] { 'x' }; //no maining
- cd.sourceStart = sourceStart;
- cd.sourceEnd = sourceEnd;
- cd.modifiers = modifiers & AccVisibilityMASK;
- cd.isDefaultConstructor = true;
-
- if (argumentsLength > 0) {
- Argument[] arguments = (cd.arguments = new Argument[argumentsLength]);
- for (int i = argumentsLength; --i >= 0;) {
- arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault);
- }
- }
-
- //the super call inside the constructor
- cd.constructorCall = SuperReference.implicitSuperConstructorCall();
- cd.constructorCall.sourceStart = sourceStart;
- cd.constructorCall.sourceEnd = sourceEnd;
-
- if (argumentsLength > 0) {
- Expression[] args;
- args = cd.constructorCall.arguments = new Expression[argumentsLength];
- for (int i = argumentsLength; --i >= 0;) {
- args[i] = new SingleNameReference((baseName + i).toCharArray(), 0L);
- }
- }
-
- //adding the constructor in the methods list
- if (methods == null) {
- methods = new AbstractMethodDeclaration[] { cd };
- } else {
- AbstractMethodDeclaration[] newMethods;
- System.arraycopy(
- methods,
- 0,
- newMethods = new AbstractMethodDeclaration[methods.length + 1],
- 1,
- methods.length);
- newMethods[0] = cd;
- methods = newMethods;
- }
-
- //============BINDING UPDATE==========================
- cd.binding = new MethodBinding(
- cd.modifiers, //methodDeclaration
- argumentsLength == 0 ? NoParameters : argumentTypes, //arguments bindings
- inheritedConstructorBinding.thrownExceptions, //exceptions
- binding); //declaringClass
-
- cd.scope = new MethodScope(scope, cd, true);
- cd.bindArguments();
- cd.constructorCall.resolve(cd.scope);
-
- if (binding.methods == null) {
- binding.methods = new MethodBinding[] { cd.binding };
- } else {
- MethodBinding[] newMethods;
- System.arraycopy(
- binding.methods,
- 0,
- newMethods = new MethodBinding[binding.methods.length + 1],
- 1,
- binding.methods.length);
- newMethods[0] = cd.binding;
- binding.methods = newMethods;
- }
- //===================================================
-
- return cd.binding;
-
- }
- public void resolve(BlockScope scope) {
-
- if (binding != null) {
- // remember local types binding for innerclass emulation propagation
- scope.referenceCompilationUnit().record((LocalTypeBinding)binding);
- }
- // scope and binding are provided in updateBindingSuperclass
- resolve();
- updateMaxFieldCount();
- }
-
- public String toString(int tab) {
-
- return toStringBody(tab);
- }
-
- /**
- * Iteration for a local anonymous innertype
- *
- */
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, blockScope)) {
-
- int fieldsLength;
- int methodsLength;
- int memberTypesLength;
-
- // is bound to the actual type from the allocation expression
- // therefore it has already been iterated at this point.
-
- if (memberTypes != null) {
- memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- // local type cannot have static fields
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- } catch (AbortType e) {
- }
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Argument.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Argument.java
deleted file mode 100644
index af11ab6..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Argument.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class Argument extends LocalDeclaration {
-
- public Argument(char[] name, long posNom, TypeReference tr, int modifiers) {
-
- super(null, name, (int) (posNom >>> 32), (int) posNom);
- this.declarationSourceEnd = (int) posNom;
- this.modifiers = modifiers;
- type = tr;
- this.bits |= IsLocalDeclarationReachableMASK;
- }
-
- public void bind(MethodScope scope, TypeBinding typeBinding, boolean used) {
-
- if (this.type != null)
- this.type.resolvedType = typeBinding;
- // record the resolved type into the type reference
- int modifierFlag = this.modifiers;
- if ((this.binding = scope.duplicateName(this.name)) != null) {
- //the name already exist....may carry on with the first binding ....
- scope.problemReporter().redefineArgument(this);
- } else {
- scope.addLocalVariable(
- this.binding =
- new LocalVariableBinding(this, typeBinding, modifierFlag, true));
- //true stand for argument instead of just local
- if (typeBinding != null && isTypeUseDeprecated(typeBinding, scope))
- scope.problemReporter().deprecatedType(typeBinding, this.type);
- this.binding.declaration = this;
- this.binding.useFlag = used ? LocalVariableBinding.USED : LocalVariableBinding.UNUSED;
- }
- }
-
- public TypeBinding resolveForCatch(BlockScope scope) {
-
- // resolution on an argument of a catch clause
- // provide the scope with a side effect : insertion of a LOCAL
- // that represents the argument. The type must be from JavaThrowable
-
- TypeBinding tb = type.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
- if (tb == null)
- return null;
- if ((binding = scope.duplicateName(name)) != null) {
- // the name already exists....may carry on with the first binding ....
- scope.problemReporter().redefineArgument(this);
- return null;
- }
- binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var (where isArgument = false)
- scope.addLocalVariable(binding);
- binding.constant = NotAConstant;
- return tb;
- }
-
- public String toString(int tab) {
-
- String s = ""; //$NON-NLS-1$
- if (modifiers != AccDefault) {
- s += modifiersString(modifiers);
- }
- if (type == null) {
- s += " "; //$NON-NLS-1$
- } else {
- s += type.toString(tab) + " "; //$NON-NLS-1$
- }
- s += new String(name);
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- if (type != null)
- type.traverse(visitor, scope);
- if (initialization != null)
- initialization.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayAllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayAllocationExpression.java
deleted file mode 100644
index 524ad04..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayAllocationExpression.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class ArrayAllocationExpression extends Expression {
-
- public TypeReference type;
-
- //dimensions.length gives the number of dimensions, but the
- // last ones may be nulled as in new int[4][5][][]
- public Expression[] dimensions;
- public ArrayInitializer initializer;
-
- /**
- * ArrayAllocationExpression constructor comment.
- */
- public ArrayAllocationExpression() {
- super();
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
- for (int i = 0, max = dimensions.length; i < max; i++) {
- Expression dim;
- if ((dim = dimensions[i]) != null) {
- flowInfo = dim.analyseCode(currentScope, flowContext, flowInfo);
- }
- }
- if (initializer != null) {
- return initializer.analyseCode(currentScope, flowContext, flowInfo);
- } else {
- return flowInfo;
- }
- }
-
- /**
- * Code generation for a array allocation expression
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-//
-// if (initializer != null) {
-// initializer.generateCode(currentScope, codeStream, valueRequired);
-// return;
-// }
-//
-// int nonNullDimensionsLength = 0;
-// for (int i = 0, max = dimensions.length; i < max; i++)
-// if (dimensions[i] != null) {
-// dimensions[i].generateCode(currentScope, codeStream, true);
-// nonNullDimensionsLength++;
-// }
-//
-// // Generate a sequence of bytecodes corresponding to an array allocation
-// if (this.resolvedType.dimensions() == 1) {
-// // Mono-dimensional array
-// codeStream.newArray(currentScope, (ArrayBinding)this.resolvedType);
-// } else {
-// // Multi-dimensional array
-// codeStream.multianewarray(this.resolvedType, nonNullDimensionsLength);
-// }
-//
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// codeStream.pop();
-// }
-//
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- output.append("new "); //$NON-NLS-1$
- type.print(0, output);
- for (int i = 0; i < dimensions.length; i++) {
- if (dimensions[i] == null)
- output.append("[]"); //$NON-NLS-1$
- else {
- output.append('[');
- dimensions[i].printExpression(0, output);
- output.append(']');
- }
- }
- if (initializer != null) initializer.printExpression(0, output);
- return output;
- }
- public TypeBinding resolveType(BlockScope scope) {
-
- // Build an array type reference using the current dimensions
- // The parser does not check for the fact that dimension may be null
- // only at the -end- like new int [4][][]. The parser allows new int[][4][]
- // so this must be checked here......(this comes from a reduction to LL1 grammar)
-
- TypeBinding referenceType = type.resolveType(scope);
-
- // will check for null after dimensions are checked
- constant = Constant.NotAConstant;
- if (referenceType == VoidBinding) {
- scope.problemReporter().cannotAllocateVoidArray(this);
- referenceType = null;
- }
-
- // check the validity of the dimension syntax (and test for all null dimensions)
- int explicitDimIndex = -1;
- for (int i = dimensions.length; --i >= 0;) {
- if (dimensions[i] != null) {
- if (explicitDimIndex < 0) explicitDimIndex = i;
- } else if (explicitDimIndex> 0) {
- // should not have an empty dimension before an non-empty one
- scope.problemReporter().incorrectLocationForEmptyDimension(this, i);
- }
- }
-
- // explicitDimIndex < 0 says if all dimensions are nulled
- // when an initializer is given, no dimension must be specified
- if (initializer == null) {
- if (explicitDimIndex < 0) {
- scope.problemReporter().mustDefineDimensionsOrInitializer(this);
- }
- } else if (explicitDimIndex >= 0) {
- scope.problemReporter().cannotDefineDimensionsAndInitializer(this);
- }
-
- // dimensions resolution
- for (int i = 0; i <= explicitDimIndex; i++) {
- if (dimensions[i] != null) {
- TypeBinding dimensionType = dimensions[i].resolveTypeExpecting(scope, IntBinding);
- if (dimensionType != null) {
- dimensions[i].implicitWidening(IntBinding, dimensionType);
- }
- }
- }
-
- // building the array binding
- if (referenceType != null) {
- if (dimensions.length > 255) {
- scope.problemReporter().tooManyDimensions(this);
- }
- this.resolvedType = scope.createArray(referenceType, dimensions.length);
-
- // check the initializer
- if (initializer != null) {
- if ((initializer.resolveTypeExpecting(scope, this.resolvedType)) != null)
- initializer.binding = (ArrayBinding)this.resolvedType;
- }
- }
- return this.resolvedType;
- }
-
- public String toStringExpression() {
-
- String s = "new " + type.toString(0); //$NON-NLS-1$
- for (int i = 0; i < dimensions.length; i++) {
- if (dimensions[i] == null)
- s = s + "[]"; //$NON-NLS-1$
- else
- s = s + "[" + dimensions[i].toStringExpression() + "]"; //$NON-NLS-2$ //$NON-NLS-1$
- }
- if (initializer != null)
- s = s + initializer.toStringExpression();
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- int dimensionsLength = dimensions.length;
- type.traverse(visitor, scope);
- for (int i = 0; i < dimensionsLength; i++) {
- if (dimensions[i] != null)
- dimensions[i].traverse(visitor, scope);
- }
- if (initializer != null)
- initializer.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayInitializer.java
deleted file mode 100644
index ad55a8a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayInitializer.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ArrayInitializer extends Expression {
- public Expression[] expressions;
-
- public ArrayBinding binding; //the type of the { , , , }
-
- /**
- * ArrayInitializer constructor comment.
- */
- public ArrayInitializer() {
- super();
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- if (expressions != null) {
- for (int i = 0, max = expressions.length; i < max; i++) {
- flowInfo = expressions[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- }
- return flowInfo;
- }
-
- /**
- * Code generation for a array initializer
- */
- //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- // // Flatten the values and compute the dimensions, by iterating in depth into nested array initializers
- //
- // int pc = codeStream.position;
- // int expressionLength = (expressions == null) ? 0: expressions.length;
- // codeStream.generateInlinedValue(expressionLength);
- // codeStream.newArray(currentScope, binding);
- // if (expressions != null) {
- // // binding is an ArrayType, so I can just deal with the dimension
- // int elementsTypeID = binding.dimensions > 1 ? -1 : binding.leafComponentType.id;
- // for (int i = 0; i < expressionLength; i++) {
- // Expression expr;
- // if ((expr = expressions[i]).constant != NotAConstant) {
- // switch (elementsTypeID) { // filter out initializations to default values
- // case T_int :
- // case T_short :
- // case T_byte :
- // case T_char :
- // case T_long :
- // if (expr.constant.longValue() != 0) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // break;
- // case T_float :
- // case T_double :
- // double constantValue = expr.constant.doubleValue();
- // if (constantValue == -0.0 || constantValue != 0) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // break;
- // case T_boolean :
- // if (expr.constant.booleanValue() != false) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // break;
- // default :
- // if (!(expr instanceof NullLiteral)) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // }
- // } else if (!(expr instanceof NullLiteral)) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // }
- // }
- // if (!valueRequired) {
- // codeStream.pop();
- // }
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- //}
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- output.append('{');
- if (expressions != null) {
- int j = 20;
- for (int i = 0; i < expressions.length; i++) {
- if (i > 0)
- output.append(", "); //$NON-NLS-1$
- expressions[i].printExpression(0, output);
- j--;
- if (j == 0) {
- output.append('\n');
- printIndent(indent + 1, output);
- j = 20;
- }
- }
- }
- return output.append('}');
- }
-
- public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedTb) {
- // Array initializers can only occur on the right hand side of an assignment
- // expression, therefore the expected type contains the valid information
- // concerning the type that must be enforced by the elements of the array initializer.
-
- // this method is recursive... (the test on isArrayType is the stop case)
-
- constant = NotAConstant;
- if (expectedTb.isArrayType()) {
- binding = (ArrayBinding) expectedTb;
- if (expressions == null)
- return binding;
- TypeBinding expectedElementsTb = binding.elementsType(scope);
- if (expectedElementsTb.isBaseType()) {
- for (int i = 0, length = expressions.length; i < length; i++) {
- Expression expression = expressions[i];
- TypeBinding expressionTb = (expression instanceof ArrayInitializer) ? expression.resolveTypeExpecting(scope,
- expectedElementsTb) : expression.resolveType(scope);
- if (expressionTb == null)
- return null;
-
- // Compile-time conversion required?
- if (expression.isConstantValueOfTypeAssignableToType(expressionTb, expectedElementsTb)) {
- expression.implicitWidening(expectedElementsTb, expressionTb);
- } else if (BaseTypeBinding.isWidening(expectedElementsTb.id, expressionTb.id)) {
- expression.implicitWidening(expectedElementsTb, expressionTb);
- } else {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionTb, expectedElementsTb);
- return null;
- }
- }
- } else {
- for (int i = 0, length = expressions.length; i < length; i++)
- if (expressions[i].resolveTypeExpecting(scope, expectedElementsTb) == null)
- return null;
- }
- return binding;
- }
-
- // infer initializer type for error reporting based on first element
- TypeBinding leafElementType = null;
- int dim = 1;
- if (expressions == null) {
- leafElementType = scope.getJavaLangObject();
- } else {
- Expression currentExpression = expressions[0];
- while (currentExpression != null && currentExpression instanceof ArrayInitializer) {
- dim++;
- Expression[] subExprs = ((ArrayInitializer) currentExpression).expressions;
- if (subExprs == null) {
- leafElementType = scope.getJavaLangObject();
- currentExpression = null;
- break;
- }
- currentExpression = ((ArrayInitializer) currentExpression).expressions[0];
- }
- if (currentExpression != null) {
- leafElementType = currentExpression.resolveType(scope);
- }
- }
- if (leafElementType != null) {
- TypeBinding probableTb = scope.createArray(leafElementType, dim);
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(this, probableTb, expectedTb);
- }
- return null;
- }
-
- public String toStringExpression() {
-
- String s = "{"; //$NON-NLS-1$
- if (expressions != null) {
- int j = 20;
- for (int i = 0; i < expressions.length; i++) {
- s = s + expressions[i].toStringExpression() + ","; //$NON-NLS-1$
- j--;
- if (j == 0) {
- s = s + "\n ";j = 20;}}}; //$NON-NLS-1$
- s = s + "}"; //$NON-NLS-1$
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- if (expressions != null) {
- int expressionsLength = expressions.length;
- for (int i = 0; i < expressionsLength; i++)
- expressions[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, scope);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayQualifiedTypeReference.java
deleted file mode 100644
index da3ade9..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayQualifiedTypeReference.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
- int dimensions;
-public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
- super( sources , poss);
- dimensions = dim ;
-}
-public ArrayQualifiedTypeReference(char[][] sources , TypeBinding tb, int dim, long[] poss) {
- super( sources , tb, poss);
- dimensions = dim ;
-}
-public int dimensions() {
- return dimensions;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (this.resolvedType != null)
- return this.resolvedType;
- if (dimensions > 255) {
- scope.problemReporter().tooManyDimensions(this);
- }
- return scope.createArray(scope.getType(tokens), dimensions);
-}
-public String toStringExpression(int tab){
- /* slow speed */
-
- String s = super.toStringExpression(tab) ;
- if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
- for (int i=1 ; i <= dimensions ; i++)
- s = s + "[]" ; //$NON-NLS-1$
- return s ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayReference.java
deleted file mode 100644
index af3291a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayReference.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ArrayReference extends Reference {
-
- public Expression receiver;
- public Expression position;
-
- public ArrayReference(Expression rec, Expression pos) {
- this.receiver = rec;
- this.position = pos;
- sourceStart = rec.sourceStart;
- }
-
- public FlowInfo analyseAssignment(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- Assignment assignment,
- boolean compoundAssignment) {
-
- if (assignment.expression == null) {
- return analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- } else {
- return assignment
- .expression
- .analyseCode(
- currentScope,
- flowContext,
- analyseCode(currentScope, flowContext, flowInfo).unconditionalInits())
- .unconditionalInits();
- }
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return position.analyseCode(
- currentScope,
- flowContext,
- receiver.analyseCode(currentScope, flowContext, flowInfo));
- }
-
-// public void generateAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Assignment assignment,
-// boolean valueRequired) {
-//
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion);
-// }
-// }
-
- /**
- * Code generation for a array reference
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// codeStream.arrayAt(this.resolvedType.id);
-// // Generating code for the potential runtime type checking
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// if (this.resolvedType == LongBinding
-// || this.resolvedType == DoubleBinding) {
-// codeStream.pop2();
-// } else {
-// codeStream.pop();
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-//
-// public void generateCompoundAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Expression expression,
-// int operator,
-// int assignmentImplicitConversion,
-// boolean valueRequired) {
-//
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// codeStream.dup2();
-// codeStream.arrayAt(this.resolvedType.id);
-// int operationTypeID;
-// if ((operationTypeID = implicitConversion >> 4) == T_String) {
-// codeStream.generateStringAppend(currentScope, null, expression);
-// } else {
-// // promote the array reference to the suitable operation type
-// codeStream.generateImplicitConversion(implicitConversion);
-// // generate the increment value (will by itself be promoted to the operation value)
-// if (expression == IntLiteral.One) { // prefix operation
-// codeStream.generateConstant(expression.constant, implicitConversion);
-// } else {
-// expression.generateCode(currentScope, codeStream, true);
-// }
-// // perform the operation
-// codeStream.sendOperator(operator, operationTypeID);
-// // cast the value back to the array reference type
-// codeStream.generateImplicitConversion(assignmentImplicitConversion);
-// }
-// codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
-// }
-//
-// public void generatePostIncrement(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// CompoundAssignment postIncrement,
-// boolean valueRequired) {
-//
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// codeStream.dup2();
-// codeStream.arrayAt(this.resolvedType.id);
-// if (valueRequired) {
-// if ((this.resolvedType == LongBinding)
-// || (this.resolvedType == DoubleBinding)) {
-// codeStream.dup2_x2();
-// } else {
-// codeStream.dup_x2();
-// }
-// }
-// codeStream.generateConstant(
-// postIncrement.expression.constant,
-// implicitConversion);
-// codeStream.sendOperator(postIncrement.operator, this.resolvedType.id);
-// codeStream.generateImplicitConversion(
-// postIncrement.assignmentImplicitConversion);
-// codeStream.arrayAtPut(this.resolvedType.id, false);
-// }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- receiver.printExpression(0, output).append('[');
- return position.printExpression(0, output).append(']');
- }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- constant = Constant.NotAConstant;
- TypeBinding arrayType = receiver.resolveType(scope);
- if (arrayType != null) {
- if (arrayType.isArrayType()) {
- this.resolvedType = ((ArrayBinding) arrayType).elementsType(scope);
- } else {
- scope.problemReporter().referenceMustBeArrayTypeAt(arrayType, this);
- }
- }
- TypeBinding positionType = position.resolveTypeExpecting(scope, IntBinding);
- if (positionType != null) {
- position.implicitWidening(IntBinding, positionType);
- }
- return this.resolvedType;
- }
-
- public String toStringExpression() {
-
- return receiver.toStringExpression() + "[" //$NON-NLS-1$
- +position.toStringExpression() + "]"; //$NON-NLS-1$
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- receiver.traverse(visitor, scope);
- position.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayTypeReference.java
deleted file mode 100644
index 15930a5..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ArrayTypeReference.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ArrayTypeReference extends SingleTypeReference {
- public int dimensions;
-/**
- * ArrayTypeReference constructor comment.
- * @param source char[]
- * @param dim int
- * @param pos int
- */
-public ArrayTypeReference(char[] source, int dim, long pos) {
- super(source, pos);
- dimensions = dim ;
-}
-public ArrayTypeReference(char[] source, TypeBinding tb, int dim, long pos) {
- super(source, tb, pos);
- dimensions = dim ;}
-public int dimensions() {
- return dimensions;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (this.resolvedType != null)
- return this.resolvedType;
- if (dimensions > 255) {
- scope.problemReporter().tooManyDimensions(this);
- }
- return scope.createArray(scope.getType(token), dimensions);
-
-}
-public String toStringExpression(int tab){
-
- String s = super.toStringExpression(tab) ;
- if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
- for (int i=1 ; i <= dimensions ; i++)
- s = s + "[]" ; //$NON-NLS-1$
- return s ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AssertStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AssertStatement.java
deleted file mode 100644
index 56889f7..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AssertStatement.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class AssertStatement extends Statement {
-
- public Expression assertExpression, exceptionArgument;
-
- // for local variable attribute
- int preAssertInitStateIndex = -1;
- private FieldBinding assertionSyntheticFieldBinding;
-
- public AssertStatement(
- Expression exceptionArgument,
- Expression assertExpression,
- int startPosition) {
-
- this.assertExpression = assertExpression;
- this.exceptionArgument = exceptionArgument;
- sourceStart = startPosition;
- sourceEnd = exceptionArgument.sourceEnd;
- }
-
- public AssertStatement(Expression assertExpression, int startPosition) {
-
- this.assertExpression = assertExpression;
- sourceStart = startPosition;
- sourceEnd = assertExpression.sourceEnd;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- preAssertInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
-
- Constant cst = this.assertExpression.optimizedBooleanConstant();
- boolean isOptimizedTrueAssertion = cst != NotAConstant && cst.booleanValue() == true;
- boolean isOptimizedFalseAssertion = cst != NotAConstant && cst.booleanValue() == false;
-
- FlowInfo assertInfo = flowInfo.copy();
- if (isOptimizedTrueAssertion) {
- assertInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- assertInfo = assertExpression.analyseCode(currentScope, flowContext, assertInfo).unconditionalInits();
-
- if (exceptionArgument != null) {
- // only gets evaluated when escaping - results are not taken into account
- FlowInfo exceptionInfo = exceptionArgument.analyseCode(currentScope, flowContext, assertInfo.copy());
-
- if (!isOptimizedTrueAssertion){
- flowContext.checkExceptionHandlers(
- currentScope.getJavaLangAssertionError(),
- this,
- exceptionInfo,
- currentScope);
- }
- }
-
- // add the assert support in the clinit
- manageSyntheticAccessIfNecessary(currentScope);
- if (isOptimizedFalseAssertion) {
- return flowInfo; // if assertions are enabled, the following code will be unreachable
- } else {
- return flowInfo.mergedWith(assertInfo.unconditionalInits());
- }
- }
-
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// if (this.assertionSyntheticFieldBinding != null) {
-// Label assertionActivationLabel = new Label(codeStream);
-// codeStream.getstatic(this.assertionSyntheticFieldBinding);
-// codeStream.ifne(assertionActivationLabel);
-// Label falseLabel = new Label(codeStream);
-// assertExpression.generateOptimizedBoolean(currentScope, codeStream, (falseLabel = new Label(codeStream)), null , true);
-// codeStream.newJavaLangAssertionError();
-// codeStream.dup();
-// if (exceptionArgument != null) {
-// exceptionArgument.generateCode(currentScope, codeStream, true);
-// codeStream.invokeJavaLangAssertionErrorConstructor(exceptionArgument.implicitConversion & 0xF);
-// } else {
-// codeStream.invokeJavaLangAssertionErrorDefaultConstructor();
-// }
-// codeStream.athrow();
-// falseLabel.place();
-// assertionActivationLabel.place();
-// }
-//
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (preAssertInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(currentScope, preAssertInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output);
- output.append("assert "); //$NON-NLS-1$
- this.assertExpression.printExpression(0, output);
- if (this.exceptionArgument != null) {
- output.append(": "); //$NON-NLS-1$
- this.exceptionArgument.printExpression(0, output);
- }
- return output.append(';');
- }
- public void resolve(BlockScope scope) {
-
- assertExpression.resolveTypeExpecting(scope, BooleanBinding);
- if (exceptionArgument != null) {
- TypeBinding exceptionArgumentType = exceptionArgument.resolveType(scope);
- if (exceptionArgumentType != null){
- if (exceptionArgumentType.id == T_void){
- scope.problemReporter().illegalVoidExpression(exceptionArgument);
- }
- exceptionArgument.implicitConversion = (exceptionArgumentType.id << 4) + exceptionArgumentType.id;
- }
- }
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- assertExpression.traverse(visitor, scope);
- if (exceptionArgument != null) {
- exceptionArgument.traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, scope);
- }
-
- public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
-
- // need assertion flag: $assertionsDisabled on outer most source clas
- // (in case of static member of interface, will use the outermost static member - bug 22334)
- SourceTypeBinding outerMostClass = currentScope.enclosingSourceType();
- while (outerMostClass.isLocalType()){
- ReferenceBinding enclosing = outerMostClass.enclosingType();
- if (enclosing == null || enclosing.isInterface()) break;
- outerMostClass = (SourceTypeBinding) enclosing;
- }
-
- this.assertionSyntheticFieldBinding = outerMostClass.addSyntheticField(this, currentScope);
-
- // find and enable assertion support
- TypeDeclaration typeDeclaration = outerMostClass.scope.referenceType();
- AbstractMethodDeclaration[] methods = typeDeclaration.methods;
- for (int i = 0, max = methods.length; i < max; i++) {
- AbstractMethodDeclaration method = methods[i];
- if (method.isClinit()) {
- ((Clinit) method).addSupportForAssertion(assertionSyntheticFieldBinding);
- break;
- }
- }
- }
-
- public String toString(int tab) {
-
- StringBuffer buffer = new StringBuffer(tabString(tab));
- buffer.append("assert "); //$NON-NLS-1$
- buffer.append(this.assertExpression);
- if (this.exceptionArgument != null) {
- buffer.append(":"); //$NON-NLS-1$
- buffer.append(this.exceptionArgument);
- buffer.append(";"); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Assignment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Assignment.java
deleted file mode 100644
index d6fca69..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Assignment.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Genady Beriozkin - added support for reporting assignment with no effect
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class Assignment extends Expression {
-
- public Expression lhs;
- public Expression expression;
-
- public Assignment(Expression lhs, Expression expression, int sourceEnd) {
- //lhs is always a reference by construction ,
- //but is build as an expression ==> the checkcast cannot fail
-
- this.lhs = lhs;
- lhs.bits |= IsStrictlyAssignedMASK; // tag lhs as assigned
-
- this.expression = expression;
-
- this.sourceStart = lhs.sourceStart;
- this.sourceEnd = sourceEnd;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
- // record setting a variable: various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
- // just a local variable.
-
- return ((Reference) lhs)
- .analyseAssignment(currentScope, flowContext, flowInfo, this, false)
- .unconditionalInits();
- }
-
- void checkAssignmentEffect(BlockScope scope) {
-
- Binding left = getDirectBinding(this.lhs);
- if (left != null && left == getDirectBinding(this.expression)) {
- scope.problemReporter().assignmentHasNoEffect(this, left.shortReadableName());
- this.bits |= IsAssignmentWithNoEffectMASK; // record assignment has no effect
- }
- }
-
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// // various scenarii are possible, setting an array reference,
-// // a field reference, a blank final field reference, a field of an enclosing instance or
-// // just a local variable.
-//
-// int pc = codeStream.position;
-// if ((this.bits & IsAssignmentWithNoEffectMASK) != 0) {
-// if (valueRequired) {
-// this.expression.generateCode(currentScope, codeStream, true);
-// }
-// } else {
-// ((Reference) lhs).generateAssignment(currentScope, codeStream, this, valueRequired);
-// // variable may have been optimized out
-// // the lhs is responsible to perform the implicitConversion generation for the assignment since optimized for unused local assignment.
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- Binding getDirectBinding(Expression someExpression) {
- if (someExpression instanceof SingleNameReference) {
- return ((SingleNameReference)someExpression).binding;
- } else if (someExpression instanceof FieldReference) {
- FieldReference fieldRef = (FieldReference)someExpression;
- if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) {
- return fieldRef.binding;
- }
- }
- return null;
- }
- public StringBuffer print(int indent, StringBuffer output) {
-
- //no () when used as a statement
- printIndent(indent, output);
- return printExpressionNoParenthesis(indent, output);
- }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- //subclass redefine printExpressionNoParenthesis()
- output.append('(');
- return printExpressionNoParenthesis(0, output).append(')');
- }
-
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
-
- lhs.printExpression(indent, output).append(" = "); //$NON-NLS-1$
- return expression.printExpression(0, output);
- }
-
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- //no () when used as a statement
- return print(indent, output).append(';');
- }
- public TypeBinding resolveType(BlockScope scope) {
-
- // due to syntax lhs may be only a NameReference, a FieldReference or an ArrayReference
- constant = NotAConstant;
- if (!(this.lhs instanceof Reference)) {
- scope.problemReporter().expressionShouldBeAVariable(this.lhs);
- }
- this.resolvedType = lhs.resolveType(scope); // expressionType contains the assignment type (lhs Type)
- TypeBinding rhsType = expression.resolveType(scope);
- if (this.resolvedType == null || rhsType == null) {
- return null;
- }
- checkAssignmentEffect(scope);
-
- // Compile-time conversion of base-types : implicit narrowing integer into byte/short/character
- // may require to widen the rhs expression at runtime
- if ((expression.isConstantValueOfTypeAssignableToType(rhsType, this.resolvedType)
- || (this.resolvedType.isBaseType() && BaseTypeBinding.isWidening(this.resolvedType.id, rhsType.id)))
- || rhsType.isCompatibleWith(this.resolvedType)) {
- expression.implicitWidening(this.resolvedType, rhsType);
- return this.resolvedType;
- }
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- expression,
- rhsType,
- this.resolvedType);
- return this.resolvedType;
- }
-
- public String toString(int tab) {
-
- //no () when used as a statement
- return tabString(tab) + toStringExpressionNoParenthesis();
- }
-
- public String toStringExpression() {
-
- //subclass redefine toStringExpressionNoParenthesis()
- return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- public String toStringExpressionNoParenthesis() {
-
- return lhs.toStringExpression() + " " //$NON-NLS-1$
- + "=" //$NON-NLS-1$
- + ((expression.constant != null) && (expression.constant != NotAConstant)
- ? " /*cst:" + expression.constant.toString() + "*/ " //$NON-NLS-1$ //$NON-NLS-2$
- : " ") //$NON-NLS-1$
- + expression.toStringExpression();
- }
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- expression.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BinaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BinaryExpression.java
deleted file mode 100644
index 9cb7f88..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BinaryExpression.java
+++ /dev/null
@@ -1,1754 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class BinaryExpression extends OperatorExpression {
-
- public Expression left, right;
- public Constant optimizedBooleanConstant;
-
- public BinaryExpression(Expression left, Expression right, int operator) {
-
- this.left = left;
- this.right = right;
- this.bits |= operator << OperatorSHIFT; // encode operator
- this.sourceStart = left.sourceStart;
- this.sourceEnd = right.sourceEnd;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return right
- .analyseCode(
- currentScope,
- flowContext,
- left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits())
- .unconditionalInits();
- }
-
- public void computeConstant(BlockScope scope, int leftId, int rightId) {
-
- //compute the constant when valid
- if ((this.left.constant != Constant.NotAConstant)
- && (this.right.constant != Constant.NotAConstant)) {
- try {
- this.constant =
- Constant.computeConstantOperation(
- this.left.constant,
- leftId,
- (this.bits & OperatorMASK) >> OperatorSHIFT,
- this.right.constant,
- rightId);
- } catch (ArithmeticException e) {
- this.constant = Constant.NotAConstant;
- // 1.2 no longer throws an exception at compile-time
- //scope.problemReporter().compileTimeConstantThrowsArithmeticException(this);
- }
- } else {
- this.constant = Constant.NotAConstant;
- //add some work for the boolean operators & |
-// this.optimizedBooleanConstant(
-// leftId,
-// (this.bits & OperatorMASK) >> OperatorSHIFT,
-// rightId);
- }
- }
-
- public Constant optimizedBooleanConstant() {
-
- return this.optimizedBooleanConstant == null ? this.constant : this.optimizedBooleanConstant;
- }
-
- /**
- * Code generation for a binary operation
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Label falseLabel, endLabel;
-// if (constant != Constant.NotAConstant) {
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// bits |= OnlyValueRequiredMASK;
-// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
-// case PLUS :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_String :
-// codeStream.generateStringAppend(currentScope, left, right);
-// if (!valueRequired)
-// codeStream.pop();
-// break;
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.iadd();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ladd();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.dadd();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fadd();
-// break;
-// }
-// break;
-// case MINUS :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.isub();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lsub();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.dsub();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fsub();
-// break;
-// }
-// break;
-// case MULTIPLY :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.imul();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lmul();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.dmul();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fmul();
-// break;
-// }
-// break;
-// case DIVIDE :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.idiv();
-// if (!valueRequired)
-// codeStream.pop();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.ldiv();
-// if (!valueRequired)
-// codeStream.pop2();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ddiv();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fdiv();
-// break;
-// }
-// break;
-// case REMAINDER :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.irem();
-// if (!valueRequired)
-// codeStream.pop();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.lrem();
-// if (!valueRequired)
-// codeStream.pop2();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.drem();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.frem();
-// break;
-// }
-// break;
-// case AND :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// // 0 & x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_int)
-// && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.iconst_0();
-// } else {
-// // x & 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_int)
-// && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.iconst_0();
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.iand();
-// }
-// }
-// break;
-// case T_long :
-// // 0 & x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_long)
-// && (left.constant.longValue() == 0L)) {
-// right.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.lconst_0();
-// } else {
-// // x & 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_long)
-// && (right.constant.longValue() == 0L)) {
-// left.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.lconst_0();
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.land();
-// }
-// }
-// break;
-// case T_boolean : // logical and
-// generateOptimizedLogicalAnd(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 && false;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// }
-// break;
-// case OR :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// // 0 | x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_int)
-// && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x | 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_int)
-// && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ior();
-// }
-// }
-// break;
-// case T_long :
-// // 0 | x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_long)
-// && (left.constant.longValue() == 0L)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x | 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_long)
-// && (right.constant.longValue() == 0L)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lor();
-// }
-// }
-// break;
-// case T_boolean : // logical or
-// generateOptimizedLogicalOr(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 || true;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// }
-// break;
-// case XOR :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// // 0 ^ x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_int)
-// && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x ^ 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_int)
-// && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ixor();
-// }
-// }
-// break;
-// case T_long :
-// // 0 ^ x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_long)
-// && (left.constant.longValue() == 0L)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x ^ 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_long)
-// && (right.constant.longValue() == 0L)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lxor();
-// }
-// }
-// break;
-// case T_boolean :
-// generateOptimizedLogicalXor(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 ^ bool;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// }
-// break;
-// case LEFT_SHIFT :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ishl();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lshl();
-// }
-// break;
-// case RIGHT_SHIFT :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ishr();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lshr();
-// }
-// break;
-// case UNSIGNED_RIGHT_SHIFT :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.iushr();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lushr();
-// }
-// break;
-// case GREATER :
-// generateOptimizedGreaterThan(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// break;
-// case GREATER_EQUAL :
-// generateOptimizedGreaterThanOrEqual(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// break;
-// case LESS :
-// generateOptimizedLessThan(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// break;
-// case LESS_EQUAL :
-// generateOptimizedLessThanOrEqual(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// }
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- /**
- * Boolean operator code generation
- * Optimized operations are: <, <=, >, >=, &, |, ^
- */
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
-// super.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// }
-// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
-// case LESS :
-// generateOptimizedLessThan(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case LESS_EQUAL :
-// generateOptimizedLessThanOrEqual(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case GREATER :
-// generateOptimizedGreaterThan(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case GREATER_EQUAL :
-// generateOptimizedGreaterThanOrEqual(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case AND :
-// generateOptimizedLogicalAnd(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case OR :
-// generateOptimizedLogicalOr(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case XOR :
-// generateOptimizedLogicalXor(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// }
-// super.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-//
-// /**
-// * Boolean generation for >
-// */
-// public void generateOptimizedGreaterThan(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 > x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.iflt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifge(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x > 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifgt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifle(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpgt(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifgt(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifgt(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifgt(trueLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmple(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifle(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifle(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifle(falseLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-
- /**
- * Boolean generation for >=
- */
-// public void generateOptimizedGreaterThanOrEqual(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 >= x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifle(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifgt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x >= 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifge(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.iflt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpge(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifge(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifge(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifge(trueLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmplt(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.iflt(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.iflt(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.iflt(falseLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-//
-// /**
-// * Boolean generation for <
-// */
-// public void generateOptimizedLessThan(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 < x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifgt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifle(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x < 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.iflt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifge(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmplt(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.iflt(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.iflt(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.iflt(trueLabel);
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpge(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.ifge(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifge(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.ifge(falseLabel);
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-//
-// /**
-// * Boolean generation for <=
-// */
-// public void generateOptimizedLessThanOrEqual(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 <= x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifge(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.iflt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x <= 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifle(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifgt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmple(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.ifle(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifle(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.ifle(trueLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpgt(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.ifgt(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifgt(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.ifgt(falseLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-//
-// /**
-// * Boolean generation for &
-// */
-// public void generateOptimizedLogicalAnd(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// Constant condConst;
-// if ((left.implicitConversion & 0xF) == T_boolean) {
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // & x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// } else {
-// // & x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x &
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// } else {
-// // x &
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// return;
-// }
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.iand();
-// if ((bits & OnlyValueRequiredMASK) == 0) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifeq(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// /**
-// * Boolean generation for |
-// */
-// public void generateOptimizedLogicalOr(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// Constant condConst;
-// if ((left.implicitConversion & 0xF) == T_boolean) {
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // | x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_1();
-// } else {
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// } else {
-// // | x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x |
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_1();
-// } else {
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// } else {
-// // x |
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// }
-// return;
-// }
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.ior();
-// if ((bits & OnlyValueRequiredMASK) == 0) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifeq(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// /**
-// * Boolean generation for ^
-// */
-// public void generateOptimizedLogicalXor(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// Constant condConst;
-// if ((left.implicitConversion & 0xF) == T_boolean) {
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // ^ x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// falseLabel,
-// trueLabel,
-// valueRequired);
-// } else {
-// // ^ x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x ^
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// falseLabel,
-// trueLabel,
-// valueRequired);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// } else {
-// // x ^
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// }
-// return;
-// }
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.ixor();
-// if ((bits & OnlyValueRequiredMASK) == 0) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifeq(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// public void generateOptimizedStringBuffer(
-// BlockScope blockScope,
-// CodeStream codeStream,
-// int typeID) {
-//
-// /* In the case trying to make a string concatenation, there is no need to create a new
-// * string buffer, thus use a lower-level API for code generation involving only the
-// * appending of arguments to the existing StringBuffer
-// */
-//
-// if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
-// && ((bits & ReturnTypeIDMASK) == T_String)) {
-// if (constant != NotAConstant) {
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.invokeStringBufferAppendForType(implicitConversion & 0xF);
-// } else {
-// int pc = codeStream.position;
-// left.generateOptimizedStringBuffer(
-// blockScope,
-// codeStream,
-// left.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, left.sourceStart);
-// pc = codeStream.position;
-// right.generateOptimizedStringBuffer(
-// blockScope,
-// codeStream,
-// right.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, right.sourceStart);
-// }
-// } else {
-// super.generateOptimizedStringBuffer(blockScope, codeStream, typeID);
-// }
-// }
-//
-// public void generateOptimizedStringBufferCreation(
-// BlockScope blockScope,
-// CodeStream codeStream,
-// int typeID) {
-//
-// /* In the case trying to make a string concatenation, there is no need to create a new
-// * string buffer, thus use a lower-level API for code generation involving only the
-// * appending of arguments to the existing StringBuffer
-// */
-//
-// if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
-// && ((bits & ReturnTypeIDMASK) == T_String)) {
-// if (constant != NotAConstant) {
-// codeStream.newStringBuffer(); // new: java.lang.StringBuffer
-// codeStream.dup();
-// codeStream.ldc(constant.stringValue());
-// codeStream.invokeStringBufferStringConstructor();
-// // invokespecial: java.lang.StringBuffer.(Ljava.lang.String;)V
-// } else {
-// int pc = codeStream.position;
-// left.generateOptimizedStringBufferCreation(
-// blockScope,
-// codeStream,
-// left.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, left.sourceStart);
-// pc = codeStream.position;
-// right.generateOptimizedStringBuffer(
-// blockScope,
-// codeStream,
-// right.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, right.sourceStart);
-// }
-// } else {
-// super.generateOptimizedStringBufferCreation(blockScope, codeStream, typeID);
-// }
-// }
-//
-// public boolean isCompactableOperation() {
-//
-// return true;
-// }
-//
-// public void optimizedBooleanConstant(int leftId, int operator, int rightId) {
-//
-// switch (operator) {
-// case AND :
-// if ((leftId != T_boolean) || (rightId != T_boolean))
-// return;
-// case AND_AND :
-// Constant cst;
-// if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == false) { // left is equivalent to false
-// optimizedBooleanConstant = cst; // constant(false)
-// return;
-// } else { //left is equivalent to true
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// optimizedBooleanConstant = cst;
-// // the conditional result is equivalent to the right conditional value
-// }
-// return;
-// }
-// }
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == false) { // right is equivalent to false
-// optimizedBooleanConstant = cst; // constant(false)
-// }
-// }
-// return;
-// case OR :
-// if ((leftId != T_boolean) || (rightId != T_boolean))
-// return;
-// case OR_OR :
-// if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == true) { // left is equivalent to true
-// optimizedBooleanConstant = cst; // constant(true)
-// return;
-// } else { //left is equivalent to false
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// optimizedBooleanConstant = cst;
-// }
-// return;
-// }
-// }
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == true) { // right is equivalent to true
-// optimizedBooleanConstant = cst; // constant(true)
-// }
-// }
-// }
-// }
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
-
- left.printExpression(indent, output).append(' ').append(operatorToString()).append(' ');
- return right.printExpression(0, output);
- }
- public TypeBinding resolveType(BlockScope scope) {
-
- // use the id of the type to navigate into the table
- TypeBinding leftTb = left.resolveType(scope);
- TypeBinding rightTb = right.resolveType(scope);
- if (leftTb == null || rightTb == null) {
- constant = Constant.NotAConstant;
- return null;
- }
- int leftId = leftTb.id;
- int rightId = rightTb.id;
- if (leftId > 15
- || rightId > 15) { // must convert String + Object || Object + String
- if (leftId == T_String) {
- rightId = T_Object;
- } else if (rightId == T_String) {
- leftId = T_Object;
- } else {
- constant = Constant.NotAConstant;
- scope.problemReporter().invalidOperator(this, leftTb, rightTb);
- return null;
- }
- }
- if (((bits & OperatorMASK) >> OperatorSHIFT) == PLUS) {
- if (leftId == T_String
- && rightTb.isArrayType()
- && ((ArrayBinding) rightTb).elementsType(scope) == CharBinding)
- scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(
- right);
- else if (
- rightId == T_String
- && leftTb.isArrayType()
- && ((ArrayBinding) leftTb).elementsType(scope) == CharBinding)
- scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(
- left);
- }
-
- // the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
-
- // Don't test for result = 0. If it is zero, some more work is done.
- // On the one hand when it is not zero (correct code) we avoid doing the test
- int result =
- ResolveTypeTables[(bits & OperatorMASK) >> OperatorSHIFT][(leftId << 4)
- + rightId];
- left.implicitConversion = result >>> 12;
- right.implicitConversion = (result >>> 4) & 0x000FF;
-
- bits |= result & 0xF;
- switch (result & 0xF) { // record the current ReturnTypeID
- // only switch on possible result type.....
- case T_boolean :
- this.resolvedType = BooleanBinding;
- break;
- case T_byte :
- this.resolvedType = ByteBinding;
- break;
- case T_char :
- this.resolvedType = CharBinding;
- break;
- case T_double :
- this.resolvedType = DoubleBinding;
- break;
- case T_float :
- this.resolvedType = FloatBinding;
- break;
- case T_int :
- this.resolvedType = IntBinding;
- break;
- case T_long :
- this.resolvedType = LongBinding;
- break;
- case T_String :
- this.resolvedType = scope.getJavaLangString();
- break;
- default : //error........
- constant = Constant.NotAConstant;
- scope.problemReporter().invalidOperator(this, leftTb, rightTb);
- return null;
- }
-
- // compute the constant when valid
- computeConstant(scope, leftId, rightId);
- return this.resolvedType;
- }
-
- public String toStringExpressionNoParenthesis() {
-
- return left.toStringExpression() + " " + //$NON-NLS-1$
- operatorToString() + " " + //$NON-NLS-1$
- right.toStringExpression();
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- left.traverse(visitor, scope);
- right.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Block.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Block.java
deleted file mode 100644
index fa38430..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Block.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class Block extends Statement {
-
- public Statement[] statements;
- public int explicitDeclarations;
- // the number of explicit declaration , used to create scope
- public BlockScope scope;
- public static final Block None = new Block(0);
-
- public Block(int explicitDeclarations) {
- this.explicitDeclarations = explicitDeclarations;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // empty block
- if (statements == null) return flowInfo;
- boolean didAlreadyComplain = false;
- for (int i = 0, max = statements.length; i < max; i++) {
- Statement stat;
- if (!flowInfo.complainIfUnreachable(stat = statements[i], scope, didAlreadyComplain)) {
- flowInfo = stat.analyseCode(scope, flowContext, flowInfo);
- } else {
- didAlreadyComplain = true;
- }
- }
- return flowInfo;
- }
-
- public static final Block EmptyWith(int sourceStart, int sourceEnd) {
-
- //return an empty block which position is s and e
- Block bk = new Block(0);
- bk.sourceStart = sourceStart;
- bk.sourceEnd = sourceEnd;
- return bk;
- }
-
- /**
- * Code generation for a block
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++) {
-// statements[i].generateCode(scope, codeStream);
-// }
-// } // for local variable debug attributes
-// if (scope != currentScope) { // was really associated with its own scope
-// codeStream.exitUserScope(scope);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public boolean isEmptyBlock() {
-
- return statements == null;
- }
- public StringBuffer printBody(int indent, StringBuffer output) {
-
- if (this.statements == null) return output;
- for (int i = 0; i < statements.length; i++) {
- statements[i].printStatement(indent + 1, output);
- output.append('\n');
- }
- return output;
- }
-
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output);
- output.append("{\n"); //$NON-NLS-1$
- printBody(indent, output);
- return printIndent(indent, output).append('}');
- }
- public void resolve(BlockScope upperScope) {
-
- if (statements != null) {
- scope =
- explicitDeclarations == 0
- ? upperScope
- : new BlockScope(upperScope, explicitDeclarations);
- int i = 0, length = statements.length;
- while (i < length)
- statements[i++].resolve(scope);
- }
- }
-
- public void resolveUsing(BlockScope givenScope) {
-
- // this optimized resolve(...) is sent only on none empty blocks
- scope = givenScope;
- if (statements != null) {
- int i = 0, length = statements.length;
- while (i < length)
- statements[i++].resolve(scope);
- }
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- if (this.statements == null) {
- s += "{\n"; //$NON-NLS-1$
- s += tabString(tab);
- s += "}"; //$NON-NLS-1$
- return s;
- }
- s += "{\n"; //$NON-NLS-1$
- s += this.toStringStatements(tab);
- s += tabString(tab);
- s += "}"; //$NON-NLS-1$
- return s;
- }
-
- public String toStringStatements(int tab) {
-
- if (this.statements == null)
- return ""; //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < statements.length; i++) {
- buffer.append(statements[i].toString(tab + 1));
- if (statements[i] instanceof Block) {
- buffer.append("\n"); //$NON-NLS-1$
- } else {
- buffer.append(";\n"); //$NON-NLS-1$
- }
- };
- return buffer.toString();
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- if (statements != null) {
- int statementLength = statements.length;
- for (int i = 0; i < statementLength; i++)
- statements[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- }
-
- /**
- * Dispatch the call on its last statement.
- */
- public void branchChainTo(Label label) {
- if (this.statements != null) {
- this.statements[statements.length - 1].branchChainTo(label);
- }
- }
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BranchStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BranchStatement.java
deleted file mode 100644
index df2725a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BranchStatement.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public abstract class BranchStatement extends Statement {
- public Expression expression;
- public Label targetLabel;
- public ASTNode[] subroutines;
-/**
- * BranchStatement constructor comment.
- */
-public BranchStatement(Expression expr, int s,int e) {
- expression = expr ;
- sourceStart = s;
- sourceEnd = e;
-}
-/**
- * Branch code generation
- *
- * generate the finallyInvocationSequence.
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// // generation of code responsible for invoking the finally
-// // blocks in sequence
-// if (subroutines != null){
-// for (int i = 0, max = subroutines.length; i < max; i++){
-// ASTNode sub;
-// if ((sub = subroutines[i]) instanceof SynchronizedStatement){
-// codeStream.load(((SynchronizedStatement)sub).synchroVariable);
-// codeStream.monitorexit();
-// } else {
-// TryStatement trySub = (TryStatement) sub;
-// if (trySub.subRoutineCannotReturn) {
-// codeStream.goto_(trySub.subRoutineStartLabel);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// } else {
-// codeStream.jsr(trySub.subRoutineStartLabel);
-// }
-// }
-// }
-// }
-// codeStream.goto_(targetLabel);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public void resetStateForCodeGeneration() {
- if (this.targetLabel != null) {
- this.targetLabel.resetStateForCodeGeneration();
- }
-}
-
-public void resolve(BlockScope scope) {
-}
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BreakStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BreakStatement.java
deleted file mode 100644
index d56fc43..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/BreakStatement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class BreakStatement extends BranchStatement {
-
- public BreakStatement(Expression expr, int sourceStart, int e) {
- super(expr, sourceStart, e);
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // here requires to generate a sequence of finally blocks invocations depending corresponding
- // to each of the traversed try statements, so that execution will terminate properly.
-
- // lookup the label, this should answer the returnContext
-// FlowContext targetContext = (label == null)
-// ? flowContext.getTargetContextForDefaultBreak()
-// : flowContext.getTargetContextForBreakLabel(label);
-//
-// if (targetContext == null) {
-// if (label == null) {
-// currentScope.problemReporter().invalidBreak(this);
-// } else {
-// currentScope.problemReporter().undefinedLabel(this);
-// }
-// return flowInfo; // pretend it did not break since no actual target
-// }
-//
-// targetLabel = targetContext.breakLabel();
-// FlowContext traversedContext = flowContext;
-// int subIndex = 0, maxSub = 5;
-// subroutines = new ASTNode[maxSub];
-//
-// do {
-// ASTNode sub;
-// if ((sub = traversedContext.subRoutine()) != null) {
-// if (subIndex == maxSub) {
-// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
-// }
-// subroutines[subIndex++] = sub;
-// if (sub.cannotReturn()) {
-// break;
-// }
-// }
-// traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
-//
-// ASTNode node;
-// if ((node = traversedContext.associatedNode) instanceof TryStatement) {
-// TryStatement tryStatement = (TryStatement) node;
-// flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
-// } else if (traversedContext == targetContext) {
-// // only record break info once accumulated through subroutines, and only against target context
-// targetContext.recordBreakFrom(flowInfo);
-// break;
-// }
-// } while ((traversedContext = traversedContext.parent) != null);
-//
-// // resize subroutines
-// if (subIndex != maxSub) {
-// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
-// }
- return FlowInfo.DEAD_END;
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- s += "break "; //$NON-NLS-1$
- if (expression != null)
- s += expression.toString();
- return s;
- }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output).append("break "); //$NON-NLS-1$
- if (expression != null) output.append(expression);
- return output.append(';');
- }
- public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
- BlockScope blockscope) {
-
- visitor.visit(this, blockscope);
- visitor.endVisit(this, blockscope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CaseStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CaseStatement.java
deleted file mode 100644
index d60726b..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CaseStatement.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.CaseLabel;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class CaseStatement extends Statement {
-
- public Expression constantExpression;
- public CaseLabel targetLabel;
- public CaseStatement(int sourceStart, Expression constantExpression) {
- this.constantExpression = constantExpression;
- this.sourceEnd = constantExpression.sourceEnd;
- this.sourceStart = sourceStart;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- if (constantExpression.constant == NotAConstant)
- currentScope.problemReporter().caseExpressionMustBeConstant(constantExpression);
-
- this.constantExpression.analyseCode(currentScope, flowContext, flowInfo);
- return flowInfo;
- }
-
- /**
- * Case code generation
- *
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// targetLabel.place();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output);
- if (constantExpression == null) {
- output.append("default : "); //$NON-NLS-1$
- } else {
- output.append("case "); //$NON-NLS-1$
- constantExpression.printExpression(0, output).append(" : "); //$NON-NLS-1$
- }
- return output.append(';');
- }
- /**
- * No-op : should use resolveCase(...) instead.
- */
- public void resolve(BlockScope scope) {
- }
-
- public Constant resolveCase(
- BlockScope scope,
- TypeBinding switchType,
- SwitchStatement switchStatement) {
-
- // add into the collection of cases of the associated switch statement
- switchStatement.cases[switchStatement.caseCount++] = this;
- TypeBinding caseType = constantExpression.resolveType(scope);
- if (caseType == null || switchType == null)
- return null;
- if (constantExpression.isConstantValueOfTypeAssignableToType(caseType, switchType))
- return constantExpression.constant;
- if (caseType.isCompatibleWith(switchType))
- return constantExpression.constant;
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- constantExpression,
- caseType,
- switchType);
- return null;
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- s = s + "case " + constantExpression.toStringExpression() + " : "; //$NON-NLS-1$ //$NON-NLS-2$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- constantExpression.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CastExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CastExpression.java
deleted file mode 100644
index c4eb848..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CastExpression.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class CastExpression extends Expression {
-
- public Expression expression;
- public Expression type;
- public boolean needRuntimeCheckcast;
-
- //expression.implicitConversion holds the cast for baseType casting
- public CastExpression(Expression e, Expression t) {
- expression = e;
- type = t;
-
- //due to the fact an expression may start with ( and that a cast also start with (
- //the field is an expression....it can be a TypeReference OR a NameReference Or
- //an expression <--this last one is invalid.......
-
- // :-( .............
-
- //if (type instanceof TypeReference )
- // flag = IsTypeReference ;
- //else
- // if (type instanceof NameReference)
- // flag = IsNameReference ;
- // else
- // flag = IsExpression ;
-
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return expression
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
-
- public final void areTypesCastCompatible(
- BlockScope scope,
- TypeBinding castType,
- TypeBinding expressionType) {
-
- // see specifications 5.5
- // handle errors and process constant when needed
-
- // if either one of the type is null ==>
- // some error has been already reported some where ==>
- // we then do not report an obvious-cascade-error.
-
- needRuntimeCheckcast = false;
- if (castType == null || expressionType == null) return;
-
- // identity conversion cannot be performed upfront, due to side-effects
- // like constant propagation
-
- if (castType.isBaseType()) {
- if (expressionType.isBaseType()) {
- if (expressionType == castType) {
- expression.implicitWidening(castType, expressionType);
- constant = expression.constant; //use the same constant
- return;
- }
- if (expressionType.isCompatibleWith(castType)
- || BaseTypeBinding.isNarrowing(castType.id, expressionType.id)) {
- expression.implicitConversion = (castType.id << 4) + expressionType.id;
- if (expression.constant != Constant.NotAConstant)
- constant = expression.constant.castTo(expression.implicitConversion);
- return;
- }
- }
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- }
-
- //-----------cast to something which is NOT a base type--------------------------
- if (expressionType == NullBinding) {
- // if (castType.isArrayType()){ // 26903 - need checkcast when casting null to array type
- // needRuntimeCheckcast = true;
- // }
- return; //null is compatible with every thing
- }
- if (expressionType.isBaseType()) {
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- }
-
- if (expressionType.isArrayType()) {
- if (castType == expressionType) return; // identity conversion
-
- if (castType.isArrayType()) {
- //------- (castType.isArray) expressionType.isArray -----------
- TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType(scope);
- if (exprElementType.isBaseType()) {
- // <---stop the recursion-------
- if (((ArrayBinding) castType).elementsType(scope) == exprElementType)
- needRuntimeCheckcast = true;
- else
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- }
- // recursively on the elements...
- areTypesCastCompatible(
- scope,
- ((ArrayBinding) castType).elementsType(scope),
- exprElementType);
- return;
- } else if (
- castType.isClass()) {
- //------(castType.isClass) expressionType.isArray ---------------
- if (scope.isJavaLangObject(castType))
- return;
- } else { //------- (castType.isInterface) expressionType.isArray -----------
- if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
- needRuntimeCheckcast = true;
- return;
- }
- }
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- }
-
- if (expressionType.isClass()) {
- if (castType.isArrayType()) {
- // ---- (castType.isArray) expressionType.isClass -------
- if (scope.isJavaLangObject(expressionType)) { // potential runtime error
- needRuntimeCheckcast = true;
- return;
- }
- } else if (castType.isClass()) { // ----- (castType.isClass) expressionType.isClass ------
- if (expressionType.isCompatibleWith(castType)){ // no runtime error
- if (castType.id == T_String) constant = expression.constant; // (String) cst is still a constant
- return;
- }
- if (castType.isCompatibleWith(expressionType)) {
- // potential runtime error
- needRuntimeCheckcast = true;
- return;
- }
- } else { // ----- (castType.isInterface) expressionType.isClass -------
- if (((ReferenceBinding) expressionType).isFinal()) {
- // no subclass for expressionType, thus compile-time check is valid
- if (expressionType.isCompatibleWith(castType))
- return;
- } else { // a subclass may implement the interface ==> no check at compile time
- needRuntimeCheckcast = true;
- return;
- }
- }
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- }
-
- // if (expressionType.isInterface()) { cannot be anything else
- if (castType.isArrayType()) {
- // ----- (castType.isArray) expressionType.isInterface ------
- if (scope.isJavaLangCloneable(expressionType)
- || scope.isJavaIoSerializable(expressionType)) // potential runtime error
- needRuntimeCheckcast = true;
- else
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- } else if (castType.isClass()) { // ----- (castType.isClass) expressionType.isInterface --------
- if (scope.isJavaLangObject(castType)) // no runtime error
- return;
- if (((ReferenceBinding) castType).isFinal()) {
- // no subclass for castType, thus compile-time check is valid
- if (!castType.isCompatibleWith(expressionType)) {
- // potential runtime error
- scope.problemReporter().typeCastError(this, castType, expressionType);
- return;
- }
- }
- } else { // ----- (castType.isInterface) expressionType.isInterface -------
- if (castType == expressionType) return; // identity conversion
- if (Scope.compareTypes(castType, expressionType) == NotRelated) {
- MethodBinding[] castTypeMethods = ((ReferenceBinding) castType).methods();
- MethodBinding[] expressionTypeMethods =
- ((ReferenceBinding) expressionType).methods();
- int exprMethodsLength = expressionTypeMethods.length;
- for (int i = 0, castMethodsLength = castTypeMethods.length; i < castMethodsLength; i++)
- for (int j = 0; j < exprMethodsLength; j++) {
- if ((castTypeMethods[i].returnType != expressionTypeMethods[j].returnType)
- && (castTypeMethods[i].selector == expressionTypeMethods[j].selector)
- && castTypeMethods[i].areParametersEqual(expressionTypeMethods[j])) {
- scope.problemReporter().typeCastError(this, castType, expressionType);
- }
- }
- }
- }
- needRuntimeCheckcast = true;
- return;
- }
-
- /**
- * Cast expression code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// if (constant != NotAConstant) {
-// if (valueRequired
-// || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
-// codeStream.generateConstant(constant, implicitConversion);
-// if (needRuntimeCheckcast) {
-// codeStream.checkcast(this.resolvedType);
-// if (!valueRequired)
-// codeStream.pop();
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// expression.generateCode(
-// currentScope,
-// codeStream,
-// valueRequired || needRuntimeCheckcast);
-// if (needRuntimeCheckcast) {
-// codeStream.checkcast(this.resolvedType);
-// if (!valueRequired)
-// codeStream.pop();
-// } else {
-// if (valueRequired)
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public Expression innermostCastedExpression(){
- Expression current = this.expression;
- while (current instanceof CastExpression) {
- current = ((CastExpression) current).expression;
- }
- return current;
- }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- output.append('(');
- type.print(0, output).append(") "); //$NON-NLS-1$
- return expression.printExpression(0, output);
- }
-
- public TypeBinding resolveType(BlockScope scope) {
- // compute a new constant if the cast is effective
-
- // due to the fact an expression may start with ( and that a cast can also start with (
- // the field is an expression....it can be a TypeReference OR a NameReference Or
- // any kind of Expression <-- this last one is invalid.......
-
- constant = Constant.NotAConstant;
- implicitConversion = T_undefined;
- if ((type instanceof TypeReference) || (type instanceof NameReference)) {
- this.resolvedType = type.resolveType(scope);
- TypeBinding castedExpressionType = expression.resolveType(scope);
- if (this.resolvedType != null && castedExpressionType != null) {
- areTypesCastCompatible(scope, this.resolvedType, castedExpressionType);
- }
- return this.resolvedType;
- } else { // expression as a cast !!!!!!!!
- TypeBinding castedExpressionType = expression.resolveType(scope);
- if (castedExpressionType == null) return null;
- scope.problemReporter().invalidTypeReference(type);
- return null;
- }
- }
-
- public String toStringExpression() {
-
- return "(" + type.toString(0) + ") " + //$NON-NLS-2$ //$NON-NLS-1$
- expression.toStringExpression();
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- type.traverse(visitor, blockScope);
- expression.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Clinit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Clinit.java
deleted file mode 100644
index 2f74317..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Clinit.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
-
-public class Clinit extends AbstractMethodDeclaration {
-
- public final static char[] ConstantPoolName = "".toCharArray(); //$NON-NLS-1$
-
- private FieldBinding assertionSyntheticFieldBinding = null;
- private FieldBinding classLiteralSyntheticField = null;
-
- public Clinit(CompilationResult compilationResult) {
- super(compilationResult);
- modifiers = 0;
- selector = ConstantPoolName;
- }
-
- public void analyseCode(
- ClassScope classScope,
- InitializationFlowContext staticInitializerFlowContext,
- FlowInfo flowInfo) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- ExceptionHandlingFlowContext clinitContext =
- new ExceptionHandlingFlowContext(
- staticInitializerFlowContext.parent,
- this,
- NoExceptions,
- scope,
- FlowInfo.DEAD_END);
-
- // check for missing returning path
- this.needFreeReturn = flowInfo.isReachable();
-
- // check missing blank final field initializations
- flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
- FieldBinding[] fields = scope.enclosingSourceType().fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field;
- if ((field = fields[i]).isStatic()
- && field.isFinal()
- && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
- scope.problemReporter().uninitializedBlankFinalField(
- field,
- scope.referenceType().declarationOf(field));
- // can complain against the field decl, since only one
- }
- }
- // check static initializers thrown exceptions
- staticInitializerFlowContext.checkInitializerExceptions(
- scope,
- clinitContext,
- flowInfo);
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- /**
- * Bytecode generation for a method
- *
- * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
- * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
- */
-// public void generateCode(ClassScope classScope, ClassFile classFile) {
-//
-// int clinitOffset = 0;
-// if (ignoreFurtherInvestigation) {
-// // should never have to add any problem method
-// return;
-// }
-// try {
-// clinitOffset = classFile.contentsOffset;
-// this.generateCode(classScope, classFile, clinitOffset);
-// } catch (AbortMethod e) {
-// // should never occur
-// // the clinit referenceContext is the type declaration
-// // All clinit problems will be reported against the type: AbortType instead of AbortMethod
-// // reset the contentsOffset to the value before generating the clinit code
-// // decrement the number of method info as well.
-// // This is done in the addProblemMethod and addProblemConstructor for other
-// // cases.
-// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
-// // a branch target required a goto_w, restart code gen in wide mode.
-// try {
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++)
-// statements[i].resetStateForCodeGeneration();
-// }
-// classFile.contentsOffset = clinitOffset;
-// classFile.methodCount--;
-// classFile.codeStream.wideMode = true; // request wide mode
-// this.generateCode(classScope, classFile, clinitOffset);
-// // restart method generation
-// } catch (AbortMethod e2) {
-// classFile.contentsOffset = clinitOffset;
-// classFile.methodCount--;
-// }
-// } else {
-// // produce a problem method accounting for this fatal error
-// classFile.contentsOffset = clinitOffset;
-// classFile.methodCount--;
-// }
-// }
-// }
-
- /**
- * Bytecode generation for a method
- *
- * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
- * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
- */
-// private void generateCode(
-// ClassScope classScope,
-// ClassFile classFile,
-// int clinitOffset) {
-//
-// ConstantPool constantPool = classFile.constantPool;
-// int constantPoolOffset = constantPool.currentOffset;
-// int constantPoolIndex = constantPool.currentIndex;
-// classFile.generateMethodInfoHeaderForClinit();
-// int codeAttributeOffset = classFile.contentsOffset;
-// classFile.generateCodeAttributeHeader();
-// CodeStream codeStream = classFile.codeStream;
-// this.resolve(classScope);
-//
-// codeStream.reset(this, classFile);
-// TypeDeclaration declaringType = classScope.referenceContext;
-//
-// // initialize local positions - including initializer scope.
-// MethodScope staticInitializerScope = declaringType.staticInitializerScope;
-// staticInitializerScope.computeLocalVariablePositions(0, codeStream);
-//
-// // 1.4 feature
-// // This has to be done before any other initialization
-// if (this.assertionSyntheticFieldBinding != null) {
-// // generate code related to the activation of assertion for this class
-// codeStream.generateClassLiteralAccessForType(
-// classScope.enclosingSourceType(),
-// classLiteralSyntheticField);
-// codeStream.invokeJavaLangClassDesiredAssertionStatus();
-// Label falseLabel = new Label(codeStream);
-// codeStream.ifne(falseLabel);
-// codeStream.iconst_1();
-// Label jumpLabel = new Label(codeStream);
-// codeStream.goto_(jumpLabel);
-// falseLabel.place();
-// codeStream.iconst_0();
-// jumpLabel.place();
-// codeStream.putstatic(this.assertionSyntheticFieldBinding);
-// }
-// // generate initializers
-// 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(staticInitializerScope, codeStream);
-// }
-// }
-// }
-// if (codeStream.position == 0) {
-// // do not need to output a Clinit if no bytecodes
-// // so we reset the offset inside the byte array contents.
-// classFile.contentsOffset = clinitOffset;
-// // like we don't addd a method we need to undo the increment on the method count
-// classFile.methodCount--;
-// // reset the constant pool to its state before the clinit
-// constantPool.resetForClinit(constantPoolIndex, constantPoolOffset);
-// } else {
-// if (this.needFreeReturn) {
-// int oldPosition = codeStream.position;
-// codeStream.return_();
-// codeStream.updateLocalVariablesAttribute(oldPosition);
-// }
-// // Record the end of the clinit: point to the declaration of the class
-// codeStream.recordPositionsFrom(0, declaringType.sourceStart);
-// classFile.completeCodeAttributeForClinit(codeAttributeOffset);
-// }
-// }
-
- public boolean isClinit() {
-
- return true;
- }
-
- public boolean isInitializationMethod() {
-
- return true;
- }
-
- public boolean isStatic() {
-
- return true;
- }
-
- public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
- //the clinit is filled by hand ....
- }
- public StringBuffer print(int tab, StringBuffer output) {
-
- printIndent(tab, output).append("()"); //$NON-NLS-1$
- printBody(tab + 1, output);
- return output;
- }
- public void resolve(ClassScope scope) {
-
- this.scope = new MethodScope(scope, scope.referenceContext, true);
- }
-
- public String toString(int tab) {
-
- String s = ""; //$NON-NLS-1$
- s = s + tabString(tab);
- s = s + "()"; //$NON-NLS-1$
- s = s + toStringStatements(tab + 1);
- return s;
- }
-
- public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
- ClassScope classScope) {
-
- visitor.visit(this, classScope);
- visitor.endVisit(this, classScope);
- }
-
- // 1.4 feature
- public void addSupportForAssertion(FieldBinding assertionSyntheticFieldBinding) {
-
- this.assertionSyntheticFieldBinding = assertionSyntheticFieldBinding;
-
- // we need to add the field right now, because the field infos are generated before the methods
- SourceTypeBinding sourceType =
- this.scope.outerMostMethodScope().enclosingSourceType();
- this.classLiteralSyntheticField =
- sourceType.addSyntheticField(sourceType, scope);
- }
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompilationUnitDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompilationUnitDeclaration.java
deleted file mode 100644
index 53274a0..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompilationUnitDeclaration.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-import java.util.ArrayList;
-
-import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
-import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
-
-public class CompilationUnitDeclaration extends ASTNode implements ProblemSeverities, ReferenceContext {
-
- public ImportReference currentPackage;
- public ImportReference[] imports;
- // public TypeDeclaration[] types;
- public ArrayList types;
-
- //public char[][] name;
- public int[][] comments;
-
- public boolean ignoreFurtherInvestigation = false; // once pointless to investigate due to errors
- public boolean ignoreMethodBodies = false;
- public CompilationUnitScope scope;
- public ProblemReporter problemReporter;
- public CompilationResult compilationResult;
-
- private LocalTypeBinding[] localTypes;
- int localTypeCount = 0;
-
- public boolean isPropagatingInnerClassEmulation;
-
- public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
-
- this.problemReporter = problemReporter;
- this.compilationResult = compilationResult;
- this.types = new ArrayList();
- //by definition of a compilation unit....
- sourceStart = 0;
- sourceEnd = sourceLength - 1;
- }
-
- /*
- * We cause the compilation task to abort to a given extent.
- */
- public void abort(int abortLevel) {
-
- switch (abortLevel) {
- case AbortType :
- throw new AbortType(compilationResult);
- case AbortMethod :
- throw new AbortMethod(compilationResult);
- default :
- throw new AbortCompilationUnit(compilationResult);
- }
- }
-
- /*
- * Dispatch code analysis AND request saturation of inner emulation
- */
- public void analyseCode() {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (types != null) {
- for (int i = 0, count = types.size(); i < count; i++) {
- if (types.get(i) instanceof TypeDeclaration)
- ((TypeDeclaration) types.get(i)).analyseCode(scope);
- }
- }
- // request inner emulation propagation
- propagateInnerEmulationForAllLocalTypes();
- } catch (AbortCompilationUnit e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
- }
-
- /*
- * When unit result is about to be accepted, removed back pointers
- * to compiler structures.
- */
- public void cleanUp() {
- if (this.types != null) {
- for (int i = 0, max = this.types.size(); i < max; i++) {
- if (this.types.get(i) instanceof TypeDeclaration) {
- cleanUp((TypeDeclaration) this.types.get(i));
- }
- }
- for (int i = 0, max = this.localTypeCount; i < max; i++) {
- // null out the type's scope backpointers
- localTypes[i].scope = null; // local members are already in the list
- }
- }
- // ClassFile[] classFiles = compilationResult.getClassFiles();
- // for (int i = 0, max = classFiles.length; i < max; i++) {
- // // clear the classFile back pointer to the bindings
- // ClassFile classFile = classFiles[i];
- // // null out the classfile backpointer to a type binding
- // classFile.referenceBinding = null;
- // classFile.codeStream = null; // codeStream holds onto ast and scopes
- // classFile.innerClassesBindings = null;
- // }
- }
- private void cleanUp(TypeDeclaration type) {
- if (type.memberTypes != null) {
- for (int i = 0, max = type.memberTypes.length; i < max; i++) {
- cleanUp(type.memberTypes[i]);
- }
- }
- if (type.binding != null) {
- // null out the type's scope backpointers
- type.binding.scope = null;
- }
- }
-
-// public void checkUnusedImports() {
-//
-// if (this.scope.imports != null) {
-// for (int i = 0, max = this.scope.imports.length; i < max; i++) {
-// ImportBinding importBinding = this.scope.imports[i];
-// ImportReference importReference = importBinding.reference;
-// if (importReference != null && !importReference.used) {
-// scope.problemReporter().unusedImport(importReference);
-// }
-// }
-// }
-// }
-
- public CompilationResult compilationResult() {
- return compilationResult;
- }
-
- /*
- * Finds the matching type amoung this compilation unit types.
- * Returns null if no type with this name is found.
- * The type name is a compound name
- * eg. if we're looking for X.A.B then a type name would be {X, A, B}
- */
- public TypeDeclaration declarationOfType(char[][] typeName) {
-
- for (int i = 0; i < this.types.size(); i++) {
- if (this.types.get(i) instanceof TypeDeclaration) {
- TypeDeclaration typeDecl = ((TypeDeclaration) this.types.get(i)).declarationOfType(typeName);
- if (typeDecl != null) {
- return typeDecl;
- }
- }
- }
- return null;
- }
-
- /**
- * Bytecode generation
- */
- // public void generateCode() {
- //
- // if (ignoreFurtherInvestigation) {
- // if (types != null) {
- // for (int i = 0, count = types.length; i < count; i++) {
- // types[i].ignoreFurtherInvestigation = true;
- // // propagate the flag to request problem type creation
- // types[i].generateCode(scope);
- // }
- // }
- // return;
- // }
- // try {
- // if (types != null) {
- // for (int i = 0, count = types.length; i < count; i++)
- // types[i].generateCode(scope);
- // }
- // } catch (AbortCompilationUnit e) {
- // }
- // }
-
- public char[] getFileName() {
-
- return compilationResult.getFileName();
- }
-
- public char[] getMainTypeName() {
-
- if (compilationResult.compilationUnit == null) {
- char[] fileName = compilationResult.getFileName();
-
- int start = CharOperation.lastIndexOf('/', fileName) + 1;
- if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName))
- start = CharOperation.lastIndexOf('\\', fileName) + 1;
-
- int end = CharOperation.lastIndexOf('.', fileName);
- if (end == -1)
- end = fileName.length;
-
- return CharOperation.subarray(fileName, start, end);
- } else {
- return compilationResult.compilationUnit.getMainTypeName();
- }
- }
-
- public boolean isEmpty() {
-
- return (currentPackage == null) && (imports == null) && (types == null);
- }
-
- public boolean hasErrors() {
- return this.ignoreFurtherInvestigation;
- }
- public StringBuffer print(int indent, StringBuffer output) {
-
- if (currentPackage != null) {
- printIndent(indent, output).append("package "); //$NON-NLS-1$
- currentPackage.print(0, output, false).append(";\n"); //$NON-NLS-1$
- }
- if (imports != null)
- for (int i = 0; i < imports.length; i++) {
- printIndent(indent, output).append("import "); //$NON-NLS-1$
- imports[i].print(0, output).append(";\n"); //$NON-NLS-1$
- }
-
- if (types != null) {
- for (int i = 0; i < types.size(); i++) {
- ((ASTNode)types.get(i)).print(indent, output).append("\n"); //$NON-NLS-1$
- }
- }
- return output;
- }
-
- /*
- * Force inner local types to update their innerclass emulation
- */
- public void propagateInnerEmulationForAllLocalTypes() {
-
- isPropagatingInnerClassEmulation = true;
- for (int i = 0, max = this.localTypeCount; i < max; i++) {
-
- LocalTypeBinding localType = localTypes[i];
- // only propagate for reachable local types
- if ((localType.scope.referenceType().bits & IsReachableMASK) != 0) {
- localType.updateInnerEmulationDependents();
- }
- }
- }
-
- /*
- * Keep track of all local types, so as to update their innerclass
- * emulation later on.
- */
- public void record(LocalTypeBinding localType) {
-
- if (this.localTypeCount == 0) {
- this.localTypes = new LocalTypeBinding[5];
- } else if (this.localTypeCount == this.localTypes.length) {
- System.arraycopy(
- this.localTypes,
- 0,
- (this.localTypes = new LocalTypeBinding[this.localTypeCount * 2]),
- 0,
- this.localTypeCount);
- }
- this.localTypes[this.localTypeCount++] = localType;
- }
-
- public void resolve() {
-
- try {
- if (types != null) {
- for (int i = 0, count = types.size(); i < count; i++) {
- if (types.get(i) instanceof TypeDeclaration) {
- ((TypeDeclaration) types.get(i)).resolve(scope);
- }
- }
- }
-// if (!this.compilationResult.hasSyntaxError())
-// checkUnusedImports();
- } catch (AbortCompilationUnit e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
- }
-
- public void tagAsHavingErrors() {
- ignoreFurtherInvestigation = true;
- }
-
- public String toString(int tab) {
-
- String s = ""; //$NON-NLS-1$
- if (currentPackage != null)
- s = tabString(tab) + "package " + currentPackage.toString(0, false) + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (imports != null)
- for (int i = 0; i < imports.length; i++) {
- s += tabString(tab) + "include " + imports[i].toString() + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- if (types != null)
- for (int i = 0; i < types.size(); i++) {
- s += ((ASTNode) types.get(i)).toString(tab) + "\n"; //$NON-NLS-1$
- }
- return s;
- }
-
- public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, scope)) {
- if (currentPackage != null) {
- currentPackage.traverse(visitor, scope);
- }
- if (imports != null) {
- int importLength = imports.length;
- for (int i = 0; i < importLength; i++) {
- imports[i].traverse(visitor, scope);
- }
- }
- if (types != null) {
- int typesLength = types.size();
- for (int i = 0; i < typesLength; i++) {
- if (types.get(i) instanceof TypeDeclaration) {
- ((TypeDeclaration) types.get(i)).traverse(visitor, scope);
- }
- }
- }
- }
- visitor.endVisit(this, scope);
- } catch (AbortCompilationUnit e) {
- }
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompoundAssignment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompoundAssignment.java
deleted file mode 100644
index e0d7090..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/CompoundAssignment.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class CompoundAssignment extends Assignment implements OperatorIds {
- public int operator;
- public int assignmentImplicitConversion;
-
- // var op exp is equivalent to var = (varType) var op exp
- // assignmentImplicitConversion stores the cast needed for the assignment
-
-public CompoundAssignment(Expression lhs, Expression expression,int operator, int sourceEnd) {
- //lhs is always a reference by construction ,
- //but is build as an expression ==> the checkcast cannot fail
-
- super(lhs, expression, sourceEnd);
- lhs.bits &= ~IsStrictlyAssignedMASK; // tag lhs as NON assigned - it is also a read access
- this.operator = operator ;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- // record setting a variable: various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
- // just a local variable.
-
- return ((Reference) lhs).analyseAssignment(currentScope, flowContext, flowInfo, this, true).unconditionalInits();
-}
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-//
-// // various scenarii are possible, setting an array reference,
-// // a field reference, a blank final field reference, a field of an enclosing instance or
-// // just a local variable.
-//
-// int pc = codeStream.position;
-// ((Reference) lhs).generateCompoundAssignment(currentScope, codeStream, expression, operator, assignmentImplicitConversion, valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public String operatorToString() {
- switch (operator) {
- case PLUS :
- return "+="; //$NON-NLS-1$
- case MINUS :
- return "-="; //$NON-NLS-1$
- case MULTIPLY :
- return "*="; //$NON-NLS-1$
- case DIVIDE :
- return "/="; //$NON-NLS-1$
- case AND :
- return "&="; //$NON-NLS-1$
- case OR :
- return "|="; //$NON-NLS-1$
- case XOR :
- return "^="; //$NON-NLS-1$
- case REMAINDER :
- return "%="; //$NON-NLS-1$
- case LEFT_SHIFT :
- return "<<="; //$NON-NLS-1$
- case RIGHT_SHIFT :
- return ">>="; //$NON-NLS-1$
- case UNSIGNED_RIGHT_SHIFT :
- return ">>>="; //$NON-NLS-1$
- };
- return "unknown operator"; //$NON-NLS-1$
-}
-public TypeBinding resolveType(BlockScope scope) {
- constant = NotAConstant;
- if (!(this.lhs instanceof Reference)) {
- scope.problemReporter().expressionShouldBeAVariable(this.lhs);
- }
- TypeBinding lhsType = lhs.resolveType(scope);
- TypeBinding expressionType = expression.resolveType(scope);
- if (lhsType == null || expressionType == null)
- return null;
-
- int lhsId = lhsType.id;
- int expressionId = expressionType.id;
- if (restrainUsageToNumericTypes() && !lhsType.isNumericType()) {
- scope.problemReporter().operatorOnlyValidOnNumericType(this, lhsType, expressionType);
- return null;
- }
- if (lhsId > 15 || expressionId > 15) {
- if (lhsId != T_String) { // String += Object is valid wheraas Object -= String is not
- scope.problemReporter().invalidOperator(this, lhsType, expressionType);
- return null;
- }
- expressionId = T_Object; // use the Object has tag table
- }
-
- // the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
-
- // the conversion is stored INTO the reference (info needed for the code gen)
- int result = OperatorExpression.ResolveTypeTables[operator][ (lhsId << 4) + expressionId];
- if (result == T_undefined) {
- scope.problemReporter().invalidOperator(this, lhsType, expressionType);
- return null;
- }
- if (operator == PLUS){
- if(scope.isJavaLangObject(lhsType)) {
- // += is illegal
- scope.problemReporter().invalidOperator(this, lhsType, expressionType);
- return null;
- } else if ((lhsType.isNumericType() || lhsId == T_boolean) && !expressionType.isNumericType()){
- // += is illegal
- scope.problemReporter().invalidOperator(this, lhsType, expressionType);
- return null;
- }
- }
- lhs.implicitConversion = result >>> 12;
- expression.implicitConversion = (result >>> 4) & 0x000FF;
- assignmentImplicitConversion = (lhsId << 4) + (result & 0x0000F);
- return this.resolvedType = lhsType;
-}
-public boolean restrainUsageToNumericTypes(){
- return false ;}
-public String toStringExpressionNoParenthesis() {
-
- return lhs.toStringExpression() + " " + //$NON-NLS-1$
- operatorToString() + " " + //$NON-NLS-1$
- expression.toStringExpression() ; }
-public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- expression.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConditionalExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConditionalExpression.java
deleted file mode 100644
index 4472c01..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConditionalExpression.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class ConditionalExpression extends OperatorExpression {
-
- public Expression condition, valueIfTrue, valueIfFalse;
- public Constant optimizedBooleanConstant;
- public Constant optimizedIfTrueConstant;
- public Constant optimizedIfFalseConstant;
-
- private int returnTypeSlotSize = 1;
-
- // for local variables table attributes
- int trueInitStateIndex = -1;
- int falseInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public ConditionalExpression(
- Expression condition,
- Expression valueIfTrue,
- Expression valueIfFalse) {
- this.condition = condition;
- this.valueIfTrue = valueIfTrue;
- this.valueIfFalse = valueIfFalse;
- sourceStart = condition.sourceStart;
- sourceEnd = valueIfFalse.sourceEnd;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- Constant cst = this.condition.optimizedBooleanConstant();
- boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- int mode = flowInfo.reachMode();
- flowInfo = condition.analyseCode(currentScope, flowContext, flowInfo, cst == NotAConstant);
-
- // process the if-true part
- FlowInfo trueFlowInfo = flowInfo.initsWhenTrue().copy();
- if (isConditionOptimizedFalse) {
- trueFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- trueInitStateIndex = currentScope.methodScope().recordInitializationStates(trueFlowInfo);
- trueFlowInfo = valueIfTrue.analyseCode(currentScope, flowContext, trueFlowInfo);
-
- // process the if-false part
- FlowInfo falseFlowInfo = flowInfo.initsWhenFalse().copy();
- if (isConditionOptimizedTrue) {
- falseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- falseInitStateIndex = currentScope.methodScope().recordInitializationStates(falseFlowInfo);
- falseFlowInfo = valueIfFalse.analyseCode(currentScope, flowContext, falseFlowInfo);
-
- // merge if-true & if-false initializations
- FlowInfo mergedInfo;
- if (isConditionOptimizedTrue){
- mergedInfo = trueFlowInfo.addPotentialInitializationsFrom(falseFlowInfo);
- } else if (isConditionOptimizedFalse) {
- mergedInfo = falseFlowInfo.addPotentialInitializationsFrom(trueFlowInfo);
- } else {
- // merge using a conditional info - 1GK2BLM
- // if ((t && (v = t)) ? t : t && (v = f)) r = v; -- ok
- cst = this.optimizedIfTrueConstant;
- boolean isValueIfTrueOptimizedTrue = cst != null && cst != NotAConstant && cst.booleanValue() == true;
- boolean isValueIfTrueOptimizedFalse = cst != null && cst != NotAConstant && cst.booleanValue() == false;
-
- cst = this.optimizedIfFalseConstant;
- boolean isValueIfFalseOptimizedTrue = cst != null && cst != NotAConstant && cst.booleanValue() == true;
- boolean isValueIfFalseOptimizedFalse = cst != null && cst != NotAConstant && cst.booleanValue() == false;
-
- UnconditionalFlowInfo trueInfoWhenTrue = trueFlowInfo.initsWhenTrue().copy().unconditionalInits();
- if (isValueIfTrueOptimizedFalse) trueInfoWhenTrue.setReachMode(FlowInfo.UNREACHABLE);
-
- UnconditionalFlowInfo falseInfoWhenTrue = falseFlowInfo.initsWhenTrue().copy().unconditionalInits();
- if (isValueIfFalseOptimizedFalse) falseInfoWhenTrue.setReachMode(FlowInfo.UNREACHABLE);
-
- UnconditionalFlowInfo trueInfoWhenFalse = trueFlowInfo.initsWhenFalse().copy().unconditionalInits();
- if (isValueIfTrueOptimizedTrue) trueInfoWhenFalse.setReachMode(FlowInfo.UNREACHABLE);
-
- UnconditionalFlowInfo falseInfoWhenFalse = falseFlowInfo.initsWhenFalse().copy().unconditionalInits();
- if (isValueIfFalseOptimizedTrue) falseInfoWhenFalse.setReachMode(FlowInfo.UNREACHABLE);
-
- mergedInfo =
- FlowInfo.conditional(
- trueInfoWhenTrue.mergedWith(falseInfoWhenTrue),
- trueInfoWhenFalse.mergedWith(falseInfoWhenFalse));
- }
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- mergedInfo.setReachMode(mode);
- return mergedInfo;
- }
-
- /**
- * Code generation for the conditional operator ?:
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Label endifLabel, falseLabel;
-// if (constant != NotAConstant) {
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// Constant cst = condition.constant;
-// Constant condCst = condition.optimizedBooleanConstant();
-// boolean needTruePart =
-// !(((cst != NotAConstant) && (cst.booleanValue() == false))
-// || ((condCst != NotAConstant) && (condCst.booleanValue() == false)));
-// boolean needFalsePart =
-// !(((cst != NotAConstant) && (cst.booleanValue() == true))
-// || ((condCst != NotAConstant) && (condCst.booleanValue() == true)));
-// endifLabel = new Label(codeStream);
-//
-// // Generate code for the condition
-// boolean needConditionValue = (cst == NotAConstant) && (condCst == NotAConstant);
-// condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// needConditionValue);
-//
-// if (trueInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// trueInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, trueInitStateIndex);
-// }
-// // Then code generation
-// if (needTruePart) {
-// valueIfTrue.generateCode(currentScope, codeStream, valueRequired);
-// if (needFalsePart) {
-// // Jump over the else part
-// int position = codeStream.position;
-// codeStream.goto_(endifLabel);
-// codeStream.updateLastRecordedEndPC(position);
-// // Tune codestream stack size
-// if (valueRequired) {
-// codeStream.decrStackSize(returnTypeSlotSize);
-// }
-// }
-// }
-// if (needFalsePart) {
-// falseLabel.place();
-// if (falseInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// falseInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, falseInitStateIndex);
-// }
-// valueIfFalse.generateCode(currentScope, codeStream, valueRequired);
-// // End of if statement
-// endifLabel.place();
-// }
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// // implicit conversion
-// if (valueRequired)
-// codeStream.generateImplicitConversion(implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-//
-// /**
-// * Optimized boolean code generation for the conditional operator ?:
-// */
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean) // constant
-// || (valueIfTrue.implicitConversion >> 4) != T_boolean) { // non boolean values
-// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// return;
-// }
-// Constant cst = condition.constant;
-// Constant condCst = condition.optimizedBooleanConstant();
-// boolean needTruePart =
-// !(((cst != NotAConstant) && (cst.booleanValue() == false))
-// || ((condCst != NotAConstant) && (condCst.booleanValue() == false)));
-// boolean needFalsePart =
-// !(((cst != NotAConstant) && (cst.booleanValue() == true))
-// || ((condCst != NotAConstant) && (condCst.booleanValue() == true)));
-//
-// Label internalFalseLabel, endifLabel = new Label(codeStream);
-//
-// // Generate code for the condition
-// boolean needConditionValue = (cst == NotAConstant) && (condCst == NotAConstant);
-// condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// internalFalseLabel = new Label(codeStream),
-// needConditionValue);
-//
-// if (trueInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// trueInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, trueInitStateIndex);
-// }
-// // Then code generation
-// if (needTruePart) {
-// valueIfTrue.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-//
-// if (needFalsePart) {
-// // Jump over the else part
-// int position = codeStream.position;
-// codeStream.goto_(endifLabel);
-// codeStream.updateLastRecordedEndPC(position);
-// // No need to decrement codestream stack size
-// // since valueIfTrue was already consumed by branch bytecode
-// }
-// }
-// if (needFalsePart) {
-// internalFalseLabel.place();
-// if (falseInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// falseInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, falseInitStateIndex);
-// }
-// valueIfFalse.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-//
-// // End of if statement
-// endifLabel.place();
-// }
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// // no implicit conversion for boolean values
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// public Constant optimizedBooleanConstant() {
-//
-// return this.optimizedBooleanConstant == null ? this.constant : this.optimizedBooleanConstant;
-// }
-//
-// public TypeBinding resolveType(BlockScope scope) {
-// // specs p.368
-// constant = NotAConstant;
-// TypeBinding conditionType = condition.resolveTypeExpecting(scope, BooleanBinding);
-// TypeBinding valueIfTrueType = valueIfTrue.resolveType(scope);
-// TypeBinding valueIfFalseType = valueIfFalse.resolveType(scope);
-// if (conditionType == null || valueIfTrueType == null || valueIfFalseType == null)
-// return null;
-//
-// // Propagate the constant value from the valueIfTrue and valueIFFalse expression if it is possible
-// Constant condConstant, trueConstant, falseConstant;
-// if ((condConstant = condition.constant) != NotAConstant
-// && (trueConstant = valueIfTrue.constant) != NotAConstant
-// && (falseConstant = valueIfFalse.constant) != NotAConstant) {
-// // all terms are constant expression so we can propagate the constant
-// // from valueIFTrue or valueIfFalse to teh receiver constant
-// constant = condConstant.booleanValue() ? trueConstant : falseConstant;
-// }
-// if (valueIfTrueType == valueIfFalseType) { // harmed the implicit conversion
-// valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
-// valueIfFalse.implicitConversion = valueIfTrue.implicitConversion;
-// if (valueIfTrueType == LongBinding || valueIfTrueType == DoubleBinding) {
-// returnTypeSlotSize = 2;
-// }
-//
-// if (valueIfTrueType == BooleanBinding) {
-// this.optimizedIfTrueConstant = valueIfTrue.optimizedBooleanConstant();
-// this.optimizedIfFalseConstant = valueIfFalse.optimizedBooleanConstant();
-//
-// // Propagate the optimized boolean constant if possible
-// if ((condConstant = condition.optimizedBooleanConstant()) != NotAConstant) {
-//
-// this.optimizedBooleanConstant = condConstant.booleanValue()
-// ? optimizedIfTrueConstant
-// : optimizedIfFalseConstant;
-// }
-// }
-// return this.resolvedType = valueIfTrueType;
-// }
-// // Determine the return type depending on argument types
-// // Numeric types
-// if (valueIfTrueType.isNumericType() && valueIfFalseType.isNumericType()) {
-// // (Short x Byte) or (Byte x Short)"
-// if ((valueIfTrueType == ByteBinding && valueIfFalseType == ShortBinding)
-// || (valueIfTrueType == ShortBinding && valueIfFalseType == ByteBinding)) {
-// valueIfTrue.implicitWidening(ShortBinding, valueIfTrueType);
-// valueIfFalse.implicitWidening(ShortBinding, valueIfFalseType);
-// this.resolvedType = ShortBinding;
-// return ShortBinding;
-// }
-// // x constant(Int) ---> and reciprocally
-// if ((valueIfTrueType == ByteBinding || valueIfTrueType == ShortBinding || valueIfTrueType == CharBinding)
-// && (valueIfFalseType == IntBinding
-// && valueIfFalse.isConstantValueOfTypeAssignableToType(valueIfFalseType, valueIfTrueType))) {
-// valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
-// valueIfFalse.implicitWidening(valueIfTrueType, valueIfFalseType);
-// this.resolvedType = valueIfTrueType;
-// return valueIfTrueType;
-// }
-// if ((valueIfFalseType == ByteBinding
-// || valueIfFalseType == ShortBinding
-// || valueIfFalseType == CharBinding)
-// && (valueIfTrueType == IntBinding
-// && valueIfTrue.isConstantValueOfTypeAssignableToType(valueIfTrueType, valueIfFalseType))) {
-// valueIfTrue.implicitWidening(valueIfFalseType, valueIfTrueType);
-// valueIfFalse.implicitWidening(valueIfFalseType, valueIfFalseType);
-// this.resolvedType = valueIfFalseType;
-// return valueIfFalseType;
-// }
-// // Manual binary numeric promotion
-// // int
-// if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_int)
-// && BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_int)) {
-// valueIfTrue.implicitWidening(IntBinding, valueIfTrueType);
-// valueIfFalse.implicitWidening(IntBinding, valueIfFalseType);
-// this.resolvedType = IntBinding;
-// return IntBinding;
-// }
-// // long
-// if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_long)
-// && BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_long)) {
-// valueIfTrue.implicitWidening(LongBinding, valueIfTrueType);
-// valueIfFalse.implicitWidening(LongBinding, valueIfFalseType);
-// returnTypeSlotSize = 2;
-// this.resolvedType = LongBinding;
-// return LongBinding;
-// }
-// // float
-// if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_float)
-// && BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_float)) {
-// valueIfTrue.implicitWidening(FloatBinding, valueIfTrueType);
-// valueIfFalse.implicitWidening(FloatBinding, valueIfFalseType);
-// this.resolvedType = FloatBinding;
-// return FloatBinding;
-// }
-// // double
-// valueIfTrue.implicitWidening(DoubleBinding, valueIfTrueType);
-// valueIfFalse.implicitWidening(DoubleBinding, valueIfFalseType);
-// returnTypeSlotSize = 2;
-// this.resolvedType = DoubleBinding;
-// return DoubleBinding;
-// }
-// // Type references (null null is already tested)
-// if ((valueIfTrueType.isBaseType() && valueIfTrueType != NullBinding)
-// || (valueIfFalseType.isBaseType() && valueIfFalseType != NullBinding)) {
-// scope.problemReporter().conditionalArgumentsIncompatibleTypes(
-// this,
-// valueIfTrueType,
-// valueIfFalseType);
-// return null;
-// }
-// if (valueIfFalseType.isCompatibleWith(valueIfTrueType)) {
-// valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
-// valueIfFalse.implicitWidening(valueIfTrueType, valueIfFalseType);
-// this.resolvedType = valueIfTrueType;
-// return valueIfTrueType;
-// }
-// if (valueIfTrueType.isCompatibleWith(valueIfFalseType)) {
-// valueIfTrue.implicitWidening(valueIfFalseType, valueIfTrueType);
-// valueIfFalse.implicitWidening(valueIfFalseType, valueIfFalseType);
-// this.resolvedType = valueIfFalseType;
-// return valueIfFalseType;
-// }
-// scope.problemReporter().conditionalArgumentsIncompatibleTypes(
-// this,
-// valueIfTrueType,
-// valueIfFalseType);
-// return null;
-// }
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
-
- condition.printExpression(indent, output).append(" ? "); //$NON-NLS-1$
- valueIfTrue.printExpression(0, output).append(" : "); //$NON-NLS-1$
- return valueIfFalse.printExpression(0, output);
- }
- public String toStringExpressionNoParenthesis() {
- return condition.toStringExpression() + " ? " + //$NON-NLS-1$
- valueIfTrue.toStringExpression() + " : " + //$NON-NLS-1$
- valueIfFalse.toStringExpression();
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- condition.traverse(visitor, scope);
- valueIfTrue.traverse(visitor, scope);
- valueIfFalse.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConstructorDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConstructorDeclaration.java
deleted file mode 100644
index 444c67d..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ConstructorDeclaration.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import java.util.ArrayList;
-
-import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
-
-
-public class ConstructorDeclaration extends AbstractMethodDeclaration {
-
- public ExplicitConstructorCall constructorCall;
- public final static char[] ConstantPoolName = "".toCharArray(); //$NON-NLS-1$
- public boolean isDefaultConstructor = false;
-
- public ConstructorDeclaration(CompilationResult compilationResult){
- super(compilationResult);
- }
-
- public void analyseCode(
- ClassScope classScope,
- InitializationFlowContext initializerFlowContext,
- FlowInfo flowInfo) {
-
- if (ignoreFurtherInvestigation)
- return;
-
- if (this.binding != null && this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
- if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
- scope.problemReporter().unusedPrivateConstructor(this);
- }
- }
-
- // check constructor recursion, once all constructor got resolved
- if (isRecursive(null /*lazy initialized visited list*/)) {
- this.scope.problemReporter().recursiveConstructorInvocation(this.constructorCall);
- }
-
- try {
- ExceptionHandlingFlowContext constructorContext =
- new ExceptionHandlingFlowContext(
- initializerFlowContext.parent,
- this,
- binding.thrownExceptions,
- scope,
- FlowInfo.DEAD_END);
- initializerFlowContext.checkInitializerExceptions(
- scope,
- constructorContext,
- flowInfo);
-
- // anonymous constructor can gain extra thrown exceptions from unhandled ones
- if (binding.declaringClass.isAnonymousType()) {
- ArrayList computedExceptions = constructorContext.extendedExceptions;
- if (computedExceptions != null){
- int size;
- if ((size = computedExceptions.size()) > 0){
- ReferenceBinding[] actuallyThrownExceptions;
- computedExceptions.toArray(actuallyThrownExceptions = new ReferenceBinding[size]);
- binding.thrownExceptions = actuallyThrownExceptions;
- }
- }
- }
-
- // propagate to constructor call
- if (constructorCall != null) {
- // if calling 'this(...)', then flag all non-static fields as definitely
- // set since they are supposed to be set inside other local constructor
- if (constructorCall.accessMode == ExplicitConstructorCall.This) {
- FieldBinding[] fields = binding.declaringClass.fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field;
- if (!(field = fields[i]).isStatic()) {
- flowInfo.markAsDefinitelyAssigned(field);
- }
- }
- }
- flowInfo = constructorCall.analyseCode(scope, constructorContext, flowInfo);
- }
- // propagate to statements
- if (statements != null) {
- boolean didAlreadyComplain = false;
- for (int i = 0, count = statements.length; i < count; i++) {
- Statement stat;
- if (!flowInfo.complainIfUnreachable(stat = statements[i], scope, didAlreadyComplain)) {
- flowInfo = stat.analyseCode(scope, constructorContext, flowInfo);
- } else {
- didAlreadyComplain = true;
- }
- }
- }
- // check for missing returning path
- this.needFreeReturn = flowInfo.isReachable();
-
- // check missing blank final field initializations
- if ((constructorCall != null)
- && (constructorCall.accessMode != ExplicitConstructorCall.This)) {
- flowInfo = flowInfo.mergedWith(constructorContext.initsOnReturn);
- FieldBinding[] fields = binding.declaringClass.fields();
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldBinding field;
- if ((!(field = fields[i]).isStatic())
- && field.isFinal()
- && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
- scope.problemReporter().uninitializedBlankFinalField(
- field,
- isDefaultConstructor ? (ASTNode) scope.referenceType() : this);
- }
- }
- }
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- /**
- * Bytecode generation for a constructor
- *
- * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
- * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
- */
-// public void generateCode(ClassScope classScope, ClassFile classFile) {
-//
-// int problemResetPC = 0;
-// if (ignoreFurtherInvestigation) {
-// if (this.binding == null)
-// return; // Handle methods with invalid signature or duplicates
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemConstructor(this, binding, problemsCopy);
-// return;
-// }
-// try {
-// problemResetPC = classFile.contentsOffset;
-// this.internalGenerateCode(classScope, classFile);
-// } catch (AbortMethod e) {
-// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
-// // a branch target required a goto_w, restart code gen in wide mode.
-// try {
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++)
-// statements[i].resetStateForCodeGeneration();
-// }
-// classFile.contentsOffset = problemResetPC;
-// classFile.methodCount--;
-// classFile.codeStream.wideMode = true; // request wide mode
-// this.internalGenerateCode(classScope, classFile); // restart method generation
-// } catch (AbortMethod e2) {
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getAllProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemConstructor(this, binding, problemsCopy, problemResetPC);
-// }
-// } else {
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getAllProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemConstructor(this, binding, problemsCopy, problemResetPC);
-// }
-// }
-// }
-//
-// public void generateSyntheticFieldInitializationsIfNecessary(
-// MethodScope scope,
-// CodeStream codeStream,
-// ReferenceBinding declaringClass) {
-//
-// if (!declaringClass.isNestedType()) return;
-//
-// NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;
-//
-// SyntheticArgumentBinding[] syntheticArgs = nestedType.syntheticEnclosingInstances();
-// for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
-// SyntheticArgumentBinding syntheticArg;
-// if ((syntheticArg = syntheticArgs[i]).matchingField != null) {
-// codeStream.aload_0();
-// codeStream.load(syntheticArg);
-// codeStream.putfield(syntheticArg.matchingField);
-// }
-// }
-// syntheticArgs = nestedType.syntheticOuterLocalVariables();
-// for (int i = 0, max = syntheticArgs == null ? 0 : syntheticArgs.length; i < max; i++) {
-// SyntheticArgumentBinding syntheticArg;
-// if ((syntheticArg = syntheticArgs[i]).matchingField != null) {
-// codeStream.aload_0();
-// codeStream.load(syntheticArg);
-// codeStream.putfield(syntheticArg.matchingField);
-// }
-// }
-// }
-//
-// private void internalGenerateCode(ClassScope classScope, ClassFile classFile) {
-//
-// classFile.generateMethodInfoHeader(binding);
-// int methodAttributeOffset = classFile.contentsOffset;
-// int attributeNumber = classFile.generateMethodInfoAttribute(binding);
-// if ((!binding.isNative()) && (!binding.isAbstract())) {
-//
-// TypeDeclaration declaringType = classScope.referenceContext;
-// int codeAttributeOffset = classFile.contentsOffset;
-// classFile.generateCodeAttributeHeader();
-// CodeStream codeStream = classFile.codeStream;
-// codeStream.reset(this, classFile);
-//
-// // initialize local positions - including initializer scope.
-// ReferenceBinding declaringClass = binding.declaringClass;
-//
-// int argSlotSize = 1; // this==aload0
-//
-// if (declaringClass.isNestedType()){
-// NestedTypeBinding nestedType = (NestedTypeBinding) declaringClass;
-// this.scope.extraSyntheticArguments = nestedType.syntheticOuterLocalVariables();
-// scope.computeLocalVariablePositions(// consider synthetic arguments if any
-// nestedType.enclosingInstancesSlotSize + 1,
-// codeStream);
-// argSlotSize += nestedType.enclosingInstancesSlotSize;
-// argSlotSize += nestedType.outerLocalVariablesSlotSize;
-// } else {
-// scope.computeLocalVariablePositions(1, codeStream);
-// }
-//
-// if (arguments != null) {
-// for (int i = 0, max = arguments.length; i < max; i++) {
-// // arguments initialization for local variable debug attributes
-// LocalVariableBinding argBinding;
-// codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
-// argBinding.recordInitializationStartPC(0);
-// TypeBinding argType;
-// if ((argType = argBinding.type) == LongBinding || (argType == DoubleBinding)) {
-// argSlotSize += 2;
-// } else {
-// argSlotSize++;
-// }
-// }
-// }
-//
-// MethodScope initializerScope = declaringType.initializerScope;
-// initializerScope.computeLocalVariablePositions(argSlotSize, codeStream); // offset by the argument size (since not linked to method scope)
-//
-// boolean needFieldInitializations = constructorCall == null || constructorCall.accessMode != ExplicitConstructorCall.This;
-//
-// // post 1.4 source level, synthetic initializations occur prior to explicit constructor call
-// boolean preInitSyntheticFields = scope.environment().options.targetJDK >= CompilerOptions.JDK1_4;
-//
-// if (needFieldInitializations && preInitSyntheticFields){
-// generateSyntheticFieldInitializationsIfNecessary(scope, codeStream, declaringClass);
-// }
-// // generate constructor call
-// if (constructorCall != null) {
-// constructorCall.generateCode(scope, codeStream);
-// }
-// // generate field initialization - only if not invoking another constructor call of the same class
-// if (needFieldInitializations) {
-// if (!preInitSyntheticFields){
-// generateSyntheticFieldInitializationsIfNecessary(scope, codeStream, declaringClass);
-// }
-// // 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(initializerScope, codeStream);
-// }
-// }
-// }
-// }
-// // generate statements
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++) {
-// statements[i].generateCode(scope, codeStream);
-// }
-// }
-// if (this.needFreeReturn) {
-// codeStream.return_();
-// }
-// // local variable attributes
-// codeStream.exitUserScope(scope);
-// codeStream.recordPositionsFrom(0, this.bodyEnd);
-// classFile.completeCodeAttribute(codeAttributeOffset);
-// attributeNumber++;
-// }
-// classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
-//
-// // if a problem got reported during code gen, then trigger problem method creation
-// if (ignoreFurtherInvestigation) {
-// throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
-// }
-// }
-
- public boolean isConstructor() {
-
- return true;
- }
-
- public boolean isDefaultConstructor() {
-
- return isDefaultConstructor;
- }
-
- public boolean isInitializationMethod() {
-
- return true;
- }
-
- /**
- * Returns true if the constructor is directly involved in a cycle.
- * Given most constructors aren't, we only allocate the visited list
- * lazily.
- */
- public boolean isRecursive(ArrayList visited) {
-
- if (this.binding == null
- || this.constructorCall == null
- || this.constructorCall.binding == null
- || this.constructorCall.isSuperAccess()
- || !this.constructorCall.binding.isValidBinding()) {
- return false;
- }
-
- ConstructorDeclaration targetConstructor =
- ((ConstructorDeclaration)this.scope.referenceType().declarationOf(constructorCall.binding));
- if (this == targetConstructor) return true; // direct case
-
- if (visited == null) { // lazy allocation
- visited = new ArrayList(1);
- } else {
- int index = visited.indexOf(this);
- if (index >= 0) return index == 0; // only blame if directly part of the cycle
- }
- visited.add(this);
-
- return targetConstructor.isRecursive(visited);
- }
-
- public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
-
- //fill up the constructor body with its statements
- if (ignoreFurtherInvestigation)
- return;
- if (isDefaultConstructor){
- constructorCall = SuperReference.implicitSuperConstructorCall();
- constructorCall.sourceStart = sourceStart;
- constructorCall.sourceEnd = sourceEnd;
- return;
- }
- parser.parse(this, unit);
-
- }
-
- /*
- * Type checking for constructor, just another method, except for special check
- * for recursive constructor invocations.
- */
- public void resolveStatements() {
-
- if (!CharOperation.equals(scope.enclosingSourceType().sourceName, selector)){
- scope.problemReporter().missingReturnType(this);
- }
-
- // if null ==> an error has occurs at parsing time ....
- if (this.constructorCall != null) {
- // e.g. using super() in java.lang.Object
- if (this.binding != null
- && this.binding.declaringClass.id == T_Object
- && this.constructorCall.accessMode != ExplicitConstructorCall.This) {
- if (this.constructorCall.accessMode == ExplicitConstructorCall.Super) {
- scope.problemReporter().cannotUseSuperInJavaLangObject(this.constructorCall);
- }
- this.constructorCall = null;
- } else {
- this.constructorCall.resolve(this.scope);
- }
- }
-
- super.resolveStatements();
- }
-
- public String toStringStatements(int tab) {
-
- String s = " {"; //$NON-NLS-1$
- if (constructorCall != null) {
- s = s + "\n" + constructorCall.toString(tab) + ";"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- s = s + "\n" + statements[i].toString(tab); //$NON-NLS-1$
- if (!(statements[i] instanceof Block)) {
- s += ";"; //$NON-NLS-1$
- }
- }
- }
- s += "\n" + tabString(tab == 0 ? 0 : tab - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$
- //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- ClassScope classScope) {
-
- if (visitor.visit(this, classScope)) {
- if (arguments != null) {
- int argumentLength = arguments.length;
- for (int i = 0; i < argumentLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- if (thrownExceptions != null) {
- int thrownExceptionsLength = thrownExceptions.length;
- for (int i = 0; i < thrownExceptionsLength; i++)
- thrownExceptions[i].traverse(visitor, scope);
- }
- if (constructorCall != null)
- constructorCall.traverse(visitor, scope);
- if (statements != null) {
- int statementsLength = statements.length;
- for (int i = 0; i < statementsLength; i++)
- statements[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ContinueStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ContinueStatement.java
deleted file mode 100644
index 6f5479f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ContinueStatement.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class ContinueStatement extends BranchStatement {
-
- public ContinueStatement(Expression expr, int s, int e) {
-
- super(expr, s, e);
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // here requires to generate a sequence of finally blocks invocations depending corresponding
- // to each of the traversed try statements, so that execution will terminate properly.
-
- // lookup the label, this should answer the returnContext
-// FlowContext targetContext = (expression == null)
-// ? flowContext.getTargetContextForDefaultContinue()
-// : flowContext.getTargetContextForContinueLabel(label);
-
-// if (targetContext == null) {
-// if (expression == null) {
-// currentScope.problemReporter().invalidContinue(this);
-// } else {
-// currentScope.problemReporter().undefinedLabel(this);
-// }
-// return flowInfo; // pretend it did not continue since no actual target
-// }
-
-// if (targetContext == FlowContext.NotContinuableContext) {
-// currentScope.problemReporter().invalidContinue(this);
-// return flowInfo; // pretend it did not continue since no actual target
-// }
-// targetLabel = targetContext.continueLabel();
-// FlowContext traversedContext = flowContext;
-// int subIndex = 0, maxSub = 5;
-// subroutines = new ASTNode[maxSub];
-//
-// do {
-// ASTNode sub;
-// if ((sub = traversedContext.subRoutine()) != null) {
-// if (subIndex == maxSub) {
-// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
-// }
-// subroutines[subIndex++] = sub;
-// if (sub.cannotReturn()) {
-// break;
-// }
-// }
-// traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
-//
-// ASTNode node;
-// if ((node = traversedContext.associatedNode) instanceof TryStatement) {
-// TryStatement tryStatement = (TryStatement) node;
-// flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
-// } else if (traversedContext == targetContext) {
-// // only record continue info once accumulated through subroutines, and only against target context
-// targetContext.recordContinueFrom(flowInfo);
-// break;
-// }
-// } while ((traversedContext = traversedContext.parent) != null);
-//
-// // resize subroutines
-// if (subIndex != maxSub) {
-// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
-// }
- return FlowInfo.DEAD_END;
- }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output).append("continue "); //$NON-NLS-1$
- if (expression != null) output.append(expression);
- return output.append(';');
- }
- public String toString(int tab) {
-
- String s = tabString(tab);
- s += "continue "; //$NON-NLS-1$
- if (expression != null)
- s += expression.toString();
- return s;
- }
-
- public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
- BlockScope blockScope) {
-
- visitor.visit(this, blockScope);
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DefaultCase.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DefaultCase.java
deleted file mode 100644
index 0cfac6a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DefaultCase.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.CaseLabel;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class DefaultCase extends Statement {
-
- public CaseLabel targetLabel;
-
- /**
- * DefautCase constructor comment.
- */
- public DefaultCase(int sourceEnd, int sourceStart) {
-
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- return flowInfo;
- }
-
- /**
- * Default case code generation
- *
- * @param currentScope
- * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream
- * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
- // public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- //
- // if ((bits & IsReachableMASK) == 0) {
- // return;
- // }
- // int pc = codeStream.position;
- // targetLabel.place();
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- //
- // }
- /**
- * No-op : should use resolveCase(...) instead.
- */
- public void resolve(BlockScope scope) {
- }
-
- public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
-
- // remember the default case into the associated switch statement
- if (switchStatement.defaultCase != null)
- scope.problemReporter().duplicateDefaultCase(this);
-
- // on error the last default will be the selected one .... (why not) ....
- switchStatement.defaultCase = this;
- resolve(scope);
- return null;
- }
-
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output);
- output.append("default : "); //$NON-NLS-1$
- return output.append(';');
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- s = s + "default : "; //$NON-NLS-1$
- return s;
- }
-
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
-
- visitor.visit(this, blockScope);
- visitor.endVisit(this, blockScope);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoStatement.java
deleted file mode 100644
index d9c5745..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoStatement.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.LoopingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class DoStatement extends Statement {
-
- public Expression condition;
- public Statement action;
-
- private Label breakLabel, continueLabel;
-
- // for local variables table attributes
- int mergedInitStateIndex = -1;
-
- public DoStatement(Expression condition, Statement action, int s, int e) {
-
- this.sourceStart = s;
- this.sourceEnd = e;
- this.condition = condition;
- this.action = action;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- breakLabel = new Label();
- continueLabel = new Label();
- LoopingFlowContext loopingContext =
- new LoopingFlowContext(
- flowContext,
- this,
- breakLabel,
- continueLabel,
- currentScope);
-
- Constant cst = condition.constant;
- boolean isConditionTrue = cst != NotAConstant && cst.booleanValue() == true;
- cst = condition.optimizedBooleanConstant();
- boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- int previousMode = flowInfo.reachMode();
-
- if ((action != null) && !action.isEmptyBlock()) {
- flowInfo = action.analyseCode(currentScope, loopingContext, flowInfo);
-
- // code generation can be optimized when no need to continue in the loop
- if (!flowInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
- continueLabel = null;
- }
- }
- /* Reset reach mode, to address following scenario.
- * final blank;
- * do { if (true) break; else blank = 0; } while(false);
- * blank = 1; // may be initialized already
- */
- flowInfo.setReachMode(previousMode);
-
- flowInfo =
- condition.analyseCode(
- currentScope,
- loopingContext,
- (action == null
- ? flowInfo
- : (flowInfo.mergedWith(loopingContext.initsOnContinue))));
- if (!isConditionOptimizedFalse && continueLabel != null) {
- loopingContext.complainOnFinalAssignmentsInLoop(currentScope, flowInfo);
- }
-
- // infinite loop
- FlowInfo mergedInfo;
- if (isConditionTrue) {
- mergedInfo = loopingContext.initsOnBreak;
- if (!mergedInfo.isReachable()) mergedInfo.addPotentialInitializationsFrom(flowInfo.initsWhenFalse());
- } else {
- // end of loop: either condition false or break
- mergedInfo =
- flowInfo.initsWhenFalse().unconditionalInits().mergedWith(
- loopingContext.initsOnBreak);
- if (isConditionOptimizedTrue && !loopingContext.initsOnBreak.isReachable()) {
- mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- }
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- /**
- * Do statement code generation
- *
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// // labels management
-// Label actionLabel = new Label(codeStream);
-// actionLabel.place();
-// breakLabel.codeStream = codeStream;
-// if (continueLabel != null) {
-// continueLabel.codeStream = codeStream;
-// }
-//
-// // generate action
-// if (action != null) {
-// action.generateCode(currentScope, codeStream);
-// }
-// // generate condition
-// if (continueLabel != null) {
-// continueLabel.place();
-// condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// actionLabel,
-// null,
-// true);
-// }
-// breakLabel.place();
-//
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//
-// }
-
- public void resetStateForCodeGeneration() {
- if (this.breakLabel != null) {
- this.breakLabel.resetStateForCodeGeneration();
- }
- if (this.continueLabel != null) {
- this.continueLabel.resetStateForCodeGeneration();
- }
- }
-
- public void resolve(BlockScope scope) {
-
- TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
- if (action != null)
- action.resolve(scope);
- }
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output).append("do"); //$NON-NLS-1$
- if (action == null)
- output.append(" ;\n"); //$NON-NLS-1$
- else {
- output.append('\n');
- action.printStatement(indent + 1, output).append('\n');
- }
- output.append("while ("); //$NON-NLS-1$
- return condition.printExpression(0, output).append(");"); //$NON-NLS-1$
- }
- public String toString(int tab) {
-
- String inFront, s = tabString(tab);
- inFront = s;
- s = s + "do"; //$NON-NLS-1$
- if (action == null)
- s = s + " {}\n"; //$NON-NLS-1$
- else if (action instanceof Block)
- s = s + "\n" + action.toString(tab + 1) + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- else
- s = s + " {\n" + action.toString(tab + 1) + ";}\n"; //$NON-NLS-1$ //$NON-NLS-2$
- s = s + inFront + "while (" + condition.toStringExpression() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- if (action != null) {
- action.traverse(visitor, scope);
- }
- condition.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoubleLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoubleLiteral.java
deleted file mode 100644
index f350c92..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/DoubleLiteral.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class DoubleLiteral extends NumberLiteral {
- double value;
-public DoubleLiteral(char[] token, int s, int e) {
- super(token, s,e);
-}
-public void computeConstant() {
-
- //the source is correctly formated so the exception should never occurs
-
- Double computedValue;
- try { computedValue = Double.valueOf(String.valueOf(source));}
- catch(NumberFormatException e){return ;} //how can it happen ????
-
- if (computedValue.doubleValue() > Double.MAX_VALUE) return ; //may be Infinity
- if (computedValue.doubleValue() < Double.MIN_VALUE)
- { //only a true 0 can be made of zeros
- //2.00000000000000000e-324 is illegal ....
- label :
- for (int i=0;i> 4) == T_double)
-// codeStream.generateInlinedValue(value);
-// else
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public TypeBinding literalType(BlockScope scope) {
- return DoubleBinding;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- visitor.visit(this, blockScope);
- visitor.endVisit(this, blockScope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EmptyStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EmptyStatement.java
deleted file mode 100644
index 90076cc..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EmptyStatement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class EmptyStatement extends Statement {
-
- public EmptyStatement(int startPosition, int endPosition) {
- this.sourceStart = startPosition;
- this.sourceEnd = endPosition;
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return flowInfo;
- }
-
-// public void generateCode(BlockScope currentScope, CodeStream codeStream){
-// // no bytecode, no need to check for reachability or recording source positions
-// }
- public StringBuffer printStatement(int tab, StringBuffer output) {
- return printIndent(tab, output).append(';');
- }
- public void resolve(BlockScope scope) {
- }
-
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-
- public String toString(int tab) {
- return tabString(tab) + ";"; //$NON-NLS-1$
- }
-}
-
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EqualExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EqualExpression.java
deleted file mode 100644
index 9e38661..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/EqualExpression.java
+++ /dev/null
@@ -1,560 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class EqualExpression extends BinaryExpression {
-
-public EqualExpression(Expression left, Expression right,int operator) {
- super(left,right,operator);
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
- if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
- if (left.constant.booleanValue()) { // true == anything
- // this is equivalent to the right argument inits
- return right.analyseCode(currentScope, flowContext, flowInfo);
- } else { // false == anything
- // this is equivalent to the right argument inits negated
- return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
- if (right.constant.booleanValue()) { // anything == true
- // this is equivalent to the right argument inits
- return left.analyseCode(currentScope, flowContext, flowInfo);
- } else { // anything == false
- // this is equivalent to the right argument inits negated
- return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- return right.analyseCode(
- currentScope, flowContext,
- left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).unconditionalInits();
- } else { //NOT_EQUAL :
- if ((left.constant != NotAConstant) && (left.constant.typeID() == T_boolean)) {
- if (!left.constant.booleanValue()) { // false != anything
- // this is equivalent to the right argument inits
- return right.analyseCode(currentScope, flowContext, flowInfo);
- } else { // true != anything
- // this is equivalent to the right argument inits negated
- return right.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- if ((right.constant != NotAConstant) && (right.constant.typeID() == T_boolean)) {
- if (!right.constant.booleanValue()) { // anything != false
- // this is equivalent to the right argument inits
- return left.analyseCode(currentScope, flowContext, flowInfo);
- } else { // anything != true
- // this is equivalent to the right argument inits negated
- return left.analyseCode(currentScope, flowContext, flowInfo).asNegatedCondition();
- }
- }
- return right.analyseCode(
- currentScope, flowContext,
- left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits()).asNegatedCondition().unconditionalInits();
- }
-}
-public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castType, TypeBinding expressionType) {
- //see specifications 5.5
- //A more complete version of this method is provided on
- //CastExpression (it deals with constant and need runtime checkcast)
-
- if (castType == expressionType) return true;
-
- //========ARRAY===============
- if (expressionType.isArrayType()) {
- if (castType.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
- TypeBinding expressionEltType = ((ArrayBinding) expressionType).elementsType(scope);
- if (expressionEltType.isBaseType())
- // <---stop the recursion-------
- return ((ArrayBinding) castType).elementsType(scope) == expressionEltType;
- //recursivly on the elts...
- return areTypesCastCompatible(scope, ((ArrayBinding) castType).elementsType(scope), expressionEltType);
- }
- if (castType.isBaseType()) {
- return false;
- }
- if (castType.isClass()) { //------(castTb.isClass) expressionTb.isArray ---------------
- if (scope.isJavaLangObject(castType))
- return true;
- return false;
- }
- if (castType.isInterface()) { //------- (castTb.isInterface) expressionTb.isArray -----------
- if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
- return true;
- }
- return false;
- }
-
- return false;
- }
-
- //------------(castType) null--------------
- if (expressionType == NullBinding) {
- return !castType.isBaseType();
- }
-
- //========BASETYPE==============
- if (expressionType.isBaseType()) {
- return false;
- }
-
-
- //========REFERENCE TYPE===================
-
- if (expressionType.isClass()) {
- if (castType.isArrayType()) { // ---- (castTb.isArray) expressionTb.isClass -------
- if (scope.isJavaLangObject(expressionType))
- return true;
- }
- if (castType.isBaseType()) {
- return false;
- }
- if (castType.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
- if (expressionType.isCompatibleWith(castType))
- return true;
- else {
- if (castType.isCompatibleWith(expressionType)) {
- return true;
- }
- return false;
- }
- }
- if (castType.isInterface()) { // ----- (castTb.isInterface) expressionTb.isClass -------
- if (((ReferenceBinding) expressionType).isFinal()) { //no subclass for expressionTb, thus compile-time check is valid
- if (expressionType.isCompatibleWith(castType))
- return true;
- return false;
- } else {
- return true;
- }
- }
-
- return false;
- }
- if (expressionType.isInterface()) {
- if (castType.isArrayType()) { // ----- (castTb.isArray) expressionTb.isInterface ------
- if (scope.isJavaLangCloneable(expressionType) || scope.isJavaIoSerializable(expressionType))
- //potential runtime error
- {
- return true;
- }
- return false;
- }
- if (castType.isBaseType()) {
- return false;
- }
- if (castType.isClass()) { // ----- (castTb.isClass) expressionTb.isInterface --------
- if (scope.isJavaLangObject(castType))
- return true;
- if (((ReferenceBinding) castType).isFinal()) { //no subclass for castTb, thus compile-time check is valid
- if (castType.isCompatibleWith(expressionType)) {
- return true;
- }
- return false;
- }
- return true;
- }
- if (castType.isInterface()) { // ----- (castTb.isInterface) expressionTb.isInterface -------
- if (Scope.compareTypes(castType, expressionType) == NotRelated) {
- MethodBinding[] castTbMethods = ((ReferenceBinding) castType).methods();
- int castTbMethodsLength = castTbMethods.length;
- MethodBinding[] expressionTbMethods = ((ReferenceBinding) expressionType).methods();
- int expressionTbMethodsLength = expressionTbMethods.length;
- for (int i = 0; i < castTbMethodsLength; i++) {
- for (int j = 0; j < expressionTbMethodsLength; j++) {
- if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
- if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
- if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
- return false;
- }
- }
- }
- }
- }
- }
- return true;
- }
-
- return false;
- }
-
- return false;
-}
-public final void computeConstant(TypeBinding leftType, TypeBinding rightType) {
- if ((this.left.constant != NotAConstant) && (this.right.constant != NotAConstant)) {
- this.constant =
- Constant.computeConstantOperationEQUAL_EQUAL(
- left.constant,
- leftType.id,
- EQUAL_EQUAL,
- right.constant,
- rightType.id);
- if (((this.bits & OperatorMASK) >> OperatorSHIFT) == NOT_EQUAL)
- constant = Constant.fromValue(!constant.booleanValue());
- } else {
- this.constant = NotAConstant;
- // no optimization for null == null
- }
-}
-/**
- * Normal == or != code generation.
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-//
-// if (constant != NotAConstant) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// Label falseLabel;
-// bits |= OnlyValueRequiredMASK;
-// generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// falseLabel = new Label(codeStream),
-// valueRequired);
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired){
-// // comparison is TRUE
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0){
-// codeStream.ireturn();
-// // comparison is FALSE
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// Label endLabel = new Label(codeStream);
-// codeStream.goto_(endLabel);
-// codeStream.decrStackSize(1);
-// // comparison is FALSE
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-//}
-/**
- * Boolean operator code generation
- * Optimized operations are: == and !=
- */
-//public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
-//
-// if (constant != Constant.NotAConstant) {
-// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// return;
-// }
-// if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
-// if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
-// generateOptimizedBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// } else {
-// generateOptimizedNonBooleanEqual(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// }
-// } else {
-// if ((left.implicitConversion & 0xF) /*compile-time*/ == T_boolean) {
-// generateOptimizedBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
-// } else {
-// generateOptimizedNonBooleanEqual(currentScope, codeStream, falseLabel, trueLabel, valueRequired);
-// }
-// }
-//}
-/**
- * Boolean generation for == with boolean operands
- *
- * Note this code does not optimize conditional constants !!!!
- */
-//public void generateOptimizedBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
-//
-// // optimized cases: true == x, false == x
-// if (left.constant != NotAConstant) {
-// boolean inline = left.constant.booleanValue();
-// right.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
-// return;
-// } // optimized cases: x == true, x == false
-// if (right.constant != NotAConstant) {
-// boolean inline = right.constant.booleanValue();
-// left.generateOptimizedBoolean(currentScope, codeStream, (inline ? trueLabel : falseLabel), (inline ? falseLabel : trueLabel), valueRequired);
-// return;
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.if_icmpeq(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.if_icmpne(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-//}
-///**
-// * Boolean generation for == with non-boolean operands
-// *
-// */
-//public void generateOptimizedNonBooleanEqual(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Constant inline;
-// if ((inline = right.constant) != NotAConstant) {
-// // optimized case: x == 0
-// if (((left.implicitConversion >> 4) == T_int) && (inline.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifeq(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifne(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// }
-// if ((inline = left.constant) != NotAConstant) {
-// // optimized case: 0 == x
-// if (((left.implicitConversion >> 4) == T_int)
-// && (inline.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifeq(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifne(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// }
-// // null cases
-// // optimized case: x == null
-// if (right instanceof NullLiteral) {
-// if (left instanceof NullLiteral) {
-// // null == null
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// if (((bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
-// codeStream.iconst_1();
-// } else {
-// codeStream.iconst_0();
-// }
-// } else {
-// if (falseLabel == null) {
-// // implicit falling through the FALSE case
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// }
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifnull(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifnonnull(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// } else if (left instanceof NullLiteral) { // optimized case: null == x
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifnull(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifnonnull(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-//
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (left.implicitConversion >> 4) { // operand runtime type
-// case T_int :
-// codeStream.if_icmpeq(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifeq(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifeq(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifeq(trueLabel);
-// break;
-// default :
-// codeStream.if_acmpeq(trueLabel);
-// }
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// switch (left.implicitConversion >> 4) { // operand runtime type
-// case T_int :
-// codeStream.if_icmpne(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifne(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifne(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifne(falseLabel);
-// break;
-// default :
-// codeStream.if_acmpne(falseLabel);
-// }
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public boolean isCompactableOperation() {
- return false;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // always return BooleanBinding
- TypeBinding leftType = left.resolveType(scope);
- TypeBinding rightType = right.resolveType(scope);
- if (leftType == null || rightType == null){
- constant = NotAConstant;
- return null;
- }
-
- // both base type
- if (leftType.isBaseType() && rightType.isBaseType()) {
- // the code is an int
- // (cast) left == (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
- int result = ResolveTypeTables[EQUAL_EQUAL][ (leftType.id << 4) + rightType.id];
- left.implicitConversion = result >>> 12;
- right.implicitConversion = (result >>> 4) & 0x000FF;
- bits |= result & 0xF;
- if ((result & 0x0000F) == T_undefined) {
- constant = Constant.NotAConstant;
- scope.problemReporter().invalidOperator(this, leftType, rightType);
- return null;
- }
- computeConstant(leftType, rightType);
- this.resolvedType = BooleanBinding;
- return BooleanBinding;
- }
-
- // Object references
- // spec 15.20.3
- if (areTypesCastCompatible(scope, rightType, leftType) || areTypesCastCompatible(scope, leftType, rightType)) {
- // (special case for String)
- if ((rightType.id == T_String) && (leftType.id == T_String))
- computeConstant(leftType, rightType);
- else
- constant = NotAConstant;
- if (rightType.id == T_String)
- right.implicitConversion = String2String;
- if (leftType.id == T_String)
- left.implicitConversion = String2String;
- this.resolvedType = BooleanBinding;
- return BooleanBinding;
- }
- constant = NotAConstant;
- scope.problemReporter().notCompatibleTypesError(this, leftType, rightType);
- return null;
-}
-public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- left.traverse(visitor, scope);
- right.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExplicitConstructorCall.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExplicitConstructorCall.java
deleted file mode 100644
index 467b9dd..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExplicitConstructorCall.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
-
-public class ExplicitConstructorCall
- extends Statement
- implements InvocationSite {
-
- public Expression[] arguments;
- public Expression qualification;
- public MethodBinding binding;
-
- public int accessMode;
-
- public final static int ImplicitSuper = 1;
- public final static int Super = 2;
- public final static int This = 3;
-
- public VariableBinding[][] implicitArguments;
- boolean discardEnclosingInstance;
-
- MethodBinding syntheticAccessor;
-
- public ExplicitConstructorCall(int accessMode) {
- this.accessMode = accessMode;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // must verify that exceptions potentially thrown by this expression are caught in the method.
-
- try {
- ((MethodScope) currentScope).isConstructorCall = true;
-
- // process enclosing instance
- if (qualification != null) {
- flowInfo =
- qualification
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
- // process arguments
- if (arguments != null) {
- for (int i = 0, max = arguments.length; i < max; i++) {
- flowInfo =
- arguments[i]
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
- }
-
- ReferenceBinding[] thrownExceptions;
- if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
- // check exceptions
- flowContext.checkExceptionHandlers(
- thrownExceptions,
- (accessMode == ImplicitSuper)
- ? (ASTNode) currentScope.methodScope().referenceContext
- : (ASTNode) this,
- flowInfo,
- currentScope);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- manageSyntheticAccessIfNecessary(currentScope);
- return flowInfo;
- } finally {
- ((MethodScope) currentScope).isConstructorCall = false;
- }
- }
-
- /**
- * Constructor call code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// try {
-// ((MethodScope) currentScope).isConstructorCall = true;
-//
-// int pc = codeStream.position;
-// codeStream.aload_0();
-//
-// // handling innerclass constructor invocation
-// ReferenceBinding targetType = binding.declaringClass;
-// // handling innerclass instance allocation - enclosing instance arguments
-// if (targetType.isNestedType()) {
-// codeStream.generateSyntheticEnclosingInstanceValues(
-// currentScope,
-// targetType,
-// discardEnclosingInstance ? null : qualification,
-// this);
-// }
-// // regular code gen
-// if (arguments != null) {
-// for (int i = 0, max = arguments.length; i < max; i++) {
-// arguments[i].generateCode(currentScope, codeStream, true);
-// }
-// }
-// // handling innerclass instance allocation - outer local arguments
-// if (targetType.isNestedType()) {
-// codeStream.generateSyntheticOuterArgumentValues(
-// currentScope,
-// targetType,
-// this);
-// }
-// if (syntheticAccessor != null) {
-// // synthetic accessor got some extra arguments appended to its signature, which need values
-// for (int i = 0,
-// max = syntheticAccessor.parameters.length - binding.parameters.length;
-// i < max;
-// i++) {
-// codeStream.aconst_null();
-// }
-// codeStream.invokespecial(syntheticAccessor);
-// } else {
-// codeStream.invokespecial(binding);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// } finally {
-// ((MethodScope) currentScope).isConstructorCall = false;
-// }
-// }
-
- public boolean isImplicitSuper() {
- //return true if I'm of these compiler added statement super();
-
- return (accessMode == ImplicitSuper);
- }
-
- public boolean isSuperAccess() {
-
- return accessMode != This;
- }
-
- public boolean isTypeAccess() {
-
- return true;
- }
-
- /* Inner emulation consists in either recording a dependency
- * link only, or performing one level of propagation.
- *
- * Dependency mechanism is used whenever dealing with source target
- * types, since by the time we reach them, we might not yet know their
- * exact need.
- */
- void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- ReferenceBinding superType;
-
- // perform some emulation work in case there is some and we are inside a local type only
- if ((superType = binding.declaringClass).isNestedType()
- && currentScope.enclosingSourceType().isLocalType()) {
-
- if (superType.isLocalType()) {
- ((LocalTypeBinding) superType).addInnerEmulationDependent(currentScope, qualification != null);
- } else {
- // locally propagate, since we already now the desired shape for sure
- currentScope.propagateInnerEmulation(superType, qualification != null);
- }
- }
- }
-
- public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
-
- // perform some emulation work in case there is some and we are inside a local type only
- if (binding.isPrivate() && (accessMode != This)) {
-
-// if (currentScope
-// .environment()
-// .options
-// .isPrivateConstructorAccessChangingVisibility) {
-// binding.tagForClearingPrivateModifier();
-// // constructor will not be dumped as private, no emulation required thus
-// } else {
- syntheticAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
-// }
- }
- }
-
- public void resolve(BlockScope scope) {
- // the return type should be void for a constructor.
- // the test is made into getConstructor
-
- // mark the fact that we are in a constructor call.....
- // unmark at all returns
- try {
- ((MethodScope) scope).isConstructorCall = true;
- ReferenceBinding receiverType = scope.enclosingSourceType();
- if (accessMode != This)
- receiverType = receiverType.superclass();
-
- if (receiverType == null) {
- return;
- }
-
- // qualification should be from the type of the enclosingType
- if (qualification != null) {
- if (accessMode != Super) {
- scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
- qualification,
- receiverType);
- }
- ReferenceBinding enclosingType = receiverType.enclosingType();
- if (enclosingType == null) {
- scope.problemReporter().unnecessaryEnclosingInstanceSpecification(
- qualification,
- receiverType);
- discardEnclosingInstance = true;
- } else {
- TypeBinding qTb = qualification.resolveTypeExpecting(scope, enclosingType);
- qualification.implicitWidening(qTb, qTb);
- }
- }
-
- // arguments buffering for the method lookup
- TypeBinding[] argTypes = NoParameters;
- if (arguments != null) {
- boolean argHasError = false; // typeChecks all arguments
- int length = arguments.length;
- argTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argTypes[i] = arguments[i].resolveType(scope)) == null)
- argHasError = true;
- if (argHasError)
- return;
- }
- if ((binding = scope.getConstructor(receiverType, argTypes, this))
- .isValidBinding()) {
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(binding, this);
-
- // see for user-implicit widening conversion
- if (arguments != null) {
- int length = arguments.length;
- TypeBinding[] paramTypes = binding.parameters;
- for (int i = 0; i < length; i++)
- arguments[i].implicitWidening(paramTypes[i], argTypes[i]);
- }
- if (binding.isPrivate()) {
- binding.modifiers |= AccPrivateUsed;
- }
- } else {
- if (binding.declaringClass == null)
- binding.declaringClass = receiverType;
- scope.problemReporter().invalidConstructor(this, binding);
- }
- } finally {
- ((MethodScope) scope).isConstructorCall = false;
- }
- }
-
- public void setActualReceiverType(ReferenceBinding receiverType) {
- // ignored
- }
-
- public void setDepth(int depth) {
- // ignore for here
- }
-
- public void setFieldIndex(int depth) {
- // ignore for here
- }
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output);
- if (qualification != null) qualification.printExpression(0, output).append('.');
- if (accessMode == This) {
- output.append("this("); //$NON-NLS-1$
- } else {
- output.append("super("); //$NON-NLS-1$
- }
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
- arguments[i].printExpression(0, output);
- }
- }
- return output.append(");"); //$NON-NLS-1$
- }
- public String toString(int tab) {
-
- String s = tabString(tab);
- if (qualification != null)
- s = s + qualification.toStringExpression() + "."; //$NON-NLS-1$
- if (accessMode == This) {
- s = s + "this("; //$NON-NLS-1$
- } else {
- s = s + "super("; //$NON-NLS-1$
- }
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++) {
- s = s + arguments[i].toStringExpression();
- if (i != arguments.length - 1)
- s = s + ", "; //$NON-NLS-1$
- }
- s = s + ")"; //$NON-NLS-1$
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- if (qualification != null) {
- qualification.traverse(visitor, scope);
- }
- if (arguments != null) {
- int argumentLength = arguments.length;
- for (int i = 0; i < argumentLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Expression.java
deleted file mode 100644
index effc5d9..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Expression.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class Expression extends Statement {
-
- //some expression may not be used - from a java semantic point
- //of view only - as statements. Other may. In order to avoid the creation
- //of wrappers around expression in order to tune them as expression
- //Expression is a subclass of Statement. See the message isValidJavaStatement()
-
- public int implicitConversion;
- public TypeBinding resolvedType;
-
- public Constant constant;
-
- public Expression() {
- super();
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- return flowInfo;
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
-
- return analyseCode(currentScope, flowContext, flowInfo);
- }
-
- /**
- * Constant usable for bytecode pattern optimizations, but cannot be inlined
- * since it is not strictly equivalent to the definition of constant expressions.
- * In particular, some side-effects may be required to occur (only the end value
- * is known).
- * Constant is known to be of boolean type
- */
- public Constant optimizedBooleanConstant() {
-
- return this.constant;
- }
-
- public static final boolean isConstantValueRepresentable(
- Constant constant,
- int constantTypeID,
- int targetTypeID) {
-
- //true if there is no loss of precision while casting.
- // constantTypeID == constant.typeID
- if (targetTypeID == constantTypeID)
- return true;
- switch (targetTypeID) {
- case T_char :
- switch (constantTypeID) {
- case T_char :
- return true;
- case T_double :
- return constant.doubleValue() == constant.charValue();
- case T_float :
- return constant.floatValue() == constant.charValue();
- case T_int :
- return constant.intValue() == constant.charValue();
- case T_short :
- return constant.shortValue() == constant.charValue();
- case T_byte :
- return constant.byteValue() == constant.charValue();
- case T_long :
- return constant.longValue() == constant.charValue();
- default :
- return false;//boolean
- }
-
- case T_float :
- switch (constantTypeID) {
- case T_char :
- return constant.charValue() == constant.floatValue();
- case T_double :
- return constant.doubleValue() == constant.floatValue();
- case T_float :
- return true;
- case T_int :
- return constant.intValue() == constant.floatValue();
- case T_short :
- return constant.shortValue() == constant.floatValue();
- case T_byte :
- return constant.byteValue() == constant.floatValue();
- case T_long :
- return constant.longValue() == constant.floatValue();
- default :
- return false;//boolean
- }
-
- case T_double :
- switch (constantTypeID) {
- case T_char :
- return constant.charValue() == constant.doubleValue();
- case T_double :
- return true;
- case T_float :
- return constant.floatValue() == constant.doubleValue();
- case T_int :
- return constant.intValue() == constant.doubleValue();
- case T_short :
- return constant.shortValue() == constant.doubleValue();
- case T_byte :
- return constant.byteValue() == constant.doubleValue();
- case T_long :
- return constant.longValue() == constant.doubleValue();
- default :
- return false; //boolean
- }
-
- case T_byte :
- switch (constantTypeID) {
- case T_char :
- return constant.charValue() == constant.byteValue();
- case T_double :
- return constant.doubleValue() == constant.byteValue();
- case T_float :
- return constant.floatValue() == constant.byteValue();
- case T_int :
- return constant.intValue() == constant.byteValue();
- case T_short :
- return constant.shortValue() == constant.byteValue();
- case T_byte :
- return true;
- case T_long :
- return constant.longValue() == constant.byteValue();
- default :
- return false; //boolean
- }
-
- case T_short :
- switch (constantTypeID) {
- case T_char :
- return constant.charValue() == constant.shortValue();
- case T_double :
- return constant.doubleValue() == constant.shortValue();
- case T_float :
- return constant.floatValue() == constant.shortValue();
- case T_int :
- return constant.intValue() == constant.shortValue();
- case T_short :
- return true;
- case T_byte :
- return constant.byteValue() == constant.shortValue();
- case T_long :
- return constant.longValue() == constant.shortValue();
- default :
- return false; //boolean
- }
-
- case T_int :
- switch (constantTypeID) {
- case T_char :
- return constant.charValue() == constant.intValue();
- case T_double :
- return constant.doubleValue() == constant.intValue();
- case T_float :
- return constant.floatValue() == constant.intValue();
- case T_int :
- return true;
- case T_short :
- return constant.shortValue() == constant.intValue();
- case T_byte :
- return constant.byteValue() == constant.intValue();
- case T_long :
- return constant.longValue() == constant.intValue();
- default :
- return false; //boolean
- }
-
- case T_long :
- switch (constantTypeID) {
- case T_char :
- return constant.charValue() == constant.longValue();
- case T_double :
- return constant.doubleValue() == constant.longValue();
- case T_float :
- return constant.floatValue() == constant.longValue();
- case T_int :
- return constant.intValue() == constant.longValue();
- case T_short :
- return constant.shortValue() == constant.longValue();
- case T_byte :
- return constant.byteValue() == constant.longValue();
- case T_long :
- return true;
- default :
- return false; //boolean
- }
-
- default :
- return false; //boolean
- }
- }
-
- /**
- * Expression statements are plain expressions, however they generate like
- * normal expressions with no value required.
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// generateCode(currentScope, codeStream, false);
-// }
-
- /**
- * Every expression is responsible for generating its implicit conversion when necessary.
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// if (constant != NotAConstant) {
-// // generate a constant expression
-// int pc = codeStream.position;
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// } else {
-// // actual non-constant code generation
-// throw new ShouldNotImplement(ProjectPrefUtil.bind("ast.missingCode")); //$NON-NLS-1$
-// }
-// }
-
- /**
- * Default generation of a boolean value
- */
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// // a label valued to nil means: by default we fall through the case...
-// // both nil means we leave the value on the stack
-//
-// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
-// int pc = codeStream.position;
-// if (constant.booleanValue() == true) {
-// // constant == true
-// if (valueRequired) {
-// if (falseLabel == null) {
-// // implicit falling through the FALSE case
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// } else {
-// if (valueRequired) {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// generateCode(currentScope, codeStream, valueRequired);
-// // branching
-// int position = codeStream.position;
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // Implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // Implicit falling through the TRUE case
-// codeStream.ifeq(falseLabel);
-// } else {
-// // No implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(position);
-// }
-//
-// /* Optimized (java) code generation for string concatenations that involve StringBuffer
-// * creation: going through this path means that there is no need for a new StringBuffer
-// * creation, further operands should rather be only appended to the current one.
-// * By default: no optimization.
-// */
-// public void generateOptimizedStringBuffer(
-// BlockScope blockScope,
-// net.sourceforge.phpdt.internal.compiler.codegen.CodeStream codeStream,
-// int typeID) {
-//
-// generateCode(blockScope, codeStream, true);
-// codeStream.invokeStringBufferAppendForType(typeID);
-// }
-
- /* Optimized (java) code generation for string concatenations that involve StringBuffer
- * creation: going through this path means that there is no need for a new StringBuffer
- * creation, further operands should rather be only appended to the current one.
- */
-// public void generateOptimizedStringBufferCreation(
-// BlockScope blockScope,
-// CodeStream codeStream,
-// int typeID) {
-//
-// // Optimization only for integers and strings
-// if (typeID == T_Object) {
-// // in the case the runtime value of valueOf(Object) returns null, we have to use append(Object) instead of directly valueOf(Object)
-// // append(Object) returns append(valueOf(Object)), which means that the null case is handled by append(String).
-// codeStream.newStringBuffer();
-// codeStream.dup();
-// codeStream.invokeStringBufferDefaultConstructor();
-// generateCode(blockScope, codeStream, true);
-// codeStream.invokeStringBufferAppendForType(T_Object);
-// return;
-// }
-// codeStream.newStringBuffer();
-// codeStream.dup();
-// if (typeID == T_String || typeID == T_null) {
-// if (constant != NotAConstant) {
-// codeStream.ldc(constant.stringValue());
-// } else {
-// generateCode(blockScope, codeStream, true);
-// codeStream.invokeStringValueOf(T_Object);
-// }
-// } else {
-// generateCode(blockScope, codeStream, true);
-// codeStream.invokeStringValueOf(typeID);
-// }
-// codeStream.invokeStringBufferStringConstructor();
-// }
-
- // Base types need that the widening is explicitly done by the compiler using some bytecode like i2f
- public void implicitWidening(
- TypeBinding runtimeTimeType,
- TypeBinding compileTimeType) {
-
- if (runtimeTimeType == null || compileTimeType == null)
- return;
-
-// if (compileTimeType.id == T_null) {
-// // this case is possible only for constant null
-// // The type of runtime is a reference type
-// // The code gen use the constant id thus any value
-// // for the runtime id (akak the <<4) could be used.
-// // T_Object is used as some general T_reference
-// implicitConversion = (T_Object << 4) + T_null;
-// return;
-// }
-
- switch (runtimeTimeType.id) {
- case T_byte :
- case T_short :
- case T_char :
- implicitConversion = (T_int << 4) + compileTimeType.id;
- break;
- case T_String :
- case T_float :
- case T_boolean :
- case T_double :
- case T_int : //implicitConversion may result in i2i which will result in NO code gen
- case T_long :
- implicitConversion = (runtimeTimeType.id << 4) + compileTimeType.id;
- break;
- default : //nothing on regular object ref
- }
- }
-
- public boolean isCompactableOperation() {
-
- return false;
- }
-
- //Return true if the conversion is done AUTOMATICALLY by the vm
- //while the javaVM is an int based-machine, thus for example pushing
- //a byte onto the stack , will automatically creates a int on the stack
- //(this request some work d be done by the VM on signed numbers)
- public boolean isConstantValueOfTypeAssignableToType(
- TypeBinding constantType,
- TypeBinding targetType) {
-
- if (constant == Constant.NotAConstant)
- return false;
- if (constantType == targetType)
- return true;
- if (constantType.isBaseType() && targetType.isBaseType()) {
- //No free assignment conversion from anything but to integral ones.
- if ((constantType == IntBinding
- || BaseTypeBinding.isWidening(T_int, constantType.id))
- && (BaseTypeBinding.isNarrowing(targetType.id, T_int))) {
- //use current explicit conversion in order to get some new value to compare with current one
- return isConstantValueRepresentable(constant, constantType.id, targetType.id);
- }
- }
- return false;
- }
-
- public boolean isTypeReference() {
- return false;
- }
- public StringBuffer print(int indent, StringBuffer output) {
- printIndent(indent, output);
- return printExpression(indent, output);
- }
-
- public StringBuffer printExpression(int indent, StringBuffer output) {
- output.append(super.toString(0));
- return output;
- }
-
- public StringBuffer printStatement(int indent, StringBuffer output) {
- return print(indent, output).append(";"); //$NON-NLS-1$
- }
- public void resolve(BlockScope scope) {
- // drops the returning expression's type whatever the type is.
-
- this.resolveType(scope);
- return;
- }
-
- public TypeBinding resolveType(BlockScope scope) {
- // by default... subclasses should implement a better TC if required.
-
- return null;
- }
-
- public TypeBinding resolveTypeExpecting(
- BlockScope scope,
- TypeBinding expectedType) {
-
- TypeBinding expressionType = this.resolveType(scope);
- if (expressionType == null) return null;
- if (expressionType == expectedType) return expressionType;
-
- if (!expressionType.isCompatibleWith(expectedType)) {
- scope.problemReporter().typeMismatchError(expressionType, expectedType, this);
- return null;
- }
- return expressionType;
- }
-
- public String toString(int tab) {
-
- //Subclass re-define toStringExpression
- String s = tabString(tab);
- if (constant != null)
- //before TC has runned
- if (constant != NotAConstant)
- //after the TC has runned
- s += " /*cst:" + constant.toString() + "*/ "; //$NON-NLS-1$ //$NON-NLS-2$
- return s + toStringExpression(tab);
- }
-
- //Subclass re-define toStringExpression
- //This method is abstract and should never be called
- //but we provide some code that is running.....just in case
- //of developpement time (while every thing is not built)
- public String toStringExpression() {
-
- return super.toString(0);
- }
-
- public String toStringExpression(int tab) {
- // default is regular toString expression (qualified allocation expressions redifine this method)
- return this.toStringExpression();
- }
-
- public Expression toTypeReference() {
- //by default undefined
-
- //this method is meanly used by the parser in order to transform
- //an expression that is used as a type reference in a cast ....
- //--appreciate the fact that castExpression and ExpressionWithParenthesis
- //--starts with the same pattern.....
-
- return this;
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExtendedStringLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExtendedStringLiteral.java
deleted file mode 100644
index 7bb50fe..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ExtendedStringLiteral.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class ExtendedStringLiteral extends StringLiteral {
-
- /**
- * Build a string+char literal
- */
-// public ExtendedStringLiteral(StringLiteral str, CharLiteral character) {
-//
-// super(str.source, str.sourceStart, str.sourceEnd);
-// extendWith(character);
-// }
-
- /**
- * Build a two-strings literal
- * */
- public ExtendedStringLiteral(StringLiteral str1, StringLiteral str2) {
-
- super(str1.source, str1.sourceStart, str1.sourceEnd);
- extendWith(str2);
- }
-
- /**
- * Add the lit source to mine, just as if it was mine
- */
-// public ExtendedStringLiteral extendWith(CharLiteral lit) {
-//
-// //update the source
-// int length = source.length;
-// System.arraycopy(source, 0, (source = new char[length + 1]), 0, length);
-// source[length] = lit.value;
-// //position at the end of all literals
-// sourceEnd = lit.sourceEnd;
-// return this;
-// }
-
- /**
- * Add the lit source to mine, just as if it was mine
- */
- public ExtendedStringLiteral extendWith(StringLiteral lit) {
-
- //uddate the source
- int length = source.length;
- System.arraycopy(
- source,
- 0,
- source = new char[length + lit.source.length],
- 0,
- length);
- System.arraycopy(lit.source, 0, source, length, lit.source.length);
- //position at the end of all literals
- sourceEnd = lit.sourceEnd;
- return this;
- }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- return output.append("ExtendedStringLiteral{").append(source).append('}'); //$NON-NLS-1$
- }
- public String toStringExpression() {
-
- String str = "ExtendedStringLiteral{" + new String(source) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
- return str;
- }
-
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
-
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FalseLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FalseLiteral.java
deleted file mode 100644
index 893529e..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FalseLiteral.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class FalseLiteral extends MagicLiteral {
- static final char[] source = {'f', 'a', 'l', 's', 'e'};
-public FalseLiteral(int s , int e) {
- super(s,e);
-}
-public void computeConstant() {
-
- constant = Constant.fromValue(false);}
-/**
- * Code generation for false literal
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// codeStream.iconst_0();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-//public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
-//
-// // falseLabel being not nil means that we will not fall through into the FALSE case
-//
-// int pc = codeStream.position;
-// if (valueRequired) {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public TypeBinding literalType(BlockScope scope) {
- return BooleanBinding;
-}
-/**
- *
- */
-public char[] source() {
- return source;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldDeclaration.java
deleted file mode 100644
index 6a50ccb..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldDeclaration.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class FieldDeclaration extends AbstractVariableDeclaration {
- public FieldBinding binding;
-
- boolean hasBeenResolved = false;
-
- //allows to retrieve both the "type" part of the declaration (part1)
- //and also the part that decribe the name and the init and optionally
- //some other dimension ! ....
- //public int[] a, b[] = X, c ;
- //for b that would give for
- // - part1 : public int[]
- // - part2 : b[] = X,
-
- public int endPart1Position;
-
- public int endPart2Position;
-
- public FieldDeclaration() {
- }
-
- public FieldDeclaration(char[] name, int sourceStart, int sourceEnd) {
-
- this.name = name;
-
- //due to some declaration like
- // int x, y = 3, z , x ;
- //the sourceStart and the sourceEnd is ONLY on the name
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- }
-
- public FieldDeclaration(Expression initialization, char[] name, int sourceStart, int sourceEnd) {
-
- this.initialization = initialization;
- this.name = name;
-
- //due to some declaration like
- // int x, y = 3, z , x ;
- //the sourceStart and the sourceEnd is ONLY on the name
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- }
-
- public FlowInfo analyseCode(MethodScope initializationScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- if (this.binding != null && this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
- if (!initializationScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
- initializationScope.problemReporter().unusedPrivateField(this);
- }
- }
- // cannot define static non-constant field inside nested class
- if (binding != null && binding.isValidBinding() && binding.isStatic() && binding.constant == NotAConstant
- && binding.declaringClass.isNestedType() && binding.declaringClass.isClass() && !binding.declaringClass.isStatic()) {
- initializationScope.problemReporter().unexpectedStaticModifierForField((SourceTypeBinding) binding.declaringClass, this);
- }
-
- if (initialization != null) {
- flowInfo = initialization.analyseCode(initializationScope, flowContext, flowInfo).unconditionalInits();
- flowInfo.markAsDefinitelyAssigned(binding);
- }
- return flowInfo;
- }
-
- /**
- * Code generation for a field declaration: standard assignment to a field
- *
- * @param currentScope
- * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream
- * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
- // public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- //
- // if ((bits & IsReachableMASK) == 0) {
- // return;
- // }
- // // do not generate initialization code if final and static (constant is then
- // // recorded inside the field itself).
- // int pc = codeStream.position;
- // boolean isStatic;
- // if (initialization != null
- // && !((isStatic = binding.isStatic()) && binding.constant != NotAConstant)) {
- // // non-static field, need receiver
- // if (!isStatic)
- // codeStream.aload_0();
- // // generate initialization value
- // initialization.generateCode(currentScope, codeStream, true);
- // // store into field
- // if (isStatic) {
- // codeStream.putstatic(binding);
- // } else {
- // codeStream.putfield(binding);
- // }
- // }
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- // }
- public TypeBinding getTypeBinding(Scope scope) {
-
- return type.getTypeBinding(scope);
- }
-
- public boolean isField() {
-
- return true;
- }
-
- public boolean isStatic() {
-
- if (binding != null)
- return binding.isStatic();
- return (modifiers & AccStatic) != 0;
- }
-
- public String name() {
-
- return String.valueOf(name);
- }
-
- public void resolve(MethodScope initializationScope) {
-
- // the two could be regrouped into
- // a single line but it is clearer to have two lines while the reason of their
- // existence is not at all the same. See comment for the second one.
-
- //--------------------------------------------------------
- if (!this.hasBeenResolved && binding != null && this.binding.isValidBinding()) {
-
- this.hasBeenResolved = true;
-
- if (isTypeUseDeprecated(this.binding.type, initializationScope))
- initializationScope.problemReporter().deprecatedType(this.binding.type, this.type);
-
- this.type.resolvedType = this.binding.type; // update binding for type reference
-
- // the resolution of the initialization hasn't been done
- if (this.initialization == null) {
- this.binding.constant = Constant.NotAConstant;
- } else {
- int previous = initializationScope.fieldDeclarationIndex;
- try {
- initializationScope.fieldDeclarationIndex = this.binding.id;
-
- // break dead-lock cycles by forcing constant to NotAConstant
- this.binding.constant = Constant.NotAConstant;
-
- TypeBinding typeBinding = this.binding.type;
- TypeBinding initializationTypeBinding;
-
- if (initialization instanceof ArrayInitializer) {
-
- if ((initializationTypeBinding = this.initialization.resolveTypeExpecting(initializationScope, typeBinding)) != null) {
- ((ArrayInitializer) this.initialization).binding = (ArrayBinding) initializationTypeBinding;
- this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
- }
- } else if ((initializationTypeBinding = initialization.resolveType(initializationScope)) != null) {
-
- if (this.initialization.isConstantValueOfTypeAssignableToType(initializationTypeBinding, typeBinding)
- || (typeBinding.isBaseType() && BaseTypeBinding.isWidening(typeBinding.id, initializationTypeBinding.id))) {
-
- this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
-
- } else if (initializationTypeBinding.isCompatibleWith(typeBinding)) {
- this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
-
- } else {
- initializationScope.problemReporter().typeMismatchError(initializationTypeBinding, typeBinding, this);
- }
- if (this.binding.isFinal()) { // cast from constant actual type to variable type
- this.binding.constant = this.initialization.constant.castTo((this.binding.type.id << 4)
- + this.initialization.constant.typeID());
- }
- } else {
- this.binding.constant = NotAConstant;
- }
- } finally {
- initializationScope.fieldDeclarationIndex = previous;
- if (this.binding.constant == null)
- this.binding.constant = Constant.NotAConstant;
- }
- }
- }
- }
-
- public void traverse(ASTVisitor visitor, MethodScope scope) {
-
- if (visitor.visit(this, scope)) {
- type.traverse(visitor, scope);
- if (initialization != null)
- initialization.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof FieldDeclaration) {
- char[] objName = ((FieldDeclaration) obj).name;
- if (name.length != objName.length) {
- return false;
- }
- for (int i = 0; i < objName.length; i++) {
- if (name[i] != objName[i]) {
- return false;
- }
- }
- return true;
- }
- return super.equals(obj);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldReference.java
deleted file mode 100644
index e0b1c96..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FieldReference.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class FieldReference extends Reference implements InvocationSite {
-
- public Expression receiver;
- public char[] token;
- public FieldBinding binding, codegenBinding;
- public long nameSourcePosition; //(start<<32)+end
- MethodBinding syntheticReadAccessor, syntheticWriteAccessor;
- public TypeBinding receiverType;
-
- public FieldReference(char[] source, long pos) {
-
- token = source;
- nameSourcePosition = pos;
- //by default the position are the one of the field (not true for super access)
-// sourceStart = (int) (pos >>> 32);
-// sourceEnd = (int) (pos & 0x00000000FFFFFFFFL);
- sourceStart = (int) pos;
- sourceEnd = sourceStart + source.length;
- bits |= BindingIds.FIELD;
-
- }
-
- public FlowInfo analyseAssignment(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- Assignment assignment,
- boolean isCompound) {
-
- // compound assignment extra work
- if (isCompound) { // check the variable part is initialized if blank final
- if (binding.isBlankFinal()
- && receiver.isThis()
- && currentScope.allowBlankFinalFieldAssignment(binding)
- && (!flowInfo.isDefinitelyAssigned(binding))) {
- currentScope.problemReporter().uninitializedBlankFinalField(binding, this);
- // we could improve error msg here telling "cannot use compound assignment on final blank field"
- }
- manageSyntheticReadAccessIfNecessary(currentScope);
- }
- flowInfo =
- receiver
- .analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic())
- .unconditionalInits();
- if (assignment.expression != null) {
- flowInfo =
- assignment
- .expression
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
- manageSyntheticWriteAccessIfNecessary(currentScope);
-
- // check if assigning a final field
- if (binding.isFinal()) {
- // in a context where it can be assigned?
- if (binding.isBlankFinal()
- && !isCompound
- && receiver.isThis()
- && !(receiver instanceof QualifiedThisReference)
- && ((receiver.bits & ParenthesizedMASK) == 0) // (this).x is forbidden
- && currentScope.allowBlankFinalFieldAssignment(binding)) {
- if (flowInfo.isPotentiallyAssigned(binding)) {
- currentScope.problemReporter().duplicateInitializationOfBlankFinalField(
- binding,
- this);
- } else {
- flowContext.recordSettingFinal(binding, this);
- }
- flowInfo.markAsDefinitelyAssigned(binding);
- } else {
- // assigning a final field outside an initializer or constructor or wrong reference
- currentScope.problemReporter().cannotAssignToFinalField(binding, this);
- }
- }
- return flowInfo;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return analyseCode(currentScope, flowContext, flowInfo, true);
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- boolean valueRequired) {
-
- receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic());
- if (valueRequired) {
- manageSyntheticReadAccessIfNecessary(currentScope);
- }
- return flowInfo;
- }
-
- public FieldBinding fieldBinding() {
-
- return binding;
- }
-
-// public void generateAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Assignment assignment,
-// boolean valueRequired) {
-//
-// receiver.generateCode(
-// currentScope,
-// codeStream,
-// !this.codegenBinding.isStatic());
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// fieldStore(
-// codeStream,
-// this.codegenBinding,
-// syntheticWriteAccessor,
-// valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion);
-// }
-// }
-
- /**
- * Field reference code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// if (constant != NotAConstant) {
-// if (valueRequired) {
-// codeStream.generateConstant(constant, implicitConversion);
-// }
-// } else {
-// boolean isStatic = this.codegenBinding.isStatic();
-// receiver.generateCode(currentScope, codeStream, !isStatic);
-// if (valueRequired) {
-// if (this.codegenBinding.constant == NotAConstant) {
-// if (this.codegenBinding.declaringClass == null) { // array length
-// codeStream.arraylength();
-// } else {
-// if (syntheticReadAccessor == null) {
-// if (isStatic) {
-// codeStream.getstatic(this.codegenBinding);
-// } else {
-// codeStream.getfield(this.codegenBinding);
-// }
-// } else {
-// codeStream.invokestatic(syntheticReadAccessor);
-// }
-// }
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// if (!isStatic) {
-// codeStream.invokeObjectGetClass(); // perform null check
-// codeStream.pop();
-// }
-// codeStream.generateConstant(this.codegenBinding.constant, implicitConversion);
-// }
-// } else {
-// if (!isStatic){
-// codeStream.invokeObjectGetClass(); // perform null check
-// codeStream.pop();
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-//
-// public void generateCompoundAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Expression expression,
-// int operator,
-// int assignmentImplicitConversion,
-// boolean valueRequired) {
-//
-// boolean isStatic;
-// receiver.generateCode(
-// currentScope,
-// codeStream,
-// !(isStatic = this.codegenBinding.isStatic()));
-// if (isStatic) {
-// if (syntheticReadAccessor == null) {
-// codeStream.getstatic(this.codegenBinding);
-// } else {
-// codeStream.invokestatic(syntheticReadAccessor);
-// }
-// } else {
-// codeStream.dup();
-// if (syntheticReadAccessor == null) {
-// codeStream.getfield(this.codegenBinding);
-// } else {
-// codeStream.invokestatic(syntheticReadAccessor);
-// }
-// }
-// int operationTypeID;
-// if ((operationTypeID = implicitConversion >> 4) == T_String) {
-// codeStream.generateStringAppend(currentScope, null, expression);
-// } else {
-// // promote the array reference to the suitable operation type
-// codeStream.generateImplicitConversion(implicitConversion);
-// // generate the increment value (will by itself be promoted to the operation value)
-// if (expression == IntLiteral.One) { // prefix operation
-// codeStream.generateConstant(expression.constant, implicitConversion);
-// } else {
-// expression.generateCode(currentScope, codeStream, true);
-// }
-// // perform the operation
-// codeStream.sendOperator(operator, operationTypeID);
-// // cast the value back to the array reference type
-// codeStream.generateImplicitConversion(assignmentImplicitConversion);
-// }
-// fieldStore(
-// codeStream,
-// this.codegenBinding,
-// syntheticWriteAccessor,
-// valueRequired);
-// }
-//
-// public void generatePostIncrement(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// CompoundAssignment postIncrement,
-// boolean valueRequired) {
-//
-// boolean isStatic;
-// receiver.generateCode(
-// currentScope,
-// codeStream,
-// !(isStatic = this.codegenBinding.isStatic()));
-// if (isStatic) {
-// if (syntheticReadAccessor == null) {
-// codeStream.getstatic(this.codegenBinding);
-// } else {
-// codeStream.invokestatic(syntheticReadAccessor);
-// }
-// } else {
-// codeStream.dup();
-// if (syntheticReadAccessor == null) {
-// codeStream.getfield(this.codegenBinding);
-// } else {
-// codeStream.invokestatic(syntheticReadAccessor);
-// }
-// }
-// if (valueRequired) {
-// if (isStatic) {
-// if ((this.codegenBinding.type == LongBinding)
-// || (this.codegenBinding.type == DoubleBinding)) {
-// codeStream.dup2();
-// } else {
-// codeStream.dup();
-// }
-// } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
-// if ((this.codegenBinding.type == LongBinding)
-// || (this.codegenBinding.type == DoubleBinding)) {
-// codeStream.dup2_x1();
-// } else {
-// codeStream.dup_x1();
-// }
-// }
-// }
-// codeStream.generateConstant(
-// postIncrement.expression.constant,
-// implicitConversion);
-// codeStream.sendOperator(postIncrement.operator, this.codegenBinding.type.id);
-// codeStream.generateImplicitConversion(
-// postIncrement.assignmentImplicitConversion);
-// fieldStore(codeStream, this.codegenBinding, syntheticWriteAccessor, false);
-// }
-
- public static final Constant getConstantFor(
- FieldBinding binding,
- Reference reference,
- boolean isImplicit,
- Scope referenceScope) {
-
- //propagation of the constant.
-
- //ref can be a FieldReference, a SingleNameReference or a QualifiedNameReference
- //indexInQualification may have a value greater than zero only for QualifiednameReference
- //if ref==null then indexInQualification==0 AND implicitReceiver == false. This case is a
- //degenerated case where a fake reference field (null)
- //is associted to a real FieldBinding in order
- //to allow its constant computation using the regular path (in other words, find the fieldDeclaration
- //and proceed to its type resolution). As implicitReceiver is false, no error reporting
- //against ref will be used ==> no nullPointerException risk ....
-
- //special treatment for langage-built-in field (their declaring class is null)
- if (binding.declaringClass == null) {
- //currently only one field "length" : the constant computation is never done
- return NotAConstant;
- }
- if (!binding.isFinal()) {
- return binding.constant = NotAConstant;
- }
- if (binding.constant != null) {
- if (isImplicit || (reference instanceof QualifiedNameReference
- && binding == ((QualifiedNameReference)reference).binding)) {
- return binding.constant;
- }
- return NotAConstant;
- }
-
- //The field has not been yet type checked.
- //It also means that the field is not coming from a class that
- //has already been compiled. It can only be from a class within
- //compilation units to process. Thus the field is NOT from a BinaryTypeBinbing
-
- SourceTypeBinding typeBinding = (SourceTypeBinding) binding.declaringClass;
- TypeDeclaration typeDecl = typeBinding.scope.referenceContext;
- FieldDeclaration fieldDecl = typeDecl.declarationOf(binding);
-
- fieldDecl.resolve(binding.isStatic() //side effect on binding
- ? typeDecl.staticInitializerScope
- : typeDecl.initializerScope);
-
- if (isImplicit || (reference instanceof QualifiedNameReference
- && binding == ((QualifiedNameReference)reference).binding)) {
- return binding.constant;
- }
- return NotAConstant;
- }
-
- public boolean isSuperAccess() {
-
- return receiver.isSuper();
- }
-
- public boolean isTypeAccess() {
-
- return receiver != null && receiver.isTypeReference();
- }
-
- /*
- * No need to emulate access to protected fields since not implicitly accessed
- */
- public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope) {
-
- if (binding.isPrivate()) {
- if ((currentScope.enclosingSourceType() != binding.declaringClass)
- && (binding.constant == NotAConstant)) {
- syntheticReadAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
- return;
- }
-
- } else if (receiver instanceof QualifiedSuperReference) { // qualified super
-
- // qualified super need emulation always
- SourceTypeBinding destinationType =
- (SourceTypeBinding) (((QualifiedSuperReference) receiver)
- .currentCompatibleType);
- syntheticReadAccessor = destinationType.addSyntheticMethod(binding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
- return;
-
- } else if (binding.isProtected()) {
-
- SourceTypeBinding enclosingSourceType;
- if (((bits & DepthMASK) != 0)
- && binding.declaringClass.getPackage()
- != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()) {
-
- SourceTypeBinding currentCompatibleType =
- (SourceTypeBinding) enclosingSourceType.enclosingTypeAt(
- (bits & DepthMASK) >> DepthSHIFT);
- syntheticReadAccessor = currentCompatibleType.addSyntheticMethod(binding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
-// if (binding.declaringClass != this.receiverType
-// && !this.receiverType.isArrayType()
-// && binding.declaringClass != null // array.length
-// && binding.constant == NotAConstant
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && binding.declaringClass.id != T_Object)
-// //no change for Object fields (in case there was)
-// || !binding.declaringClass.canBeSeenBy(currentScope))) {
-// this.codegenBinding =
-// currentScope.enclosingSourceType().getUpdatedFieldBinding(
-// binding,
-// (ReferenceBinding) this.receiverType);
-// }
- }
-
- /*
- * No need to emulate access to protected fields since not implicitly accessed
- */
- public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope) {
-
- if (binding.isPrivate()) {
- if (currentScope.enclosingSourceType() != binding.declaringClass) {
- syntheticWriteAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
- return;
- }
-
- } else if (receiver instanceof QualifiedSuperReference) { // qualified super
-
- // qualified super need emulation always
- SourceTypeBinding destinationType =
- (SourceTypeBinding) (((QualifiedSuperReference) receiver)
- .currentCompatibleType);
- syntheticWriteAccessor = destinationType.addSyntheticMethod(binding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
- return;
-
- } else if (binding.isProtected()) {
-
- SourceTypeBinding enclosingSourceType;
- if (((bits & DepthMASK) != 0)
- && binding.declaringClass.getPackage()
- != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()) {
-
- SourceTypeBinding currentCompatibleType =
- (SourceTypeBinding) enclosingSourceType.enclosingTypeAt(
- (bits & DepthMASK) >> DepthSHIFT);
- syntheticWriteAccessor =
- currentCompatibleType.addSyntheticMethod(binding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
-// if (binding.declaringClass != this.receiverType
-// && !this.receiverType.isArrayType()
-// && binding.declaringClass != null // array.length
-// && binding.constant == NotAConstant
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && binding.declaringClass.id != T_Object)
-// //no change for Object fields (in case there was)
-// || !binding.declaringClass.canBeSeenBy(currentScope))) {
-// this.codegenBinding =
-// currentScope.enclosingSourceType().getUpdatedFieldBinding(
-// binding,
-// (ReferenceBinding) this.receiverType);
-// }
- }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- // Answer the signature type of the field.
- // constants are propaged when the field is final
- // and initialized with a (compile time) constant
-
- // regular receiver reference
- this.receiverType = receiver.resolveType(scope);
- if (this.receiverType == null) {
- constant = NotAConstant;
- return null;
- }
- // the case receiverType.isArrayType and token = 'length' is handled by the scope API
- this.codegenBinding =
- this.binding = scope.getField(this.receiverType, token, this);
- if (!binding.isValidBinding()) {
- constant = NotAConstant;
- scope.problemReporter().invalidField(this, this.receiverType);
- return null;
- }
-
- if (isFieldUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedField(binding, this);
-
- boolean isImplicitThisRcv = receiver.isImplicitThis();
- constant = FieldReference.getConstantFor(binding, this, isImplicitThisRcv, scope);
- if (!isImplicitThisRcv) {
- constant = NotAConstant;
- }
- if (binding.isStatic()) {
- // static field accessed through receiver? legal but unoptimal (optional warning)
- if (!(isImplicitThisRcv
- || receiver.isSuper()
- || (receiver instanceof NameReference
- && (((NameReference) receiver).bits & BindingIds.TYPE) != 0))) {
- scope.problemReporter().unnecessaryReceiverForStaticField(this, binding);
- }
- }
- return this.resolvedType = binding.type;
- }
-
- public void setActualReceiverType(ReferenceBinding receiverType) {
- // ignored
- }
-
- public void setDepth(int depth) {
-
- bits &= ~DepthMASK; // flush previous depth if any
- if (depth > 0) {
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
- }
- }
-
- public void setFieldIndex(int index) {
- // ignored
- }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- return receiver.printExpression(0, output).append('.').append(token);
- }
- public String toStringExpression() {
-
- return receiver.toString() + "." //$NON-NLS-1$
- + new String(token);
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- receiver.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FloatLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FloatLiteral.java
deleted file mode 100644
index 7843039..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/FloatLiteral.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class FloatLiteral extends NumberLiteral {
- float value;
- final static float Float_MIN_VALUE = Float.intBitsToFloat(1); // work-around VAJ problem 1F6IGUU
-public FloatLiteral(char[] token, int s, int e) {
- super(token, s,e);
-}
-public void computeConstant() {
-
- //the source is correctly formated so the exception should never occurs
-
- Float computedValue;
- try {
- computedValue = Float.valueOf(String.valueOf(source));
- } catch (NumberFormatException e) {
- return;
- }
-
- if (computedValue.doubleValue() > Float.MAX_VALUE){
- return; //may be Infinity
- }
- if (computedValue.floatValue() < Float_MIN_VALUE){
- // see 1F6IGUU
- //only a true 0 can be made of zeros
- //1.00000000e-46f is illegal ....
- label : for (int i = 0; i < source.length; i++) {
- switch (source[i]) {
- case '.' :
- case 'f' :
- case 'F' :
- case '0' :
- break;
- case 'e' :
- case 'E' :
- break label; //exposant are valid !....
- default :
- return; //error
-
-
- }
- }
- }
- constant = Constant.fromValue(value = computedValue.floatValue());
-}
-/**
- * Code generation for float literal
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// if ((implicitConversion >> 4) == T_float)
-// codeStream.generateInlinedValue(value);
-// else
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public TypeBinding literalType(BlockScope scope) {
- return FloatBinding;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- visitor.visit(this, blockScope);
- visitor.endVisit(this, blockScope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ForStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ForStatement.java
deleted file mode 100644
index 4231b49..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ForStatement.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.LoopingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ForStatement extends Statement {
-
- public Statement[] initializations;
- public Expression condition;
- public Statement[] increments;
- public Statement action;
-
- //when there is no local declaration, there is no need of a new scope
- //scope is positionned either to a new scope, or to the "upper"scope (see resolveType)
- public boolean neededScope;
- public BlockScope scope;
-
- private Label breakLabel, continueLabel;
-
- // for local variables table attributes
- int preCondInitStateIndex = -1;
- int condIfTrueInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public ForStatement(
- Statement[] initializations,
- Expression condition,
- Statement[] increments,
- Statement action,
- boolean neededScope,
- int s,
- int e) {
-
- this.sourceStart = s;
- this.sourceEnd = e;
- this.initializations = initializations;
- this.condition = condition;
- this.increments = increments;
- this.action = action;
- this.neededScope = neededScope;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- breakLabel = new Label();
- continueLabel = new Label();
-
- // process the initializations
- if (initializations != null) {
- int count = initializations.length, i = 0;
- while (i < count) {
- flowInfo = initializations[i++].analyseCode(scope, flowContext, flowInfo);
- }
- }
- preCondInitStateIndex =
- currentScope.methodScope().recordInitializationStates(flowInfo);
-
- Constant cst = this.condition == null ? null : this.condition.constant;
- boolean isConditionTrue = cst == null || (cst != NotAConstant && cst.booleanValue() == true);
- boolean isConditionFalse = cst != null && (cst != NotAConstant && cst.booleanValue() == false);
-
- cst = this.condition == null ? null : this.condition.optimizedBooleanConstant();
- boolean isConditionOptimizedTrue = cst == null || (cst != NotAConstant && cst.booleanValue() == true);
- boolean isConditionOptimizedFalse = cst != null && (cst != NotAConstant && cst.booleanValue() == false);
-
- // process the condition
- LoopingFlowContext condLoopContext = null;
- if (condition != null) {
- if (!isConditionTrue) {
- flowInfo =
- condition.analyseCode(
- scope,
- (condLoopContext =
- new LoopingFlowContext(flowContext, this, null, null, scope)),
- flowInfo);
- }
- }
-
- // process the action
- LoopingFlowContext loopingContext;
- FlowInfo actionInfo;
- if (action == null ){
-// || (action.isEmptyBlock() && currentScope.environment().options.complianceLevel <= CompilerOptions.JDK1_3)) {
- if (condLoopContext != null)
- condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
- if (isConditionTrue) {
- return FlowInfo.DEAD_END;
- } else {
- if (isConditionFalse){
- continueLabel = null; // for(;false;p());
- }
- actionInfo = flowInfo.initsWhenTrue().copy();
- loopingContext =
- new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
- }
- } else {
- loopingContext =
- new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
- FlowInfo initsWhenTrue = flowInfo.initsWhenTrue();
- condIfTrueInitStateIndex =
- currentScope.methodScope().recordInitializationStates(initsWhenTrue);
-
- if (isConditionFalse) {
- actionInfo = FlowInfo.DEAD_END;
- } else {
- actionInfo = initsWhenTrue.copy();
- if (isConditionOptimizedFalse){
- actionInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- }
- if (!actionInfo.complainIfUnreachable(action, scope, false)) {
- actionInfo = action.analyseCode(scope, loopingContext, actionInfo);
- }
-
- // code generation can be optimized when no need to continue in the loop
- if (!actionInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
- continueLabel = null;
- } else {
- if (condLoopContext != null)
- condLoopContext.complainOnFinalAssignmentsInLoop(scope, flowInfo);
- loopingContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
- actionInfo =
- actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits());
- // for increments
- }
- }
- if ((continueLabel != null) && (increments != null)) {
- LoopingFlowContext loopContext =
- new LoopingFlowContext(flowContext, this, null, null, scope);
- int i = 0, count = increments.length;
- while (i < count)
- actionInfo = increments[i++].analyseCode(scope, loopContext, actionInfo);
- loopContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
- }
-
- // infinite loop
- FlowInfo mergedInfo;
- if (isConditionOptimizedTrue) {
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(
- mergedInfo = loopingContext.initsOnBreak);
- return mergedInfo;
- }
-
- //end of loop: either condition false or break
- mergedInfo =
- flowInfo.initsWhenFalse().unconditionalInits().mergedWith(
- loopingContext.initsOnBreak.unconditionalInits());
- if (isConditionOptimizedTrue && continueLabel == null){
- mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- /**
- * For statement code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// // generate the initializations
-// if (initializations != null) {
-// for (int i = 0, max = initializations.length; i < max; i++) {
-// initializations[i].generateCode(scope, codeStream);
-// }
-// }
-//
-// // label management
-// Label actionLabel = new Label(codeStream);
-// Label conditionLabel = new Label(codeStream);
-// breakLabel.codeStream = codeStream;
-// if (continueLabel != null) {
-// continueLabel.codeStream = codeStream;
-// }
-// // jump over the actionBlock
-// if ((condition != null)
-// && (condition.constant == NotAConstant)
-// && !((action == null || action.isEmptyBlock()) && (increments == null))) {
-// int jumpPC = codeStream.position;
-// codeStream.goto_(conditionLabel);
-// codeStream.recordPositionsFrom(jumpPC, condition.sourceStart);
-// }
-// // generate the loop action
-// actionLabel.place();
-// if (action != null) {
-// // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
-// if (condIfTrueInitStateIndex != -1) {
-// // insert all locals initialized inside the condition into the action generated prior to the condition
-// codeStream.addDefinitelyAssignedVariables(
-// currentScope,
-// condIfTrueInitStateIndex);
-// }
-// action.generateCode(scope, codeStream);
-// }
-// // continuation point
-// if (continueLabel != null) {
-// continueLabel.place();
-// // generate the increments for next iteration
-// if (increments != null) {
-// for (int i = 0, max = increments.length; i < max; i++) {
-// increments[i].generateCode(scope, codeStream);
-// }
-// }
-// }
-//
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (preCondInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// preCondInitStateIndex);
-// }
-//
-// // generate the condition
-// conditionLabel.place();
-// if ((condition != null) && (condition.constant == NotAConstant)) {
-// condition.generateOptimizedBoolean(scope, codeStream, actionLabel, null, true);
-// } else {
-// if (continueLabel != null) {
-// codeStream.goto_(actionLabel);
-// }
-// }
-// breakLabel.place();
-//
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (neededScope) {
-// codeStream.exitUserScope(scope);
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public void resetStateForCodeGeneration() {
- if (this.breakLabel != null) {
- this.breakLabel.resetStateForCodeGeneration();
- }
- if (this.continueLabel != null) {
- this.continueLabel.resetStateForCodeGeneration();
- }
- }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output).append("for ("); //$NON-NLS-1$
- //inits
- if (initializations != null) {
- for (int i = 0; i < initializations.length; i++) {
- //nice only with expressions
- if (i > 0) output.append(", "); //$NON-NLS-1$
- initializations[i].print(0, output);
- }
- }
- output.append("; "); //$NON-NLS-1$
- //cond
- if (condition != null) condition.printExpression(0, output);
- output.append("; "); //$NON-NLS-1$
- //updates
- if (increments != null) {
- for (int i = 0; i < increments.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
- increments[i].print(0, output);
- }
- }
- output.append(") "); //$NON-NLS-1$
- //block
- if (action == null)
- output.append(';');
- else {
- output.append('\n');
- action.printStatement(tab + 1, output); //$NON-NLS-1$
- }
- return output.append(';');
- }
- public void resolve(BlockScope upperScope) {
-
- // use the scope that will hold the init declarations
- scope = neededScope ? new BlockScope(upperScope) : upperScope;
- if (initializations != null)
- for (int i = 0, length = initializations.length; i < length; i++)
- initializations[i].resolve(scope);
- if (condition != null) {
- TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
- }
- if (increments != null)
- for (int i = 0, length = increments.length; i < length; i++)
- increments[i].resolve(scope);
- if (action != null)
- action.resolve(scope);
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab) + "for ("; //$NON-NLS-1$
- if (!neededScope)
- s = s + " //--NO upperscope scope needed\n" + tabString(tab) + " "; //$NON-NLS-2$ //$NON-NLS-1$
- //inits
- if (initializations != null) {
- for (int i = 0; i < initializations.length; i++) {
- //nice only with expressions
- s = s + initializations[i].toString(0);
- if (i != (initializations.length - 1))
- s = s + " , "; //$NON-NLS-1$
- }
- };
- s = s + "; "; //$NON-NLS-1$
- //cond
- if (condition != null)
- s = s + condition.toStringExpression();
- s = s + "; "; //$NON-NLS-1$
- //updates
- if (increments != null) {
- for (int i = 0; i < increments.length; i++) {
- //nice only with expressions
- s = s + increments[i].toString(0);
- if (i != (increments.length - 1))
- s = s + " , "; //$NON-NLS-1$
- }
- };
- s = s + ") "; //$NON-NLS-1$
- //block
- if (action == null)
- s = s + "{}"; //$NON-NLS-1$
- else
- s = s + "\n" + action.toString(tab + 1); //$NON-NLS-1$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- if (initializations != null) {
- int initializationsLength = initializations.length;
- for (int i = 0; i < initializationsLength; i++)
- initializations[i].traverse(visitor, scope);
- }
-
- if (condition != null)
- condition.traverse(visitor, scope);
-
- if (increments != null) {
- int incrementsLength = increments.length;
- for (int i = 0; i < incrementsLength; i++)
- increments[i].traverse(visitor, scope);
- }
-
- if (action != null)
- action.traverse(visitor, scope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IfStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IfStatement.java
deleted file mode 100644
index d76577b..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IfStatement.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class IfStatement extends Statement {
-
- //this class represents the case of only one statement in
- //either else and/or then branches.
-
- public Expression condition;
- public Statement thenStatement;
- public Statement elseStatement;
- public Expression[] elseifConditions;
- public Statement[] elseifStatements;
- public boolean checkUnreachable;
- boolean thenExit;
-
-
- // for local variables table attributes
- int thenInitStateIndex = -1;
- int elseInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public IfStatement(
- Expression condition,
- Statement thenStatement,
- int s,
- int e) {
-
- this.condition = condition;
- this.thenStatement = thenStatement;
- sourceStart = s;
- sourceEnd = e;
- checkUnreachable = true;
- }
-
- public IfStatement(
- Expression condition,
- Statement thenStatement,
- Statement elseStatement,
- int s,
- int e) {
-
- this.condition = condition;
- this.thenStatement = thenStatement;
- this.elseStatement = elseStatement;
- sourceEnd = e;
- sourceStart = s;
- checkUnreachable = true;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // process the condition
- flowInfo = condition.analyseCode(currentScope, flowContext, flowInfo);
-
- Constant cst = this.condition.optimizedBooleanConstant();
- boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- // process the THEN part
- FlowInfo thenFlowInfo = flowInfo.initsWhenTrue().copy();
- if (isConditionOptimizedFalse) {
- thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- if (this.thenStatement != null) {
- // Save info for code gen
- thenInitStateIndex =
- currentScope.methodScope().recordInitializationStates(thenFlowInfo);
- if (!thenFlowInfo.complainIfUnreachable(thenStatement, currentScope, false)) {
- thenFlowInfo =
- thenStatement.analyseCode(currentScope, flowContext, thenFlowInfo);
- }
- };
- // optimizing the jump around the ELSE part
- this.thenExit = !thenFlowInfo.isReachable();
-
- // process the ELSE part
- FlowInfo elseFlowInfo = flowInfo.initsWhenFalse().copy();
- if (isConditionOptimizedTrue) {
- elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- if (this.elseStatement != null) {
- // Save info for code gen
- elseInitStateIndex =
- currentScope.methodScope().recordInitializationStates(elseFlowInfo);
- if (!elseFlowInfo.complainIfUnreachable(elseStatement, currentScope, false)) {
- elseFlowInfo =
- elseStatement.analyseCode(currentScope, flowContext, elseFlowInfo);
- }
- }
-
- boolean elseExit = !elseFlowInfo.isReachable();
-
- // merge THEN & ELSE initializations
- FlowInfo mergedInfo;
-// if (isConditionOptimizedTrue){
-// if (!this.thenExit) {
-// mergedInfo = thenFlowInfo;
-// } else {
-// mergedInfo = elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
-// }
-//
-// } else if (isConditionOptimizedFalse) {
-// if (!elseExit) {
-// mergedInfo = elseFlowInfo;
-// } else {
-// mergedInfo = thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
-// }
-//
-// } else {
-// mergedInfo = thenFlowInfo.mergedWith(elseFlowInfo.unconditionalInits());
-// }
- if (isConditionOptimizedTrue){
- if (!this.thenExit) {
- mergedInfo = thenFlowInfo.addPotentialInitializationsFrom(elseFlowInfo);
- } else {
- mergedInfo = elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
-
- } else if (isConditionOptimizedFalse) {
- if (!elseExit) {
- mergedInfo = elseFlowInfo.addPotentialInitializationsFrom(thenFlowInfo);
- } else {
- mergedInfo = thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
-
- } else {
- mergedInfo = thenFlowInfo.mergedWith(elseFlowInfo.unconditionalInits());
- }
-
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- /**
- * If code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((this.bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// Label endifLabel = new Label(codeStream);
-//
-// // optimizing the then/else part code gen
-// Constant cst;
-// boolean hasThenPart =
-// !(((cst = this.condition.optimizedBooleanConstant()) != NotAConstant
-// && cst.booleanValue() == false)
-// || this.thenStatement == null
-// || this.thenStatement.isEmptyBlock());
-// boolean hasElsePart =
-// !((cst != NotAConstant && cst.booleanValue() == true)
-// || this.elseStatement == null
-// || this.elseStatement.isEmptyBlock());
-//
-// if (hasThenPart) {
-// Label falseLabel;
-// // generate boolean condition
-// this.condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// true);
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (thenInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// thenInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, thenInitStateIndex);
-// }
-// // generate then statement
-// this.thenStatement.generateCode(currentScope, codeStream);
-// // jump around the else statement
-// if (hasElsePart && !thenExit) {
-// this.thenStatement.branchChainTo(endifLabel);
-// int position = codeStream.position;
-// codeStream.goto_(endifLabel);
-// codeStream.updateLastRecordedEndPC(position);
-// //goto is tagged as part of the thenAction block
-// }
-// falseLabel.place();
-// } else {
-// if (hasElsePart) {
-// // generate boolean condition
-// this.condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// endifLabel,
-// null,
-// true);
-// } else {
-// // generate condition side-effects
-// this.condition.generateCode(currentScope, codeStream, false);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-// }
-// // generate else statement
-// if (hasElsePart) {
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (elseInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// elseInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, elseInitStateIndex);
-// }
-// this.elseStatement.generateCode(currentScope, codeStream);
-// }
-// endifLabel.place();
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output).append("if ("); //$NON-NLS-1$
- condition.printExpression(0, output).append(")\n"); //$NON-NLS-1$
- thenStatement.printStatement(indent + 2, output);
- if (elseStatement != null) {
- output.append('\n');
- printIndent(indent, output);
- output.append("else\n"); //$NON-NLS-1$
- elseStatement.printStatement(indent + 2, output);
- }
- return output;
- }
- public void resolve(BlockScope scope) {
-
- TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
- if (thenStatement != null)
- thenStatement.resolve(scope);
- if (elseStatement != null)
- elseStatement.resolve(scope);
- }
-
- public String toString(int tab) {
-
- String inFront, s = tabString(tab);
- inFront = s;
- s = s + "if (" + condition.toStringExpression() + ") \n"; //$NON-NLS-1$ //$NON-NLS-2$
- s = s + thenStatement.toString(tab + 2) + ";"; //$NON-NLS-1$
- if (elseStatement != null)
- s = s + "\n" + inFront + "else\n" + elseStatement.toString(tab + 2) + ";"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- condition.traverse(visitor, blockScope);
- if (thenStatement != null)
- thenStatement.traverse(visitor, blockScope);
- if (elseStatement != null)
- elseStatement.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImplicitDocTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImplicitDocTypeReference.java
deleted file mode 100644
index e435e07..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImplicitDocTypeReference.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ImplicitDocTypeReference extends TypeReference {
-
- public char[] token;
-
- public ImplicitDocTypeReference(char[] name, int pos) {
- super();
- this.token = name;
- this.sourceStart = pos;
- this.sourceEnd = pos;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#copyDims(int)
- */
- public TypeReference copyDims(int dim) {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
- */
- public TypeBinding getTypeBinding(Scope scope) {
- this.constant = NotAConstant;
- return this.resolvedType = scope.enclosingSourceType();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeName()
- */
- public char[][] getTypeName() {
- if (this.token != null) {
- char[][] tokens = { this.token };
- return tokens;
- }
- return null;
- }
- public boolean isThis() {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.ClassScope)
- */
- public void traverse(ASTVisitor visitor, ClassScope classScope) {
- // Do nothing
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.compiler.ast.Expression#printExpression(int, java.lang.StringBuffer)
- */
- public StringBuffer printExpression(int indent, StringBuffer output) {
- return new StringBuffer();
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImportReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImportReference.java
deleted file mode 100644
index 4f45ff4..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ImportReference.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
-
-import org.eclipse.core.resources.IFile;
-
-public class ImportReference extends ASTNode {
-
- public char[][] tokens;
-
- // public long[] sourcePositions; //each entry is using the code : (start<<32) + end
- public boolean onDemand = true; //most of the time
-
- public final char[] includeSource;
-
- public int declarationEnd;// doesn't include an potential trailing comment
-
- public int declarationSourceStart;
-
- public int declarationSourceEnd;
-
- public boolean used;
-
- private IFile fFile;
-
- public ImportReference(char[][] sources, char[] sourceString, int start, int end, boolean d) { // char[][] sources , long[] poss ,
- // boolean d) {
- tokens = sources;
- // sourcePositions = poss ;
- includeSource = sourceString;
- onDemand = d;
- sourceEnd = end;//(int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF);
- sourceStart = start;//(int)(sourcePositions[0]>>>32) ;
- fFile = null;
- }
-
- /**
- * @return char[][]
- */
- public char[][] getImportName() {
- return tokens;
- }
-
- public char[] getIncludeName() {
- return includeSource;
- }
-
- public StringBuffer print(int indent, StringBuffer output) {
-
- return print(indent, output, true);
- }
-
- public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) {
-
- /* when withOnDemand is false, only the name is printed */
- for (int i = 0; i < tokens.length; i++) {
- if (i > 0)
- output.append('.');
- output.append(tokens[i]);
- }
- if (withOnDemand && onDemand) {
- output.append(".*"); //$NON-NLS-1$
- }
- return output;
- }
-
- public String toString(int tab) {
-
- return toString(tab, true);
- }
-
- public String toString(int tab, boolean withOnDemand) {
- /* when withOnDemand is false, only the name is printed */
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++) {
- buffer.append(tokens[i]);
- if (i < (tokens.length - 1)) {
- buffer.append("."); //$NON-NLS-1$
- }
- }
- if (withOnDemand && onDemand) {
- buffer.append(".*"); //$NON-NLS-1$
- }
- buffer.append(" - ");
- buffer.append(includeSource);
- return buffer.toString();
- // return new String(includeSource);
- }
-
- public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-
- /**
- * @return Returns the filePath.
- */
- public IFile getFile() {
- return fFile;
- }
-
- /**
- * @param filePath
- * The filePath to set.
- */
- public void setFile(IFile filePath) {
- fFile = filePath;
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Initializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Initializer.java
deleted file mode 100644
index 3f0296c..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Initializer.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
-
-public class Initializer extends FieldDeclaration {
-
- public Block block;
- public int lastFieldID;
- public int bodyStart;
- public Initializer(Block block, int modifiers) {
- this.block = block;
- this.modifiers = modifiers;
-
- declarationSourceStart = sourceStart = bodyStart = block.sourceStart;
- }
-
- public FlowInfo analyseCode(
- MethodScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return block.analyseCode(currentScope, flowContext, flowInfo);
- }
-
- /**
- * Code generation for a non-static initializer:
- * standard block code gen
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// block.generateCode(currentScope, codeStream);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public boolean isField() {
-
- return false;
- }
-
- public boolean isStatic() {
-
- return (modifiers & AccStatic) != 0;
- }
-
- public void parseStatements(
- UnitParser parser,
- TypeDeclaration type,
- CompilationUnitDeclaration unit) {
-
- //fill up the method body with statement
- parser.parse(this, type, unit);
- }
-
- public void resolve(MethodScope scope) {
-
- int previous = scope.fieldDeclarationIndex;
- try {
- scope.fieldDeclarationIndex = lastFieldID;
- if (isStatic()) {
- ReferenceBinding declaringType = scope.enclosingSourceType();
- if (declaringType.isNestedType() && !declaringType.isStatic())
- scope.problemReporter().innerTypesCannotDeclareStaticInitializers(
- declaringType,
- this);
- }
- block.resolve(scope);
- } finally {
- scope.fieldDeclarationIndex = previous;
- }
- }
-
- public String toString(int tab) {
-
- if (modifiers != 0) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(tabString(tab));
- buffer.append(modifiersString(modifiers));
- buffer.append("{\n"); //$NON-NLS-1$
- buffer.append(block.toStringStatements(tab));
- buffer.append(tabString(tab));
- buffer.append("}"); //$NON-NLS-1$
- return buffer.toString();
- } else {
- return block.toString(tab);
- }
- }
-
- public void traverse(ASTVisitor visitor, MethodScope scope) {
-
- if (visitor.visit(this, scope)) {
- block.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InnerTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InnerTypeDeclaration.java
deleted file mode 100644
index fdce37d..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InnerTypeDeclaration.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-
-public class InnerTypeDeclaration extends TypeDeclaration {
-
- public InnerTypeDeclaration(CompilationResult compilationResult){
- super(compilationResult);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InstanceOfExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InstanceOfExpression.java
deleted file mode 100644
index f3e8b49..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/InstanceOfExpression.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class InstanceOfExpression extends OperatorExpression {
-
- public Expression expression;
- public TypeReference type;
-
- public InstanceOfExpression(
- Expression expression,
- TypeReference type,
- int operator) {
-
- this.expression = expression;
- this.type = type;
- this.bits |= operator << OperatorSHIFT;
- this.sourceStart = expression.sourceStart;
- this.sourceEnd = type.sourceEnd;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return expression
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
-
- public final boolean areTypesCastCompatible(
- BlockScope scope,
- TypeBinding castType,
- TypeBinding expressionType) {
-
- // see specifications p.68
- //A more cpmplete version of this method is provided on
- //CastExpression (it deals with constant and need runtime checkcast)
-
- if (castType == expressionType) return true;
-
- //by grammatical construction, the first test is ALWAYS false
- //if (castTb.isBaseType())
- //{ if (expressionTb.isBaseType())
- // { if (expression.isConstantValueOfTypeAssignableToType(expressionTb,castTb))
- // { return true;}
- // else
- // { if (expressionTb==castTb)
- // { return true;}
- // else
- // { if (scope.areTypesCompatible(expressionTb,castTb))
- // { return true; }
- //
- // if (BaseTypeBinding.isNarrowing(castTb.id,expressionTb.id))
- // { return true;}
- // return false;}}}
- // else
- // { return false; }}
- //else
- { //-------------checkcast to something which is NOT a basetype----------------------------------
-
- //null is compatible with every thing ....
- if (NullBinding == expressionType) {
- return true;
- }
- if (expressionType.isArrayType()) {
- if (castType.isArrayType()) {
- //------- (castTb.isArray) expressionTb.isArray -----------
- TypeBinding expressionEltTb = ((ArrayBinding) expressionType).elementsType(scope);
- if (expressionEltTb.isBaseType())
- // <---stop the recursion-------
- return ((ArrayBinding) castType).elementsType(scope) == expressionEltTb;
- //recursivly on the elts...
- return areTypesCastCompatible(
- scope,
- ((ArrayBinding) castType).elementsType(scope),
- expressionEltTb);
- }
- if (castType.isClass()) {
- //------(castTb.isClass) expressionTb.isArray ---------------
- if (scope.isJavaLangObject(castType))
- return true;
- return false;
- }
- if (castType.isInterface()) {
- //------- (castTb.isInterface) expressionTb.isArray -----------
- if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
- return true;
- }
- return false;
- }
-
- return false;
- }
- if (expressionType.isBaseType()) {
- return false;
- }
- if (expressionType.isClass()) {
- if (castType.isArrayType()) {
- // ---- (castTb.isArray) expressionTb.isClass -------
- if (scope.isJavaLangObject(expressionType)) {
- return true;
- } else {
- return false;
- }
- }
- if (castType.isClass()) { // ----- (castTb.isClass) expressionTb.isClass ------
- if (expressionType.isCompatibleWith(castType))
- return true;
- else {
- if (castType.isCompatibleWith(expressionType)) {
- return true;
- }
- return false;
- }
- }
- if (castType.isInterface()) {
- // ----- (castTb.isInterface) expressionTb.isClass -------
- if (((ReferenceBinding) expressionType).isFinal()) {
- //no subclass for expressionTb, thus compile-time check is valid
- if (expressionType.isCompatibleWith(castType))
- return true;
- return false;
- } else {
- return true;
- }
- }
-
- return false;
- }
- if (expressionType.isInterface()) {
- if (castType.isArrayType()) {
- // ----- (castTb.isArray) expressionTb.isInterface ------
- if (scope.isJavaLangCloneable(expressionType)
- || scope.isJavaIoSerializable(expressionType))
- //potential runtime error
- {
- return true;
- }
- return false;
- }
- if (castType.isClass()) {
- // ----- (castTb.isClass) expressionTb.isInterface --------
- if (scope.isJavaLangObject(castType))
- return true;
- if (((ReferenceBinding) castType).isFinal()) {
- //no subclass for castTb, thus compile-time check is valid
- if (castType.isCompatibleWith(expressionType)) {
- return true;
- }
- return false;
- }
- return true;
- }
- if (castType.isInterface()) {
- // ----- (castTb.isInterface) expressionTb.isInterface -------
- if ((Scope.compareTypes(castType, expressionType) == NotRelated)) {
- MethodBinding[] castTbMethods = ((ReferenceBinding) castType).methods();
- int castTbMethodsLength = castTbMethods.length;
- MethodBinding[] expressionTbMethods =
- ((ReferenceBinding) expressionType).methods();
- int expressionTbMethodsLength = expressionTbMethods.length;
- for (int i = 0; i < castTbMethodsLength; i++) {
- for (int j = 0; j < expressionTbMethodsLength; j++) {
- if (castTbMethods[i].selector == expressionTbMethods[j].selector) {
- if (castTbMethods[i].returnType != expressionTbMethods[j].returnType) {
- if (castTbMethods[i].areParametersEqual(expressionTbMethods[j])) {
- return false;
- }
- }
- }
- }
- }
- }
- return true;
- }
-
- return false;
- }
-
- return false;
- }
- }
- /**
- * Code generation for instanceOfExpression
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// expression.generateCode(currentScope, codeStream, true);
-// codeStream.instance_of(type.resolvedType);
-// if (!valueRequired)
-// codeStream.pop();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- constant = NotAConstant;
- TypeBinding expressionType = expression.resolveType(scope);
- TypeBinding checkType = type.resolveType(scope);
- if (expressionType == null || checkType == null)
- return null;
-
- if (!areTypesCastCompatible(scope, checkType, expressionType)) {
- scope.problemReporter().notCompatibleTypesError(this, expressionType, checkType);
- return null;
- }
- this.resolvedType = BooleanBinding;
- return BooleanBinding;
- }
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
-
- expression.printExpression(indent, output).append(" instanceof "); //$NON-NLS-1$
- return type.print(0, output);
- }
- public String toStringExpressionNoParenthesis() {
-
- return expression.toStringExpression() + " instanceof " + //$NON-NLS-1$
- type.toString(0);
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- expression.traverse(visitor, scope);
- type.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteral.java
deleted file mode 100644
index b75afa9..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteral.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.impl.DoubleConstant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class IntLiteral extends NumberLiteral {
- public int value;
-
- public static final IntLiteral
- One = new IntLiteral(new char[]{'1'},0,0,1);//used for ++ and --
-
- static final Constant FORMAT_ERROR = new DoubleConstant(1.0/0.0); // NaN;
-public IntLiteral(char[] token, int s, int e) {
- super(token, s,e);
-}
-public IntLiteral(char[] token, int s,int e, int value) {
- this(token, s,e);
- this.value = value;
-}
-public IntLiteral(int intValue) {
- //special optimized constructor : the cst is the argument
-
- //value that should not be used
- // tokens = null ;
- // sourceStart = 0;
- // sourceEnd = 0;
- super(null,0,0);
- constant = Constant.fromValue(intValue);
- value = intValue;
-
-}
-public void computeConstant() {
- //a special constant is use for the potential Integer.MAX_VALUE+1
- //which is legal if used with a - as prefix....cool....
- //notice that Integer.MIN_VALUE == -2147483648
-
- long MAX = Integer.MAX_VALUE;
- if (this == One) { constant = Constant.One; return ;}
-
- int length = source.length;
- long computedValue = 0L;
- if (source[0] == '0')
- { MAX = 0xFFFFFFFFL ; //a long in order to be positive !
- if (length == 1) { constant = Constant.fromValue(0); return ;}
- final int shift,radix;
- int j ;
- if ( (source[1] == 'x') | (source[1] == 'X') )
- { shift = 4 ; j = 2; radix = 16;}
- else
- { shift = 3 ; j = 1; radix = 8;}
- while (source[j]=='0')
- { j++; //jump over redondant zero
- if (j == length)
- { //watch for 000000000000000000 :-(
- constant = Constant.fromValue(value = (int)computedValue);
- return ;}}
-
- while (j MAX) return /*constant stays null*/ ;}}
- else
- { //-----------regular case : radix = 10-----------
- for (int i = 0 ; i < length;i++)
- { int digitValue ;
- if ((digitValue = Character.digit(source[i],10)) < 0 )
- { constant = FORMAT_ERROR; return ;}
- computedValue = 10*computedValue + digitValue;
- if (computedValue > MAX) return /*constant stays null*/ ; }}
-
- constant = Constant.fromValue(value = (int)computedValue);
-
-}
-/**
- * Code generation for int literal
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// if ((implicitConversion >> 4) == T_int)
-// codeStream.generateInlinedValue(value);
-// else
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public TypeBinding literalType(BlockScope scope) {
- return IntBinding;
-}
-public final boolean mayRepresentMIN_VALUE(){
- //a special autorized int literral is 2147483648
- //which is ONE over the limit. This special case
- //only is used in combinaison with - to denote
- //the minimal value of int -2147483648
-
- return ((source.length == 10) &&
- (source[0] == '2') &&
- (source[1] == '1') &&
- (source[2] == '4') &&
- (source[3] == '7') &&
- (source[4] == '4') &&
- (source[5] == '8') &&
- (source[6] == '3') &&
- (source[7] == '6') &&
- (source[8] == '4') &&
- (source[9] == '8'));}
-public TypeBinding resolveType(BlockScope scope) {
- // the format may be incorrect while the scanner could detect
- // such an error only on painfull tests...easier and faster here
-
- TypeBinding tb = super.resolveType(scope);
- if (constant == FORMAT_ERROR) {
- constant = NotAConstant;
- scope.problemReporter().constantOutOfFormat(this);
- this.resolvedType = null;
- return null;
- }
- return tb;
-}
-public String toStringExpression(){
-
- if (source == null)
- /* special optimized IntLiteral that are created by the compiler */
- return String.valueOf(value);
-
- return super.toStringExpression();}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteralMinValue.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteralMinValue.java
deleted file mode 100644
index 76c4c02..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/IntLiteralMinValue.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-
-
-public class IntLiteralMinValue extends IntLiteral {
-
- final static char[] CharValue = new char[]{'-','2','1','4','7','4','8','3','6','4','8'};
- final static Constant MIN_VALUE = Constant.fromValue(Integer.MIN_VALUE) ;
-
-public IntLiteralMinValue() {
- super(CharValue,0,0,Integer.MIN_VALUE);
- constant = MIN_VALUE;
-}
-public void computeConstant(){
-
- /*precomputed at creation time*/ }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
deleted file mode 100644
index 56f1e22..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-
-
-
-public class JavadocArrayQualifiedTypeReference extends ArrayQualifiedTypeReference {
-
- public int tagSourceStart, tagSourceEnd;
-
- public JavadocArrayQualifiedTypeReference(JavadocQualifiedTypeReference typeRef, int dim) {
- super(typeRef.tokens, dim, typeRef.sourcePositions);
- }
-
- protected void reportInvalidType(Scope scope) {
- scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
- }
- protected void reportDeprecatedType(Scope scope) {
- scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
- }
-
- /* (non-Javadoc)
- * Redefine to capture javadoc specific signatures
- * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- */
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArraySingleTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArraySingleTypeReference.java
deleted file mode 100644
index 8298d2e..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocArraySingleTypeReference.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-
-
-public class JavadocArraySingleTypeReference extends ArrayTypeReference {
-
- public JavadocArraySingleTypeReference(char[] name, int dim, long pos) {
- super(name, dim, pos);
- this.bits |= InsideJavadoc;
- }
-
- protected void reportInvalidType(Scope scope) {
- scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
- }
- protected void reportDeprecatedType(Scope scope) {
- scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
- }
-
- /* (non-Javadoc)
- * Redefine to capture javadoc specific signatures
- * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- */
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocQualifiedTypeReference.java
deleted file mode 100644
index 0edef17..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocQualifiedTypeReference.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-
-public class JavadocQualifiedTypeReference extends QualifiedTypeReference {
-
- public int tagSourceStart, tagSourceEnd;
- public PackageBinding packageBinding;
-
- public JavadocQualifiedTypeReference(char[][] sources, long[] pos, int tagStart, int tagEnd) {
- super(sources, pos);
- this.tagSourceStart = tagStart;
- this.tagSourceEnd = tagEnd;
- this.bits |= InsideJavadoc;
- }
-
- protected void reportInvalidType(Scope scope) {
- scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
- }
- protected void reportDeprecatedType(Scope scope) {
- scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
- }
-
- /* (non-Javadoc)
- * Redefine to capture javadoc specific signatures
- * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- */
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-
- /*
- *
- */
- private TypeBinding internalResolveType(Scope scope) {
- // handle the error here
- this.constant = NotAConstant;
- if (this.resolvedType != null) { // is a shared type reference which was already resolved
- if (!this.resolvedType.isValidBinding())
- return null; // already reported error
- } else {
- this.resolvedType = getTypeBinding(scope);
- if (!this.resolvedType.isValidBinding()) {
- Binding binding = scope.getTypeOrPackage(this.tokens);
- if (binding instanceof PackageBinding) {
- this.packageBinding = (PackageBinding) binding;
- } else {
- reportInvalidType(scope);
- }
- return null;
- }
- if (isTypeUseDeprecated(this.resolvedType, scope)) {
- reportDeprecatedType(scope);
- }
- }
- return this.resolvedType;
- }
-
- /* (non-Javadoc)
- * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- * We need to override to handle package references
- */
- public TypeBinding resolveType(BlockScope blockScope) {
- return internalResolveType(blockScope);
- }
-
- /* (non-Javadoc)
- * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.ClassScope)
- * We need to override to handle package references
- */
- public TypeBinding resolveType(ClassScope classScope) {
- return internalResolveType(classScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocReturnStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocReturnStatement.java
deleted file mode 100644
index 25e92e6..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocReturnStatement.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class JavadocReturnStatement extends ReturnStatement {
- public char[] description;
-
- public JavadocReturnStatement(int s, int e, char[] descr) {
- super(null, s, e);
- this.description = descr;
- this.bits |= InsideJavadoc;
- }
-
- public void resolve(BlockScope scope) {
- MethodScope methodScope = scope.methodScope();
- MethodBinding methodBinding;
- TypeBinding methodType =
- (methodScope.referenceContext instanceof AbstractMethodDeclaration)
- ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null
- ? null
- : methodBinding.returnType)
- : VoidBinding;
- if (methodType == null || methodType == VoidBinding) {
- scope.problemReporter().javadocUnexpectedTag(this.sourceStart, this.sourceEnd);
- }
- }
-
- /* (non-Javadoc)
- * Redefine to capture javadoc specific signatures
- * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- */
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocSingleTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocSingleTypeReference.java
deleted file mode 100644
index 5261574..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/JavadocSingleTypeReference.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class JavadocSingleTypeReference extends SingleTypeReference {
-
- public int tagSourceStart, tagSourceEnd;
- public PackageBinding packageBinding;
-
- public JavadocSingleTypeReference(char[] source, long pos, int tagStart, int tagEnd) {
- super(source, pos);
- this.tagSourceStart = tagStart;
- this.tagSourceEnd = tagEnd;
- this.bits |= InsideJavadoc;
- }
-
- protected void reportInvalidType(Scope scope) {
- scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers());
- }
- protected void reportDeprecatedType(Scope scope) {
- scope.problemReporter().javadocDeprecatedType(this.resolvedType, this, scope.getDeclarationModifiers());
- }
-
- /* (non-Javadoc)
- * Redefine to capture javadoc specific signatures
- * @see net.sourceforge.phpdt.internal.compiler.ast.ASTNode#traverse(net.sourceforge.phpdt.internal.compiler.ASTVisitor, net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- */
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-
- /*
- *
- */
- private TypeBinding internalResolveType(Scope scope) {
- // handle the error here
- this.constant = NotAConstant;
- if (this.resolvedType != null) { // is a shared type reference which was already resolved
- if (!this.resolvedType.isValidBinding())
- return null; // already reported error
- } else {
- this.resolvedType = getTypeBinding(scope);
- if (!this.resolvedType.isValidBinding()) {
- char[][] tokens = { this.token };
- Binding binding = scope.getTypeOrPackage(tokens);
- if (binding instanceof PackageBinding) {
- this.packageBinding = (PackageBinding) binding;
- } else {
- reportInvalidType(scope);
- }
- return null;
- }
- if (isTypeUseDeprecated(this.resolvedType, scope)) {
- reportDeprecatedType(scope);
- }
- }
- return this.resolvedType;
- }
-
- /* (non-Javadoc)
- * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.BlockScope)
- * We need to override to handle package references
- */
- public TypeBinding resolveType(BlockScope blockScope) {
- return internalResolveType(blockScope);
- }
-
- /* (non-Javadoc)
- * @see net.sourceforge.phpdt.internal.compiler.ast.Expression#resolveType(net.sourceforge.phpdt.internal.compiler.lookup.ClassScope)
- * We need to override to handle package references
- */
- public TypeBinding resolveType(ClassScope classScope) {
- return internalResolveType(classScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LabeledStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LabeledStatement.java
deleted file mode 100644
index 31f7e1f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LabeledStatement.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.LabelFlowContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-
-public class LabeledStatement extends Statement {
-
- public Statement statement;
- public char[] label;
- public Label targetLabel;
-
- // for local variables table attributes
- int mergedInitStateIndex = -1;
-
- /**
- * LabeledStatement constructor comment.
- */
- public LabeledStatement(char[] l, Statement st, int s, int e) {
-
- this.statement = st;
- this.label = l;
- this.sourceStart = s;
- this.sourceEnd = e;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // need to stack a context to store explicit label, answer inits in case of normal completion merged
- // with those relative to the exit path from break statement occurring inside the labeled statement.
- if (statement == null) {
- return flowInfo;
- } else {
- LabelFlowContext labelContext;
- FlowInfo mergedInfo =
- statement
- .analyseCode(
- currentScope,
- (labelContext =
- new LabelFlowContext(
- flowContext,
- this,
- label,
- (targetLabel = new Label()),
- currentScope)),
- flowInfo)
- .mergedWith(labelContext.initsOnBreak);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
- }
-
- public ASTNode concreteStatement() {
-
- // return statement.concreteStatement(); // for supporting nested labels: a:b:c: someStatement (see 21912)
- return statement;
- }
-
- /**
- * Code generation for labeled statement
- *
- * may not need actual source positions recording
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// int pc = codeStream.position;
-// if (targetLabel != null) {
-// targetLabel.codeStream = codeStream;
-// if (statement != null) {
-// statement.generateCode(currentScope, codeStream);
-// }
-// targetLabel.place();
-// }
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output).append(label).append(": "); //$NON-NLS-1$
- if (this.statement == null)
- output.append(';');
- else
- this.statement.printStatement(0, output);
- return output;
- }
- public void resolve(BlockScope scope) {
-
- statement.resolve(scope);
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- s += new String(label) + ": " + statement.toString(0); //$NON-NLS-1$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- statement.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-
- public void resetStateForCodeGeneration() {
- if (this.targetLabel != null) {
- this.targetLabel.resetStateForCodeGeneration();
- }
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Literal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Literal.java
deleted file mode 100644
index 54c3414..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Literal.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public abstract class Literal extends Expression {
-
-public Literal(int s,int e) {
- sourceStart = s ;
- sourceEnd= e;
-}
-
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return flowInfo;
-}
-
-public abstract void computeConstant() ;
- //ON ERROR constant STAYS NULL
-public abstract TypeBinding literalType(BlockScope scope);
-public StringBuffer printExpression(int indent, StringBuffer output){
-
- return output.append(source());
- }
-public TypeBinding resolveType(BlockScope scope) {
- // compute the real value, which must range its type's range
-
- computeConstant();
- if (constant == null) {
- scope.problemReporter().constantOutOfRange(this);
- constant = Constant.NotAConstant;
- return null;
- }
- this.resolvedType = literalType(scope);
- return this.resolvedType;
-}
-public abstract char[] source() ;
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalDeclaration.java
deleted file mode 100644
index c2912bb..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalDeclaration.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class LocalDeclaration extends AbstractVariableDeclaration {
-
- public LocalVariableBinding binding;
-
- public LocalDeclaration(
- Expression expr,
- char[] name,
- int sourceStart,
- int sourceEnd) {
-
- initialization = expr;
- this.name = name;
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- if (initialization != null) {
- this.declarationSourceEnd = initialization.sourceEnd;
- this.declarationEnd = initialization.sourceEnd;
- } else {
- this.declarationEnd = sourceEnd;
- }
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // record variable initialization if any
- if (flowInfo.isReachable()) {
- bits |= IsLocalDeclarationReachableMASK; // only set if actually reached
- }
- if (initialization == null)
- return flowInfo;
-
- flowInfo =
- initialization
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
-
- // final int i = (i = 0);
- // no need to complain since (i = 0) part will get the blame
- //if (binding.isFinal() && flowInfo.isPotentiallyAssigned(binding)) {
- // currentScope.problemReporter().duplicateInitializationOfFinalLocal(binding, this);
- //}
-
- flowInfo.markAsDefinitelyAssigned(binding);
- return flowInfo;
- }
-
- public void checkModifiers() {
-
- //only potential valid modifier is <>
- if (((modifiers & AccJustFlag) & ~AccFinal) != 0)
- //AccModifierProblem -> other (non-visibility problem)
- //AccAlternateModifierProblem -> duplicate modifier
- //AccModifierProblem | AccAlternateModifierProblem -> visibility problem"
-
- modifiers = (modifiers & ~AccAlternateModifierProblem) | AccModifierProblem;
- }
-
- /**
- * Code generation for a local declaration:
- * normal assignment to a local variable + unused variable handling
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// // even if not reachable, variable must be added to visible if allocated (28298)
-// if (binding.resolvedPosition != -1) {
-// codeStream.addVisibleLocalVariable(binding);
-// }
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// Constant inlinedValue;
-//
-// // something to initialize?
-// if (initialization != null) {
-// // initialize to constant value?
-// if ((inlinedValue = initialization.constant) != NotAConstant) {
-// // forget initializing unused or final locals set to constant value (final ones are inlined)
-// if (binding.resolvedPosition != -1) { // may need to preserve variable
-// int initPC = codeStream.position;
-// codeStream.generateConstant(inlinedValue, initialization.implicitConversion);
-// codeStream.recordPositionsFrom(initPC, initialization.sourceStart);
-// codeStream.store(binding, false);
-// binding.recordInitializationStartPC(codeStream.position);
-// // codeStream.lastInitStateIndexWhenRemovingInits = -2; // reinitialize remove index
-// // codeStream.lastInitStateIndexWhenAddingInits = -2; // reinitialize add index
-// }
-// } else { // initializing to non-constant value
-// initialization.generateCode(currentScope, codeStream, true);
-// // if binding unused generate then discard the value
-// if (binding.resolvedPosition != -1) {
-// // 26903, need extra cast to store null in array local var
-// if (binding.type.isArrayType()
-// && (initialization.resolvedType == NullBinding // arrayLoc = null
-// || ((initialization instanceof CastExpression) // arrayLoc = (type[])null
-// && (((CastExpression)initialization).innermostCastedExpression().resolvedType == NullBinding)))){
-// codeStream.checkcast(binding.type);
-// }
-// codeStream.store(binding, false);
-// if (binding.initializationCount == 0) {
-// /* Variable may have been initialized during the code initializing it
-// e.g. int i = (i = 1);
-// */
-// binding.recordInitializationStartPC(codeStream.position);
-// // codeStream.lastInitStateIndexWhenRemovingInits = -2; // reinitialize remove index
-// // codeStream.lastInitStateIndexWhenAddingInits = -2; // reinitialize add index
-// }
-// } else {
-// if ((binding.type == LongBinding) || (binding.type == DoubleBinding)) {
-// codeStream.pop2();
-// } else {
-// codeStream.pop();
-// }
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public String name() {
-
- return String.valueOf(name);
- }
-
- public void resolve(BlockScope scope) {
-
- // create a binding and add it to the scope
- TypeBinding tb = type.resolveType(scope);
-
- checkModifiers();
-
- if (tb != null) {
- if (tb == VoidBinding) {
- scope.problemReporter().variableTypeCannotBeVoid(this);
- return;
- }
- if (tb.isArrayType() && ((ArrayBinding) tb).leafComponentType == VoidBinding) {
- scope.problemReporter().variableTypeCannotBeVoidArray(this);
- return;
- }
- }
-
- // duplicate checks
- if ((binding = scope.duplicateName(name)) != null) {
- // the name already exists... may carry on with the first binding...
- scope.problemReporter().redefineLocal(this);
- } else {
- if ((modifiers & AccFinal)!= 0 && this.initialization == null) {
- modifiers |= AccBlankFinal;
- }
- binding = new LocalVariableBinding(this, tb, modifiers, false);
- scope.addLocalVariable(binding);
- binding.constant = NotAConstant;
- // allow to recursivelly target the binding....
- // the correct constant is harmed if correctly computed at the end of this method
- }
-
- if (tb == null) {
- if (initialization != null)
- initialization.resolveType(scope); // want to report all possible errors
- return;
- }
-
- // store the constant for final locals
- if (initialization != null) {
- if (initialization instanceof ArrayInitializer) {
- TypeBinding initTb = initialization.resolveTypeExpecting(scope, tb);
- if (initTb != null) {
- ((ArrayInitializer) initialization).binding = (ArrayBinding) initTb;
- initialization.implicitWidening(tb, initTb);
- }
- } else {
- TypeBinding initTb = initialization.resolveType(scope);
- if (initTb != null) {
- if (initialization.isConstantValueOfTypeAssignableToType(initTb, tb)
- || (tb.isBaseType() && BaseTypeBinding.isWidening(tb.id, initTb.id))
- || initTb.isCompatibleWith(tb))
- initialization.implicitWidening(tb, initTb);
- else
- scope.problemReporter().typeMismatchError(initTb, tb, this);
- }
- }
-
- // change the constant in the binding when it is final
- // (the optimization of the constant propagation will be done later on)
- // cast from constant actual type to variable type
- binding.constant =
- binding.isFinal()
- ? initialization.constant.castTo((tb.id << 4) + initialization.constant.typeID())
- : NotAConstant;
- }
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- type.traverse(visitor, scope);
- if (initialization != null)
- initialization.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalTypeDeclaration.java
deleted file mode 100644
index 83b154f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LocalTypeDeclaration.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
-
-public class LocalTypeDeclaration extends InnerTypeDeclaration {
- public AbstractMethodDeclaration enclosingMethod;
-
-public LocalTypeDeclaration(CompilationResult compilationResult){
- super(compilationResult);
-}
-
-/**
- * Iteration for a local innertype
- *
- */
-public void traverse(ASTVisitor visitor, BlockScope blockScope) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, blockScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
- }
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- // local type cannot have static fields
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- } catch (AbortType e) {
- }
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteral.java
deleted file mode 100644
index 7ae7d85..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteral.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.impl.DoubleConstant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class LongLiteral extends NumberLiteral {
- long value;
-
- static final Constant FORMAT_ERROR = new DoubleConstant(1.0/0.0); // NaN;
-
-public LongLiteral(char[] token, int s,int e) {
- super(token, s,e);
-}
-public LongLiteral(char[] token, int s,int e, long value) {
- this(token, s,e);
- this.value = value;
-}
-public void computeConstant() {
- //the overflow (when radix=10) is tested using the fact that
- //the value should always grow during its computation
-
- int length = source.length - 1; //minus one because the last char is 'l' or 'L'
-
- long computedValue ;
- if (source[0] == '0')
- { if (length == 1) { constant = Constant.fromValue(0L); return; }
- final int shift,radix;
- int j ;
- if ( (source[1] == 'x') | (source[1] == 'X') )
- { shift = 4 ; j = 2; radix = 16;}
- else
- { shift = 3 ; j = 1; radix = 8;}
- int nbDigit = 0;
- while (source[j]=='0')
- { j++; //jump over redondant zero
- if ( j == length)
- { //watch for 0000000000000L
- constant = Constant.fromValue(value = 0L);
- return ;}}
-
- int digitValue ;
- if ((digitValue = Character.digit(source[j++],radix)) < 0 )
- { constant = FORMAT_ERROR; return ;}
- if (digitValue >= 8) nbDigit = 4;
- else if (digitValue >= 4) nbDigit = 3;
- else if (digitValue >= 2) nbDigit = 2;
- else nbDigit = 1; //digitValue is not 0
- computedValue = digitValue ;
- while (j 64) return /*constant stays null*/ ;
- computedValue = (computedValue< computedValue) return /*constant stays null*/;}}
-
- constant = Constant.fromValue(value = computedValue);
-}
-/**
- * Code generation for long literal
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// if ((implicitConversion >> 4) == T_long)
-// codeStream.generateInlinedValue(value);
-// else
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public TypeBinding literalType(BlockScope scope) {
- return LongBinding;
-}
-public final boolean mayRepresentMIN_VALUE(){
- //a special autorized int literral is 9223372036854775808L
- //which is ONE over the limit. This special case
- //only is used in combinaison with - to denote
- //the minimal value of int -9223372036854775808L
-
- return ((source.length == 20) &&
- (source[0] == '9') &&
- (source[1] == '2') &&
- (source[2] == '2') &&
- (source[3] == '3') &&
- (source[4] == '3') &&
- (source[5] == '7') &&
- (source[6] == '2') &&
- (source[7] == '0') &&
- (source[8] == '3') &&
- (source[9] == '6') &&
- (source[10] == '8') &&
- (source[11] == '5') &&
- (source[12] == '4') &&
- (source[13] == '7') &&
- (source[14] == '7') &&
- (source[15] == '5') &&
- (source[16] == '8') &&
- (source[17] == '0') &&
- (source[18] == '8'));}
-public TypeBinding resolveType(BlockScope scope) {
- // the format may be incorrect while the scanner could detect
- // such error only on painfull tests...easier and faster here
-
- TypeBinding tb = super.resolveType(scope);
- if (constant == FORMAT_ERROR) {
- constant = NotAConstant;
- scope.problemReporter().constantOutOfFormat(this);
- this.resolvedType = null;
- return null;
- }
- return tb;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteralMinValue.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteralMinValue.java
deleted file mode 100644
index 38cdfc4..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/LongLiteralMinValue.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-
-
-public class LongLiteralMinValue extends LongLiteral {
-
- final static char[] CharValue = new char[]{'-', '9','2','2','3','3','7','2','0','3','6','8','5','4','7','7','5','8','0','8','L'};
- final static Constant MIN_VALUE = Constant.fromValue(Long.MIN_VALUE) ;
-
-public LongLiteralMinValue(){
- super(CharValue,0,0,Long.MIN_VALUE);
- constant = MIN_VALUE;
-}
-public void computeConstant() {
-
- /*precomputed at creation time*/}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MagicLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MagicLiteral.java
deleted file mode 100644
index 5acab73..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MagicLiteral.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-public abstract class MagicLiteral extends Literal {
-public MagicLiteral(int s , int e) {
- super(s,e);
-}
-public boolean isValidJavaStatement(){
- //should never be reach, but with a bug in the ast tree....
- //see comment on the Statement class
-
- return false ;}
-/**
- * source method comment.
- */
-public char[] source() {
- return null;
-}
-public String toStringExpression(){
-
- return new String(source()) ; }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MemberTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MemberTypeDeclaration.java
deleted file mode 100644
index 3070b63..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MemberTypeDeclaration.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
-
-public class MemberTypeDeclaration extends InnerTypeDeclaration {
- public TypeDeclaration enclosingType;
-
-public MemberTypeDeclaration(CompilationResult compilationResult){
- super(compilationResult);
-}
-/**
- * Iteration for a member innertype
- *
- */
-public void traverse(ASTVisitor visitor, ClassScope classScope) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, classScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
- }
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
- } catch (AbortType e) {
- }
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MessageSend.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MessageSend.java
deleted file mode 100644
index f3e9dfb..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MessageSend.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ProblemMethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class MessageSend extends Expression implements InvocationSite {
- public Expression receiver ;
- public char[] selector ;
- public Expression[] arguments ;
- public MethodBinding binding, codegenBinding;
-
- public long nameSourcePosition ; //(start<<32)+end
-
- MethodBinding syntheticAccessor;
-
- public TypeBinding receiverType, qualifyingType;
-
-public MessageSend() {
-
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic()).unconditionalInits();
- if (arguments != null) {
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- }
- ReferenceBinding[] thrownExceptions;
- if ((thrownExceptions = binding.thrownExceptions) != NoExceptions) {
- // must verify that exceptions potentially thrown by this expression are caught in the method
- flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo, currentScope);
- }
- manageSyntheticAccessIfNecessary(currentScope);
- return flowInfo;
-}
-/**
- * MessageSend code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-//
-// int pc = codeStream.position;
-//
-// // generate receiver/enclosing instance access
-// boolean isStatic = codegenBinding.isStatic();
-// // outer access ?
-// if (!isStatic && ((bits & DepthMASK) != 0) && receiver.isImplicitThis()){
-// // outer method can be reached through emulation if implicit access
-// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
-// Object[] path = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(path, this, targetType, currentScope);
-// } else {
-// receiver.generateCode(currentScope, codeStream, !isStatic);
-// }
-// // generate arguments
-// if (arguments != null){
-// for (int i = 0, max = arguments.length; i < max; i++){
-// arguments[i].generateCode(currentScope, codeStream, true);
-// }
-// }
-// // actual message invocation
-// if (syntheticAccessor == null){
-// if (isStatic){
-// codeStream.invokestatic(codegenBinding);
-// } else {
-// if( (receiver.isSuper()) || codegenBinding.isPrivate()){
-// codeStream.invokespecial(codegenBinding);
-// } else {
-// if (codegenBinding.declaringClass.isInterface()){
-// codeStream.invokeinterface(codegenBinding);
-// } else {
-// codeStream.invokevirtual(codegenBinding);
-// }
-// }
-// }
-// } else {
-// codeStream.invokestatic(syntheticAccessor);
-// }
-// // operation on the returned value
-// if (valueRequired){
-// // implicit conversion if necessary
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// // pop return value if any
-// switch(binding.returnType.id){
-// case T_long :
-// case T_double :
-// codeStream.pop2();
-// break;
-// case T_void :
-// break;
-// default:
-// codeStream.pop();
-// }
-// }
-// codeStream.recordPositionsFrom(pc, (int)(this.nameSourcePosition >>> 32)); // highlight selector
-//}
-public boolean isSuperAccess() {
- return receiver.isSuper();
-}
-public boolean isTypeAccess() {
- return receiver != null && receiver.isTypeReference();
-}
-public void manageSyntheticAccessIfNecessary(BlockScope currentScope){
-
- if (binding.isPrivate()){
-
- // depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy)
- if (currentScope.enclosingSourceType() != binding.declaringClass){
-
- syntheticAccessor = ((SourceTypeBinding)binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- return;
- }
-
- } else if (receiver instanceof QualifiedSuperReference){ // qualified super
-
- // qualified super need emulation always
- SourceTypeBinding destinationType = (SourceTypeBinding)(((QualifiedSuperReference)receiver).currentCompatibleType);
- syntheticAccessor = destinationType.addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- return;
-
- } else if (binding.isProtected()){
-
- SourceTypeBinding enclosingSourceType;
- if (((bits & DepthMASK) != 0)
- && binding.declaringClass.getPackage()
- != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()){
-
- SourceTypeBinding currentCompatibleType = (SourceTypeBinding)enclosingSourceType.enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
- syntheticAccessor = currentCompatibleType.addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
- // and not from Object or implicit static method call.
-// if (binding.declaringClass != this.qualifyingType
-// && !this.qualifyingType.isArrayType()
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && (!receiver.isImplicitThis() || !binding.isStatic())
-// && binding.declaringClass.id != T_Object) // no change for Object methods
-// || !binding.declaringClass.canBeSeenBy(currentScope))) {
-//
-// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(binding, (ReferenceBinding) this.qualifyingType);
-// }
-}
-public StringBuffer printExpression(int indent, StringBuffer output){
-
- if (!receiver.isImplicitThis()) receiver.printExpression(0, output).append('.');
- output.append(selector).append('(') ; //$NON-NLS-1$
- if (arguments != null) {
- for (int i = 0; i < arguments.length ; i ++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
- arguments[i].printExpression(0, output);
- }
- }
- return output.append(')');
-}
-public TypeBinding resolveType(BlockScope scope) {
- // Answer the signature return type
- // Base type promotion
-
- constant = NotAConstant;
- this.qualifyingType = this.receiverType = receiver.resolveType(scope);
-
- // will check for null after args are resolved
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- boolean argHasError = false; // typeChecks all arguments
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++){
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null){
- argHasError = true;
- }
- }
- if (argHasError){
- if(receiverType instanceof ReferenceBinding) {
- // record any selector match, for clients who may still need hint about possible method match
- this.codegenBinding = this.binding = scope.findMethod((ReferenceBinding)receiverType, selector, new TypeBinding[]{}, this);
- }
- return null;
- }
- }
- if (this.receiverType == null)
- return null;
-
- // base type cannot receive any message
- if (this.receiverType.isBaseType()) {
- scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
- return null;
- }
-
- this.codegenBinding = this.binding =
- receiver.isImplicitThis()
- ? scope.getImplicitMethod(selector, argumentTypes, this)
- : scope.getMethod(this.receiverType, selector, argumentTypes, this);
- if (!binding.isValidBinding()) {
- if (binding.declaringClass == null) {
- if (this.receiverType instanceof ReferenceBinding) {
- binding.declaringClass = (ReferenceBinding) this.receiverType;
- } else {
- scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
- return null;
- }
- }
- scope.problemReporter().invalidMethod(this, binding);
- // record the closest match, for clients who may still need hint about possible method match
- if (binding instanceof ProblemMethodBinding){
- MethodBinding closestMatch = ((ProblemMethodBinding)binding).closestMatch;
- if (closestMatch != null) this.codegenBinding = this.binding = closestMatch;
- }
- return binding == null ? null : binding.returnType;
- }
- if (!binding.isStatic()) {
- // the "receiver" must not be a type, in other words, a NameReference that the TC has bound to a Type
- if (receiver instanceof NameReference
- && (((NameReference) receiver).bits & BindingIds.TYPE) != 0) {
- scope.problemReporter().mustUseAStaticMethod(this, binding);
- }
- } else {
- // static message invoked through receiver? legal but unoptimal (optional warning).
- if (!(receiver.isImplicitThis()
- || receiver.isSuper()
- || (receiver instanceof NameReference
- && (((NameReference) receiver).bits & BindingIds.TYPE) != 0))) {
- scope.problemReporter().unnecessaryReceiverForStaticMethod(this, binding);
- }
- }
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
-
- //-------message send that are known to fail at compile time-----------
- if (binding.isAbstract()) {
- if (receiver.isSuper()) {
- scope.problemReporter().cannotDireclyInvokeAbstractMethod(this, binding);
- }
- // abstract private methods cannot occur nor abstract static............
- }
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(binding, this);
-
- return this.resolvedType = binding.returnType;
-}
-public void setActualReceiverType(ReferenceBinding receiverType) {
- this.qualifyingType = receiverType;
-}
-public void setDepth(int depth) {
- bits &= ~DepthMASK; // flush previous depth if any
- if (depth > 0) {
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
- }
-}
-public void setFieldIndex(int depth) {
- // ignore for here
-}
-
-public String toStringExpression(){
-
- String s = ""; //$NON-NLS-1$
- if (!receiver.isImplicitThis())
- s = s + receiver.toStringExpression()+"."; //$NON-NLS-1$
- s = s + new String(selector) + "(" ; //$NON-NLS-1$
- if (arguments != null)
- for (int i = 0; i < arguments.length ; i ++)
- { s = s + arguments[i].toStringExpression();
- if ( i != arguments.length -1 ) s = s + " , " ;};; //$NON-NLS-1$
- s =s + ")" ; //$NON-NLS-1$
- return s;
-}
-
-public void traverse(ASTVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope)) {
- receiver.traverse(visitor, blockScope);
- if (arguments != null) {
- int argumentsLength = arguments.length;
- for (int i = 0; i < argumentsLength; i++)
- arguments[i].traverse(visitor, blockScope);
- }
- }
- visitor.endVisit(this, blockScope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MethodDeclaration.java
deleted file mode 100644
index b5988a9..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/MethodDeclaration.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
-
-public class MethodDeclaration extends AbstractMethodDeclaration {
-
- public TypeReference returnType;
- public static final int FUNCTION_DEFINITION = 1;
- public static final int METHOD_DEFINITION = 2;
- public int type;
-
- /**
- * MethodDeclaration constructor comment.
- */
- public MethodDeclaration(CompilationResult compilationResult) {
- super(compilationResult);
- }
-
- public void analyseCode(ClassScope classScope, InitializationFlowContext initializationContext, FlowInfo flowInfo) {
-
- // starting of the code analysis for methods
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (binding == null)
- return;
-
- if (this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
- if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
- scope.problemReporter().unusedPrivateMethod(this);
- }
- }
-
- // may be in a non necessary for innerclass with static final constant fields
- if (binding.isAbstract()) // || binding.isNative())
- return;
-
- ExceptionHandlingFlowContext methodContext =
- new ExceptionHandlingFlowContext(initializationContext, this, binding.thrownExceptions, scope, FlowInfo.DEAD_END);
-
- // propagate to statements
- if (statements != null) {
- boolean didAlreadyComplain = false;
- for (int i = 0, count = statements.length; i < count; i++) {
- Statement stat;
- if (!flowInfo.complainIfUnreachable((stat = statements[i]), scope, didAlreadyComplain)) {
- flowInfo = stat.analyseCode(scope, methodContext, flowInfo);
- } else {
- didAlreadyComplain = true;
- }
- }
- }
- // check for missing returning path
- TypeBinding returnType = binding.returnType;
- if ((returnType == VoidBinding) || isAbstract()) {
- this.needFreeReturn = flowInfo.isReachable();
- } else {
- if (flowInfo != FlowInfo.DEAD_END) {
- scope.problemReporter().shouldReturn(returnType, this);
- }
- }
- } catch (AbortMethod e) {
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
-
- //fill up the method body with statement
- if (ignoreFurtherInvestigation)
- return;
- parser.parse(this, unit);
- }
-
- public void resolveStatements() {
-
- // ========= abort on fatal error =============
- if (this.returnType != null && this.binding != null) {
- this.returnType.resolvedType = this.binding.returnType;
- // record the return type binding
- }
- // look if the name of the method is correct
- if (binding != null && isTypeUseDeprecated(binding.returnType, scope))
- scope.problemReporter().deprecatedType(binding.returnType, returnType);
-
- if (scope != null) {
- if (CharOperation.equals(scope.enclosingSourceType().sourceName, selector))
- scope.problemReporter().methodWithConstructorName(this);
-
- // by grammatical construction, interface methods are always abstract
- if (!scope.enclosingSourceType().isInterface()) {
-
- // if a method has an semicolon body and is not declared as abstract==>error
- // native methods may have a semicolon body
- // if ((modifiers & AccSemicolonBody) != 0) {
- // if ((modifiers & AccNative) == 0)
- // if ((modifiers & AccAbstract) == 0)
- // scope.problemReporter().methodNeedingAbstractModifier(this);
- // } else {
- // // the method HAS a body --> abstract native modifiers are forbiden
- // if (((modifiers & AccNative) != 0) || ((modifiers & AccAbstract) != 0))
- // scope.problemReporter().methodNeedingNoBody(this);
- // }
- }
- }
- super.resolveStatements();
- }
-
- public String returnTypeToString(int tab) {
-
- if (returnType == null)
- return ""; //$NON-NLS-1$
- return returnType.toString(tab) + " "; //$NON-NLS-1$
- }
-
- public void traverse(ASTVisitor visitor, ClassScope classScope) {
-
- if (visitor.visit(this, classScope)) {
- if (returnType != null)
- returnType.traverse(visitor, scope);
- if (arguments != null) {
- int argumentLength = arguments.length;
- for (int i = 0; i < argumentLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- if (thrownExceptions != null) {
- int thrownExceptionsLength = thrownExceptions.length;
- for (int i = 0; i < thrownExceptionsLength; i++)
- thrownExceptions[i].traverse(visitor, scope);
- }
- if (statements != null) {
- int statementsLength = statements.length;
- for (int i = 0; i < statementsLength; i++)
- statements[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NameReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NameReference.java
deleted file mode 100644
index 1080fa1..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NameReference.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
-import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public abstract class NameReference extends Reference implements InvocationSite, BindingIds {
-
- public Binding binding, codegenBinding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
-
- public TypeBinding receiverType; // raw receiver type
- public TypeBinding actualReceiverType; // modified receiver type - actual one according to namelookup
-
- //the error printing
- //some name reference are build as name reference but
- //only used as type reference. When it happens, instead of
- //creating a new objet (aTypeReference) we just flag a boolean
- //This concesion is valuable while their are cases when the NameReference
- //will be a TypeReference (static message sends.....) and there is
- //no changeClass in java.
-public NameReference() {
- super();
- bits |= TYPE | VARIABLE; // restrictiveFlag
-
-}
-public FieldBinding fieldBinding() {
- //this method should be sent ONLY after a check against isFieldReference()
- //check its use doing senders.........
-
- return (FieldBinding) binding ;
-}
-public boolean isSuperAccess() {
- return false;
-}
-public boolean isTypeAccess() {
- // null is acceptable when we are resolving the first part of a reference
- return binding == null || binding instanceof ReferenceBinding;
-}
-public boolean isTypeReference() {
- return binding instanceof ReferenceBinding;
-}
-public void setActualReceiverType(ReferenceBinding receiverType) {
- this.actualReceiverType = receiverType;
-}
-public void setDepth(int depth) {
- bits &= ~DepthMASK; // flush previous depth if any
- if (depth > 0) {
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
- }
-}
-public void setFieldIndex(int index){
- // ignored
-}
-
-public abstract String unboundReferenceErrorName();
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NullLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NullLiteral.java
deleted file mode 100644
index bc1151c..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NullLiteral.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class NullLiteral extends MagicLiteral {
-
- static final char[] source = {'n' , 'u' , 'l' , 'l'};
-
- public NullLiteral(int s , int e) {
-
- super(s,e);
- }
-
- public void computeConstant() {
-
- constant = NotAConstant;
- }
-
- /**
- * Code generation for the null literal
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// codeStream.aconst_null();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
- public TypeBinding literalType(BlockScope scope) {
- return NullBinding;
- }
-
- /**
- *
- */
- public char[] source() {
- return source;
- }
-
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NumberLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NumberLiteral.java
deleted file mode 100644
index 4e29d26..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/NumberLiteral.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-public abstract class NumberLiteral extends Literal {
- char[] source;
-public NumberLiteral(char[] token, int s, int e) {
- this(s,e) ;
- source = token ;
-}
-public NumberLiteral(int s, int e) {
- super (s,e) ;
-}
-public boolean isValidJavaStatement(){
- //should never be reach, but with a bug in the ast tree....
- //see comment on the Statement class
-
- return false ;}
-public char[] source(){
- return source;}
-public String toStringExpression(){
-
- return new String(source);}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OR_OR_Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OR_OR_Expression.java
deleted file mode 100644
index 796956e..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OR_OR_Expression.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-//dedicated treatment for the ||
-public class OR_OR_Expression extends BinaryExpression {
-
- int rightInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public OR_OR_Expression(Expression left, Expression right, int operator) {
- super(left, right, operator);
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- Constant cst = this.left.optimizedBooleanConstant();
- boolean isLeftOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isLeftOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- if (isLeftOptimizedFalse) {
- // FALSE || anything
- // need to be careful of scenario:
- // (x || y) || !z, if passing the left info to the right, it would be swapped by the !
- FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- mergedInfo = right.analyseCode(currentScope, flowContext, mergedInfo);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- FlowInfo leftInfo = left.analyseCode(currentScope, flowContext, flowInfo);
-
- // need to be careful of scenario:
- // (x || y) || !z, if passing the left info to the right, it would be swapped by the !
- FlowInfo rightInfo = leftInfo.initsWhenFalse().unconditionalInits().copy();
- rightInitStateIndex =
- currentScope.methodScope().recordInitializationStates(rightInfo);
-
- int previousMode = rightInfo.reachMode();
- if (isLeftOptimizedTrue){
- rightInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- rightInfo = right.analyseCode(currentScope, flowContext, rightInfo);
- FlowInfo falseMergedInfo = rightInfo.initsWhenFalse().copy();
- rightInfo.setReachMode(previousMode); // reset after falseMergedInfo got extracted
-
- FlowInfo mergedInfo = FlowInfo.conditional(
- // merging two true initInfos for such a negative case: if ((t && (b = t)) || f) r = b; // b may not have been initialized
- leftInfo.initsWhenTrue().copy().unconditionalInits().mergedWith(
- rightInfo.initsWhenTrue().copy().unconditionalInits()),
- falseMergedInfo);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- /**
- * Code generation for a binary operation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-// int pc = codeStream.position;
-// Label falseLabel, endLabel;
-// if (constant != Constant.NotAConstant) {
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// bits |= OnlyValueRequiredMASK;
-// generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 || true;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-//
-// /**
-// * Boolean operator code generation
-// * Optimized operations are: ||
-// */
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-// if (constant != Constant.NotAConstant) {
-// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// return;
-// }
-// Constant condConst;
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // || x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_1();
-// } else {
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// } else {
-// // || x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x ||
-// Label internalFalseLabel = new Label(codeStream);
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// internalFalseLabel, // will be true in the end
-// false);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// internalFalseLabel.place();
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_1();
-// } else {
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// } else {
-// // x ||
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// return;
-// }
-// // default case
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// left.generateOptimizedBoolean(currentScope, codeStream, trueLabel, null, true);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// null,
-// valueRequired);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// Label internalTrueLabel = new Label(codeStream);
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// internalTrueLabel,
-// null,
-// true);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// falseLabel,
-// valueRequired);
-// internalTrueLabel.place();
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// }
-
- public boolean isCompactableOperation() {
- return false;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- left.traverse(visitor, scope);
- right.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorExpression.java
deleted file mode 100644
index 2988f4e..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorExpression.java
+++ /dev/null
@@ -1,1571 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-public abstract class OperatorExpression extends Expression implements OperatorIds {
-
- public static int[][] ResolveTypeTables = new int[NumberOfTables][];
-
- static {classInitialize();}
-
- /**
- * OperatorExpression constructor comment.
- */
- public OperatorExpression() {
- super();
- }
- public static final void classInitialize() {
- ResolveTypeTables[AND] = get_AND();
- ResolveTypeTables[AND_AND] = get_AND_AND();
- ResolveTypeTables[DIVIDE] = get_DIVIDE();
- ResolveTypeTables[EQUAL_EQUAL] = get_EQUAL_EQUAL();
- ResolveTypeTables[GREATER] = get_GREATER();
- ResolveTypeTables[GREATER_EQUAL] = get_GREATER_EQUAL();
- ResolveTypeTables[LEFT_SHIFT] = get_LEFT_SHIFT();
- ResolveTypeTables[LESS] = get_LESS();
- ResolveTypeTables[LESS_EQUAL] = get_LESS_EQUAL();
- ResolveTypeTables[MINUS] = get_MINUS();
- ResolveTypeTables[MULTIPLY] = get_MULTIPLY();
- ResolveTypeTables[OR] = get_OR();
- ResolveTypeTables[OR_OR] = get_OR_OR();
- ResolveTypeTables[PLUS] = get_PLUS();
- ResolveTypeTables[REMAINDER] = get_REMAINDER();
- ResolveTypeTables[RIGHT_SHIFT] = get_RIGHT_SHIFT();
- ResolveTypeTables[UNSIGNED_RIGHT_SHIFT] = get_UNSIGNED_RIGHT_SHIFT();
- ResolveTypeTables[XOR] = get_XOR();
- }
-
- public static final String generateTableTestCase(){
- //return a String which is a java method allowing to test
- //the non zero entries of all tables
-
- /*
- net.sourceforge.phpdt.internal.compiler.ast.
- OperatorExpression.generateTableTestCase();
- */
-
- int[] operators = new int[]{AND,AND_AND,DIVIDE,GREATER,GREATER_EQUAL,
- LEFT_SHIFT,LESS,LESS_EQUAL,MINUS,MULTIPLY,OR,OR_OR,PLUS,REMAINDER,
- RIGHT_SHIFT,UNSIGNED_RIGHT_SHIFT,XOR};
-
- class Decode {
- public final String constant(int code){
- switch(code){
- case T_boolean : return "true" ; //$NON-NLS-1$
- case T_byte : return "((byte) 3)" ; //$NON-NLS-1$
- case T_char : return "'A'" ; //$NON-NLS-1$
- case T_double : return "300.0d" ; //$NON-NLS-1$
- case T_float : return "100.0f" ; //$NON-NLS-1$
- case T_int : return "1" ; //$NON-NLS-1$
- case T_long : return "7L" ; //$NON-NLS-1$
- case T_String : return "\"hello-world\"" ; //$NON-NLS-1$
- case T_null : return "null"; //$NON-NLS-1$
- case T_short : return "((short) 5)"; //$NON-NLS-1$
- case T_Object : return "null";} //$NON-NLS-1$
- return "";} //$NON-NLS-1$
-
- public final String type(int code){
- switch(code){
- case T_boolean : return "z" ; //$NON-NLS-1$
- case T_byte : return "b" ; //$NON-NLS-1$
- case T_char : return "c" ; //$NON-NLS-1$
- case T_double : return "d" ; //$NON-NLS-1$
- case T_float : return "f" ; //$NON-NLS-1$
- case T_int : return "i" ; //$NON-NLS-1$
- case T_long : return "l" ; //$NON-NLS-1$
- case T_String : return "str" ; //$NON-NLS-1$
- case T_null : return "null"; //$NON-NLS-1$
- case T_short : return "s"; //$NON-NLS-1$
- case T_Object : return "obj";} //$NON-NLS-1$
- return "xxx";} //$NON-NLS-1$
-
- public final String operator(int operator){
- switch (operator) {
- case EQUAL_EQUAL : return "=="; //$NON-NLS-1$
- case LESS_EQUAL : return "<="; //$NON-NLS-1$
- case GREATER_EQUAL :return ">="; //$NON-NLS-1$
- case LEFT_SHIFT : return "<<"; //$NON-NLS-1$
- case RIGHT_SHIFT : return ">>"; //$NON-NLS-1$
- case UNSIGNED_RIGHT_SHIFT : return ">>>"; //$NON-NLS-1$
- case OR_OR :return "||"; //$NON-NLS-1$
- case AND_AND : return "&&"; //$NON-NLS-1$
- case PLUS : return "+"; //$NON-NLS-1$
- case MINUS : return "-"; //$NON-NLS-1$
- case NOT : return "!"; //$NON-NLS-1$
- case REMAINDER : return "%"; //$NON-NLS-1$
- case XOR : return "^"; //$NON-NLS-1$
- case AND : return "&"; //$NON-NLS-1$
- case MULTIPLY : return "*"; //$NON-NLS-1$
- case OR : return "|"; //$NON-NLS-1$
- case TWIDDLE : return "~"; //$NON-NLS-1$
- case DIVIDE : return "/"; //$NON-NLS-1$
- case GREATER : return ">"; //$NON-NLS-1$
- case LESS : return "<"; }; //$NON-NLS-1$
- return "????";} //$NON-NLS-1$
- }
-
-
- Decode decode = new Decode();
- String s ;
-
- s = "\tpublic static void binaryOperationTablesTestCase(){\n" + //$NON-NLS-1$
-
- "\t\t//TC test : all binary operation (described in tables)\n"+ //$NON-NLS-1$
- "\t\t//method automatically generated by\n"+ //$NON-NLS-1$
- "\t\t//net.sourceforge.phpdt.internal.compiler.ast.OperatorExpression.generateTableTestCase();\n"+ //$NON-NLS-1$
-
- "\t\tString str0 ;\t String str\t= "+decode.constant(T_String)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tint i0 ;\t int i\t= "+decode.constant(T_int)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tboolean z0;\t boolean z\t= "+decode.constant(T_boolean)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tchar c0; \t char c\t= "+decode.constant(T_char)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tfloat f0; \t float f\t= "+decode.constant(T_float)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tdouble d0;\t double d\t= "+decode.constant(T_double)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tbyte b0; \t byte b\t= "+decode.constant(T_byte)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tshort s0; \t short s\t= "+decode.constant(T_short)+";\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tlong l0; \t long l\t= "+decode.constant(T_long)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\t\tObject obj0; \t Object obj\t= "+decode.constant(T_Object)+" ;\n"+ //$NON-NLS-1$ //$NON-NLS-2$
- "\n"; //$NON-NLS-1$
-
- int error = 0;
- for (int i=0; i < operators.length ; i++)
- { int operator = operators[i];
- for (int left=0; left<16;left++)
- for (int right=0; right<16;right++)
- { int result = (ResolveTypeTables[operator][(left<<4)+right]) & 0x0000F;
- if (result != T_undefined)
-
- //1/ First regular computation then 2/ comparaison
- //with a compile time constant (generated by the compiler)
- // z0 = s >= s;
- // if ( z0 != (((short) 5) >= ((short) 5)))
- // System.out.println(155);
-
- { s += "\t\t"+decode.type(result)+"0"+" = "+decode.type(left); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
- s += " "+decode.operator(operator)+" "+decode.type(right)+";\n"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$
- String begin = result == T_String ? "\t\tif (! " : "\t\tif ( "; //$NON-NLS-2$ //$NON-NLS-1$
- String test = result == T_String ? ".equals(" : " != (" ; //$NON-NLS-2$ //$NON-NLS-1$
- s += begin +decode.type(result)+"0"+test //$NON-NLS-1$
- +decode.constant(left)+" " //$NON-NLS-1$
- +decode.operator(operator)+" " //$NON-NLS-1$
- +decode.constant(right)+"))\n"; //$NON-NLS-1$
- s += "\t\t\tSystem.out.println("+ (++error) +");\n"; //$NON-NLS-1$ //$NON-NLS-2$
-
- }
- }
- }
-
- return s += "\n\t\tSystem.out.println(\"binary tables test : done\");}" ; //$NON-NLS-1$
- }
-
- public static final int[] get_AND(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- // table[(T_undefined<<4)+T_undefined] = T_undefined ;
- // table[(T_undefined<<4)+T_byte] = T_undefined ;
- // table[(T_undefined<<4)+T_long] = T_undefined ;
- // table[(T_undefined<<4)+T_short] = T_undefined ;
- // table[(T_undefined<<4)+T_void] = T_undefined ;
- // table[(T_undefined<<4)+T_String] = T_undefined ;
- // table[(T_undefined<<4)+T_Object] = T_undefined ;
- // table[(T_undefined<<4)+T_double] = T_undefined ;
- // table[(T_undefined<<4)+T_float] = T_undefined ;
- // table[(T_undefined<<4)+T_boolean] = T_undefined ;
- // table[(T_undefined<<4)+T_char] = T_undefined ;
- // table[(T_undefined<<4)+T_int] = T_undefined ;
- // table[(T_undefined<<4)+T_null] = T_undefined ;
-
- // table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12) +(Byte2Int<<4) +T_int ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12) +(Short2Int<<4)+T_int;
- // table[(T_byte<<4)+T_void] = T_undefined ;
- // table[(T_byte<<4)+T_String] = T_undefined ;
- // table[(T_byte<<4)+T_Object] = T_undefined ;
- // table[(T_byte<<4)+T_double] = T_undefined ;
- // table[(T_byte<<4)+T_float] = T_undefined ;
- // table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12) +(Char2Int<<4) +T_int ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12) +(Int2Int<<4) +T_int ;
- // table[(T_byte<<4)+T_null] = T_undefined ;
-
- // table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long; ;
- // table[(T_long<<4)+T_void] = T_undefined ;
- // table[(T_long<<4)+T_String] = T_undefined ;
- // table[(T_long<<4)+T_Object] = T_undefined ;
- // table[(T_long<<4)+T_double] = T_undefined ;
- // table[(T_long<<4)+T_float] = T_undefined ;
- // table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ;
- // table[(T_long<<4)+T_null] = T_undefined ;
-
- // table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_short<<4)+T_void] = T_undefined ;
- // table[(T_short<<4)+T_String] = T_undefined ;
- // table[(T_short<<4)+T_Object] = T_undefined ;
- // table[(T_short<<4)+T_double] = T_undefined ;
- // table[(T_short<<4)+T_float] = T_undefined ;
- // table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_short<<4)+T_null] = T_undefined ;
-
- // table[(T_void<<4)+T_undefined] = T_undefined ;
- // table[(T_void<<4)+T_byte] = T_undefined ;
- // table[(T_void<<4)+T_long] = T_undefined ;
- // table[(T_void<<4)+T_short] = T_undefined ;
- // table[(T_void<<4)+T_void] = T_undefined ;
- // table[(T_void<<4)+T_String] = T_undefined ;
- // table[(T_void<<4)+T_Object] = T_undefined ;
- // table[(T_void<<4)+T_double] = T_undefined ;
- // table[(T_void<<4)+T_float] = T_undefined ;
- // table[(T_void<<4)+T_boolean] = T_undefined ;
- // table[(T_void<<4)+T_char] = T_undefined ;
- // table[(T_void<<4)+T_int] = T_undefined ;
- // table[(T_void<<4)+T_null] = T_undefined ;
-
- // table[(T_String<<4)+T_undefined] = T_undefined ;
- // table[(T_String<<4)+T_byte] = T_undefined ;
- // table[(T_String<<4)+T_long] = T_undefined ;
- // table[(T_String<<4)+T_short] = T_undefined ;
- // table[(T_String<<4)+T_void] = T_undefined ;
- // table[(T_String<<4)+T_String] = T_undefined ;
- // table[(T_String<<4)+T_Object] = T_undefined ;
- // table[(T_String<<4)+T_double] = T_undefined ;
- // table[(T_String<<4)+T_float] = T_undefined ;
- // table[(T_String<<4)+T_boolean] = T_undefined ;
- // table[(T_String<<4)+T_char] = T_undefined ;
- // table[(T_String<<4)+T_int] = T_undefined ;
- // table[(T_String<<4)+T_null] = T_undefined ;
-
- // table[(T_Object<<4)+T_undefined] = T_undefined ;
- // table[(T_Object<<4)+T_byte] = T_undefined ;
- // table[(T_Object<<4)+T_long] = T_undefined ;
- // table[(T_Object<<4)+T_short] = T_undefined ;
- // table[(T_Object<<4)+T_void] = T_undefined ;
- // table[(T_Object<<4)+T_String] = T_undefined ;
- // table[(T_Object<<4)+T_Object] = T_undefined ;
- // table[(T_Object<<4)+T_double] = T_undefined ;
- // table[(T_Object<<4)+T_float] = T_undefined ;
- // table[(T_Object<<4)+T_boolean] = T_undefined ;
- // table[(T_Object<<4)+T_char] = T_undefined ;
- // table[(T_Object<<4)+T_int] = T_undefined ;
- // table[(T_Object<<4)+T_null] = T_undefined ;
-
- // table[(T_double<<4)+T_undefined] = T_undefined ;
- // table[(T_double<<4)+T_byte] = T_undefined ;
- // table[(T_double<<4)+T_long] = T_undefined ;
- // table[(T_double<<4)+T_short] = T_undefined ;
- // table[(T_double<<4)+T_void] = T_undefined ;
- // table[(T_double<<4)+T_String] = T_undefined ;
- // table[(T_double<<4)+T_Object] = T_undefined ;
- // table[(T_double<<4)+T_double] = T_undefined ;
- // table[(T_double<<4)+T_float] = T_undefined ;
- // table[(T_double<<4)+T_boolean] = T_undefined ;
- // table[(T_double<<4)+T_char] = T_undefined ;
- // table[(T_double<<4)+T_int] = T_undefined;
- // table[(T_double<<4)+T_null] = T_undefined ;
-
- // table[(T_float<<4)+T_undefined] = T_undefined ;
- // table[(T_float<<4)+T_byte] = T_undefined ;
- // table[(T_float<<4)+T_long] = T_undefined ;
- // table[(T_float<<4)+T_short] = T_undefined ;
- // table[(T_float<<4)+T_void] = T_undefined ;
- // table[(T_float<<4)+T_String] = T_undefined ;
- // table[(T_float<<4)+T_Object] = T_undefined ;
- // table[(T_float<<4)+T_double] = T_undefined ;
- // table[(T_float<<4)+T_float] = T_undefined ;
- // table[(T_float<<4)+T_boolean] = T_undefined ;
- // table[(T_float<<4)+T_char] = T_undefined ;
- // table[(T_float<<4)+T_int] = T_undefined ;
- // table[(T_float<<4)+T_null] = T_undefined ;
-
- // table[(T_boolean<<4)+T_undefined] = T_undefined ;
- // table[(T_boolean<<4)+T_byte] = T_undefined ;
- // table[(T_boolean<<4)+T_long] = T_undefined ;
- // table[(T_boolean<<4)+T_short] = T_undefined ;
- // table[(T_boolean<<4)+T_void] = T_undefined ;
- // table[(T_boolean<<4)+T_String] = T_undefined ;
- // table[(T_boolean<<4)+T_Object] = T_undefined ;
- // table[(T_boolean<<4)+T_double] = T_undefined ;
- // table[(T_boolean<<4)+T_float] = T_undefined ;
- table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean << 12)+(Boolean2Boolean << 4)+T_boolean ;
- // table[(T_boolean<<4)+T_char] = T_undefined ;
- // table[(T_boolean<<4)+T_int] = T_undefined ;
- // table[(T_boolean<<4)+T_null] = T_undefined ;
-
- // table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_char<<4)+T_void] = T_undefined ;
- // table[(T_char<<4)+T_String] = T_undefined ;
- // table[(T_char<<4)+T_Object] = T_undefined ;
- // table[(T_char<<4)+T_double] = T_undefined ;
- // table[(T_char<<4)+T_float] = T_undefined ;
- // table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_char<<4)+T_null] = T_undefined ;
-
- // table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_int<<4)+T_void] = T_undefined ;
- // table[(T_int<<4)+T_String] = T_undefined ;
- // table[(T_int<<4)+T_Object] = T_undefined ;
- // table[(T_int<<4)+T_double] = T_undefined ;
- // table[(T_int<<4)+T_float] = T_undefined ;
- // table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_int<<4)+T_null] = T_undefined ;
-
- // table[(T_null<<4)+T_undefined] = T_undefined ;
- // table[(T_null<<4)+T_byte] = T_undefined ;
- // table[(T_null<<4)+T_long] = T_undefined ;
- // table[(T_null<<4)+T_short] = T_undefined ;
- // table[(T_null<<4)+T_void] = T_undefined ;
- // table[(T_null<<4)+T_String] = T_undefined ;
- // table[(T_null<<4)+T_Object] = T_undefined ;
- // table[(T_null<<4)+T_double] = T_undefined ;
- // table[(T_null<<4)+T_float] = T_undefined ;
- // table[(T_null<<4)+T_boolean] = T_undefined ;
- // table[(T_null<<4)+T_char] = T_undefined ;
- // table[(T_null<<4)+T_int] = T_undefined ;
- // table[(T_null<<4)+T_null] = T_undefined ;
-
- return table ;
- }
-
- public static final int[] get_AND_AND(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- // table[(T_undefined<<4)+T_undefined] = T_undefined ;
- // table[(T_undefined<<4)+T_byte] = T_undefined ;
- // table[(T_undefined<<4)+T_long] = T_undefined ;
- // table[(T_undefined<<4)+T_short] = T_undefined ;
- // table[(T_undefined<<4)+T_void] = T_undefined ;
- // table[(T_undefined<<4)+T_String] = T_undefined ;
- // table[(T_undefined<<4)+T_Object] = T_undefined ;
- // table[(T_undefined<<4)+T_double] = T_undefined ;
- // table[(T_undefined<<4)+T_float] = T_undefined ;
- // table[(T_undefined<<4)+T_boolean] = T_undefined ;
- // table[(T_undefined<<4)+T_char] = T_undefined ;
- // table[(T_undefined<<4)+T_int] = T_undefined ;
- // table[(T_undefined<<4)+T_null] = T_undefined ;
-
- // table[(T_byte<<4)+T_undefined] = T_undefined ;
- // table[(T_byte<<4)+T_byte] = T_undefined ;
- // table[(T_byte<<4)+T_long] = T_undefined ;
- // table[(T_byte<<4)+T_short] = T_undefined ;
- // table[(T_byte<<4)+T_void] = T_undefined ;
- // table[(T_byte<<4)+T_String] = T_undefined ;
- // table[(T_byte<<4)+T_Object] = T_undefined ;
- // table[(T_byte<<4)+T_double] = T_undefined ;
- // table[(T_byte<<4)+T_float] = T_undefined ;
- // table[(T_byte<<4)+T_boolean] = T_undefined ;
- // table[(T_byte<<4)+T_char] = T_undefined ;
- // table[(T_byte<<4)+T_int] = T_undefined ;
- // table[(T_byte<<4)+T_null] = T_undefined ;
-
- // table[(T_long<<4)+T_undefined] = T_undefined ;
- // table[(T_long<<4)+T_byte] = T_undefined;
- // table[(T_long<<4)+T_long] = T_undefined ;
- // table[(T_long<<4)+T_short] = T_undefined ;
- // table[(T_long<<4)+T_void] = T_undefined ;
- // table[(T_long<<4)+T_String] = T_undefined ;
- // table[(T_long<<4)+T_Object] = T_undefined ;
- // table[(T_long<<4)+T_double] = T_undefined ;
- // table[(T_long<<4)+T_float] = T_undefined ;
- // table[(T_long<<4)+T_boolean] = T_undefined ;
- // table[(T_long<<4)+T_char] = T_undefined ;
- // table[(T_long<<4)+T_int] = T_undefined ;
- // table[(T_long<<4)+T_null] = T_undefined ;
-
- // table[(T_short<<4)+T_undefined] = T_undefined ;
- // table[(T_short<<4)+T_byte] = T_undefined ;
- // table[(T_short<<4)+T_long] = T_undefined ;
- // table[(T_short<<4)+T_short] = T_undefined ;
- // table[(T_short<<4)+T_void] = T_undefined ;
- // table[(T_short<<4)+T_String] = T_undefined ;
- // table[(T_short<<4)+T_Object] = T_undefined ;
- // table[(T_short<<4)+T_double] = T_undefined ;
- // table[(T_short<<4)+T_float] = T_undefined ;
- // table[(T_short<<4)+T_boolean] = T_undefined ;
- // table[(T_short<<4)+T_char] = T_undefined ;
- // table[(T_short<<4)+T_int] = T_undefined ;
- // table[(T_short<<4)+T_null] = T_undefined ;
-
- // table[(T_void<<4)+T_undefined] = T_undefined ;
- // table[(T_void<<4)+T_byte] = T_undefined ;
- // table[(T_void<<4)+T_long] = T_undefined ;
- // table[(T_void<<4)+T_short] = T_undefined ;
- // table[(T_void<<4)+T_void] = T_undefined ;
- // table[(T_void<<4)+T_String] = T_undefined ;
- // table[(T_void<<4)+T_Object] = T_undefined ;
- // table[(T_void<<4)+T_double] = T_undefined ;
- // table[(T_void<<4)+T_float] = T_undefined ;
- // table[(T_void<<4)+T_boolean] = T_undefined ;
- // table[(T_void<<4)+T_char] = T_undefined ;
- // table[(T_void<<4)+T_int] = T_undefined ;
- // table[(T_void<<4)+T_null] = T_undefined ;
-
- // table[(T_String<<4)+T_undefined] = T_undefined ;
- // table[(T_String<<4)+T_byte] = T_undefined ;
- // table[(T_String<<4)+T_long] = T_undefined ;
- // table[(T_String<<4)+T_short] = T_undefined ;
- // table[(T_String<<4)+T_void] = T_undefined ;
- // table[(T_String<<4)+T_String] = T_undefined ;
- // table[(T_String<<4)+T_Object] = T_undefined ;
- // table[(T_String<<4)+T_double] = T_undefined ;
- // table[(T_String<<4)+T_float] = T_undefined ;
- // table[(T_String<<4)+T_boolean] = T_undefined ;
- // table[(T_String<<4)+T_char] = T_undefined ;
- // table[(T_String<<4)+T_int] = T_undefined ;
- // table[(T_String<<4)+T_null] = T_undefined ;
-
- // table[(T_Object<<4)+T_undefined] = T_undefined ;
- // table[(T_Object<<4)+T_byte] = T_undefined ;
- // table[(T_Object<<4)+T_long] = T_undefined ;
- // table[(T_Object<<4)+T_short] = T_undefined ;
- // table[(T_Object<<4)+T_void] = T_undefined ;
- // table[(T_Object<<4)+T_String] = T_undefined ;
- // table[(T_Object<<4)+T_Object] = T_undefined ;
- // table[(T_Object<<4)+T_double] = T_undefined ;
- // table[(T_Object<<4)+T_float] = T_undefined ;
- // table[(T_Object<<4)+T_boolean] = T_undefined ;
- // table[(T_Object<<4)+T_char] = T_undefined ;
- // table[(T_Object<<4)+T_int] = T_undefined ;
- // table[(T_Object<<4)+T_null] = T_undefined ;
-
- // table[(T_double<<4)+T_undefined] = T_undefined ;
- // table[(T_double<<4)+T_byte] = T_undefined ;
- // table[(T_double<<4)+T_long] = T_undefined ;
- // table[(T_double<<4)+T_short] = T_undefined ;
- // table[(T_double<<4)+T_void] = T_undefined ;
- // table[(T_double<<4)+T_String] = T_undefined ;
- // table[(T_double<<4)+T_Object] = T_undefined ;
- // table[(T_double<<4)+T_double] = T_undefined ;
- // table[(T_double<<4)+T_float] = T_undefined ;
- // table[(T_double<<4)+T_boolean] = T_undefined ;
- // table[(T_double<<4)+T_char] = T_undefined ;
- // table[(T_double<<4)+T_int] = T_undefined;
- // table[(T_double<<4)+T_null] = T_undefined ;
-
- // table[(T_float<<4)+T_undefined] = T_undefined ;
- // table[(T_float<<4)+T_byte] = T_undefined ;
- // table[(T_float<<4)+T_long] = T_undefined ;
- // table[(T_float<<4)+T_short] = T_undefined ;
- // table[(T_float<<4)+T_void] = T_undefined ;
- // table[(T_float<<4)+T_String] = T_undefined ;
- // table[(T_float<<4)+T_Object] = T_undefined ;
- // table[(T_float<<4)+T_double] = T_undefined ;
- // table[(T_float<<4)+T_float] = T_undefined ;
- // table[(T_float<<4)+T_boolean] = T_undefined ;
- // table[(T_float<<4)+T_char] = T_undefined ;
- // table[(T_float<<4)+T_int] = T_undefined ;
- // table[(T_float<<4)+T_null] = T_undefined ;
-
- // table[(T_boolean<<4)+T_undefined] = T_undefined ;
- // table[(T_boolean<<4)+T_byte] = T_undefined ;
- // table[(T_boolean<<4)+T_long] = T_undefined ;
- // table[(T_boolean<<4)+T_short] = T_undefined ;
- // table[(T_boolean<<4)+T_void] = T_undefined ;
- // table[(T_boolean<<4)+T_String] = T_undefined ;
- // table[(T_boolean<<4)+T_Object] = T_undefined ;
- // table[(T_boolean<<4)+T_double] = T_undefined ;
- // table[(T_boolean<<4)+T_float] = T_undefined ;
- table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
- // table[(T_boolean<<4)+T_char] = T_undefined ;
- // table[(T_boolean<<4)+T_int] = T_undefined ;
- // table[(T_boolean<<4)+T_null] = T_undefined ;
-
- // table[(T_char<<4)+T_undefined] = T_undefined ;
- // table[(T_char<<4)+T_byte] = T_undefined ;
- // table[(T_char<<4)+T_long] = T_undefined;
- // table[(T_char<<4)+T_short] = T_undefined ;
- // table[(T_char<<4)+T_void] = T_undefined ;
- // table[(T_char<<4)+T_String] = T_undefined ;
- // table[(T_char<<4)+T_Object] = T_undefined ;
- // table[(T_char<<4)+T_double] = T_undefined ;
- // table[(T_char<<4)+T_float] = T_undefined ;
- // table[(T_char<<4)+T_boolean] = T_undefined ;
- // table[(T_char<<4)+T_char] = T_undefined ;
- // table[(T_char<<4)+T_int] = T_undefined ;
- // table[(T_char<<4)+T_null] = T_undefined ;
-
- // table[(T_int<<4)+T_undefined] = T_undefined ;
- // table[(T_int<<4)+T_byte] = T_undefined ;
- // table[(T_int<<4)+T_long] = T_undefined ;
- // table[(T_int<<4)+T_short] = T_undefined ;
- // table[(T_int<<4)+T_void] = T_undefined ;
- // table[(T_int<<4)+T_String] = T_undefined ;
- // table[(T_int<<4)+T_Object] = T_undefined ;
- // table[(T_int<<4)+T_double] = T_undefined ;
- // table[(T_int<<4)+T_float] = T_undefined ;
- // table[(T_int<<4)+T_boolean] = T_undefined ;
- // table[(T_int<<4)+T_char] = T_undefined ;
- // table[(T_int<<4)+T_int] = T_undefined ;
- // table[(T_int<<4)+T_null] = T_undefined ;
-
- // table[(T_null<<4)+T_undefined] = T_undefined ;
- // table[(T_null<<4)+T_byte] = T_undefined ;
- // table[(T_null<<4)+T_long] = T_undefined ;
- // table[(T_null<<4)+T_short] = T_undefined ;
- // table[(T_null<<4)+T_void] = T_undefined ;
- // table[(T_null<<4)+T_String] = T_undefined ;
- // table[(T_null<<4)+T_Object] = T_undefined ;
- // table[(T_null<<4)+T_double] = T_undefined ;
- // table[(T_null<<4)+T_float] = T_undefined ;
- // table[(T_null<<4)+T_boolean] = T_undefined ;
- // table[(T_null<<4)+T_char] = T_undefined ;
- // table[(T_null<<4)+T_int] = T_undefined ;
- // table[(T_null<<4)+T_null] = T_undefined ;
- return table ;
- }
-
- public static final int[] get_DIVIDE(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- // int[] table = new int[16*16] ;
-
- return get_MINUS();
- }
-
- public static final int[] get_EQUAL_EQUAL(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- // table[(T_undefined<<4)+T_undefined] = T_undefined ;
- // table[(T_undefined<<4)+T_byte] = T_undefined ;
- // table[(T_undefined<<4)+T_long] = T_undefined ;
- // table[(T_undefined<<4)+T_short] = T_undefined ;
- // table[(T_undefined<<4)+T_void] = T_undefined ;
- // table[(T_undefined<<4)+T_String] = T_undefined ;
- // table[(T_undefined<<4)+T_Object] = T_undefined ;
- // table[(T_undefined<<4)+T_double] = T_undefined ;
- // table[(T_undefined<<4)+T_float] = T_undefined ;
- // table[(T_undefined<<4)+T_boolean] = T_undefined ;
- // table[(T_undefined<<4)+T_char] = T_undefined ;
- // table[(T_undefined<<4)+T_int] = T_undefined ;
- // table[(T_undefined<<4)+T_null] = T_undefined ;
-
- // table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_byte<<4)+T_void] = T_undefined ;
- // table[(T_byte<<4)+T_String] = T_undefined ;
- // table[(T_byte<<4)+T_Object] = T_undefined ;
- table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
- // table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean;
- // table[(T_byte<<4)+T_null] = T_undefined ;
-
- // table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
- // table[(T_long<<4)+T_void] = T_undefined ;
- // table[(T_long<<4)+T_String] = T_undefined ;
- // table[(T_long<<4)+T_Object] = T_undefined ;
- table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
- // table[(T_long<<4)+T_null] = T_undefined ;
-
- // table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_short<<4)+T_void] = T_undefined ;
- // table[(T_short<<4)+T_String] = T_undefined ;
- // table[(T_short<<4)+T_Object] = T_undefined ;
- table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
- // table[(T_short<<4)+T_null] = T_undefined ;
-
- // table[(T_void<<4)+T_undefined] = T_undefined ;
- // table[(T_void<<4)+T_byte] = T_undefined ;
- // table[(T_void<<4)+T_long] = T_undefined ;
- // table[(T_void<<4)+T_short] = T_undefined ;
- // table[(T_void<<4)+T_void] = T_undefined ;
- // table[(T_void<<4)+T_String] = T_undefined ;
- // table[(T_void<<4)+T_Object] = T_undefined ;
- // table[(T_void<<4)+T_double] = T_undefined ;
- // table[(T_void<<4)+T_float] = T_undefined ;
- // table[(T_void<<4)+T_boolean] = T_undefined ;
- // table[(T_void<<4)+T_char] = T_undefined ;
- // table[(T_void<<4)+T_int] = T_undefined ;
- // table[(T_void<<4)+T_null] = T_undefined ;
-
- // table[(T_String<<4)+T_undefined] = T_undefined ;
- // table[(T_String<<4)+T_byte] = T_undefined ;
- // table[(T_String<<4)+T_long] = T_undefined ;
- // table[(T_String<<4)+T_short] = T_undefined ;
- // table[(T_String<<4)+T_void] = T_undefined ;
- table[(T_String<<4)+T_String] = /*String2Object String2Object*/
- (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
- table[(T_String<<4)+T_Object] = /*String2Object Object2Object*/
- (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
- // table[(T_String<<4)+T_double] = T_undefined ;
- // table[(T_String<<4)+T_float] = T_undefined ;
- // table[(T_String<<4)+T_boolean] = T_undefined ;
- // table[(T_String<<4)+T_char] = T_undefined ;
- // table[(T_String<<4)+T_int] = T_undefined ;
- table[(T_String<<4)+T_null] = /*Object2String null2Object */
- (T_Object<<16)+(T_String<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
-
- // table[(T_Object<<4)+T_undefined] = T_undefined ;
- // table[(T_Object<<4)+T_byte] = T_undefined ;
- // table[(T_Object<<4)+T_long] = T_undefined ;
- // table[(T_Object<<4)+T_short] = T_undefined ;
- // table[(T_Object<<4)+T_void] = T_undefined ;
- table[(T_Object<<4)+T_String] = /*Object2Object String2Object*/
- (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
- table[(T_Object<<4)+T_Object] = /*Object2Object Object2Object*/
- (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ;
- // table[(T_Object<<4)+T_double] = T_undefined ;
- // table[(T_Object<<4)+T_float] = T_undefined ;
- // table[(T_Object<<4)+T_boolean] = T_undefined ;
- // table[(T_Object<<4)+T_char] = T_undefined ;
- // table[(T_Object<<4)+T_int] = T_undefined ;
- table[(T_Object<<4)+T_null] = /*Object2Object null2Object*/
- (T_Object<<16)+(T_Object<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
-
- // table[(T_double<<4)+T_undefined] = T_undefined ;
- table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
- // table[(T_double<<4)+T_void] = T_undefined ;
- // table[(T_double<<4)+T_String] = T_undefined ;
- // table[(T_double<<4)+T_Object] = T_undefined ;
- table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean;
- // table[(T_double<<4)+T_boolean] = T_undefined ;
- table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean ;
- // table[(T_double<<4)+T_null] = T_undefined ;
-
- // table[(T_float<<4)+T_undefined] = T_undefined ;
- table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
- // table[(T_float<<4)+T_void] = T_undefined ;
- // table[(T_float<<4)+T_String] = T_undefined ;
- // table[(T_float<<4)+T_Object] = T_undefined ;
- table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_float<<4)+T_boolean] = T_undefined ;
- table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
- // table[(T_float<<4)+T_null] = T_undefined ;
-
- // table[(T_boolean<<4)+T_undefined] = T_undefined ;
- // table[(T_boolean<<4)+T_byte] = T_undefined ;
- // table[(T_boolean<<4)+T_long] = T_undefined ;
- // table[(T_boolean<<4)+T_short] = T_undefined ;
- // table[(T_boolean<<4)+T_void] = T_undefined ;
- // table[(T_boolean<<4)+T_String] = T_undefined ;
- // table[(T_boolean<<4)+T_Object] = T_undefined ;
- // table[(T_boolean<<4)+T_double] = T_undefined ;
- // table[(T_boolean<<4)+T_float] = T_undefined ;
- table[(T_boolean<<4)+T_boolean] = (Boolean2Boolean<<12)+(Boolean2Boolean<<4)+T_boolean ;
- // table[(T_boolean<<4)+T_char] = T_undefined ;
- // table[(T_boolean<<4)+T_int] = T_undefined ;
- // table[(T_boolean<<4)+T_null] = T_undefined ;
-
- // table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_char<<4)+T_void] = T_undefined ;
- // table[(T_char<<4)+T_String] = T_undefined ;
- // table[(T_char<<4)+T_Object] = T_undefined ;
- table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
- // table[(T_char<<4)+T_null] = T_undefined ;
-
- // table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_int<<4)+T_void] = T_undefined ;
- // table[(T_int<<4)+T_String] = T_undefined ;
- // table[(T_int<<4)+T_Object] = T_undefined ;
- table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean;
- // table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean ;
- // table[(T_int<<4)+T_null] = T_undefined ;
-
- // table[(T_null<<4)+T_undefined] = T_undefined ;
- // table[(T_null<<4)+T_byte] = T_undefined ;
- // table[(T_null<<4)+T_long] = T_undefined ;
- // table[(T_null<<4)+T_short] = T_undefined ;
- // table[(T_null<<4)+T_void] = T_undefined ;
- table[(T_null<<4)+T_String] = /*null2Object String2Object*/
- (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_String<<4)+T_boolean ;
- table[(T_null<<4)+T_Object] = /*null2Object Object2Object*/
- (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_Object<<4)+T_boolean ; ;
- // table[(T_null<<4)+T_double] = T_undefined ;
- // table[(T_null<<4)+T_float] = T_undefined ;
- // table[(T_null<<4)+T_boolean] = T_undefined ;
- // table[(T_null<<4)+T_char] = T_undefined ;
- // table[(T_null<<4)+T_int] = T_undefined ;
- table[(T_null<<4)+T_null] = /*null2Object null2Object*/
- (T_Object<<16)+(T_null<<12)+(T_Object<<8)+(T_null<<4)+T_boolean ;
- return table ;
- }
-
- public static final int[] get_GREATER(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_LESS();
- }
-
- public static final int[] get_GREATER_EQUAL(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_LESS();
- }
-
- public static final int[] get_LEFT_SHIFT(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- // table[(T_undefined<<4)+T_undefined] = T_undefined ;
- // table[(T_undefined<<4)+T_byte] = T_undefined ;
- // table[(T_undefined<<4)+T_long] = T_undefined ;
- // table[(T_undefined<<4)+T_short] = T_undefined ;
- // table[(T_undefined<<4)+T_void] = T_undefined ;
- // table[(T_undefined<<4)+T_String] = T_undefined ;
- // table[(T_undefined<<4)+T_Object] = T_undefined ;
- // table[(T_undefined<<4)+T_double] = T_undefined ;
- // table[(T_undefined<<4)+T_float] = T_undefined ;
- // table[(T_undefined<<4)+T_boolean] = T_undefined ;
- // table[(T_undefined<<4)+T_char] = T_undefined ;
- // table[(T_undefined<<4)+T_int] = T_undefined ;
- // table[(T_undefined<<4)+T_null] = T_undefined ;
-
- // table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_byte<<4)+T_long] = (Byte2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_byte<<4)+T_void] = T_undefined ;
- // table[(T_byte<<4)+T_String] = T_undefined ;
- // table[(T_byte<<4)+T_Object] = T_undefined ;
- // table[(T_byte<<4)+T_double] = T_undefined ;
- // table[(T_byte<<4)+T_float] = T_undefined ;
- // table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_byte<<4)+T_null] = T_undefined ;
-
- // table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Int<<4)+T_long;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Int<<4)+T_long ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Int<<4)+T_long ;
- // table[(T_long<<4)+T_void] = T_undefined ;
- // table[(T_long<<4)+T_String] = T_undefined ;
- // table[(T_long<<4)+T_Object] = T_undefined ;
- // table[(T_long<<4)+T_double] = T_undefined ;
- // table[(T_long<<4)+T_float] = T_undefined ;
- // table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Int<<4)+T_long ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Int<<4)+T_long ;
- // table[(T_long<<4)+T_null] = T_undefined ;
-
- // table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_short<<4)+T_long] = (Short2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_short<<4)+T_void] = T_undefined ;
- // table[(T_short<<4)+T_String] = T_undefined ;
- // table[(T_short<<4)+T_Object] = T_undefined ;
- // table[(T_short<<4)+T_double] = T_undefined ;
- // table[(T_short<<4)+T_float] = T_undefined ;
- // table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_short<<4)+T_null] = T_undefined ;
-
- // table[(T_void<<4)+T_undefined] = T_undefined ;
- // table[(T_void<<4)+T_byte] = T_undefined ;
- // table[(T_void<<4)+T_long] = T_undefined ;
- // table[(T_void<<4)+T_short] = T_undefined ;
- // table[(T_void<<4)+T_void] = T_undefined ;
- // table[(T_void<<4)+T_String] = T_undefined ;
- // table[(T_void<<4)+T_Object] = T_undefined ;
- // table[(T_void<<4)+T_double] = T_undefined ;
- // table[(T_void<<4)+T_float] = T_undefined ;
- // table[(T_void<<4)+T_boolean] = T_undefined ;
- // table[(T_void<<4)+T_char] = T_undefined ;
- // table[(T_void<<4)+T_int] = T_undefined ;
- // table[(T_void<<4)+T_null] = T_undefined ;
-
- // table[(T_String<<4)+T_undefined] = T_undefined ;
- // table[(T_String<<4)+T_byte] = T_undefined ;
- // table[(T_String<<4)+T_long] = T_undefined ;
- // table[(T_String<<4)+T_short] = T_undefined ;
- // table[(T_String<<4)+T_void] = T_undefined ;
- // table[(T_String<<4)+T_String] = T_undefined ;
- // table[(T_String<<4)+T_Object] = T_undefined ;
- // table[(T_String<<4)+T_double] = T_undefined ;
- // table[(T_String<<4)+T_float] = T_undefined ;
- // table[(T_String<<4)+T_boolean] = T_undefined ;
- // table[(T_String<<4)+T_char] = T_undefined ;
- // table[(T_String<<4)+T_int] = T_undefined ;
- // table[(T_String<<4)+T_null] = T_undefined ;
-
- // table[(T_Object<<4)+T_undefined] = T_undefined ;
- // table[(T_Object<<4)+T_byte] = T_undefined ;
- // table[(T_Object<<4)+T_long] = T_undefined ;
- // table[(T_Object<<4)+T_short] = T_undefined ;
- // table[(T_Object<<4)+T_void] = T_undefined ;
- // table[(T_Object<<4)+T_String] = T_undefined ;
- // table[(T_Object<<4)+T_Object] = T_undefined ;
- // table[(T_Object<<4)+T_double] = T_undefined ;
- // table[(T_Object<<4)+T_float] = T_undefined ;
- // table[(T_Object<<4)+T_boolean] = T_undefined ;
- // table[(T_Object<<4)+T_char] = T_undefined ;
- // table[(T_Object<<4)+T_int] = T_undefined ;
- // table[(T_Object<<4)+T_null] = T_undefined ;
-
- // table[(T_double<<4)+T_undefined] = T_undefined ;
- // table[(T_double<<4)+T_byte] = T_undefined ;
- // table[(T_double<<4)+T_long] = T_undefined ;
- // table[(T_double<<4)+T_short] = T_undefined ;
- // table[(T_double<<4)+T_void] = T_undefined ;
- // table[(T_double<<4)+T_String] = T_undefined ;
- // table[(T_double<<4)+T_Object] = T_undefined ;
- // table[(T_double<<4)+T_double] = T_undefined ;
- // table[(T_double<<4)+T_float] = T_undefined ;
- // table[(T_double<<4)+T_boolean] = T_undefined ;
- // table[(T_double<<4)+T_char] = T_undefined ;
- // table[(T_double<<4)+T_int] = T_undefined;
- // table[(T_double<<4)+T_null] = T_undefined ;
-
- // table[(T_float<<4)+T_undefined] = T_undefined ;
- // table[(T_float<<4)+T_byte] = T_undefined ;
- // table[(T_float<<4)+T_long] = T_undefined ;
- // table[(T_float<<4)+T_short] = T_undefined ;
- // table[(T_float<<4)+T_void] = T_undefined ;
- // table[(T_float<<4)+T_String] = T_undefined ;
- // table[(T_float<<4)+T_Object] = T_undefined ;
- // table[(T_float<<4)+T_double] = T_undefined ;
- // table[(T_float<<4)+T_float] = T_undefined ;
- // table[(T_float<<4)+T_boolean] = T_undefined ;
- // table[(T_float<<4)+T_char] = T_undefined ;
- // table[(T_float<<4)+T_int] = T_undefined ;
- // table[(T_float<<4)+T_null] = T_undefined ;
-
- // table[(T_boolean<<4)+T_undefined] = T_undefined ;
- // table[(T_boolean<<4)+T_byte] = T_undefined ;
- // table[(T_boolean<<4)+T_long] = T_undefined ;
- // table[(T_boolean<<4)+T_short] = T_undefined ;
- // table[(T_boolean<<4)+T_void] = T_undefined ;
- // table[(T_boolean<<4)+T_String] = T_undefined ;
- // table[(T_boolean<<4)+T_Object] = T_undefined ;
- // table[(T_boolean<<4)+T_double] = T_undefined ;
- // table[(T_boolean<<4)+T_float] = T_undefined ;
- // table[(T_boolean<<4)+T_boolean] = T_undefined ;
- // table[(T_boolean<<4)+T_char] = T_undefined ;
- // table[(T_boolean<<4)+T_int] = T_undefined ;
- // table[(T_boolean<<4)+T_null] = T_undefined ;
-
- // table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_char<<4)+T_long] = (Char2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_char<<4)+T_void] = T_undefined ;
- // table[(T_char<<4)+T_String] = T_undefined ;
- // table[(T_char<<4)+T_Object] = T_undefined ;
- // table[(T_char<<4)+T_double] = T_undefined ;
- // table[(T_char<<4)+T_float] = T_undefined ;
- // table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_char<<4)+T_null] = T_undefined ;
-
- // table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_int<<4)+T_long] = (Int2Int<<12)+(Long2Int<<4)+T_int ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_int<<4)+T_void] = T_undefined ;
- // table[(T_int<<4)+T_String] = T_undefined ;
- // table[(T_int<<4)+T_Object] = T_undefined ;
- // table[(T_int<<4)+T_double] = T_undefined ;
- // table[(T_int<<4)+T_float] = T_undefined ;
- // table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_int<<4)+T_null] = T_undefined ;
-
- // table[(T_null<<4)+T_undefined] = T_undefined ;
- // table[(T_null<<4)+T_byte] = T_undefined ;
- // table[(T_null<<4)+T_long] = T_undefined ;
- // table[(T_null<<4)+T_short] = T_undefined ;
- // table[(T_null<<4)+T_void] = T_undefined ;
- // table[(T_null<<4)+T_String] = T_undefined ;
- // table[(T_null<<4)+T_Object] = T_undefined ;
- // table[(T_null<<4)+T_double] = T_undefined ;
- // table[(T_null<<4)+T_float] = T_undefined ;
- // table[(T_null<<4)+T_boolean] = T_undefined ;
- // table[(T_null<<4)+T_char] = T_undefined ;
- // table[(T_null<<4)+T_int] = T_undefined ;
- // table[(T_null<<4)+T_null] = T_undefined ;
-
- return table ;
- }
-
- public static final int[] get_LESS(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- // table[(T_undefined<<4)+T_undefined] = T_undefined ;
- // table[(T_undefined<<4)+T_byte] = T_undefined ;
- // table[(T_undefined<<4)+T_long] = T_undefined ;
- // table[(T_undefined<<4)+T_short] = T_undefined ;
- // table[(T_undefined<<4)+T_void] = T_undefined ;
- // table[(T_undefined<<4)+T_String] = T_undefined ;
- // table[(T_undefined<<4)+T_Object] = T_undefined ;
- // table[(T_undefined<<4)+T_double] = T_undefined ;
- // table[(T_undefined<<4)+T_float] = T_undefined ;
- // table[(T_undefined<<4)+T_boolean] = T_undefined ;
- // table[(T_undefined<<4)+T_char] = T_undefined ;
- // table[(T_undefined<<4)+T_int] = T_undefined ;
- // table[(T_undefined<<4)+T_null] = T_undefined ;
-
- // table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_byte<<4)+T_void] = T_undefined ;
- // table[(T_byte<<4)+T_String] = T_undefined ;
- // table[(T_byte<<4)+T_Object] = T_undefined ;
- table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_boolean;
- // table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_boolean ;
- // table[(T_byte<<4)+T_null] = T_undefined ;
-
- // table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_boolean;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_boolean ;
- // table[(T_long<<4)+T_void] = T_undefined ;
- // table[(T_long<<4)+T_String] = T_undefined ;
- // table[(T_long<<4)+T_Object] = T_undefined ;
- table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_boolean ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_boolean ;
- // table[(T_long<<4)+T_null] = T_undefined ;
-
- // table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_short<<4)+T_void] = T_undefined ;
- // table[(T_short<<4)+T_String] = T_undefined ;
- // table[(T_short<<4)+T_Object] = T_undefined ;
- table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_boolean ;
- // table[(T_short<<4)+T_null] = T_undefined ;
-
- // table[(T_void<<4)+T_undefined] = T_undefined ;
- // table[(T_void<<4)+T_byte] = T_undefined ;
- // table[(T_void<<4)+T_long] = T_undefined ;
- // table[(T_void<<4)+T_short] = T_undefined ;
- // table[(T_void<<4)+T_void] = T_undefined ;
- // table[(T_void<<4)+T_String] = T_undefined ;
- // table[(T_void<<4)+T_Object] = T_undefined ;
- // table[(T_void<<4)+T_double] = T_undefined ;
- // table[(T_void<<4)+T_float] = T_undefined ;
- // table[(T_void<<4)+T_boolean] = T_undefined ;
- // table[(T_void<<4)+T_char] = T_undefined ;
- // table[(T_void<<4)+T_int] = T_undefined ;
- // table[(T_void<<4)+T_null] = T_undefined ;
-
- // table[(T_String<<4)+T_undefined] = T_undefined ;
- // table[(T_String<<4)+T_byte] = T_undefined ;
- // table[(T_String<<4)+T_long] = T_undefined ;
- // table[(T_String<<4)+T_short] = T_undefined ;
- // table[(T_String<<4)+T_void] = T_undefined ;
- // table[(T_String<<4)+T_String] = T_undefined ;
- // table[(T_String<<4)+T_Object] = T_undefined ;
- // table[(T_String<<4)+T_double] = T_undefined ;
- // table[(T_String<<4)+T_float] = T_undefined ;
- // table[(T_String<<4)+T_boolean] = T_undefined ;
- // table[(T_String<<4)+T_char] = T_undefined ;
- // table[(T_String<<4)+T_int] = T_undefined ;
- // table[(T_String<<4)+T_null] = T_undefined ;
-
- // table[(T_Object<<4)+T_undefined] = T_undefined ;
- // table[(T_Object<<4)+T_byte] = T_undefined ;
- // table[(T_Object<<4)+T_long] = T_undefined ;
- // table[(T_Object<<4)+T_short] = T_undefined ;
- // table[(T_Object<<4)+T_void] = T_undefined ;
- // table[(T_Object<<4)+T_String] = T_undefined ;
- // table[(T_Object<<4)+T_Object] = T_undefined ;
- // table[(T_Object<<4)+T_double] = T_undefined ;
- // table[(T_Object<<4)+T_float] = T_undefined ;
- // table[(T_Object<<4)+T_boolean] = T_undefined ;
- // table[(T_Object<<4)+T_char] = T_undefined ;
- // table[(T_Object<<4)+T_int] = T_undefined ;
- // table[(T_Object<<4)+T_null] = T_undefined ;
-
- // table[(T_double<<4)+T_undefined] = T_undefined ;
- table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_boolean;
- table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_boolean ;
- // table[(T_double<<4)+T_void] = T_undefined ;
- // table[(T_double<<4)+T_String] = T_undefined ;
- // table[(T_double<<4)+T_Object] = T_undefined ;
- table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_boolean ;
- // table[(T_double<<4)+T_boolean] = T_undefined ;
- table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_boolean ;
- table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_boolean;
- // table[(T_double<<4)+T_null] = T_undefined ;
-
- // table[(T_float<<4)+T_undefined] = T_undefined ;
- table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_boolean ;
- // table[(T_float<<4)+T_void] = T_undefined ;
- // table[(T_float<<4)+T_String] = T_undefined ;
- // table[(T_float<<4)+T_Object] = T_undefined ;
- table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_float<<4)+T_boolean] = T_undefined ;
- table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_boolean ;
- table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_boolean ;
- // table[(T_float<<4)+T_null] = T_undefined ;
-
- // table[(T_boolean<<4)+T_undefined] = T_undefined ;
- // table[(T_boolean<<4)+T_byte] = T_undefined ;
- // table[(T_boolean<<4)+T_long] = T_undefined ;
- // table[(T_boolean<<4)+T_short] = T_undefined ;
- // table[(T_boolean<<4)+T_void] = T_undefined ;
- // table[(T_boolean<<4)+T_String] = T_undefined ;
- // table[(T_boolean<<4)+T_Object] = T_undefined ;
- // table[(T_boolean<<4)+T_double] = T_undefined ;
- // table[(T_boolean<<4)+T_float] = T_undefined ;
- // table[(T_boolean<<4)+T_boolean] = T_undefined ;
- // table[(T_boolean<<4)+T_char] = T_undefined ;
- // table[(T_boolean<<4)+T_int] = T_undefined ;
- // table[(T_boolean<<4)+T_null] = T_undefined ;
-
- // table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_boolean ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_char<<4)+T_void] = T_undefined ;
- // table[(T_char<<4)+T_String] = T_undefined ;
- // table[(T_char<<4)+T_Object] = T_undefined ;
- table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_boolean ;
- // table[(T_char<<4)+T_null] = T_undefined ;
-
- // table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_boolean;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_boolean ;
- // table[(T_int<<4)+T_void] = T_undefined ;
- // table[(T_int<<4)+T_String] = T_undefined ;
- // table[(T_int<<4)+T_Object] = T_undefined ;
- table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_boolean ;
- table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_boolean ;
- // table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_boolean ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_boolean;
- // table[(T_int<<4)+T_null] = T_undefined ;
-
- // table[(T_null<<4)+T_undefined] = T_undefined ;
- // table[(T_null<<4)+T_byte] = T_undefined ;
- // table[(T_null<<4)+T_long] = T_undefined ;
- // table[(T_null<<4)+T_short] = T_undefined ;
- // table[(T_null<<4)+T_void] = T_undefined ;
- // table[(T_null<<4)+T_String] = T_undefined ;
- // table[(T_null<<4)+T_Object] = T_undefined ;
- // table[(T_null<<4)+T_double] = T_undefined ;
- // table[(T_null<<4)+T_float] = T_undefined ;
- // table[(T_null<<4)+T_boolean] = T_undefined ;
- // table[(T_null<<4)+T_char] = T_undefined ;
- // table[(T_null<<4)+T_int] = T_undefined ;
- // table[(T_null<<4)+T_null] = T_undefined ;
-
- return table ;
- }
-
- public static final int[] get_LESS_EQUAL(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_LESS();
- }
-
- public static final int[] get_MINUS(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- table = (int[]) get_PLUS().clone();
-
- // customization
- table[(T_String<<4)+T_byte] = T_undefined ;
- table[(T_String<<4)+T_long] = T_undefined ;
- table[(T_String<<4)+T_short] = T_undefined ;
- table[(T_String<<4)+T_void] = T_undefined ;
- table[(T_String<<4)+T_String] = T_undefined ;
- table[(T_String<<4)+T_Object] = T_undefined ;
- table[(T_String<<4)+T_double] = T_undefined ;
- table[(T_String<<4)+T_float] = T_undefined ;
- table[(T_String<<4)+T_boolean] = T_undefined ;
- table[(T_String<<4)+T_char] = T_undefined ;
- table[(T_String<<4)+T_int] = T_undefined ;
- table[(T_String<<4)+T_null] = T_undefined ;
-
- table[(T_byte<<4) +T_String] = T_undefined ;
- table[(T_long<<4) +T_String] = T_undefined ;
- table[(T_short<<4) +T_String] = T_undefined ;
- table[(T_void<<4) +T_String] = T_undefined ;
- table[(T_Object<<4) +T_String] = T_undefined ;
- table[(T_double<<4) +T_String] = T_undefined ;
- table[(T_float<<4) +T_String] = T_undefined ;
- table[(T_boolean<<4)+T_String] = T_undefined ;
- table[(T_char<<4) +T_String] = T_undefined ;
- table[(T_int<<4) +T_String] = T_undefined ;
- table[(T_null<<4) +T_String] = T_undefined ;
-
- table[(T_null<<4) +T_null] = T_undefined ;
-
- return table ;
- }
-
- public static final int[] get_MULTIPLY(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_MINUS();
- }
-
- public static final int[] get_OR(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
-
- // int[] table = new int[16*16] ;
- return get_AND() ;
- }
-
- public static final int[] get_OR_OR(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_AND_AND() ;
- }
-
- public static final int[] get_PLUS(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- int[] table = new int[16*16] ;
-
- // table[(T_undefined<<4)+T_undefined] = T_undefined ;
- // table[(T_undefined<<4)+T_byte] = T_undefined ;
- // table[(T_undefined<<4)+T_long] = T_undefined ;
- // table[(T_undefined<<4)+T_short] = T_undefined ;
- // table[(T_undefined<<4)+T_void] = T_undefined ;
- // table[(T_undefined<<4)+T_String] = T_undefined ;
- // table[(T_undefined<<4)+T_Object] = T_undefined ;
- // table[(T_undefined<<4)+T_double] = T_undefined ;
- // table[(T_undefined<<4)+T_float] = T_undefined ;
- // table[(T_undefined<<4)+T_boolean] = T_undefined ;
- // table[(T_undefined<<4)+T_char] = T_undefined ;
- // table[(T_undefined<<4)+T_int] = T_undefined ;
- // table[(T_undefined<<4)+T_null] = T_undefined ;
-
- // table[(T_byte<<4)+T_undefined] = T_undefined ;
- table[(T_byte<<4)+T_byte] = (Byte2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_byte<<4)+T_long] = (Byte2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_byte<<4)+T_short] = (Byte2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_byte<<4)+T_void] = T_undefined ;
- table[(T_byte<<4)+T_String] = (Byte2Byte<<12)+(String2String<<4)+T_String ;
- // table[(T_byte<<4)+T_Object] = T_undefined ;
- table[(T_byte<<4)+T_double] = (Byte2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_byte<<4)+T_float] = (Byte2Float<<12)+(Float2Float<<4)+T_float;
- // table[(T_byte<<4)+T_boolean] = T_undefined ;
- table[(T_byte<<4)+T_char] = (Byte2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_byte<<4)+T_int] = (Byte2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_byte<<4)+T_null] = T_undefined ;
-
- // table[(T_long<<4)+T_undefined] = T_undefined ;
- table[(T_long<<4)+T_byte] = (Long2Long<<12)+(Byte2Long<<4)+T_long;
- table[(T_long<<4)+T_long] = (Long2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_long<<4)+T_short] = (Long2Long<<12)+(Short2Long<<4)+T_long ;
- // table[(T_long<<4)+T_void] = T_undefined ;
- table[(T_long<<4)+T_String] = (Long2Long<<12)+(String2String<<4)+T_String ;
- // table[(T_long<<4)+T_Object] = T_undefined ;
- table[(T_long<<4)+T_double] = (Long2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_long<<4)+T_float] = (Long2Float<<12)+(Float2Float<<4)+T_float ;
- // table[(T_long<<4)+T_boolean] = T_undefined ;
- table[(T_long<<4)+T_char] = (Long2Long<<12)+(Char2Long<<4)+T_long ;
- table[(T_long<<4)+T_int] = (Long2Long<<12)+(Int2Long<<4)+T_long ; ;
- // table[(T_long<<4)+T_null] = T_undefined ;
-
- // table[(T_short<<4)+T_undefined] = T_undefined ;
- table[(T_short<<4)+T_byte] = (Short2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_short<<4)+T_long] = (Short2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_short<<4)+T_short] = (Short2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_short<<4)+T_void] = T_undefined ;
- table[(T_short<<4)+T_String] = (Short2Short<<12)+(String2String<<4)+T_String ;
- // table[(T_short<<4)+T_Object] = T_undefined ;
- table[(T_short<<4)+T_double] = (Short2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_short<<4)+T_float] = (Short2Float<<12)+(Float2Float<<4)+T_float ;
- // table[(T_short<<4)+T_boolean] = T_undefined ;
- table[(T_short<<4)+T_char] = (Short2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_short<<4)+T_int] = (Short2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_short<<4)+T_null] = T_undefined ;
-
- // table[(T_void<<4)+T_undefined] = T_undefined ;
- // table[(T_void<<4)+T_byte] = T_undefined ;
- // table[(T_void<<4)+T_long] = T_undefined ;
- // table[(T_void<<4)+T_short] = T_undefined ;
- // table[(T_void<<4)+T_void] = T_undefined ;
- // table[(T_void<<4)+T_String] = T_undefined ;
- // table[(T_void<<4)+T_Object] = T_undefined ;
- // table[(T_void<<4)+T_double] = T_undefined ;
- // table[(T_void<<4)+T_float] = T_undefined ;
- // table[(T_void<<4)+T_boolean] = T_undefined ;
- // table[(T_void<<4)+T_char] = T_undefined ;
- // table[(T_void<<4)+T_int] = T_undefined ;
- // table[(T_void<<4)+T_null] = T_undefined ;
-
- // table[(T_String<<4)+T_undefined] = T_undefined ;
- table[(T_String<<4)+T_byte] = (String2String<<12)+(Byte2Byte<<4)+T_String ;
- table[(T_String<<4)+T_long] = (String2String<<12)+(Long2Long<<4)+T_String ;
- table[(T_String<<4)+T_short] = (String2String<<12)+(Short2Short<<4)+T_String ;
- // table[(T_String<<4)+T_void] = T_undefined ;
- table[(T_String<<4)+T_String] = (String2String<<12)+(String2String<<4)+T_String ;
- table[(T_String<<4)+T_Object] = (String2String<<12)+(Object2Object<<4)+T_String ;
- table[(T_String<<4)+T_double] = (String2String<<12)+(Double2Double<<4)+T_String ;
- table[(T_String<<4)+T_float] = (String2String<<12)+(Float2Float<<4)+T_String ;
- table[(T_String<<4)+T_boolean] = (String2String<<12)+(Boolean2Boolean<<4)+T_String ;
- table[(T_String<<4)+T_char] = (String2String<<12)+(Char2Char<<4)+T_String ;
- table[(T_String<<4)+T_int] = (String2String<<12)+(Int2Int<<4)+T_String ;
- table[(T_String<<4)+T_null] = (String2String<<12)+(T_null<<8)+(T_null<<4)+T_String ;
-
- // table[(T_Object<<4)+T_undefined] = T_undefined ;
- // table[(T_Object<<4)+T_byte] = T_undefined ;
- // table[(T_Object<<4)+T_long] = T_undefined ;
- // table[(T_Object<<4)+T_short] = T_undefined ;
- // table[(T_Object<<4)+T_void] = T_undefined ;
- table[(T_Object<<4)+T_String] = (Object2Object<<12)+(String2String<<4)+T_String ;
- // table[(T_Object<<4)+T_Object] = T_undefined ;
- // table[(T_Object<<4)+T_double] = T_undefined ;
- // table[(T_Object<<4)+T_float] = T_undefined ;
- // table[(T_Object<<4)+T_boolean] = T_undefined ;
- // table[(T_Object<<4)+T_char] = T_undefined ;
- // table[(T_Object<<4)+T_int] = T_undefined ;
- // table[(T_Object<<4)+T_null] = T_undefined ;
-
- // table[(T_double<<4)+T_undefined] = T_undefined ;
- table[(T_double<<4)+T_byte] = (Double2Double<<12)+(Byte2Double<<4)+T_double ;
- table[(T_double<<4)+T_long] = (Double2Double<<12)+(Long2Double<<4)+T_double ;
- table[(T_double<<4)+T_short] = (Double2Double<<12)+(Short2Double<<4)+T_double ; ;
- // table[(T_double<<4)+T_void] = T_undefined ;
- table[(T_double<<4)+T_String] = (Double2Double<<12)+(String2String<<4)+T_String ;
- // table[(T_double<<4)+T_Object] = T_undefined ;
- table[(T_double<<4)+T_double] = (Double2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_double<<4)+T_float] = (Double2Double<<12)+(Float2Double<<4)+T_double ; ;
- // table[(T_double<<4)+T_boolean] = T_undefined ;
- table[(T_double<<4)+T_char] = (Double2Double<<12)+(Char2Double<<4)+T_double ; ;
- table[(T_double<<4)+T_int] = (Double2Double<<12)+(Int2Double<<4)+T_double ; ;
- // table[(T_double<<4)+T_null] = T_undefined ;
-
- // table[(T_float<<4)+T_undefined] = T_undefined ;
- table[(T_float<<4)+T_byte] = (Float2Float<<12)+(Byte2Float<<4)+T_float ;
- table[(T_float<<4)+T_long] = (Float2Float<<12)+(Long2Float<<4)+T_float ;
- table[(T_float<<4)+T_short] = (Float2Float<<12)+(Short2Float<<4)+T_float ;
- // table[(T_float<<4)+T_void] = T_undefined ;
- table[(T_float<<4)+T_String] = (Float2Float<<12)+(String2String<<4)+T_String ;
- // table[(T_float<<4)+T_Object] = T_undefined ;
- table[(T_float<<4)+T_double] = (Float2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_float<<4)+T_float] = (Float2Float<<12)+(Float2Float<<4)+T_float ;
- // table[(T_float<<4)+T_boolean] = T_undefined ;
- table[(T_float<<4)+T_char] = (Float2Float<<12)+(Char2Float<<4)+T_float ;
- table[(T_float<<4)+T_int] = (Float2Float<<12)+(Int2Float<<4)+T_float ;
- // table[(T_float<<4)+T_null] = T_undefined ;
-
- // table[(T_boolean<<4)+T_undefined] = T_undefined ;
- // table[(T_boolean<<4)+T_byte] = T_undefined ;
- // table[(T_boolean<<4)+T_long] = T_undefined ;
- // table[(T_boolean<<4)+T_short] = T_undefined ;
- // table[(T_boolean<<4)+T_void] = T_undefined ;
- table[(T_boolean<<4)+T_String] = (Boolean2Boolean<<12)+(String2String<<4)+T_String ;
- // table[(T_boolean<<4)+T_Object] = T_undefined ;
- // table[(T_boolean<<4)+T_double] = T_undefined ;
- // table[(T_boolean<<4)+T_float] = T_undefined ;
- // table[(T_boolean<<4)+T_boolean] = T_undefined ;
- // table[(T_boolean<<4)+T_char] = T_undefined ;
- // table[(T_boolean<<4)+T_int] = T_undefined ;
- // table[(T_boolean<<4)+T_null] = T_undefined ;
-
- // table[(T_char<<4)+T_undefined] = T_undefined ;
- table[(T_char<<4)+T_byte] = (Char2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_char<<4)+T_long] = (Char2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_char<<4)+T_short] = (Char2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_char<<4)+T_void] = T_undefined ;
- table[(T_char<<4)+T_String] = (Char2Char<<12)+(String2String<<4)+T_String ;
- // table[(T_char<<4)+T_Object] = T_undefined ;
- table[(T_char<<4)+T_double] = (Char2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_char<<4)+T_float] = (Char2Float<<12)+(Float2Float<<4)+T_float ;
- // table[(T_char<<4)+T_boolean] = T_undefined ;
- table[(T_char<<4)+T_char] = (Char2Int<<12)+(Char2Int<<4)+T_int ; ;
- table[(T_char<<4)+T_int] = (Char2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_char<<4)+T_null] = T_undefined ;
-
- // table[(T_int<<4)+T_undefined] = T_undefined ;
- table[(T_int<<4)+T_byte] = (Int2Int<<12)+(Byte2Int<<4)+T_int ;
- table[(T_int<<4)+T_long] = (Int2Long<<12)+(Long2Long<<4)+T_long ;
- table[(T_int<<4)+T_short] = (Int2Int<<12)+(Short2Int<<4)+T_int ;
- // table[(T_int<<4)+T_void] = T_undefined ;
- table[(T_int<<4)+T_String] = (Int2Int<<12)+(String2String<<4)+T_String ;
- // table[(T_int<<4)+T_Object] = T_undefined ;
- table[(T_int<<4)+T_double] = (Int2Double<<12)+(Double2Double<<4)+T_double ;
- table[(T_int<<4)+T_float] = (Int2Float<<12)+(Float2Float<<4)+T_float ;
- // table[(T_int<<4)+T_boolean] = T_undefined ;
- table[(T_int<<4)+T_char] = (Int2Int<<12)+(Char2Int<<4)+T_int ;
- table[(T_int<<4)+T_int] = (Int2Int<<12)+(Int2Int<<4)+T_int ;
- // table[(T_int<<4)+T_null] = T_undefined ;
-
- // table[(T_null<<4)+T_undefined] = T_undefined ;
- // table[(T_null<<4)+T_byte] = T_undefined ;
- // table[(T_null<<4)+T_long] = T_undefined ;
- // table[(T_null<<4)+T_short] = T_undefined ;
- // table[(T_null<<4)+T_void] = T_undefined ;
- table[(T_null<<4)+T_String] = (T_null<<16)+(T_null<<12)+(String2String<<4)+T_String ;
- // table[(T_null<<4)+T_Object] = T_undefined ;
- // table[(T_null<<4)+T_double] = T_undefined ;
- // table[(T_null<<4)+T_float] = T_undefined ;
- // table[(T_null<<4)+T_boolean] = T_undefined ;
- // table[(T_null<<4)+T_char] = T_undefined ;
- // table[(T_null<<4)+T_int] = T_undefined ;
- // table[(T_null<<4)+T_null] = (Null2String<<12)+(Null2String<<4)+T_String ;;
-
- return table ;
- }
-
- public static final int[] get_REMAINDER(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_MINUS();
- }
-
- public static final int[] get_RIGHT_SHIFT(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_LEFT_SHIFT();
- }
-
- public static final int[] get_UNSIGNED_RIGHT_SHIFT(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_LEFT_SHIFT();
- }
-
- public static final int[] get_XOR(){
-
- //the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4
-
- // int[] table = new int[16*16] ;
- return get_AND() ;
- }
-
- public String operatorToString() {
- switch ((bits & OperatorMASK) >> OperatorSHIFT) {
- case EQUAL_EQUAL :
- return "=="; //$NON-NLS-1$
- case LESS_EQUAL :
- return "<="; //$NON-NLS-1$
- case GREATER_EQUAL :
- return ">="; //$NON-NLS-1$
- case NOT_EQUAL :
- return "!="; //$NON-NLS-1$
- case LEFT_SHIFT :
- return "<<"; //$NON-NLS-1$
- case RIGHT_SHIFT :
- return ">>"; //$NON-NLS-1$
- case UNSIGNED_RIGHT_SHIFT :
- return ">>>"; //$NON-NLS-1$
- case OR_OR :
- return "||"; //$NON-NLS-1$
- case AND_AND :
- return "&&"; //$NON-NLS-1$
- case PLUS :
- return "+"; //$NON-NLS-1$
- case MINUS :
- return "-"; //$NON-NLS-1$
- case NOT :
- return "!"; //$NON-NLS-1$
- case REMAINDER :
- return "%"; //$NON-NLS-1$
- case XOR :
- return "^"; //$NON-NLS-1$
- case AND :
- return "&"; //$NON-NLS-1$
- case MULTIPLY :
- return "*"; //$NON-NLS-1$
- case OR :
- return "|"; //$NON-NLS-1$
- case TWIDDLE :
- return "~"; //$NON-NLS-1$
- case DIVIDE :
- return "/"; //$NON-NLS-1$
- case GREATER :
- return ">"; //$NON-NLS-1$
- case LESS :
- return "<"; //$NON-NLS-1$
- case QUESTIONCOLON :
- return "?:"; //$NON-NLS-1$
- case EQUAL :
- return "="; //$NON-NLS-1$
- };
- return "unknown operator"; //$NON-NLS-1$
- }
- public StringBuffer printExpression(int indent, StringBuffer output){
-
- output.append('(');
- return printExpressionNoParenthesis(0, output).append(')');
- }
-
- public abstract StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output);
-
- public String toStringExpression(){
-
- //subclass redefine toStringExpressionNoParenthesis()
- return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- public abstract String toStringExpressionNoParenthesis();
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorIds.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorIds.java
deleted file mode 100644
index c62835a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/OperatorIds.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-public interface OperatorIds {
- public static final int AND_AND = 0;
- public static final int OR_OR = 1;
- public static final int AND = 2;
- public static final int OR = 3;
- public static final int LESS = 4;
- public static final int LESS_EQUAL = 5;
- public static final int GREATER = 6;
- public static final int GREATER_EQUAL = 7;
- public static final int XOR = 8;
- public static final int DIVIDE = 9;
- public static final int LEFT_SHIFT = 10;
- public static final int NOT = 11;
- public static final int TWIDDLE = 12;
- public static final int MINUS = 13;
- public static final int PLUS = 14;
- public static final int MULTIPLY = 15;
- public static final int REMAINDER = 16;
- public static final int RIGHT_SHIFT = 17;
- public static final int EQUAL_EQUAL = 18;
- public static final int UNSIGNED_RIGHT_SHIFT= 19;
- public static final int NumberOfTables = 20;
-
- public static final int QUESTIONCOLON = 23;
-
- public static final int NOT_EQUAL = 29;
- public static final int EQUAL = 30;
- public static final int INSTANCEOF = 31;
- public static final int PLUS_PLUS = 32;
- public static final int MINUS_MINUS = 33;
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PostfixExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PostfixExpression.java
deleted file mode 100644
index b231308..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PostfixExpression.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class PostfixExpression extends CompoundAssignment {
-
- public PostfixExpression(Expression l, Expression e, int op, int pos) {
-
- super(l, e, op, pos);
- this.sourceStart = l.sourceStart;
- this.sourceEnd = pos;
- }
-
- /**
- * Code generation for PostfixExpression
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// // various scenarii are possible, setting an array reference,
-// // a field reference, a blank final field reference, a field of an enclosing instance or
-// // just a local variable.
-//
-// int pc = codeStream.position;
-// ((Reference) lhs).generatePostIncrement(currentScope, codeStream, this, valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public String operatorToString() {
- switch (operator) {
- case PLUS :
- return "++"; //$NON-NLS-1$
- case MINUS :
- return "--"; //$NON-NLS-1$
- }
- return "unknown operator"; //$NON-NLS-1$
- }
-
- public boolean restrainUsageToNumericTypes() {
-
- return true;
- }
-
- public String toStringExpressionNoParenthesis() {
-
- return lhs.toStringExpression() + " " + operatorToString(); //$NON-NLS-1$
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PrefixExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PrefixExpression.java
deleted file mode 100644
index 9dfb251..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/PrefixExpression.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-
-public class PrefixExpression extends CompoundAssignment {
-
- /**
- * PrefixExpression constructor comment.
- * @param l net.sourceforge.phpdt.internal.compiler.ast.Expression
- * @param r net.sourceforge.phpdt.internal.compiler.ast.Expression
- * @param op int
- */
- public PrefixExpression(Expression l, Expression e, int op, int pos) {
-
- super(l, e, op, l.sourceEnd);
- this.sourceStart = pos;
- this.sourceEnd = l.sourceEnd;
- }
-
- public String operatorToString() {
-
- switch (operator) {
- case PLUS :
- return "++"; //$NON-NLS-1$
- case MINUS :
- return "--"; //$NON-NLS-1$
- }
- return "unknown operator"; //$NON-NLS-1$
- }
-
- public boolean restrainUsageToNumericTypes() {
-
- return true;
- }
-
- public String toStringExpressionNoParenthesis() {
-
- return operatorToString() + " " + lhs.toStringExpression(); //$NON-NLS-1$
-
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- lhs.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedAllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedAllocationExpression.java
deleted file mode 100644
index b8e885a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedAllocationExpression.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-/**
- * Variation on allocation, where can be specified an enclosing instance and an anonymous type
- */
-public class QualifiedAllocationExpression extends AllocationExpression {
-
- //qualification may be on both side
- public Expression enclosingInstance;
- public AnonymousLocalTypeDeclaration anonymousType;
- public ReferenceBinding superTypeBinding;
-
- public QualifiedAllocationExpression() {
- }
-
- public QualifiedAllocationExpression(AnonymousLocalTypeDeclaration anonymousType) {
- this.anonymousType = anonymousType;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // analyse the enclosing instance
- if (enclosingInstance != null) {
- flowInfo = enclosingInstance.analyseCode(currentScope, flowContext, flowInfo);
- }
-
- // check captured variables are initialized in current context (26134)
- checkCapturedLocalInitializationIfNecessary(
- this.superTypeBinding == null ? this.binding.declaringClass : this.superTypeBinding,
- currentScope,
- flowInfo);
-
- // process arguments
- if (arguments != null) {
- for (int i = 0, count = arguments.length; i < count; i++) {
- flowInfo = arguments[i].analyseCode(currentScope, flowContext, flowInfo);
- }
- }
-
- // analyse the anonymous nested type
- if (anonymousType != null) {
- flowInfo = anonymousType.analyseCode(currentScope, flowContext, flowInfo);
- }
-
- // record some dependency information for exception types
- ReferenceBinding[] thrownExceptions;
- if (((thrownExceptions = binding.thrownExceptions).length) != 0) {
- // check exception handling
- flowContext.checkExceptionHandlers(
- thrownExceptions,
- this,
- flowInfo,
- currentScope);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- manageSyntheticAccessIfNecessary(currentScope);
- return flowInfo;
- }
-
- public Expression enclosingInstance() {
-
- return enclosingInstance;
- }
-
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// ReferenceBinding allocatedType = binding.declaringClass;
-// codeStream.new_(allocatedType);
-// if (valueRequired) {
-// codeStream.dup();
-// }
-// // better highlight for allocation: display the type individually
-// codeStream.recordPositionsFrom(pc, type.sourceStart);
-//
-// // handling innerclass instance allocation - enclosing instance arguments
-// if (allocatedType.isNestedType()) {
-// codeStream.generateSyntheticEnclosingInstanceValues(
-// currentScope,
-// allocatedType,
-// enclosingInstance(),
-// this);
-// }
-// // generate the arguments for constructor
-// if (arguments != null) {
-// for (int i = 0, count = arguments.length; i < count; i++) {
-// arguments[i].generateCode(currentScope, codeStream, true);
-// }
-// }
-// // handling innerclass instance allocation - outer local arguments
-// if (allocatedType.isNestedType()) {
-// codeStream.generateSyntheticOuterArgumentValues(
-// currentScope,
-// allocatedType,
-// this);
-// }
-//
-// // invoke constructor
-// if (syntheticAccessor == null) {
-// codeStream.invokespecial(binding);
-// } else {
-// // synthetic accessor got some extra arguments appended to its signature, which need values
-// for (int i = 0,
-// max = syntheticAccessor.parameters.length - binding.parameters.length;
-// i < max;
-// i++) {
-// codeStream.aconst_null();
-// }
-// codeStream.invokespecial(syntheticAccessor);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//
-// if (anonymousType != null) {
-// anonymousType.generateCode(currentScope, codeStream);
-// }
-// }
-
- public boolean isSuperAccess() {
-
- // necessary to lookup super constructor of anonymous type
- return anonymousType != null;
- }
-
- /* Inner emulation consists in either recording a dependency
- * link only, or performing one level of propagation.
- *
- * Dependency mechanism is used whenever dealing with source target
- * types, since by the time we reach them, we might not yet know their
- * exact need.
- */
- public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
-
- ReferenceBinding allocatedType;
-
- // perform some emulation work in case there is some and we are inside a local type only
- if ((allocatedType = binding.declaringClass).isNestedType()
- && currentScope.enclosingSourceType().isLocalType()) {
-
- if (allocatedType.isLocalType()) {
- ((LocalTypeBinding) allocatedType).addInnerEmulationDependent(currentScope, enclosingInstance != null);
- } else {
- // locally propagate, since we already now the desired shape for sure
- currentScope.propagateInnerEmulation(allocatedType, enclosingInstance != null);
- }
- }
- }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- // added for code assist...cannot occur with 'normal' code
- if (anonymousType == null && enclosingInstance == null) {
- return super.resolveType(scope);
- }
-
- // Propagate the type checking to the arguments, and checks if the constructor is defined.
- // ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- // ClassInstanceCreationExpression ::= Name '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- // ==> by construction, when there is an enclosing instance the typename may NOT be qualified
- // ==> therefore by construction the type is always a SingleTypeReferenceType instead of being either
- // sometime a SingleTypeReference and sometime a QualifedTypeReference
-
- constant = NotAConstant;
- TypeBinding enclosingInstanceType = null;
- TypeBinding receiverType = null;
- boolean hasError = false;
- if (anonymousType == null) { //----------------no anonymous class------------------------
- if ((enclosingInstanceType = enclosingInstance.resolveType(scope)) == null){
- hasError = true;
- } else if (enclosingInstanceType.isBaseType() || enclosingInstanceType.isArrayType()) {
- scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(
- enclosingInstanceType,
- enclosingInstance);
- hasError = true;
- } else if ((this.resolvedType = receiverType = ((SingleTypeReference) type).resolveTypeEnclosing(
- scope,
- (ReferenceBinding) enclosingInstanceType)) == null) {
- hasError = true;
- }
- // will check for null after args are resolved
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null){
- hasError = true;
- }
- }
- // limit of fault-tolerance
- if (hasError) return receiverType;
-
- if (!receiverType.canBeInstantiated()) {
- scope.problemReporter().cannotInstantiate(type, receiverType);
- return receiverType;
- }
- if ((this.binding = scope.getConstructor((ReferenceBinding) receiverType, argumentTypes, this))
- .isValidBinding()) {
- if (isMethodUseDeprecated(binding, scope))
- scope.problemReporter().deprecatedMethod(this.binding, this);
-
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(this.binding.parameters[i], argumentTypes[i]);
- } else {
- if (this.binding.declaringClass == null)
- this.binding.declaringClass = (ReferenceBinding) receiverType;
- scope.problemReporter().invalidConstructor(this, this.binding);
- return receiverType;
- }
-
- // The enclosing instance must be compatible with the innermost enclosing type
- ReferenceBinding expectedType = this.binding.declaringClass.enclosingType();
- if (enclosingInstanceType.isCompatibleWith(expectedType))
- return receiverType;
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- this.enclosingInstance,
- enclosingInstanceType,
- expectedType);
- return receiverType;
- }
-
- //--------------there is an anonymous type declaration-----------------
- if (this.enclosingInstance != null) {
- if ((enclosingInstanceType = this.enclosingInstance.resolveType(scope)) == null) {
- hasError = true;
- } else if (enclosingInstanceType.isBaseType() || enclosingInstanceType.isArrayType()) {
- scope.problemReporter().illegalPrimitiveOrArrayTypeForEnclosingInstance(
- enclosingInstanceType,
- this.enclosingInstance);
- hasError = true;
- } else {
- receiverType = ((SingleTypeReference) type).resolveTypeEnclosing(
- scope,
- (ReferenceBinding) enclosingInstanceType);
- }
- } else {
- receiverType = type.resolveType(scope);
- }
- if (receiverType == null) {
- hasError = true;
- } else if (((ReferenceBinding) receiverType).isFinal()) {
- scope.problemReporter().anonymousClassCannotExtendFinalClass(type, receiverType);
- hasError = true;
- }
- TypeBinding[] argumentTypes = NoParameters;
- if (arguments != null) {
- int length = arguments.length;
- argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++)
- if ((argumentTypes[i] = arguments[i].resolveType(scope)) == null) {
- hasError = true;
- }
- }
- // limit of fault-tolerance
- if (hasError) {
- return receiverType;
- }
-
- // an anonymous class inherits from java.lang.Object when declared "after" an interface
- this.superTypeBinding =
- receiverType.isInterface() ? scope.getJavaLangObject() : (ReferenceBinding) receiverType;
- MethodBinding inheritedBinding =
- scope.getConstructor(this.superTypeBinding, argumentTypes, this);
- if (!inheritedBinding.isValidBinding()) {
- if (inheritedBinding.declaringClass == null)
- inheritedBinding.declaringClass = this.superTypeBinding;
- scope.problemReporter().invalidConstructor(this, inheritedBinding);
- return null;
- }
- if (enclosingInstance != null) {
- if (!enclosingInstanceType.isCompatibleWith(inheritedBinding.declaringClass.enclosingType())) {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- enclosingInstance,
- enclosingInstanceType,
- inheritedBinding.declaringClass.enclosingType());
- return null;
- }
- }
-
- // this promotion has to be done somewhere: here or inside the constructor of the
- // anonymous class. We do it here while the constructor of the inner is then easier.
- if (arguments != null)
- for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(inheritedBinding.parameters[i], argumentTypes[i]);
-
- // Update the anonymous inner class : superclass, interface
- scope.addAnonymousType(anonymousType, (ReferenceBinding) receiverType);
- anonymousType.resolve(scope);
- binding = anonymousType.createsInternalConstructorWithBinding(inheritedBinding);
- return anonymousType.binding; // 1.2 change
- }
-
- public String toStringExpression() {
- return this.toStringExpression(0);
- }
-
- public String toStringExpression(int tab) {
-
- String s = ""; //$NON-NLS-1$
- if (enclosingInstance != null)
- s += enclosingInstance.toString() + "."; //$NON-NLS-1$
- s += super.toStringExpression();
- if (anonymousType != null) {
- s += anonymousType.toString(tab);
- } //allows to restart just after the } one line under ....
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
-
- if (visitor.visit(this, scope)) {
- if (enclosingInstance != null)
- enclosingInstance.traverse(visitor, scope);
- type.traverse(visitor, scope);
- if (arguments != null) {
- int argumentsLength = arguments.length;
- for (int i = 0; i < argumentsLength; i++)
- arguments[i].traverse(visitor, scope);
- }
- if (anonymousType != null)
- anonymousType.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedNameReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedNameReference.java
deleted file mode 100644
index da5359a..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedNameReference.java
+++ /dev/null
@@ -1,807 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ProblemFieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticAccessMethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
-
-
-public class QualifiedNameReference extends NameReference {
-
- public char[][] tokens;
- public FieldBinding[] otherBindings, otherCodegenBindings;
- int[] otherDepths;
- public int indexOfFirstFieldBinding;//points (into tokens) for the first token that corresponds to first FieldBinding
- SyntheticAccessMethodBinding syntheticWriteAccessor;
- SyntheticAccessMethodBinding[] syntheticReadAccessors;
- protected FieldBinding lastFieldBinding;
- public QualifiedNameReference(
- char[][] sources,
- int sourceStart,
- int sourceEnd) {
- super();
- tokens = sources;
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- }
- public FlowInfo analyseAssignment(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- Assignment assignment,
- boolean isCompound) {
-
- // determine the rank until which we now we do not need any actual value for the field access
- int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
- boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- lastFieldBinding = (FieldBinding) binding;
- if (needValue) {
- manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, this.actualReceiverType, 0);
- } // check if final blank field
- if (lastFieldBinding.isBlankFinal()
- && this.otherBindings != null // the last field binding is only assigned
- && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) {
- if (!flowInfo.isDefinitelyAssigned(lastFieldBinding)) {
- currentScope.problemReporter().uninitializedBlankFinalField(
- lastFieldBinding,
- this);
- }
- }
- break;
-// case LOCAL :
-// // first binding is a local variable
-// LocalVariableBinding localBinding;
-// if (!flowInfo
-// .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-// }
-// if (flowInfo.isReachable()) {
-// localBinding.useFlag = LocalVariableBinding.USED;
-// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-// }
- }
-
- if (needValue) {
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- // only for first binding
- }
- // all intermediate field accesses are read accesses
- if (otherBindings != null) {
- for (int i = 0; i < otherBindingsCount-1; i++) {
- lastFieldBinding = otherBindings[i];
- needValue = !otherBindings[i+1].isStatic();
- if (needValue) {
- manageSyntheticReadAccessIfNecessary(
- currentScope,
- lastFieldBinding,
- i == 0
- ? ((VariableBinding)binding).type
- : otherBindings[i-1].type,
- i + 1);
- }
- }
- lastFieldBinding = otherBindings[otherBindingsCount-1];
- }
-
- if (isCompound) {
- if (binding == lastFieldBinding
- && lastFieldBinding.isBlankFinal()
- && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)
- && (!flowInfo.isDefinitelyAssigned(lastFieldBinding))) {
- currentScope.problemReporter().uninitializedBlankFinalField(
- lastFieldBinding,
- this);
- }
- TypeBinding lastReceiverType;
- if (lastFieldBinding == binding){
- lastReceiverType = this.actualReceiverType;
- } else if (otherBindingsCount == 1){
- lastReceiverType = ((VariableBinding)this.binding).type;
- } else {
- lastReceiverType = this.otherBindings[otherBindingsCount-2].type;
- }
- manageSyntheticReadAccessIfNecessary(
- currentScope,
- lastFieldBinding,
- lastReceiverType,
- lastFieldBinding == binding
- ? 0
- : otherBindingsCount);
- }
-
- if (assignment.expression != null) {
- flowInfo =
- assignment
- .expression
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
- }
-
- // the last field access is a write access
- if (lastFieldBinding.isFinal()) {
- // in a context where it can be assigned?
- if (lastFieldBinding.isBlankFinal()
- && !isCompound
- && currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)
- && indexOfFirstFieldBinding == 1) {
- if (flowInfo.isPotentiallyAssigned(lastFieldBinding)) {
- currentScope.problemReporter().duplicateInitializationOfBlankFinalField(lastFieldBinding, this);
- } else {
- flowContext.recordSettingFinal(lastFieldBinding, this);
- }
- flowInfo.markAsDefinitelyAssigned(lastFieldBinding);
- } else {
- currentScope.problemReporter().cannotAssignToFinalField(lastFieldBinding, this);
- if (currentScope.allowBlankFinalFieldAssignment(lastFieldBinding)) { // pretend it got assigned
- flowInfo.markAsDefinitelyAssigned(lastFieldBinding);
- }
- }
- }
- // equivalent to valuesRequired[maxOtherBindings]
- TypeBinding lastReceiverType;
- if (lastFieldBinding == binding){
- lastReceiverType = this.actualReceiverType;
- } else if (otherBindingsCount == 1){
- lastReceiverType = ((VariableBinding)this.binding).type;
- } else {
- lastReceiverType = this.otherBindings[otherBindingsCount-2].type;
- }
- manageSyntheticWriteAccessIfNecessary(currentScope, lastFieldBinding, lastReceiverType);
-
- return flowInfo;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return analyseCode(currentScope, flowContext, flowInfo, true);
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- boolean valueRequired) {
-
- // determine the rank until which we now we do not need any actual value for the field access
- int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
-
- boolean needValue = otherBindingsCount == 0 ? valueRequired : !this.otherBindings[0].isStatic();
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- if (needValue) {
- manageSyntheticReadAccessIfNecessary(currentScope, (FieldBinding) binding, this.actualReceiverType, 0);
- }
- // check if reading a final blank field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isBlankFinal()
- && (indexOfFirstFieldBinding == 1)
- // was an implicit reference to the first field binding
- && currentScope.allowBlankFinalFieldAssignment(fieldBinding)
- && (!flowInfo.isDefinitelyAssigned(fieldBinding))) {
- currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
- }
- break;
-// case LOCAL : // reading a local variable
-// LocalVariableBinding localBinding;
-// if (!flowInfo
-// .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-// }
-// if (flowInfo.isReachable()) {
-// localBinding.useFlag = LocalVariableBinding.USED;
-// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-// }
- }
- if (needValue) {
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- // only for first binding
- }
- if (otherBindings != null) {
- for (int i = 0; i < otherBindingsCount; i++) {
- needValue = i < otherBindingsCount-1 ? !otherBindings[i+1].isStatic() : valueRequired;
- if (needValue) {
- manageSyntheticReadAccessIfNecessary(
- currentScope,
- otherBindings[i],
- i == 0
- ? ((VariableBinding)binding).type
- : otherBindings[i-1].type,
- i + 1);
- }
- }
- }
- return flowInfo;
- }
- /**
- * Check and/or redirect the field access to the delegate receiver if any
- */
- public TypeBinding checkFieldAccess(BlockScope scope) {
- // check for forward references
- FieldBinding fieldBinding = (FieldBinding) binding;
- MethodScope methodScope = scope.methodScope();
- if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
- && methodScope.fieldDeclarationIndex != MethodScope.NotInFieldDecl
- && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
- if ((!fieldBinding.isStatic() || methodScope.isStatic)
- && this.indexOfFirstFieldBinding == 1)
- scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
- }
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= FIELD;
- return getOtherFieldBindings(scope);
- }
-// public void generateAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Assignment assignment,
-// boolean valueRequired) {
-//
-// generateReadSequence(currentScope, codeStream);
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired);
-// // equivalent to valuesRequired[maxOtherBindings]
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion);
-// }
-// }
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// if (constant != NotAConstant) {
-// if (valueRequired) {
-// codeStream.generateConstant(constant, implicitConversion);
-// }
-// } else {
-// generateReadSequence(currentScope, codeStream);
-// if (valueRequired) {
-// if (lastFieldBinding.declaringClass == null) { // array length
-// codeStream.arraylength();
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// if (lastFieldBinding.constant != NotAConstant) {
-// if (!lastFieldBinding.isStatic()){
-// codeStream.invokeObjectGetClass();
-// codeStream.pop();
-// }
-// // inline the last field constant
-// codeStream.generateConstant(lastFieldBinding.constant, implicitConversion);
-// } else {
-// SyntheticAccessMethodBinding accessor =
-// syntheticReadAccessors == null
-// ? null
-// : syntheticReadAccessors[syntheticReadAccessors.length - 1];
-// if (accessor == null) {
-// if (lastFieldBinding.isStatic()) {
-// codeStream.getstatic(lastFieldBinding);
-// } else {
-// codeStream.getfield(lastFieldBinding);
-// }
-// } else {
-// codeStream.invokestatic(accessor);
-// }
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// }
-// } else {
-// if (lastFieldBinding != null && !lastFieldBinding.isStatic()){
-// codeStream.invokeObjectGetClass(); // perform null check
-// codeStream.pop();
-// }
-//
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-// public void generateCompoundAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Expression expression,
-// int operator,
-// int assignmentImplicitConversion,
-// boolean valueRequired) {
-//
-// generateReadSequence(currentScope, codeStream);
-// SyntheticAccessMethodBinding accessor =
-// syntheticReadAccessors == null
-// ? null
-// : syntheticReadAccessors[syntheticReadAccessors.length - 1];
-// if (lastFieldBinding.isStatic()) {
-// if (accessor == null) {
-// codeStream.getstatic(lastFieldBinding);
-// } else {
-// codeStream.invokestatic(accessor);
-// }
-// } else {
-// codeStream.dup();
-// if (accessor == null) {
-// codeStream.getfield(lastFieldBinding);
-// } else {
-// codeStream.invokestatic(accessor);
-// }
-// }
-// // the last field access is a write access
-// // perform the actual compound operation
-// int operationTypeID;
-// if ((operationTypeID = implicitConversion >> 4) == T_String) {
-// codeStream.generateStringAppend(currentScope, null, expression);
-// } else {
-// // promote the array reference to the suitable operation type
-// codeStream.generateImplicitConversion(implicitConversion);
-// // generate the increment value (will by itself be promoted to the operation value)
-// if (expression == IntLiteral.One) { // prefix operation
-// codeStream.generateConstant(expression.constant, implicitConversion);
-// } else {
-// expression.generateCode(currentScope, codeStream, true);
-// }
-// // perform the operation
-// codeStream.sendOperator(operator, operationTypeID);
-// // cast the value back to the array reference type
-// codeStream.generateImplicitConversion(assignmentImplicitConversion);
-// }
-// // actual assignment
-// fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired);
-// // equivalent to valuesRequired[maxOtherBindings]
-// }
-// public void generatePostIncrement(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// CompoundAssignment postIncrement,
-// boolean valueRequired) {
-// generateReadSequence(currentScope, codeStream);
-// SyntheticAccessMethodBinding accessor =
-// syntheticReadAccessors == null
-// ? null
-// : syntheticReadAccessors[syntheticReadAccessors.length - 1];
-// if (lastFieldBinding.isStatic()) {
-// if (accessor == null) {
-// codeStream.getstatic(lastFieldBinding);
-// } else {
-// codeStream.invokestatic(accessor);
-// }
-// } else {
-// codeStream.dup();
-// if (accessor == null) {
-// codeStream.getfield(lastFieldBinding);
-// } else {
-// codeStream.invokestatic(accessor);
-// }
-// }
-// // duplicate the old field value
-// if (valueRequired) {
-// if (lastFieldBinding.isStatic()) {
-// if ((lastFieldBinding.type == LongBinding)
-// || (lastFieldBinding.type == DoubleBinding)) {
-// codeStream.dup2();
-// } else {
-// codeStream.dup();
-// }
-// } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
-// if ((lastFieldBinding.type == LongBinding)
-// || (lastFieldBinding.type == DoubleBinding)) {
-// codeStream.dup2_x1();
-// } else {
-// codeStream.dup_x1();
-// }
-// }
-// }
-// codeStream.generateConstant(
-// postIncrement.expression.constant,
-// implicitConversion);
-// codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id);
-// codeStream.generateImplicitConversion(
-// postIncrement.assignmentImplicitConversion);
-// fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, false);
-// }
-// /*
-// * Generate code for all bindings (local and fields) excluding the last one, which may then be generated code
-// * for a read or write access.
-// */
-// public void generateReadSequence(
-// BlockScope currentScope,
-// CodeStream codeStream) {
-//
-// // determine the rank until which we now we do not need any actual value for the field access
-// int otherBindingsCount = this.otherCodegenBindings == null ? 0 : otherCodegenBindings.length;
-//
-// boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
-// switch (bits & RestrictiveFlagMASK) {
-// case FIELD :
-// lastFieldBinding = (FieldBinding) this.codegenBinding;
-// // if first field is actually constant, we can inline it
-// if (lastFieldBinding.constant != NotAConstant) {
-// break;
-// }
-// if (needValue && !lastFieldBinding.isStatic()) {
-// if ((bits & DepthMASK) != 0) {
-// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
-// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
-// } else {
-// generateReceiver(codeStream);
-// }
-// }
-// break;
-// case LOCAL : // reading the first local variable
-// if (!needValue) break; // no value needed
-// lastFieldBinding = null;
-// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
-// // regular local variable read
-// if (localBinding.constant != NotAConstant) {
-// codeStream.generateConstant(localBinding.constant, 0);
-// // no implicit conversion
-// } else {
-// // outer local?
-// if ((bits & DepthMASK) != 0) {
-// // outer local can be reached either through a synthetic arg or a synthetic field
-// VariableBinding[] path = currentScope.getEmulationPath(localBinding);
-// codeStream.generateOuterAccess(path, this, localBinding, currentScope);
-// } else {
-// codeStream.load(localBinding);
-// }
-// }
-// }
-//
-// // all intermediate field accesses are read accesses
-// // only the last field binding is a write access
-// if (this.otherCodegenBindings != null) {
-// for (int i = 0; i < otherBindingsCount; i++) {
-// FieldBinding nextField = this.otherCodegenBindings[i];
-// if (lastFieldBinding != null) {
-// needValue = !nextField.isStatic();
-// if (needValue) {
-// MethodBinding accessor =
-// syntheticReadAccessors == null ? null : syntheticReadAccessors[i];
-// if (accessor == null) {
-// if (lastFieldBinding.constant != NotAConstant) {
-// if (this.lastFieldBinding != this.codegenBinding && !this.lastFieldBinding.isStatic()) {
-// codeStream.invokeObjectGetClass(); // perform null check
-// codeStream.pop();
-// }
-// codeStream.generateConstant(lastFieldBinding.constant, 0);
-// } else if (lastFieldBinding.isStatic()) {
-// codeStream.getstatic(lastFieldBinding);
-// } else {
-// codeStream.getfield(lastFieldBinding);
-// }
-// } else {
-// codeStream.invokestatic(accessor);
-// }
-// } else {
-// if (this.codegenBinding != this.lastFieldBinding && !this.lastFieldBinding.isStatic()){
-// codeStream.invokeObjectGetClass(); // perform null check
-// codeStream.pop();
-// }
-// }
-// }
-// this.lastFieldBinding = nextField;
-// }
-// }
-// }
-// public void generateReceiver(CodeStream codeStream) {
-// codeStream.aload_0();
-// }
- public TypeBinding getOtherFieldBindings(BlockScope scope) {
- // At this point restrictiveFlag may ONLY have two potential value : FIELD LOCAL (i.e cast <<(VariableBinding) binding>> is valid)
- if ((bits & FIELD) != 0) {
- if (!((FieldBinding) binding).isStatic()) {
- //must check for the static status....
- if (indexOfFirstFieldBinding == 1) {
- //the field is the first token of the qualified reference....
- if (scope.methodScope().isStatic) {
- scope.problemReporter().staticFieldAccessToNonStaticVariable(
- this,
- (FieldBinding) binding);
- return null;
- }
- } else { //accessing to a field using a type as "receiver" is allowed only with static field
- scope.problemReporter().staticFieldAccessToNonStaticVariable(
- this,
- (FieldBinding) binding);
- return null;
- }
- }
- if (isFieldUseDeprecated((FieldBinding) binding, scope))
- scope.problemReporter().deprecatedField((FieldBinding) binding, this);
- }
- TypeBinding type = ((VariableBinding) binding).type;
- int index = indexOfFirstFieldBinding;
- int length = tokens.length;
- if (index == length) { // restrictiveFlag == FIELD
- this.constant = FieldReference.getConstantFor((FieldBinding) binding, this, false, scope);
- return type;
- }
- // allocation of the fieldBindings array and its respective constants
- int otherBindingsLength = length - index;
- otherCodegenBindings = otherBindings = new FieldBinding[otherBindingsLength];
- otherDepths = new int[otherBindingsLength];
-
- // fill the first constant (the one of the binding)
- this.constant =
- ((bits & FIELD) != 0)
- ? FieldReference.getConstantFor((FieldBinding) binding, this, false, scope)
- : ((VariableBinding) binding).constant;
- // save first depth, since will be updated by visibility checks of other bindings
- int firstDepth = (bits & DepthMASK) >> DepthSHIFT;
- // iteration on each field
- while (index < length) {
- char[] token = tokens[index];
- if (type == null)
- return null; // could not resolve type prior to this point
-
- bits &= ~DepthMASK; // flush previous depth if any
- FieldBinding field = scope.getField(type, token, this);
- int place = index - indexOfFirstFieldBinding;
- otherBindings[place] = field;
- otherDepths[place] = (bits & DepthMASK) >> DepthSHIFT;
- if (field.isValidBinding()) {
- if (isFieldUseDeprecated(field, scope))
- scope.problemReporter().deprecatedField(field, this);
- Constant someConstant = FieldReference.getConstantFor(field, this, false, scope);
- // constant propagation can only be performed as long as the previous one is a constant too.
- if (this.constant != NotAConstant) {
- this.constant = someConstant;
- }
-
- type = field.type;
- index++;
-
- if (field.isStatic()) {
- // static field accessed through receiver? legal but unoptimal (optional warning)
- scope.problemReporter().unnecessaryReceiverForStaticField(this, field);
- }
-
- } else {
- constant = NotAConstant; //don't fill other constants slots...
- scope.problemReporter().invalidField(this, field, index, type);
- setDepth(firstDepth);
- return null;
- }
- }
- setDepth(firstDepth);
- return (otherBindings[otherBindingsLength - 1]).type;
- }
- public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
- //If inlinable field, forget the access emulation, the code gen will directly target it
- if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) {
- return;
- }
- if ((bits & RestrictiveFlagMASK) == LOCAL) {
- currentScope.emulateOuterAccess((LocalVariableBinding) binding);
- }
- }
- public void manageSyntheticReadAccessIfNecessary(
- BlockScope currentScope,
- FieldBinding fieldBinding,
- TypeBinding lastReceiverType,
- int index) {
- // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings'
- if (fieldBinding.constant != NotAConstant)
- return;
- if (fieldBinding.isPrivate()) { // private access
- if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
- if (syntheticReadAccessors == null) {
- if (otherBindings == null)
- syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
- else
- syntheticReadAccessors =
- new SyntheticAccessMethodBinding[otherBindings.length + 1];
- }
- syntheticReadAccessors[index] = ((SourceTypeBinding) fieldBinding.declaringClass).addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- return;
- }
- } else if (fieldBinding.isProtected()){
- int depth = index == 0 ? (bits & DepthMASK) >> DepthSHIFT : otherDepths[index-1];
- // implicit protected access (only for first one)
- if (depth > 0 && (fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage())) {
- if (syntheticReadAccessors == null) {
- if (otherBindings == null)
- syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
- else
- syntheticReadAccessors =
- new SyntheticAccessMethodBinding[otherBindings.length + 1];
- }
- syntheticReadAccessors[index] =
- ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth))
- .addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
-// if (fieldBinding.declaringClass != lastReceiverType
-// && !lastReceiverType.isArrayType()
-// && fieldBinding.declaringClass != null
-// && fieldBinding.constant == NotAConstant
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && (index > 0 || indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
-// && fieldBinding.declaringClass.id != T_Object)
-// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
-// if (index == 0){
-// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
-// } else {
-// if (this.otherCodegenBindings == this.otherBindings){
-// int l = this.otherBindings.length;
-// System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
-// }
-// this.otherCodegenBindings[index-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
-// }
-// }
- }
- /*
- * No need to emulate access to protected fields since not implicitly accessed
- */
- public void manageSyntheticWriteAccessIfNecessary(
- BlockScope currentScope,
- FieldBinding fieldBinding,
- TypeBinding lastReceiverType) {
- if (fieldBinding.isPrivate()) {
- if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
- syntheticWriteAccessor = ((SourceTypeBinding) fieldBinding.declaringClass)
- .addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
- return;
- }
- } else if (fieldBinding.isProtected()){
- int depth = fieldBinding == binding ? (bits & DepthMASK) >> DepthSHIFT : otherDepths[otherDepths.length-1];
- if (depth > 0 && (fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage())) {
- syntheticWriteAccessor = ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth))
- .addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
-// if (fieldBinding.declaringClass != lastReceiverType
-// && !lastReceiverType.isArrayType()
-// && fieldBinding.declaringClass != null
-// && fieldBinding.constant == NotAConstant
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && (fieldBinding != binding || indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
-// && fieldBinding.declaringClass.id != T_Object)
-// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
-// if (fieldBinding == binding){
-// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
-// } else {
-// if (this.otherCodegenBindings == this.otherBindings){
-// int l = this.otherBindings.length;
-// System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
-// }
-// this.otherCodegenBindings[this.otherCodegenBindings.length-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
-// }
-// }
-
- }
- /**
- * Normal field binding did not work, try to bind to a field of the delegate receiver.
- */
- public TypeBinding reportError(BlockScope scope) {
- if (binding instanceof ProblemFieldBinding) {
- scope.problemReporter().invalidField(this, (FieldBinding) binding);
- } else if (binding instanceof ProblemReferenceBinding) {
- scope.problemReporter().invalidType(this, (TypeBinding) binding);
- } else {
- scope.problemReporter().unresolvableReference(this, binding);
- }
- return null;
- }
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- for (int i = 0; i < tokens.length; i++) {
- if (i > 0) output.append('.');
- output.append(tokens[i]);
- }
- return output;
- }
- public TypeBinding resolveType(BlockScope scope) {
- // field and/or local are done before type lookups
- // the only available value for the restrictiveFlag BEFORE
- // the TC is Flag_Type Flag_LocalField and Flag_TypeLocalField
- this.actualReceiverType = this.receiverType = scope.enclosingSourceType();
- constant = Constant.NotAConstant;
- if ((this.codegenBinding = this.binding = scope.getBinding(tokens, bits & RestrictiveFlagMASK, this))
- .isValidBinding()) {
- switch (bits & RestrictiveFlagMASK) {
- case VARIABLE : //============only variable===========
- case TYPE | VARIABLE :
- if (binding instanceof LocalVariableBinding) {
- if (!((LocalVariableBinding) binding).isFinal() && ((bits & DepthMASK) != 0))
- scope.problemReporter().cannotReferToNonFinalOuterLocal(
- (LocalVariableBinding) binding,
- this);
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= LOCAL;
- return this.resolvedType = getOtherFieldBindings(scope);
- }
- if (binding instanceof FieldBinding) {
- // check for forward references
- FieldBinding fieldBinding = (FieldBinding) binding;
- MethodScope methodScope = scope.methodScope();
- if (methodScope.enclosingSourceType() == fieldBinding.declaringClass
- && methodScope.fieldDeclarationIndex != MethodScope.NotInFieldDecl
- && fieldBinding.id >= methodScope.fieldDeclarationIndex) {
- if ((!fieldBinding.isStatic() || methodScope.isStatic)
- && this.indexOfFirstFieldBinding == 1)
- scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
- }
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= FIELD;
-
- // check for deprecated receiver type
- // deprecation check for receiver type if not first token
- if (indexOfFirstFieldBinding > 1) {
- if (isTypeUseDeprecated(this.actualReceiverType, scope))
- scope.problemReporter().deprecatedType(this.actualReceiverType, this);
- }
-
- return this.resolvedType = getOtherFieldBindings(scope);
- }
- // thus it was a type
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= TYPE;
- case TYPE : //=============only type ==============
- if (isTypeUseDeprecated((TypeBinding) binding, scope))
- scope.problemReporter().deprecatedType((TypeBinding) binding, this);
- return this.resolvedType = (TypeBinding) binding;
- }
- }
- //========error cases===============
- return this.resolvedType = this.reportError(scope);
- }
- public void setFieldIndex(int index) {
- this.indexOfFirstFieldBinding = index;
- }
- public String toStringExpression() {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++) {
- buffer.append(tokens[i]);
- if (i < (tokens.length - 1)) {
- buffer.append("."); //$NON-NLS-1$
- }
- }
- return buffer.toString();
- }
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
- public String unboundReferenceErrorName() {
- return new String(tokens[0]);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedSuperReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedSuperReference.java
deleted file mode 100644
index fc114ff..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedSuperReference.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class QualifiedSuperReference extends QualifiedThisReference {
-
- public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
- super(name, pos, sourceEnd);
- }
-
- public boolean isSuper() {
-
- return true;
- }
-
- public boolean isThis() {
-
- return false;
- }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- if ((this.bits & ParenthesizedMASK) != 0) {
- scope.problemReporter().invalidParenthesizedExpression(this);
- return null;
- }
- super.resolveType(scope);
- if (currentCompatibleType == null)
- return null; // error case
-
- if (scope.isJavaLangObject(currentCompatibleType)) {
- scope.problemReporter().cannotUseSuperInJavaLangObject(this);
- return null;
- }
- return this.resolvedType = currentCompatibleType.superclass();
- }
-
- public String toStringExpression() {
-
- return qualification.toString(0) + ".super"; //$NON-NLS-1$
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- qualification.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedThisReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedThisReference.java
deleted file mode 100644
index 321c41f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedThisReference.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class QualifiedThisReference extends ThisReference {
-
- public TypeReference qualification;
- ReferenceBinding currentCompatibleType;
-
- public QualifiedThisReference(TypeReference name, int sourceStart, int sourceEnd) {
- super(sourceStart, sourceEnd);
- qualification = name;
- this.sourceStart = name.sourceStart;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- return flowInfo;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- boolean valueRequired) {
-
- return flowInfo;
- }
-
- /**
- * Code generation for QualifiedThisReference
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// if (valueRequired) {
-// if ((bits & DepthMASK) != 0) {
-// Object[] emulationPath =
-// currentScope.getEmulationPath(this.currentCompatibleType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(emulationPath, this, this.currentCompatibleType, currentScope);
-// } else {
-// // nothing particular after all
-// codeStream.aload_0();
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- constant = NotAConstant;
- this.resolvedType = qualification.resolveType(scope);
- if (this.resolvedType == null) return null;
-
- // the qualification MUST exactly match some enclosing type name
- // Its possible to qualify 'this' by the name of the current class
- int depth = 0;
- this.currentCompatibleType = scope.referenceType().binding;
- while (this.currentCompatibleType != null
- && this.currentCompatibleType != this.resolvedType) {
- depth++;
- this.currentCompatibleType = this.currentCompatibleType.isStatic() ? null : this.currentCompatibleType.enclosingType();
- }
- bits &= ~DepthMASK; // flush previous depth if any
- bits |= (depth & 0xFF) << DepthSHIFT; // encoded depth into 8 bits
-
- if (this.currentCompatibleType == null) {
- scope.problemReporter().noSuchEnclosingInstance(this.resolvedType, this, false);
- return this.resolvedType;
- }
-
- // Ensure one cannot write code like: B() { super(B.this); }
- if (depth == 0) {
- checkAccess(scope.methodScope());
- } // if depth>0, path emulation will diagnose bad scenarii
- return this.resolvedType;
- }
-
- public String toStringExpression() {
-
- return qualification.toString(0) + ".this"; //$NON-NLS-1$
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- qualification.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedTypeReference.java
deleted file mode 100644
index fc4b45c..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedTypeReference.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class QualifiedTypeReference extends TypeReference {
- public char[][] tokens;
- public long[] sourcePositions;
-public QualifiedTypeReference(char[][] sources , long[] poss) {
- tokens = sources ;
- sourcePositions = poss ;
- sourceStart = (int) (sourcePositions[0]>>>32) ;
- sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
-}
-public QualifiedTypeReference(char[][] sources , TypeBinding type , long[] poss) {
- this(sources,poss);
- this.resolvedType = type;
-}
-public TypeReference copyDims(int dim){
- //return a type reference copy of me with some dimensions
- //warning : the new type ref has a null binding
-
- return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (this.resolvedType != null)
- return this.resolvedType;
- return scope.getType(tokens);
-}
-public char[][] getTypeName(){
-
- return tokens;
-}
-public StringBuffer printExpression(int indent, StringBuffer output) {
-
- for (int i = 0; i < tokens.length; i++) {
- if (i > 0) output.append('.');
- output.append(tokens[i]);
- }
- return output;
-}
-public String toStringExpression(int tab) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < tokens.length; i++) {
- buffer.append(tokens[i]);
- if (i < (tokens.length - 1)) {
- buffer.append("."); //$NON-NLS-1$
- }
- }
- return buffer.toString();
-}
-public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public void traverse(ASTVisitor visitor, ClassScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Reference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Reference.java
deleted file mode 100644
index cc3c4a0..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Reference.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-
-public abstract class Reference extends Expression {
-/**
- * BaseLevelReference constructor comment.
- */
-public Reference() {
- super();
-}
-public abstract FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound);
-
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return flowInfo;
-}
-public FieldBinding fieldBinding() {
- //this method should be sent one FIELD-tagged references
- // (ref.bits & BindingIds.FIELD != 0)()
- return null ;
-}
-//public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
-//
-// if (fieldBinding.isStatic()) {
-// if (valueRequired) {
-// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
-// codeStream.dup2();
-// } else {
-// codeStream.dup();
-// }
-// }
-// if (syntheticWriteAccessor == null) {
-// codeStream.putstatic(fieldBinding);
-// } else {
-// codeStream.invokestatic(syntheticWriteAccessor);
-// }
-// } else { // Stack: [owner][new field value] ---> [new field value][owner][new field value]
-// if (valueRequired) {
-// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
-// codeStream.dup2_x1();
-// } else {
-// codeStream.dup_x1();
-// }
-// }
-// if (syntheticWriteAccessor == null) {
-// codeStream.putfield(fieldBinding);
-// } else {
-// codeStream.invokestatic(syntheticWriteAccessor);
-// }
-// }
-//}
-//public abstract void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired);
-//
-//public abstract void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired);
-//
-//public abstract void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired);
-
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ReturnStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ReturnStatement.java
deleted file mode 100644
index 6ace7a6..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ReturnStatement.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ReturnStatement extends Statement {
- public Expression expression;
-
- public TypeBinding expressionType;
-
- public boolean isSynchronized;
-
- public ASTNode[] subroutines;
-
- public LocalVariableBinding saveValueVariable;
-
- public ReturnStatement(Expression expr, int s, int e) {
- sourceStart = s;
- sourceEnd = e;
- expression = expr;
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { // here requires to generate a
- // sequence of finally blocks
- // invocations depending
- // corresponding
- // to each of the traversed try statements, so that execution will terminate properly.
-
- // lookup the label, this should answer the returnContext
-
- if (expression != null) {
- flowInfo = expression.analyseCode(currentScope, flowContext, flowInfo);
- }
- // compute the return sequence (running the finally blocks)
- FlowContext traversedContext = flowContext;
- int subIndex = 0, maxSub = 5;
- boolean saveValueNeeded = false;
- boolean hasValueToSave = expression != null && expression.constant == NotAConstant;
- do {
- ASTNode sub;
- if ((sub = traversedContext.subRoutine()) != null) {
- if (this.subroutines == null) {
- this.subroutines = new ASTNode[maxSub];
- }
- if (subIndex == maxSub) {
- System.arraycopy(this.subroutines, 0, (this.subroutines = new ASTNode[maxSub *= 2]), 0, subIndex); // grow
- }
- this.subroutines[subIndex++] = sub;
- if (sub.cannotReturn()) {
- saveValueNeeded = false;
- break;
- }
- }
- traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
-
- ASTNode node = traversedContext.associatedNode;
-// if ((node = traversedContext.associatedNode) instanceof SynchronizedStatement) {
-// isSynchronized = true;
-//
-// } else
- if (node instanceof TryStatement) {
- TryStatement tryStatement = (TryStatement) node;
- flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
- if (hasValueToSave) {
- if (this.saveValueVariable == null) { // closest subroutine secret variable is used
- prepareSaveValueLocation(tryStatement);
- }
- saveValueNeeded = true;
- }
-
- } else if (traversedContext instanceof InitializationFlowContext) {
- currentScope.problemReporter().cannotReturnInInitializer(this);
- return FlowInfo.DEAD_END;
- }
- } while ((traversedContext = traversedContext.parent) != null);
-
- // resize subroutines
- if ((subroutines != null) && (subIndex != maxSub)) {
- System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
- }
-
- // secret local variable for return value (note that this can only occur in a real method)
- if (saveValueNeeded) {
- if (this.saveValueVariable != null) {
- this.saveValueVariable.useFlag = LocalVariableBinding.USED;
- }
- } else {
- this.saveValueVariable = null;
- if ((!isSynchronized) && (expressionType == BooleanBinding)) {
- this.expression.bits |= ValueForReturnMASK;
- }
- }
- return FlowInfo.DEAD_END;
- }
-
- /**
- * Retrun statement code generation
- *
- * generate the finallyInvocationSequence.
- *
- * @param currentScope
- * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream
- * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
- //public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- // if ((bits & IsReachableMASK) == 0) {
- // return;
- // }
- // int pc = codeStream.position;
- // // generate the expression
- // if ((expression != null) && (expression.constant == NotAConstant)) {
- // expression.generateCode(currentScope, codeStream, needValue()); // no value needed if non-returning subroutine
- // generateStoreSaveValueIfNecessary(codeStream);
- // }
- //
- // // generation of code responsible for invoking the finally blocks in sequence
- // if (subroutines != null) {
- // for (int i = 0, max = subroutines.length; i < max; i++) {
- // ASTNode sub;
- // if ((sub = subroutines[i]) instanceof SynchronizedStatement) {
- // codeStream.load(((SynchronizedStatement) sub).synchroVariable);
- // codeStream.monitorexit();
- // } else {
- // TryStatement trySub = (TryStatement) sub;
- // if (trySub.subRoutineCannotReturn) {
- // codeStream.goto_(trySub.subRoutineStartLabel);
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- // return;
- // } else {
- // codeStream.jsr(trySub.subRoutineStartLabel);
- // }
- // }
- // }
- // }
- // if (saveValueVariable != null) codeStream.load(saveValueVariable);
- //
- // if ((expression != null) && (expression.constant != NotAConstant)) {
- // codeStream.generateConstant(expression.constant, expression.implicitConversion);
- // generateStoreSaveValueIfNecessary(codeStream);
- // }
- // // output the suitable return bytecode or wrap the value inside a descriptor for doits
- // this.generateReturnBytecode(codeStream);
- //
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- //}
- /**
- * Dump the suitable return bytecode for a return statement
- *
- */
- //public void generateReturnBytecode(CodeStream codeStream) {
- //
- // if (expression == null) {
- // codeStream.return_();
- // } else {
- // switch (expression.implicitConversion >> 4) {
- // case T_boolean :
- // case T_int :
- // codeStream.ireturn();
- // break;
- // case T_float :
- // codeStream.freturn();
- // break;
- // case T_long :
- // codeStream.lreturn();
- // break;
- // case T_double :
- // codeStream.dreturn();
- // break;
- // default :
- // codeStream.areturn();
- // }
- // }
- //}
- //public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
- // if (saveValueVariable != null) codeStream.store(saveValueVariable, false);
- //}
- public boolean needValue() {
- return (subroutines == null) || (saveValueVariable != null) || isSynchronized;
- }
-
- public void prepareSaveValueLocation(TryStatement targetTryStatement) {
-
- this.saveValueVariable = targetTryStatement.secretReturnValue;
- }
-
- public void resolve(BlockScope scope) {
- MethodScope methodScope = scope.methodScope();
- MethodBinding methodBinding;
- TypeBinding methodType = (methodScope.referenceContext instanceof AbstractMethodDeclaration) ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null ? null
- : methodBinding.returnType)
- : VoidBinding;
- if (methodType == VoidBinding) {
- // the expression should be null
- if (expression == null)
- return;
- if ((expressionType = expression.resolveType(scope)) != null)
- scope.problemReporter().attemptToReturnNonVoidExpression(this, expressionType);
- return;
- }
- if (expression == null) {
- if (methodType != null)
- scope.problemReporter().shouldReturn(methodType, this);
- return;
- }
- if ((expressionType = expression.resolveType(scope)) == null)
- return;
-
- if (methodType != null && expression.isConstantValueOfTypeAssignableToType(expressionType, methodType)) {
- // dealing with constant
- expression.implicitWidening(methodType, expressionType);
- return;
- }
- if (expressionType == VoidBinding) {
- scope.problemReporter().attemptToReturnVoidValue(this);
- return;
- }
- if (methodType != null && expressionType.isCompatibleWith(methodType)) {
- expression.implicitWidening(methodType, expressionType);
- return;
- }
- if (methodType != null) {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionType, methodType);
- }
- }
-
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output).append("return "); //$NON-NLS-1$
- if (expression != null)
- expression.printExpression(0, output);
- return output.append(';');
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- s = s + "return "; //$NON-NLS-1$
- if (expression != null)
- s = s + expression.toStringExpression();
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- if (expression != null)
- expression.traverse(visitor, scope);
- }
- visitor.endVisit(this, scope);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleNameReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleNameReference.java
deleted file mode 100644
index 07b21c3..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleNameReference.java
+++ /dev/null
@@ -1,677 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ProblemFieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.VariableBinding;
-
-public class SingleNameReference extends NameReference implements OperatorIds {
- public char[] token;
-
- public MethodBinding[] syntheticAccessors; // [0]=read accessor [1]=write accessor
- public static final int READ = 0;
- public static final int WRITE = 1;
-
-public SingleNameReference(char[] source, long pos) {
- super();
- token = source;
- sourceStart = (int) (pos >>> 32);
- sourceEnd = (int) pos;
-}
-public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
-
- // compound assignment extra work
- if (isCompound) { // check the variable part is initialized if blank final
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isBlankFinal()
- && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
- if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
- currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
- }
- }
- manageSyntheticReadAccessIfNecessary(currentScope);
- break;
-// case LOCAL : // reading a local variable
-// // check if assigning a final blank field
-// LocalVariableBinding localBinding;
-// if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-// // we could improve error msg here telling "cannot use compound assignment on final local variable"
-// }
-// if (flowInfo.isReachable()) {
-// localBinding.useFlag = LocalVariableBinding.USED;
-// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-// }
- }
- }
- if (assignment.expression != null) {
- flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // assigning to a field
- manageSyntheticWriteAccessIfNecessary(currentScope);
-
- // check if assigning a final field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isFinal()) {
- // inside a context where allowed
- if (!isCompound && fieldBinding.isBlankFinal() && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
- if (flowInfo.isPotentiallyAssigned(fieldBinding)) {
- currentScope.problemReporter().duplicateInitializationOfBlankFinalField(fieldBinding, this);
- } else {
- flowContext.recordSettingFinal(fieldBinding, this);
- }
- flowInfo.markAsDefinitelyAssigned(fieldBinding);
- } else {
- currentScope.problemReporter().cannotAssignToFinalField(fieldBinding, this);
- }
- }
- break;
- case LOCAL : // assigning to a local variable
- LocalVariableBinding localBinding = (LocalVariableBinding) binding;
- if (!flowInfo.isDefinitelyAssigned(localBinding)){// for local variable debug attributes
- bits |= FirstAssignmentToLocalMASK;
- } else {
- bits &= ~FirstAssignmentToLocalMASK;
- }
- if (localBinding.isFinal()) {
- if ((bits & DepthMASK) == 0) {
- if (isCompound || !localBinding.isBlankFinal()){
- currentScope.problemReporter().cannotAssignToFinalLocal(localBinding, this);
- } else if (flowInfo.isPotentiallyAssigned(localBinding)) {
- currentScope.problemReporter().duplicateInitializationOfFinalLocal(localBinding, this);
- } else {
- flowContext.recordSettingFinal(localBinding, this);
- }
- } else {
- currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
- }
- }
- flowInfo.markAsDefinitelyAssigned(localBinding);
- }
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- return flowInfo;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return analyseCode(currentScope, flowContext, flowInfo, true);
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
-
- switch (bits & RestrictiveFlagMASK) {
- case FIELD : // reading a field
- if (valueRequired) {
- manageSyntheticReadAccessIfNecessary(currentScope);
- }
- // check if reading a final blank field
- FieldBinding fieldBinding;
- if ((fieldBinding = (FieldBinding) binding).isBlankFinal()
- && currentScope.allowBlankFinalFieldAssignment(fieldBinding)) {
- if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
- currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
- }
- }
- break;
-// case LOCAL : // reading a local variable
-// LocalVariableBinding localBinding;
-// if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-// currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-// }
-// if (flowInfo.isReachable()) {
-// localBinding.useFlag = LocalVariableBinding.USED;
-// } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-// localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-// }
- }
- if (valueRequired) {
- manageEnclosingInstanceAccessIfNecessary(currentScope);
- }
- return flowInfo;
-}
-public TypeBinding checkFieldAccess(BlockScope scope) {
-
- FieldBinding fieldBinding = (FieldBinding) binding;
-
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= FIELD;
- if (!((FieldBinding) binding).isStatic()) {
- // must check for the static status....
- if (scope.methodScope().isStatic) {
- scope.problemReporter().staticFieldAccessToNonStaticVariable(this, fieldBinding);
- constant = NotAConstant;
- return fieldBinding.type;
- }
- }
- constant = FieldReference.getConstantFor(fieldBinding, this, true, scope);
-
- if (isFieldUseDeprecated(fieldBinding, scope))
- scope.problemReporter().deprecatedField(fieldBinding, this);
-
- MethodScope ms = scope.methodScope();
- if ((this.bits & IsStrictlyAssignedMASK) == 0
- && ms.enclosingSourceType() == fieldBinding.declaringClass
- && ms.fieldDeclarationIndex != MethodScope.NotInFieldDecl
- && fieldBinding.id >= ms.fieldDeclarationIndex) {
- //if the field is static and ms is not .... then it is valid
- if (!fieldBinding.isStatic() || ms.isStatic)
- scope.problemReporter().forwardReference(this, 0, scope.enclosingSourceType());
- }
- //====================================================
-
- return fieldBinding.type;
-
-}
-//public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
-//
-// // optimizing assignment like: i = i + 1 or i = 1 + i
-// if (assignment.expression.isCompactableOperation()) {
-// BinaryExpression operation = (BinaryExpression) assignment.expression;
-// SingleNameReference variableReference;
-// if ((operation.left instanceof SingleNameReference) && ((variableReference = (SingleNameReference) operation.left).binding == binding)) {
-// // i = i + value, then use the variable on the right hand side, since it has the correct implicit conversion
-// variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.right, (operation.bits & OperatorMASK) >> OperatorSHIFT, operation.left.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
-// return;
-// }
-// int operator = (operation.bits & OperatorMASK) >> OperatorSHIFT;
-// if ((operation.right instanceof SingleNameReference)
-// && ((operator == PLUS) || (operator == MULTIPLY)) // only commutative operations
-// && ((variableReference = (SingleNameReference) operation.right).binding == binding)
-// && (operation.left.constant != NotAConstant) // exclude non constant expressions, since could have side-effect
-// && ((operation.left.implicitConversion >> 4) != T_String) // exclude string concatenation which would occur backwards
-// && ((operation.right.implicitConversion >> 4) != T_String)) { // exclude string concatenation which would occur backwards
-// // i = value + i, then use the variable on the right hand side, since it has the correct implicit conversion
-// variableReference.generateCompoundAssignment(currentScope, codeStream, syntheticAccessors == null ? null : syntheticAccessors[WRITE], operation.left, operator, operation.right.implicitConversion /*should be equivalent to no conversion*/, valueRequired);
-// return;
-// }
-// }
-// switch (bits & RestrictiveFlagMASK) {
-// case FIELD : // assigning to a field
-// FieldBinding fieldBinding;
-// if (!(fieldBinding = (FieldBinding) this.codegenBinding).isStatic()) { // need a receiver?
-// if ((bits & DepthMASK) != 0) {
-// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
-// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
-// } else {
-// this.generateReceiver(codeStream);
-// }
-// }
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion);
-// }
-// return;
-// case LOCAL : // assigning to a local variable
-// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
-// if (localBinding.resolvedPosition != -1) {
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// } else {
-// if (assignment.expression.constant != NotAConstant) {
-// // assigning an unused local to a constant value = no actual assignment is necessary
-// if (valueRequired) {
-// codeStream.generateConstant(assignment.expression.constant, assignment.implicitConversion);
-// }
-// } else {
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// /* Even though the value may not be required, we force it to be produced, and discard it later
-// on if it was actually not necessary, so as to provide the same behavior as JDK1.2beta3. */
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion); // implicit conversion
-// } else {
-// if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
-// codeStream.pop2();
-// } else {
-// codeStream.pop();
-// }
-// }
-// }
-// return;
-// }
-// // 26903, need extra cast to store null in array local var
-// if (localBinding.type.isArrayType()
-// && (assignment.expression.resolvedType == NullBinding // arrayLoc = null
-// || ((assignment.expression instanceof CastExpression) // arrayLoc = (type[])null
-// && (((CastExpression)assignment.expression).innermostCastedExpression().resolvedType == NullBinding)))){
-// codeStream.checkcast(localBinding.type);
-// }
-//
-// // normal local assignment (since cannot store in outer local which are final locations)
-// codeStream.store(localBinding, valueRequired);
-// if ((bits & FirstAssignmentToLocalMASK) != 0) { // for local variable debug attributes
-// localBinding.recordInitializationStartPC(codeStream.position);
-// }
-// // implicit conversion
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion);
-// }
-// }
-//}
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (constant != NotAConstant) {
-// if (valueRequired) {
-// codeStream.generateConstant(constant, implicitConversion);
-// }
-// } else {
-// switch (bits & RestrictiveFlagMASK) {
-// case FIELD : // reading a field
-// FieldBinding fieldBinding;
-// if (valueRequired) {
-// if ((fieldBinding = (FieldBinding) this.codegenBinding).constant == NotAConstant) { // directly use inlined value for constant fields
-// boolean isStatic;
-// if (!(isStatic = fieldBinding.isStatic())) {
-// if ((bits & DepthMASK) != 0) {
-// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
-// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
-// } else {
-// generateReceiver(codeStream);
-// }
-// }
-// // managing private access
-// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
-// if (isStatic) {
-// codeStream.getstatic(fieldBinding);
-// } else {
-// codeStream.getfield(fieldBinding);
-// }
-// } else {
-// codeStream.invokestatic(syntheticAccessors[READ]);
-// }
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else { // directly use the inlined value
-// codeStream.generateConstant(fieldBinding.constant, implicitConversion);
-// }
-// }
-// break;
-// case LOCAL : // reading a local
-// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
-// if (valueRequired) {
-// // outer local?
-// if ((bits & DepthMASK) != 0) {
-// // outer local can be reached either through a synthetic arg or a synthetic field
-// VariableBinding[] path = currentScope.getEmulationPath(localBinding);
-// codeStream.generateOuterAccess(path, this, localBinding, currentScope);
-// } else {
-// // regular local variable read
-// codeStream.load(localBinding);
-// }
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-///*
-// * Regular API for compound assignment, relies on the fact that there is only one reference to the
-// * variable, which carries both synthetic read/write accessors.
-// * The APIs with an extra argument is used whenever there are two references to the same variable which
-// * are optimized in one access: e.g "a = a + 1" optimized into "a++".
-// */
-//public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
-//
-// this.generateCompoundAssignment(
-// currentScope,
-// codeStream,
-// syntheticAccessors == null ? null : syntheticAccessors[WRITE],
-// expression,
-// operator,
-// assignmentImplicitConversion,
-// valueRequired);
-//}
-///*
-// * The APIs with an extra argument is used whenever there are two references to the same variable which
-// * are optimized in one access: e.g "a = a + 1" optimized into "a++".
-// */
-//public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, MethodBinding writeAccessor, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
-// switch (bits & RestrictiveFlagMASK) {
-// case FIELD : // assigning to a field
-// FieldBinding fieldBinding;
-// if ((fieldBinding = (FieldBinding) this.codegenBinding).isStatic()) {
-// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
-// codeStream.getstatic(fieldBinding);
-// } else {
-// codeStream.invokestatic(syntheticAccessors[READ]);
-// }
-// } else {
-// if ((bits & DepthMASK) != 0) {
-// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
-// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
-// } else {
-// codeStream.aload_0();
-// }
-// codeStream.dup();
-// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
-// codeStream.getfield(fieldBinding);
-// } else {
-// codeStream.invokestatic(syntheticAccessors[READ]);
-// }
-// }
-// break;
-// case LOCAL : // assigning to a local variable (cannot assign to outer local)
-// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
-// Constant assignConstant;
-// int increment;
-// // using incr bytecode if possible
-// switch (localBinding.type.id) {
-// case T_String :
-// codeStream.generateStringAppend(currentScope, this, expression);
-// if (valueRequired) {
-// codeStream.dup();
-// }
-// codeStream.store(localBinding, false);
-// return;
-// case T_int :
-// if (((assignConstant = expression.constant) != NotAConstant)
-// && (assignConstant.typeID() != T_float) // only for integral types
-// && (assignConstant.typeID() != T_double)
-// && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value
-// switch (operator) {
-// case PLUS :
-// codeStream.iinc(localBinding.resolvedPosition, increment);
-// if (valueRequired) {
-// codeStream.load(localBinding);
-// }
-// return;
-// case MINUS :
-// codeStream.iinc(localBinding.resolvedPosition, -increment);
-// if (valueRequired) {
-// codeStream.load(localBinding);
-// }
-// return;
-// }
-// }
-// default :
-// codeStream.load(localBinding);
-// }
-// }
-// // perform the actual compound operation
-// int operationTypeID;
-// if ((operationTypeID = implicitConversion >> 4) == T_String || operationTypeID == T_Object) {
-// // we enter here if the single name reference is a field of type java.lang.String or if the type of the
-// // operation is java.lang.Object
-// // For example: o = o + ""; // where the compiled type of o is java.lang.Object.
-// codeStream.generateStringAppend(currentScope, null, expression);
-// } else {
-// // promote the array reference to the suitable operation type
-// codeStream.generateImplicitConversion(implicitConversion);
-// // generate the increment value (will by itself be promoted to the operation value)
-// if (expression == IntLiteral.One){ // prefix operation
-// codeStream.generateConstant(expression.constant, implicitConversion);
-// } else {
-// expression.generateCode(currentScope, codeStream, true);
-// }
-// // perform the operation
-// codeStream.sendOperator(operator, operationTypeID);
-// // cast the value back to the array reference type
-// codeStream.generateImplicitConversion(assignmentImplicitConversion);
-// }
-// // store the result back into the variable
-// switch (bits & RestrictiveFlagMASK) {
-// case FIELD : // assigning to a field
-// fieldStore(codeStream, (FieldBinding) this.codegenBinding, writeAccessor, valueRequired);
-// return;
-// case LOCAL : // assigning to a local variable
-// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
-// if (valueRequired) {
-// if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
-// codeStream.dup2();
-// } else {
-// codeStream.dup();
-// }
-// }
-// codeStream.store(localBinding, false);
-// }
-//}
-//public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
-// switch (bits & RestrictiveFlagMASK) {
-// case FIELD : // assigning to a field
-// FieldBinding fieldBinding;
-// if ((fieldBinding = (FieldBinding) this.codegenBinding).isStatic()) {
-// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
-// codeStream.getstatic(fieldBinding);
-// } else {
-// codeStream.invokestatic(syntheticAccessors[READ]);
-// }
-// } else {
-// if ((bits & DepthMASK) != 0) {
-// ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
-// Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
-// codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
-// } else {
-// codeStream.aload_0();
-// }
-// codeStream.dup();
-// if ((syntheticAccessors == null) || (syntheticAccessors[READ] == null)) {
-// codeStream.getfield(fieldBinding);
-// } else {
-// codeStream.invokestatic(syntheticAccessors[READ]);
-// }
-// }
-// if (valueRequired) {
-// if (fieldBinding.isStatic()) {
-// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
-// codeStream.dup2();
-// } else {
-// codeStream.dup();
-// }
-// } else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
-// if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
-// codeStream.dup2_x1();
-// } else {
-// codeStream.dup_x1();
-// }
-// }
-// }
-// codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
-// codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id);
-// codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
-// fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], false);
-// return;
-// case LOCAL : // assigning to a local variable
-// LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
-// // using incr bytecode if possible
-// if (localBinding.type == IntBinding) {
-// if (valueRequired) {
-// codeStream.load(localBinding);
-// }
-// if (postIncrement.operator == PLUS) {
-// codeStream.iinc(localBinding.resolvedPosition, 1);
-// } else {
-// codeStream.iinc(localBinding.resolvedPosition, -1);
-// }
-// } else {
-// codeStream.load(localBinding);
-// if (valueRequired){
-// if ((localBinding.type == LongBinding) || (localBinding.type == DoubleBinding)) {
-// codeStream.dup2();
-// } else {
-// codeStream.dup();
-// }
-// }
-// codeStream.generateConstant(postIncrement.expression.constant, implicitConversion);
-// codeStream.sendOperator(postIncrement.operator, localBinding.type.id);
-// codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
-//
-// codeStream.store(localBinding, false);
-// }
-// }
-//}
-//public void generateReceiver(CodeStream codeStream) {
-// codeStream.aload_0();
-//}
-public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
-
- //If inlinable field, forget the access emulation, the code gen will directly target it
- if (((bits & DepthMASK) == 0) || (constant != NotAConstant)) return;
-
- if ((bits & RestrictiveFlagMASK) == LOCAL) {
- currentScope.emulateOuterAccess((LocalVariableBinding) binding);
- }
-}
-public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope) {
-
- //If inlinable field, forget the access emulation, the code gen will directly target it
- if (constant != NotAConstant)
- return;
-
- if ((bits & FIELD) != 0) {
- FieldBinding fieldBinding = (FieldBinding) binding;
- if (((bits & DepthMASK) != 0)
- && (fieldBinding.isPrivate() // private access
- || (fieldBinding.isProtected() // implicit protected access
- && fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()))) {
- if (syntheticAccessors == null)
- syntheticAccessors = new MethodBinding[2];
- syntheticAccessors[READ] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- return;
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- // and not from Object or implicit static field access.
-// if (fieldBinding.declaringClass != this.actualReceiverType
-// && !this.actualReceiverType.isArrayType()
-// && fieldBinding.declaringClass != null
-// && fieldBinding.constant == NotAConstant
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && !fieldBinding.isStatic()
-// && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
-// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
-// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);
-// }
- }
-}
-public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope) {
-
- if ((bits & FIELD) != 0) {
- FieldBinding fieldBinding = (FieldBinding) binding;
- if (((bits & DepthMASK) != 0)
- && (fieldBinding.isPrivate() // private access
- || (fieldBinding.isProtected() // implicit protected access
- && fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()))) {
- if (syntheticAccessors == null)
- syntheticAccessors = new MethodBinding[2];
- syntheticAccessors[WRITE] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
- return;
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- // and not from Object or implicit static field access.
-// if (fieldBinding.declaringClass != this.actualReceiverType
-// && !this.actualReceiverType.isArrayType()
-// && fieldBinding.declaringClass != null
-// && fieldBinding.constant == NotAConstant
-// && ((currentScope.environment().options.targetJDK >= CompilerOptions.JDK1_2
-// && !fieldBinding.isStatic()
-// && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
-// || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
-// this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);
-// }
- }
-}
-public TypeBinding reportError(BlockScope scope) {
- //=====error cases=======
- constant = Constant.NotAConstant;
- if (binding instanceof ProblemFieldBinding) {
- scope.problemReporter().invalidField(this, (FieldBinding) binding);
- } else if (binding instanceof ProblemReferenceBinding) {
- scope.problemReporter().invalidType(this, (TypeBinding) binding);
- } else {
- scope.problemReporter().unresolvableReference(this, binding);
- }
- return null;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // for code gen, harm the restrictiveFlag
-
- this.actualReceiverType = this.receiverType = scope.enclosingSourceType();
-
- if ((this.codegenBinding = this.binding = scope.getBinding(token, bits & RestrictiveFlagMASK, this)).isValidBinding()) {
- switch (bits & RestrictiveFlagMASK) {
- case VARIABLE : // =========only variable============
- case VARIABLE | TYPE : //====both variable and type============
- if (binding instanceof VariableBinding) {
- VariableBinding variable = (VariableBinding) binding;
- if (binding instanceof LocalVariableBinding) {
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= LOCAL;
- if ((this.bits & IsStrictlyAssignedMASK) == 0) {
- constant = variable.constant;
- } else {
- constant = NotAConstant;
- }
- if ((!variable.isFinal()) && ((bits & DepthMASK) != 0)) {
- scope.problemReporter().cannotReferToNonFinalOuterLocal((LocalVariableBinding)variable, this);
- }
- return this.resolvedType = variable.type;
- }
- // a field
- return this.resolvedType = checkFieldAccess(scope);
- }
-
- // thus it was a type
- bits &= ~RestrictiveFlagMASK; // clear bits
- bits |= TYPE;
- case TYPE : //========only type==============
- constant = Constant.NotAConstant;
- //deprecated test
- if (isTypeUseDeprecated((TypeBinding) binding, scope))
- scope.problemReporter().deprecatedType((TypeBinding) binding, this);
- return this.resolvedType = (TypeBinding) binding;
- }
- }
-
- // error scenarii
- return this.resolvedType = this.reportError(scope);
-}
-public StringBuffer printExpression(int indent, StringBuffer output){
-
- return output.append(token);
- }
-public String toStringExpression(){
-
- return new String(token);}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public String unboundReferenceErrorName(){
-
- return new String(token);}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleTypeReference.java
deleted file mode 100644
index b1f41b2..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleTypeReference.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class SingleTypeReference extends TypeReference {
- public char[] token;
-
-
-public SingleTypeReference(char[] source, long pos) {
- token = source;
- sourceStart = (int) (pos>>>32) ;
- sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
-
-}
-public SingleTypeReference(char[] source ,TypeBinding type, long pos) {
- this(source, pos) ;
- this.resolvedType = type ;
-}
-public TypeReference copyDims(int dim){
- //return a type reference copy of me with some dimensions
- //warning : the new type ref has a null binding
-
- return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (this.resolvedType != null)
- return this.resolvedType;
- return scope.getType(token);
-}
-public char [][] getTypeName() {
- return new char[][] { token };
-}
-public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
- ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
- if (!memberTb.isValidBinding()) {
- scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
- return null;
- }
- if (isTypeUseDeprecated(memberTb, scope))
- scope.problemReporter().deprecatedType(memberTb, this);
- return this.resolvedType = memberTb;
-}
-public StringBuffer printExpression(int indent, StringBuffer output){
-
- return output.append(token);
-}
-public String toStringExpression(int tab){
- return new String(token) ;
-}
-public void traverse(ASTVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public void traverse(ASTVisitor visitor, ClassScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Statement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Statement.java
deleted file mode 100644
index bcd71cb..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/Statement.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public abstract class Statement extends ASTNode {
-
- /**
- * Statement constructor comment.
- */
- public Statement() {
- super();
- }
-
- public abstract FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo);
-
-// public abstract void generateCode(BlockScope currentScope, CodeStream codeStream);
-
- public boolean isEmptyBlock() {
- return false;
- }
-
- public boolean isValidJavaStatement() {
- //the use of this method should be avoid in most cases
- //and is here mostly for documentation purpose.....
- //while the parser is responsable for creating
- //welled formed expression statement, which results
- //in the fact that java-non-semantic-expression-used-as-statement
- //should not be parsable...thus not being built.
- //It sounds like the java grammar as help the compiler job in removing
- //-by construction- some statement that would have no effect....
- //(for example all expression that may do side-effects are valid statement
- // -this is an appromative idea.....-)
-
- return true;
- }
- public StringBuffer print(int indent, StringBuffer output) {
- return printStatement(indent, output);
- }
- public abstract StringBuffer printStatement(int indent, StringBuffer output);
-
- public abstract void resolve(BlockScope scope);
-
- public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
- // statement within a switch that are not case are treated as normal statement....
-
- resolve(scope);
- return null;
- }
-
- public void resetStateForCodeGeneration() {
- }
-
- /**
- * INTERNAL USE ONLY.
- * Do nothing by default. This is used to redirect inter-statements jumps.
- */
- public void branchChainTo(Label label) {
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteral.java
deleted file mode 100644
index df8f307..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteral.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class StringLiteral extends Literal {
-
- char[] source;
-
- public StringLiteral(char[] token, int s, int e) {
-
- this(s, e);
- source = token;
- }
-
- public StringLiteral(int s, int e) {
-
- super(s, e);
- }
-
- public void computeConstant() {
-
- constant = Constant.fromValue(String.valueOf(source));
- }
-
-// public ExtendedStringLiteral extendWith(CharLiteral lit) {
-//
-// //add the lit source to mine, just as if it was mine
-// return new ExtendedStringLiteral(this, lit);
-// }
-
- public ExtendedStringLiteral extendWith(StringLiteral lit) {
-
- //add the lit source to mine, just as if it was mine
- return new ExtendedStringLiteral(this, lit);
- }
-
- /**
- * Code generation for string literal
- */
- // public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- //
- // int pc = codeStream.position;
- // if (valueRequired)
- // codeStream.ldc(constant.stringValue());
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- // }
- public TypeBinding literalType(BlockScope scope) {
-
- return scope.getJavaLangString();
- }
-
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- // handle some special char.....
- output.append('\"');
- for (int i = 0; i < source.length; i++) {
- switch (source[i]) {
- case '\b':
- output.append("\\b"); //$NON-NLS-1$
- break;
- case '\t':
- output.append("\\t"); //$NON-NLS-1$
- break;
- case '\n':
- output.append("\\n"); //$NON-NLS-1$
- break;
- case '\f':
- output.append("\\f"); //$NON-NLS-1$
- break;
- case '\r':
- output.append("\\r"); //$NON-NLS-1$
- break;
- case '\"':
- output.append("\\\""); //$NON-NLS-1$
- break;
- case '\'':
- output.append("\\'"); //$NON-NLS-1$
- break;
- case '\\': //take care not to display the escape as a potential real char
- output.append("\\\\"); //$NON-NLS-1$
- break;
- default:
- output.append(source[i]);
- }
- }
- output.append('\"');
- return output;
- }
-
- public char[] source() {
-
- return source;
- }
-
- public String toStringExpression() {
-
- // handle some special char.....
- StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
- for (int i = 0; i < source.length; i++) {
- switch (source[i]) {
- case '\b':
- result.append("\\b"); //$NON-NLS-1$
- break;
- case '\t':
- result.append("\\t"); //$NON-NLS-1$
- break;
- case '\n':
- result.append("\\n"); //$NON-NLS-1$
- break;
- case '\f':
- result.append("\\f"); //$NON-NLS-1$
- break;
- case '\r':
- result.append("\\r"); //$NON-NLS-1$
- break;
- case '\"':
- result.append("\\\""); //$NON-NLS-1$
- break;
- case '\'':
- result.append("\\'"); //$NON-NLS-1$
- break;
- case '\\': //take care not to display the escape as a potential real char
- result.append("\\\\"); //$NON-NLS-1$
- break;
- default:
- result.append(source[i]);
- }
- }
- result.append("\""); //$NON-NLS-1$
- return result.toString();
- }
-
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java
deleted file mode 100644
index 793d57c..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralDQ.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-/**
- *
- * double quoted string literal
- */
-public class StringLiteralDQ extends StringLiteral {
-
- public StringLiteralDQ(char[] token, int s, int e) {
- super(token, s, e);
- }
-
- public StringLiteralDQ(int s, int e) {
- super(s, e);
- }
-
- public String toStringExpression() {
-
- // handle some special char.....
- StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$
- for (int i = 0; i < source.length; i++) {
- switch (source[i]) {
- case '\b':
- result.append("\\b"); //$NON-NLS-1$
- break;
- case '\t':
- result.append("\\t"); //$NON-NLS-1$
- break;
- case '\n':
- result.append("\\n"); //$NON-NLS-1$
- break;
- case '\f':
- result.append("\\f"); //$NON-NLS-1$
- break;
- case '\r':
- result.append("\\r"); //$NON-NLS-1$
- break;
- case '\"':
- result.append("\\\""); //$NON-NLS-1$
- break;
- case '\'':
- result.append("\\'"); //$NON-NLS-1$
- break;
- case '\\': //take care not to display the escape as a potential real char
- result.append("\\\\"); //$NON-NLS-1$
- break;
- default:
- result.append(source[i]);
- }
- }
- result.append("\""); //$NON-NLS-1$
- return result.toString();
- }
-
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java
deleted file mode 100644
index bc862a9..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/StringLiteralSQ.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-/**
- *
- * single quoted string literal
- */
-public class StringLiteralSQ extends StringLiteral {
- public StringLiteralSQ(char[] token, int s, int e) {
- super(token, s, e);
- }
-
- public StringLiteralSQ(int s, int e) {
-
- super(s, e);
- }
-
- public String toStringExpression() {
-
- // handle some special char.....
- StringBuffer result = new StringBuffer("\'"); //$NON-NLS-1$
- for (int i = 0; i < source.length; i++) {
- switch (source[i]) {
- case '\b':
- result.append("\\b"); //$NON-NLS-1$
- break;
- case '\t':
- result.append("\\t"); //$NON-NLS-1$
- break;
- case '\n':
- result.append("\\n"); //$NON-NLS-1$
- break;
- case '\f':
- result.append("\\f"); //$NON-NLS-1$
- break;
- case '\r':
- result.append("\\r"); //$NON-NLS-1$
- break;
- case '\"':
- result.append("\\\""); //$NON-NLS-1$
- break;
- case '\'':
- result.append("\\'"); //$NON-NLS-1$
- break;
- case '\\': //take care not to display the escape as a potential real char
- result.append("\\\\"); //$NON-NLS-1$
- break;
- default:
- result.append(source[i]);
- }
- }
- result.append("\'"); //$NON-NLS-1$
- return result.toString();
- }
-
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SuperReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SuperReference.java
deleted file mode 100644
index 0eb6261..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SuperReference.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class SuperReference extends ThisReference {
-
-public SuperReference(int sourceStart, int sourceEnd) {
- super(sourceStart, sourceEnd);
-}
-public static ExplicitConstructorCall implicitSuperConstructorCall() {
- return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
-}
-public boolean isImplicitThis() {
-
- return false;
-}
-public boolean isSuper() {
-
- return true;
-}
-public boolean isThis() {
-
- return false ;
-}
-public TypeBinding resolveType(BlockScope scope) {
- constant = NotAConstant;
- if (!checkAccess(scope.methodScope()))
- return null;
- SourceTypeBinding enclosingTb = scope.enclosingSourceType();
- if (scope.isJavaLangObject(enclosingTb)) {
- scope.problemReporter().cannotUseSuperInJavaLangObject(this);
- return null;
- }
- return this.resolvedType = enclosingTb.superclass;
-}
-public String toStringExpression(){
-
- return "super"; //$NON-NLS-1$
-
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
- visitor.visit(this, blockScope);
- visitor.endVisit(this, blockScope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SwitchStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SwitchStatement.java
deleted file mode 100644
index 82dc2b3..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SwitchStatement.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.SwitchFlowContext;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class SwitchStatement extends Statement {
- public Expression expression;
- public Statement[] statements;
- public BlockScope scope;
- public int explicitDeclarations;
- public Label breakLabel;
- public CaseStatement[] cases;
- public DefaultCase defaultCase;
- public int caseCount = 0;
-
- // for local variables table attributes
- int preSwitchInitStateIndex = -1;
- int mergedInitStateIndex = -1;
- /**
- * SwitchStatement constructor comment.
- */
- public SwitchStatement() {
- super();
- }
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
- flowInfo = expression.analyseCode(currentScope, flowContext, flowInfo);
- SwitchFlowContext switchContext =
- new SwitchFlowContext(flowContext, this, (breakLabel = new Label()));
-
- // analyse the block by considering specially the case/default statements (need to bind them
- // to the entry point)
- FlowInfo caseInits = FlowInfo.DEAD_END;
- // in case of statements before the first case
- preSwitchInitStateIndex =
- currentScope.methodScope().recordInitializationStates(flowInfo);
- int caseIndex = 0;
- if (statements != null) {
- boolean didAlreadyComplain = false;
- for (int i = 0, max = statements.length; i < max; i++) {
- Statement statement = statements[i];
- if ((caseIndex < caseCount) && (statement == cases[caseIndex])) { // statement is a case
- caseIndex++;
- caseInits = caseInits.mergedWith(flowInfo.copy().unconditionalInits());
- didAlreadyComplain = false; // reset complaint
- } else if (statement == defaultCase) { // statement is the default case
- caseInits = caseInits.mergedWith(flowInfo.copy().unconditionalInits());
- didAlreadyComplain = false; // reset complaint
- }
- if (!caseInits.complainIfUnreachable(statement, scope, didAlreadyComplain)) {
- caseInits = statement.analyseCode(scope, switchContext, caseInits);
- } else {
- didAlreadyComplain = true;
- }
- }
- }
-
- // if no default case, then record it may jump over the block directly to the end
- if (defaultCase == null) {
- // only retain the potential initializations
- flowInfo.addPotentialInitializationsFrom(
- caseInits.mergedWith(switchContext.initsOnBreak));
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(flowInfo);
- return flowInfo;
- }
-
- // merge all branches inits
- FlowInfo mergedInfo = caseInits.mergedWith(switchContext.initsOnBreak);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
- /**
- * Switch code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-// int[] sortedIndexes = new int[caseCount];
-// int[] localKeysCopy;
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// // prepare the labels and constants
-// breakLabel.codeStream = codeStream;
-// CaseLabel[] caseLabels = new CaseLabel[caseCount];
-// int[] constants = new int[caseCount];
-// boolean needSwitch = caseCount != 0;
-// for (int i = 0; i < caseCount; i++) {
-// constants[i] = cases[i].constantExpression.constant.intValue();
-// cases[i].targetLabel = (caseLabels[i] = new CaseLabel(codeStream));
-// }
-//
-// // we sort the keys to be able to generate the code for tableswitch or lookupswitch
-// for (int i = 0; i < caseCount; i++) {
-// sortedIndexes[i] = i;
-// }
-// System.arraycopy(
-// constants,
-// 0,
-// (localKeysCopy = new int[caseCount]),
-// 0,
-// caseCount);
-// CodeStream.sort(localKeysCopy, 0, caseCount - 1, sortedIndexes);
-// CaseLabel defaultLabel = new CaseLabel(codeStream);
-// if (defaultCase != null) {
-// defaultCase.targetLabel = defaultLabel;
-// }
-// // generate expression testes
-// testExpression.generateCode(currentScope, codeStream, needSwitch);
-//
-// // generate the appropriate switch table/lookup bytecode
-// if (needSwitch) {
-// int max = localKeysCopy[caseCount - 1];
-// int min = localKeysCopy[0];
-// if ((long) (caseCount * 2.5) > ((long) max - (long) min)) {
-//
-// // work-around 1.3 VM bug, if max>0x7FFF0000, must use lookup bytecode
-// // see http://dev.eclipse.org/bugs/show_bug.cgi?id=21557
-// if (max > 0x7FFF0000 && currentScope.environment().options.complianceLevel < CompilerOptions.JDK1_4) {
-// codeStream.lookupswitch(defaultLabel, constants, sortedIndexes, caseLabels);
-//
-// } else {
-// codeStream.tableswitch(
-// defaultLabel,
-// min,
-// max,
-// constants,
-// sortedIndexes,
-// caseLabels);
-// }
-// } else {
-// codeStream.lookupswitch(defaultLabel, constants, sortedIndexes, caseLabels);
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// // generate the switch block statements
-// int caseIndex = 0;
-// if (statements != null) {
-// for (int i = 0, maxCases = statements.length; i < maxCases; i++) {
-// Statement statement = statements[i];
-// if ((caseIndex < caseCount)
-// && (statement == cases[caseIndex])) { // statements[i] is a case
-// if (preSwitchInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// preSwitchInitStateIndex);
-// caseIndex++;
-// }
-// } else {
-// if (statement == defaultCase) { // statements[i] is a case or a default case
-// if (preSwitchInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// preSwitchInitStateIndex);
-// }
-// }
-// }
-// statement.generateCode(scope, codeStream);
-// }
-// }
-// // place the trailing labels (for break and default case)
-// breakLabel.place();
-// if (defaultCase == null) {
-// defaultLabel.place();
-// }
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
-// }
-// if (scope != currentScope) {
-// codeStream.exitUserScope(scope);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
-
- public void resetStateForCodeGeneration() {
- if (this.breakLabel != null) {
- this.breakLabel.resetStateForCodeGeneration();
- }
- }
-
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output).append("switch ("); //$NON-NLS-1$
- expression.printExpression(0, output).append(") {"); //$NON-NLS-1$
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- output.append('\n');
- if (statements[i] instanceof CaseStatement) {
- statements[i].printStatement(indent, output);
- } else {
- statements[i].printStatement(indent+2, output);
- }
- }
- }
- output.append("\n"); //$NON-NLS-1$
- return printIndent(indent, output).append('}');
- }
- public void resolve(BlockScope upperScope) {
-
- TypeBinding testType = expression.resolveType(upperScope);
- if (testType == null)
- return;
- expression.implicitWidening(testType, testType);
- if (!(expression.isConstantValueOfTypeAssignableToType(testType, IntBinding))) {
- if (!testType.isCompatibleWith(IntBinding)) {
- upperScope.problemReporter().incorrectSwitchType(expression, testType);
- return;
- }
- }
- if (statements != null) {
- scope = explicitDeclarations == 0 ? upperScope : new BlockScope(upperScope);
- int length;
- // collection of cases is too big but we will only iterate until caseCount
- cases = new CaseStatement[length = statements.length];
- int[] casesValues = new int[length];
- int counter = 0;
- for (int i = 0; i < length; i++) {
- Constant cst;
- if ((cst = statements[i].resolveCase(scope, testType, this)) != null) {
- //----check for duplicate case statement------------
- if (cst != NotAConstant) {
- int key = cst.intValue();
- for (int j = 0; j < counter; j++) {
- if (casesValues[j] == key) {
- scope.problemReporter().duplicateCase((CaseStatement) statements[i], cst); //TODO: (philippe) could improve diagnosis to indicate colliding case
- }
- }
- casesValues[counter++] = key;
- }
- }
- }
- }
- }
- public String toString(int tab) {
-
- String inFront, s = tabString(tab);
- inFront = s;
- s = s + "switch (" + expression.toStringExpression() + ") "; //$NON-NLS-1$ //$NON-NLS-2$
- if (statements == null) {
- s = s + "{}"; //$NON-NLS-1$
- return s;
- } else
- s = s + "{"; //$NON-NLS-1$
- s = s
- + (explicitDeclarations != 0
- ? "// ---scope needed for " //$NON-NLS-1$
- + String.valueOf(explicitDeclarations)
- + " locals------------ \n"//$NON-NLS-1$
- : "// ---NO scope needed------ \n"); //$NON-NLS-1$
-
- int i = 0;
- String tabulation = " "; //$NON-NLS-1$
- try {
- while (true) {
- //use instanceof in order not to polluate classes with behavior only needed for printing purpose.
- if (statements[i] instanceof Expression)
- s = s + "\n" + inFront + tabulation; //$NON-NLS-1$
- if (statements[i] instanceof BreakStatement)
- s = s + statements[i].toString(0);
- else
- s = s + "\n" + statements[i].toString(tab + 2); //$NON-NLS-1$
- //=============
- if ((statements[i] instanceof CaseStatement)
- || (statements[i] instanceof DefaultCase)) {
- i++;
- while (!((statements[i] instanceof CaseStatement)
- || (statements[i] instanceof DefaultCase))) {
- if ((statements[i] instanceof Expression) || (statements[i] instanceof BreakStatement))
- s = s + statements[i].toString(0) + " ; "; //$NON-NLS-1$
- else
- s = s + "\n" + statements[i].toString(tab + 6) + " ; "; //$NON-NLS-1$ //$NON-NLS-2$
- i++;
- }
- } else {
- s = s + " ;"; //$NON-NLS-1$
- i++;
- }
- }
- } catch (IndexOutOfBoundsException e) {
- };
- s = s + "}"; //$NON-NLS-1$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- expression.traverse(visitor, scope);
- if (statements != null) {
- int statementsLength = statements.length;
- for (int i = 0; i < statementsLength; i++)
- statements[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- }
-
- /**
- * Dispatch the call on its last statement.
- */
- public void branchChainTo(Label label) {
-
- // in order to improve debug attributes for stepping (11431)
- // we want to inline the jumps to #breakLabel which already got
- // generated (if any), and have them directly branch to a better
- // location (the argument label).
- // we know at this point that the breakLabel already got placed
- if (this.breakLabel.hasForwardReferences()) {
- label.appendForwardReferencesFrom(this.breakLabel);
- }
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThisReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThisReference.java
deleted file mode 100644
index ab9190b..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThisReference.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ThisReference extends Reference {
-
- public static ThisReference implicitThis() {
-
- ThisReference implicitThis = new ThisReference(0, 0);
- implicitThis.bits |= IsImplicitThisMask;
- return implicitThis;
- }
-
- public ThisReference(int sourceStart, int sourceEnd) {
-
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- }
-
- /*
- * @see Reference#analyseAssignment(...)
- */
- public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment,
- boolean isCompound) {
-
- return flowInfo; // this cannot be assigned
- }
-
- public boolean checkAccess(MethodScope methodScope) {
-
- // this/super cannot be used in constructor call
- if (methodScope.isConstructorCall) {
- methodScope.problemReporter().fieldsOrThisBeforeConstructorInvocation(this);
- return false;
- }
-
- // static may not refer to this/super
- if (methodScope.isStatic) {
- methodScope.problemReporter().errorThisSuperInStatic(this);
- return false;
- }
- return true;
- }
-
- /*
- * @see Reference#generateAssignment(...)
- */
- // public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
- //
- // // this cannot be assigned
- // }
- //
- // public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- //
- // int pc = codeStream.position;
- // if (valueRequired)
- // codeStream.aload_0();
- // if ((this.bits & IsImplicitThisMask) == 0) codeStream.recordPositionsFrom(pc, this.sourceStart);
- // }
- //
- // /*
- // * @see Reference#generateCompoundAssignment(...)
- // */
- // public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int
- // assignmentImplicitConversion, boolean valueRequired) {
- //
- // // this cannot be assigned
- // }
- //
- // /*
- // * @see net.sourceforge.phpdt.internal.compiler.ast.Reference#generatePostIncrement()
- // */
- // public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean
- // valueRequired) {
- //
- // // this cannot be assigned
- // }
- public boolean isImplicitThis() {
-
- return (this.bits & IsImplicitThisMask) != 0;
- }
-
- public boolean isThis() {
-
- return true;
- }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- constant = NotAConstant;
- if (!this.isImplicitThis() && !checkAccess(scope.methodScope()))
- return null;
- return this.resolvedType = scope.enclosingSourceType();
- }
-
- public StringBuffer printExpression(int indent, StringBuffer output) {
-
- if (this.isImplicitThis())
- return output;
- return output.append("this"); //$NON-NLS-1$
- }
-
- public String toStringExpression() {
-
- if (this.isImplicitThis())
- return ""; //$NON-NLS-1$
- return "this"; //$NON-NLS-1$
- }
-
- public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
-
- visitor.visit(this, blockScope);
- visitor.endVisit(this, blockScope);
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThrowStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThrowStatement.java
deleted file mode 100644
index f2a0e5c..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/ThrowStatement.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ThrowStatement extends Statement {
- public Expression exception;
- public TypeBinding exceptionType;
-
- public ThrowStatement(Expression exception, int startPosition) {
- this.exception = exception;
- this.sourceStart = startPosition;
- this.sourceEnd = exception.sourceEnd;
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- exception.analyseCode(currentScope, flowContext, flowInfo);
- // need to check that exception thrown is actually caught somewhere
- flowContext.checkExceptionHandlers(exceptionType, this, flowInfo, currentScope);
- return FlowInfo.DEAD_END;
- }
-
- /**
- * Throw code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0)
-// return;
-// int pc = codeStream.position;
-// exception.generateCode(currentScope, codeStream, true);
-// codeStream.athrow();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public void resolve(BlockScope scope) {
-
- exceptionType = exception.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
-
-// if (exceptionType == NullBinding
-// && scope.environment().options.complianceLevel <= CompilerOptions.JDK1_3){
-// // if compliant with 1.4, this problem will not be reported
-// scope.problemReporter().cannotThrowNull(this);
-// }
- exception.implicitWidening(exceptionType, exceptionType);
- }
- public StringBuffer printStatement(int indent, StringBuffer output) {
-
- printIndent(indent, output).append("throw "); //$NON-NLS-1$
- exception.printExpression(0, output);
- return output.append(';');
- }
- public String toString(int tab) {
- String s = tabString(tab);
- s = s + "throw "; //$NON-NLS-1$
- s = s + exception.toStringExpression();
- return s;
- }
-
- public void traverse(ASTVisitor visitor, BlockScope blockScope) {
- if (visitor.visit(this, blockScope))
- exception.traverse(visitor, blockScope);
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TrueLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TrueLiteral.java
deleted file mode 100644
index 9aa700f..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TrueLiteral.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class TrueLiteral extends MagicLiteral {
- static final char[] source = {'t' , 'r' , 'u' , 'e'};
-public TrueLiteral(int s , int e) {
- super(s,e);
-}
-public void computeConstant() {
-
- constant = Constant.fromValue(true);}
-/**
- * Code generation for the true literal
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-// int pc = codeStream.position;
-// if (valueRequired)
-// codeStream.iconst_1();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-//public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, Label trueLabel, Label falseLabel, boolean valueRequired) {
-//
-// // trueLabel being not nil means that we will not fall through into the TRUE case
-//
-// int pc = codeStream.position;
-// // constant == true
-// if (valueRequired) {
-// if (falseLabel == null) {
-// // implicit falling through the FALSE case
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public TypeBinding literalType(BlockScope scope) {
- return BooleanBinding;
-}
-/**
- *
- */
-public char[] source() {
- return source;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TryStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TryStatement.java
deleted file mode 100644
index b2a2c71..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TryStatement.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.ExceptionHandlingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FinallyFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InsideSubRoutineFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class TryStatement extends Statement {
-
- public Block tryBlock;
- public Block[] catchBlocks;
- public Argument[] catchArguments;
- public Block finallyBlock;
- BlockScope scope;
-
- public boolean subRoutineCannotReturn = true;
- public UnconditionalFlowInfo subRoutineInits;
-
- // should rename into subRoutineComplete to be set to false by default
-
- ReferenceBinding[] caughtExceptionTypes;
- boolean tryBlockExit;
- boolean[] catchExits;
- public int[] preserveExceptionHandler;
-
- Label subRoutineStartLabel;
- public LocalVariableBinding anyExceptionVariable,
- returnAddressVariable,
- secretReturnValue;
-
- public final static char[] SecretReturnName = " returnAddress".toCharArray(); //$NON-NLS-1$
- public final static char[] SecretAnyHandlerName = " anyExceptionHandler".toCharArray(); //$NON-NLS-1$
- public static final char[] SecretLocalDeclarationName = " returnValue".toCharArray(); //$NON-NLS-1$
-
- // for local variables table attributes
- int preTryInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- // Consider the try block and catch block so as to compute the intersection of initializations and
- // the minimum exit relative depth amongst all of them. Then consider the subroutine, and append its
- // initialization to the try/catch ones, if the subroutine completes normally. If the subroutine does not
- // complete, then only keep this result for the rest of the analysis
-
- // process the finally block (subroutine) - create a context for the subroutine
-
- preTryInitStateIndex =
- currentScope.methodScope().recordInitializationStates(flowInfo);
-
- if (anyExceptionVariable != null) {
- anyExceptionVariable.useFlag = LocalVariableBinding.USED;
- }
- if (returnAddressVariable != null) {
- returnAddressVariable.useFlag = LocalVariableBinding.USED;
- }
- InsideSubRoutineFlowContext insideSubContext;
- FinallyFlowContext finallyContext;
- UnconditionalFlowInfo subInfo;
- if (subRoutineStartLabel == null) {
- // no finally block
- insideSubContext = null;
- finallyContext = null;
- subInfo = null;
- } else {
- // analyse finally block first
- insideSubContext = new InsideSubRoutineFlowContext(flowContext, this);
- subInfo =
- finallyBlock
- .analyseCode(
- currentScope,
- finallyContext = new FinallyFlowContext(flowContext, finallyBlock),
- flowInfo.copy())
- .unconditionalInits();
- if (subInfo.isReachable()) {
- subRoutineCannotReturn = false;
- }
- this.subRoutineInits = subInfo;
- }
- // process the try block in a context handling the local exceptions.
- ExceptionHandlingFlowContext handlingContext =
- new ExceptionHandlingFlowContext(
- insideSubContext == null ? flowContext : insideSubContext,
- tryBlock,
- caughtExceptionTypes,
- scope,
- flowInfo.unconditionalInits());
-
- FlowInfo tryInfo;
- if (tryBlock.statements == null) {
- tryInfo = flowInfo;
- tryBlockExit = false;
- } else {
- tryInfo = tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy());
- tryBlockExit = !tryInfo.isReachable();
- }
-
- // check unreachable catch blocks
-// handlingContext.complainIfUnusedExceptionHandlers(catchBlocks, scope, this);
-
- // process the catch blocks - computing the minimal exit depth amongst try/catch
- if (catchArguments != null) {
- int catchCount;
- catchExits = new boolean[catchCount = catchBlocks.length];
- for (int i = 0; i < catchCount; i++) {
- // keep track of the inits that could potentially have led to this exception handler (for final assignments diagnosis)
- FlowInfo catchInfo =
- flowInfo
- .copy()
- .unconditionalInits()
- .addPotentialInitializationsFrom(
- handlingContext.initsOnException(caughtExceptionTypes[i]).unconditionalInits())
- .addPotentialInitializationsFrom(tryInfo.unconditionalInits())
- .addPotentialInitializationsFrom(handlingContext.initsOnReturn);
-
- // catch var is always set
- catchInfo.markAsDefinitelyAssigned(catchArguments[i].binding);
- /*
- "If we are about to consider an unchecked exception handler, potential inits may have occured inside
- the try block that need to be detected , e.g.
- try { x = 1; throwSomething();} catch(Exception e){ x = 2} "
- "(uncheckedExceptionTypes notNil and: [uncheckedExceptionTypes at: index])
- ifTrue: [catchInits addPotentialInitializationsFrom: tryInits]."
- */
- // TODO: should only tag as unreachable if the catchblock cannot be reached
- //??? if (!handlingContext.initsOnException(caughtExceptionTypes[i]).isReachable()){
- if (tryBlock.statements == null) {
- catchInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- catchInfo =
- catchBlocks[i].analyseCode(
- currentScope,
- insideSubContext == null ? flowContext : insideSubContext,
- catchInfo);
- catchExits[i] = !catchInfo.isReachable();
- tryInfo = tryInfo.mergedWith(catchInfo.unconditionalInits());
- }
- }
- if (subRoutineStartLabel == null) {
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(tryInfo);
- return tryInfo;
- }
-
-
- // we also need to check potential multiple assignments of final variables inside the finally block
- // need to include potential inits from returns inside the try/catch parts - 1GK2AOF
- finallyContext.complainOnRedundantFinalAssignments(
- tryInfo.isReachable()
- ? (tryInfo.addPotentialInitializationsFrom(insideSubContext.initsOnReturn))
- : insideSubContext.initsOnReturn,
- currentScope);
- if (subInfo == FlowInfo.DEAD_END) {
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(subInfo);
- return subInfo;
- } else {
- FlowInfo mergedInfo = tryInfo.addInitializationsFrom(subInfo);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
- }
-
- public boolean cannotReturn() {
-
- return subRoutineCannotReturn;
- }
-
- /**
- * Try statement code generation
- *
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// if (tryBlock.isEmptyBlock()) {
-// if (subRoutineStartLabel != null) {
-// // since not passing the finallyScope, the block generation will exitUserScope(finallyScope)
-// finallyBlock.generateCode(scope, codeStream);
-// }
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// // no local bytecode produced so no need for position remembering
-// return;
-// }
-// int pc = codeStream.position;
-// Label endLabel = new Label(codeStream);
-// boolean requiresNaturalJsr = false;
-//
-// // preparing exception labels
-// int maxCatches;
-// ExceptionLabel[] exceptionLabels =
-// new ExceptionLabel[maxCatches =
-// catchArguments == null ? 0 : catchArguments.length];
-// for (int i = 0; i < maxCatches; i++) {
-// boolean preserveCurrentHandler =
-// (preserveExceptionHandler[i
-// / ExceptionHandlingFlowContext.BitCacheSize]
-// & (1 << (i % ExceptionHandlingFlowContext.BitCacheSize)))
-// != 0;
-// if (preserveCurrentHandler) {
-// exceptionLabels[i] =
-// new ExceptionLabel(
-// codeStream,
-// (ReferenceBinding) catchArguments[i].binding.type);
-// }
-// }
-// ExceptionLabel anyExceptionLabel = null;
-// if (subRoutineStartLabel != null) {
-// subRoutineStartLabel.codeStream = codeStream;
-// anyExceptionLabel = new ExceptionLabel(codeStream, null);
-// }
-// // generate the try block
-// tryBlock.generateCode(scope, codeStream);
-// boolean tryBlockHasSomeCode = codeStream.position != pc;
-// // flag telling if some bytecodes were issued inside the try block
-//
-// // natural exit: only if necessary
-// boolean nonReturningSubRoutine =
-// (subRoutineStartLabel != null) && subRoutineCannotReturn;
-// if ((!tryBlockExit) && tryBlockHasSomeCode) {
-// int position = codeStream.position;
-// if (nonReturningSubRoutine) {
-// codeStream.goto_(subRoutineStartLabel);
-// } else {
-// requiresNaturalJsr = true;
-// codeStream.goto_(endLabel);
-// }
-// codeStream.updateLastRecordedEndPC(position);
-// //goto is tagged as part of the try block
-// }
-// // place end positions of user-defined exception labels
-// if (tryBlockHasSomeCode) {
-// for (int i = 0; i < maxCatches; i++) {
-// boolean preserveCurrentHandler =
-// (preserveExceptionHandler[i / ExceptionHandlingFlowContext.BitCacheSize]
-// & (1 << (i % ExceptionHandlingFlowContext.BitCacheSize)))
-// != 0;
-// if (preserveCurrentHandler) {
-// exceptionLabels[i].placeEnd();
-// }
-// }
-// /* generate sequence of handler, all starting by storing the TOS (exception
-// thrown) into their own catch variables, the one specified in the source
-// that must denote the handled exception.
-// */
-// if (catchArguments == null) {
-// if (anyExceptionLabel != null) {
-// anyExceptionLabel.placeEnd();
-// }
-// } else {
-// for (int i = 0; i < maxCatches; i++) {
-// boolean preserveCurrentHandler =
-// (preserveExceptionHandler[i / ExceptionHandlingFlowContext.BitCacheSize]
-// & (1 << (i % ExceptionHandlingFlowContext.BitCacheSize)))
-// != 0;
-// if (preserveCurrentHandler) {
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (preTryInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// preTryInitStateIndex);
-// }
-// exceptionLabels[i].place();
-// codeStream.incrStackSize(1);
-// // optimizing the case where the exception variable is not actually used
-// LocalVariableBinding catchVar;
-// int varPC = codeStream.position;
-// if ((catchVar = catchArguments[i].binding).resolvedPosition != -1) {
-// codeStream.store(catchVar, false);
-// catchVar.recordInitializationStartPC(codeStream.position);
-// codeStream.addVisibleLocalVariable(catchVar);
-// } else {
-// codeStream.pop();
-// }
-// codeStream.recordPositionsFrom(varPC, catchArguments[i].sourceStart);
-// // Keep track of the pcs at diverging point for computing the local attribute
-// // since not passing the catchScope, the block generation will exitUserScope(catchScope)
-// catchBlocks[i].generateCode(scope, codeStream);
-// }
-// if (i == maxCatches - 1) {
-// if (anyExceptionLabel != null) {
-// anyExceptionLabel.placeEnd();
-// }
-// if (subRoutineStartLabel != null) {
-// if (!catchExits[i] && preserveCurrentHandler) {
-// requiresNaturalJsr = true;
-// codeStream.goto_(endLabel);
-// }
-// }
-// } else {
-// if (!catchExits[i] && preserveCurrentHandler) {
-// if (nonReturningSubRoutine) {
-// codeStream.goto_(subRoutineStartLabel);
-// } else {
-// requiresNaturalJsr = true;
-// codeStream.goto_(endLabel);
-// }
-// }
-// }
-// }
-// }
-// // addition of a special handler so as to ensure that any uncaught exception (or exception thrown
-// // inside catch blocks) will run the finally block
-// int finallySequenceStartPC = codeStream.position;
-// if (subRoutineStartLabel != null) {
-// // the additional handler is doing: jsr finallyBlock and rethrow TOS-exception
-// anyExceptionLabel.place();
-//
-// if (preTryInitStateIndex != -1) {
-// // reset initialization state, as for a normal catch block
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// preTryInitStateIndex);
-// }
-//
-// codeStream.incrStackSize(1);
-// if (nonReturningSubRoutine) {
-// codeStream.pop();
-// // "if subroutine cannot return, no need to jsr/jump to subroutine since it will be entered in sequence
-// } else {
-// codeStream.store(anyExceptionVariable, false);
-// codeStream.jsr(subRoutineStartLabel);
-// codeStream.load(anyExceptionVariable);
-// codeStream.athrow();
-// }
-// }
-// // end of catch sequence, place label that will correspond to the finally block beginning, or end of statement
-// endLabel.place();
-// if (subRoutineStartLabel != null) {
-// if (nonReturningSubRoutine) {
-// requiresNaturalJsr = false;
-// }
-// Label veryEndLabel = new Label(codeStream);
-// if (requiresNaturalJsr) {
-// codeStream.jsr(subRoutineStartLabel);
-// codeStream.goto_(veryEndLabel);
-// }
-// subRoutineStartLabel.place();
-// if (!nonReturningSubRoutine) {
-// codeStream.incrStackSize(1);
-// codeStream.store(returnAddressVariable, false);
-// }
-// codeStream.recordPositionsFrom(
-// finallySequenceStartPC,
-// finallyBlock.sourceStart);
-// // entire sequence for finally is associated to finally block
-// finallyBlock.generateCode(scope, codeStream);
-// if (!nonReturningSubRoutine) {
-// int position = codeStream.position;
-// codeStream.ret(returnAddressVariable.resolvedPosition);
-// codeStream.updateLastRecordedEndPC(position);
-// // the ret bytecode is part of the subroutine
-// }
-// if (requiresNaturalJsr) {
-// veryEndLabel.place();
-// }
-// }
-// } else {
-// // try block had no effect, only generate the body of the finally block if any
-// if (subRoutineStartLabel != null) {
-// finallyBlock.generateCode(scope, codeStream);
-// }
-// }
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public void resetStateForCodeGeneration() {
- if (this.subRoutineStartLabel != null) {
- this.subRoutineStartLabel.resetStateForCodeGeneration();
- }
- }
- public StringBuffer printStatement(int indent, StringBuffer output) {
- printIndent(indent, output).append("try \n"); //$NON-NLS-1$
- tryBlock.printStatement(indent + 1, output); //$NON-NLS-1$
-
- //catches
- if (catchBlocks != null)
- for (int i = 0; i < catchBlocks.length; i++) {
- output.append('\n');
- printIndent(indent, output).append("catch ("); //$NON-NLS-1$
- catchArguments[i].print(0, output).append(") "); //$NON-NLS-1$
- catchBlocks[i].printStatement(indent + 1, output);
- }
- //finally
- if (finallyBlock != null) {
- output.append('\n');
- printIndent(indent, output).append("finally\n"); //$NON-NLS-1$
- finallyBlock.printStatement(indent + 1, output);
- }
-
- return output;
- }
- public void resolve(BlockScope upperScope) {
-
- // special scope for secret locals optimization.
- this.scope = new BlockScope(upperScope);
-
- BlockScope tryScope = new BlockScope(scope);
- BlockScope finallyScope = null;
-
- if (finallyBlock != null
- && finallyBlock.statements != null) {
-
- finallyScope = new BlockScope(scope, false); // don't add it yet to parent scope
-
- // provision for returning and forcing the finally block to run
- MethodScope methodScope = scope.methodScope();
-
- // the type does not matter as long as it is not a base type
- this.returnAddressVariable =
- new LocalVariableBinding(SecretReturnName, upperScope.getJavaLangObject(), AccDefault, false);
- finallyScope.addLocalVariable(returnAddressVariable);
- this.returnAddressVariable.constant = NotAConstant; // not inlinable
- this.subRoutineStartLabel = new Label();
-
- this.anyExceptionVariable =
- new LocalVariableBinding(SecretAnyHandlerName, scope.getJavaLangThrowable(), AccDefault, false);
- finallyScope.addLocalVariable(this.anyExceptionVariable);
- this.anyExceptionVariable.constant = NotAConstant; // not inlinable
-
- if (!methodScope.isInsideInitializer()) {
- MethodBinding methodBinding =
- ((AbstractMethodDeclaration) methodScope.referenceContext).binding;
- if (methodBinding != null) {
- TypeBinding methodReturnType = methodBinding.returnType;
- if (methodReturnType.id != T_void) {
- this.secretReturnValue =
- new LocalVariableBinding(
- SecretLocalDeclarationName,
- methodReturnType,
- AccDefault,
- false);
- finallyScope.addLocalVariable(this.secretReturnValue);
- this.secretReturnValue.constant = NotAConstant; // not inlinable
- }
- }
- }
- finallyBlock.resolveUsing(finallyScope);
- // force the finally scope to have variable positions shifted after its try scope and catch ones
- finallyScope.shiftScopes = new BlockScope[catchArguments == null ? 1 : catchArguments.length+1];
- finallyScope.shiftScopes[0] = tryScope;
- }
- this.tryBlock.resolveUsing(tryScope);
-
- // arguments type are checked against JavaLangThrowable in resolveForCatch(..)
- if (this.catchBlocks != null) {
- int length = this.catchArguments.length;
- TypeBinding[] argumentTypes = new TypeBinding[length];
- for (int i = 0; i < length; i++) {
- BlockScope catchScope = new BlockScope(scope);
- if (finallyScope != null){
- finallyScope.shiftScopes[i+1] = catchScope;
- }
- // side effect on catchScope in resolveForCatch(..)
- if ((argumentTypes[i] = catchArguments[i].resolveForCatch(catchScope)) == null)
- return;
- catchBlocks[i].resolveUsing(catchScope);
- }
-
- // Verify that the catch clause are ordered in the right way:
- // more specialized first.
- this.caughtExceptionTypes = new ReferenceBinding[length];
- for (int i = 0; i < length; i++) {
- caughtExceptionTypes[i] = (ReferenceBinding) argumentTypes[i];
- for (int j = 0; j < i; j++) {
- if (caughtExceptionTypes[i].isCompatibleWith(argumentTypes[j])) {
- scope.problemReporter().wrongSequenceOfExceptionTypesError(this, i, j);
- // cannot return - since may still proceed if unreachable code is ignored (21203)
- }
- }
- }
- } else {
- caughtExceptionTypes = new ReferenceBinding[0];
- }
-
- if (finallyScope != null){
- // add finallyScope as last subscope, so it can be shifted behind try/catch subscopes.
- // the shifting is necessary to achieve no overlay in between the finally scope and its
- // sibling in term of local variable positions.
- this.scope.addSubscope(finallyScope);
- }
- }
-
- public String toString(int tab) {
- String s = tabString(tab);
- //try
- s = s + "try "; //$NON-NLS-1$
- if (tryBlock == Block.None)
- s = s + "{}"; //$NON-NLS-1$
- else
- s = s + "\n" + tryBlock.toString(tab + 1); //$NON-NLS-1$
-
- //catches
- if (catchBlocks != null)
- for (int i = 0; i < catchBlocks.length; i++)
- s = s + "\n" + tabString(tab) + "catch (" //$NON-NLS-2$ //$NON-NLS-1$
- +catchArguments[i].toString(0) + ") " //$NON-NLS-1$
- +catchBlocks[i].toString(tab + 1);
- //finally
- if (finallyBlock != null) {
- if (finallyBlock == Block.None)
- s = s + "\n" + tabString(tab) + "finally {}"; //$NON-NLS-2$ //$NON-NLS-1$
- else
- s = s + "\n" + tabString(tab) + "finally\n" + //$NON-NLS-2$ //$NON-NLS-1$
- finallyBlock.toString(tab + 1);
- }
-
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- tryBlock.traverse(visitor, scope);
- if (catchArguments != null) {
- for (int i = 0, max = catchBlocks.length; i < max; i++) {
- catchArguments[i].traverse(visitor, scope);
- catchBlocks[i].traverse(visitor, scope);
- }
- }
- if (finallyBlock != null)
- finallyBlock.traverse(visitor, scope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeDeclaration.java
deleted file mode 100644
index 7d566d3..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeDeclaration.java
+++ /dev/null
@@ -1,1089 +0,0 @@
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.core.compiler.CharOperation;
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.CompilationResult;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.InitializationFlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.UnconditionalFlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.LocalTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MemberTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.NestedTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-import net.sourceforge.phpdt.internal.compiler.parser.Parser;
-import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilationUnit;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
-import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
-import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
-
-public class TypeDeclaration extends Statement implements ProblemSeverities, ReferenceContext {
-
- public int modifiers;
-
- public int modifiersSourceStart;
-
- public char[] name;
-
- public TypeReference superclass;
-
- public TypeReference[] superInterfaces;
-
- public FieldDeclaration[] fields;
-
- public AbstractMethodDeclaration[] methods;
-
- public TypeDeclaration[] memberTypes;
-
- public SourceTypeBinding binding;
-
- public ClassScope scope;
-
- public MethodScope initializerScope;
-
- public MethodScope staticInitializerScope;
-
- public boolean ignoreFurtherInvestigation = false;
-
- public int maxFieldCount;
-
- public int declarationSourceStart;
-
- public int declarationSourceEnd;
-
- public int bodyStart;
-
- public int bodyEnd; // doesn't include the trailing comment if any.
-
- protected boolean hasBeenGenerated = false;
-
- public CompilationResult compilationResult;
-
- private MethodDeclaration[] missingAbstractMethods;
-
- public TypeDeclaration(CompilationResult compilationResult) {
- this.compilationResult = compilationResult;
- }
-
- /*
- * We cause the compilation task to abort to a given extent.
- */
- public void abort(int abortLevel) {
-
- if (scope == null) {
- throw new AbortCompilation(); // cannot do better
- }
-
- CompilationResult compilationResult = scope.referenceCompilationUnit().compilationResult;
-
- switch (abortLevel) {
- case AbortCompilation:
- throw new AbortCompilation(compilationResult);
- case AbortCompilationUnit:
- throw new AbortCompilationUnit(compilationResult);
- case AbortMethod:
- throw new AbortMethod(compilationResult);
- default:
- throw new AbortType(compilationResult);
- }
- }
-
- /**
- * This method is responsible for adding a method declaration to the type method collections. Note that this
- * implementation is inserting it in first place (as VAJ or javac), and that this impacts the behavior of the method
- * ConstantPool.resetForClinit(int. int), in so far as the latter will have to reset the constant pool state accordingly (if it
- * was added first, it does not need to preserve some of the method specific cached entries since this will be the first method).
- * inserts the clinit method declaration in the first position.
- *
- * @see net.sourceforge.phpdt.internal.compiler.codegen.ConstantPool#resetForClinit(int, int)
- */
- public final void addClinit() {
-
- //see comment on needClassInitMethod
- if (needClassInitMethod()) {
- int length;
- AbstractMethodDeclaration[] methods;
- if ((methods = this.methods) == null) {
- length = 0;
- methods = new AbstractMethodDeclaration[1];
- } else {
- length = methods.length;
- System.arraycopy(methods, 0, (methods = new AbstractMethodDeclaration[length + 1]), 1, length);
- }
- Clinit clinit = new Clinit(this.compilationResult);
- methods[0] = clinit;
- // clinit is added in first location, so as to minimize the use of ldcw (big consumer of constant inits)
- clinit.declarationSourceStart = clinit.sourceStart = sourceStart;
- clinit.declarationSourceEnd = clinit.sourceEnd = sourceEnd;
- clinit.bodyEnd = sourceEnd;
- this.methods = methods;
- }
- }
-
- /**
- * Flow analysis for a local innertype
- *
- */
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- if (ignoreFurtherInvestigation)
- return flowInfo;
- try {
- bits |= IsReachableMASK;
- LocalTypeBinding localType = (LocalTypeBinding) binding;
-
- localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
- manageEnclosingInstanceAccessIfNecessary(currentScope);
-
- updateMaxFieldCount(); // propagate down the max field count
- internalAnalyseCode(flowContext, flowInfo);
- } catch (AbortType e) {
- this.ignoreFurtherInvestigation = true;
- }
- return flowInfo;
- }
-
- /**
- * Flow analysis for a member innertype
- *
- */
- public void analyseCode(ClassScope enclosingClassScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- // propagate down the max field count
- updateMaxFieldCount();
- internalAnalyseCode(null, FlowInfo.initial(maxFieldCount));
- } catch (AbortType e) {
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- /**
- * Flow analysis for a local member innertype
- *
- */
- public void analyseCode(ClassScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- bits |= IsReachableMASK;
- LocalTypeBinding localType = (LocalTypeBinding) binding;
-
- localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
- manageEnclosingInstanceAccessIfNecessary(currentScope);
-
- updateMaxFieldCount(); // propagate down the max field count
- internalAnalyseCode(flowContext, flowInfo);
- } catch (AbortType e) {
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- /**
- * Flow analysis for a package member type
- *
- */
- public void analyseCode(CompilationUnitScope unitScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- internalAnalyseCode(null, FlowInfo.initial(maxFieldCount));
- } catch (AbortType e) {
- this.ignoreFurtherInvestigation = true;
- }
- }
-
- /*
- * Check for constructor vs. method with no return type. Answers true if at least one constructor is defined
- */
- public boolean checkConstructors(Parser parser) {
-
- //if a constructor has not the name of the type,
- //convert it into a method with 'null' as its return type
- boolean hasConstructor = false;
- if (methods != null) {
- for (int i = methods.length; --i >= 0;) {
- AbstractMethodDeclaration am;
- if ((am = methods[i]).isConstructor()) {
- if (!CharOperation.equals(am.selector, name)) {
- // the constructor was in fact a method with no return type
- // unless an explicit constructor call was supplied
- ConstructorDeclaration c = (ConstructorDeclaration) am;
- if ((c.constructorCall == null) || (c.constructorCall.isImplicitSuper())) { //changed to a method
- MethodDeclaration m = new MethodDeclaration(this.compilationResult);
- m.sourceStart = c.sourceStart;
- m.sourceEnd = c.sourceEnd;
- m.bodyStart = c.bodyStart;
- m.bodyEnd = c.bodyEnd;
- m.declarationSourceEnd = c.declarationSourceEnd;
- m.declarationSourceStart = c.declarationSourceStart;
- m.selector = c.selector;
- m.statements = c.statements;
- m.modifiers = c.modifiers;
- m.arguments = c.arguments;
- m.thrownExceptions = c.thrownExceptions;
- m.explicitDeclarations = c.explicitDeclarations;
- m.returnType = null;
- methods[i] = m;
- }
- } else {
- if (this.isInterface()) {
- // report the problem and continue the parsing
- parser.problemReporter().interfaceCannotHaveConstructors((ConstructorDeclaration) am);
- }
- hasConstructor = true;
- }
- }
- }
- }
- return hasConstructor;
- }
-
- public CompilationResult compilationResult() {
-
- return this.compilationResult;
- }
-
- public ConstructorDeclaration createsInternalConstructor(boolean needExplicitConstructorCall, boolean needToInsert) {
-
- //Add to method'set, the default constuctor that just recall the
- //super constructor with no arguments
- //The arguments' type will be positionned by the TC so just use
- //the default int instead of just null (consistency purpose)
-
- //the constructor
- ConstructorDeclaration constructor = new ConstructorDeclaration(this.compilationResult);
- constructor.isDefaultConstructor = true;
- constructor.selector = name;
- if (modifiers != AccDefault) {
- constructor.modifiers = ((this instanceof MemberTypeDeclaration) && (modifiers & AccPrivate) != 0) ? AccDefault : modifiers
- & AccVisibilityMASK;
- }
-
- //if you change this setting, please update the
- //SourceIndexer2.buildTypeDeclaration(TypeDeclaration,char[]) method
- constructor.declarationSourceStart = constructor.sourceStart = sourceStart;
- constructor.declarationSourceEnd = constructor.sourceEnd = constructor.bodyEnd = sourceEnd;
-
- //the super call inside the constructor
- if (needExplicitConstructorCall) {
- constructor.constructorCall = SuperReference.implicitSuperConstructorCall();
- constructor.constructorCall.sourceStart = sourceStart;
- constructor.constructorCall.sourceEnd = sourceEnd;
- }
-
- //adding the constructor in the methods list
- if (needToInsert) {
- if (methods == null) {
- methods = new AbstractMethodDeclaration[] { constructor };
- } else {
- AbstractMethodDeclaration[] newMethods;
- System.arraycopy(methods, 0, newMethods = new AbstractMethodDeclaration[methods.length + 1], 1, methods.length);
- newMethods[0] = constructor;
- methods = newMethods;
- }
- }
- return constructor;
- }
-
- /**
- * INTERNAL USE ONLY - Creates a fake method declaration for the corresponding binding. It is used to report errors for missing
- * abstract methods.
- */
- public MethodDeclaration addMissingAbstractMethodFor(MethodBinding methodBinding) {
- TypeBinding[] argumentTypes = methodBinding.parameters;
- int argumentsLength = argumentTypes.length;
- //the constructor
- MethodDeclaration methodDeclaration = new MethodDeclaration(this.compilationResult);
- methodDeclaration.selector = methodBinding.selector;
- methodDeclaration.sourceStart = sourceStart;
- methodDeclaration.sourceEnd = sourceEnd;
- methodDeclaration.modifiers = methodBinding.getAccessFlags() & ~AccAbstract;
-
- if (argumentsLength > 0) {
- String baseName = "arg";//$NON-NLS-1$
- Argument[] arguments = (methodDeclaration.arguments = new Argument[argumentsLength]);
- for (int i = argumentsLength; --i >= 0;) {
- arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /* type ref */, AccDefault);
- }
- }
-
- //adding the constructor in the methods list
- if (this.missingAbstractMethods == null) {
- this.missingAbstractMethods = new MethodDeclaration[] { methodDeclaration };
- } else {
- MethodDeclaration[] newMethods;
- System.arraycopy(this.missingAbstractMethods, 0, newMethods = new MethodDeclaration[this.missingAbstractMethods.length + 1],
- 1, this.missingAbstractMethods.length);
- newMethods[0] = methodDeclaration;
- this.missingAbstractMethods = newMethods;
- }
-
- //============BINDING UPDATE==========================
- methodDeclaration.binding = new MethodBinding(methodDeclaration.modifiers, //methodDeclaration
- methodBinding.selector, methodBinding.returnType, argumentsLength == 0 ? NoParameters : argumentTypes, //arguments bindings
- methodBinding.thrownExceptions, //exceptions
- binding); //declaringClass
-
- methodDeclaration.scope = new MethodScope(scope, methodDeclaration, true);
- methodDeclaration.bindArguments();
-
- /*
- * if (binding.methods == null) { binding.methods = new MethodBinding[] { methodDeclaration.binding }; } else { MethodBinding[]
- * newMethods; System.arraycopy( binding.methods, 0, newMethods = new MethodBinding[binding.methods.length + 1], 1,
- * binding.methods.length); newMethods[0] = methodDeclaration.binding; binding.methods = newMethods; }
- */
- //===================================================
- return methodDeclaration;
- }
-
- /*
- * Find the matching parse node, answers null if nothing found
- */
- public FieldDeclaration declarationOf(FieldBinding fieldBinding) {
-
- if (fieldBinding != null) {
- for (int i = 0, max = this.fields.length; i < max; i++) {
- FieldDeclaration fieldDecl;
- if ((fieldDecl = this.fields[i]).binding == fieldBinding)
- return fieldDecl;
- }
- }
- return null;
- }
-
- /*
- * Find the matching parse node, answers null if nothing found
- */
- public TypeDeclaration declarationOf(MemberTypeBinding memberTypeBinding) {
-
- if (memberTypeBinding != null) {
- for (int i = 0, max = this.memberTypes.length; i < max; i++) {
- TypeDeclaration memberTypeDecl;
- if ((memberTypeDecl = this.memberTypes[i]).binding == memberTypeBinding)
- return memberTypeDecl;
- }
- }
- return null;
- }
-
- /*
- * Find the matching parse node, answers null if nothing found
- */
- public AbstractMethodDeclaration declarationOf(MethodBinding methodBinding) {
-
- if (methodBinding != null) {
- for (int i = 0, max = this.methods.length; i < max; i++) {
- AbstractMethodDeclaration methodDecl;
-
- if ((methodDecl = this.methods[i]).binding == methodBinding)
- return methodDecl;
- }
- }
- return null;
- }
-
- /*
- * Finds the matching type amoung this type's member types. Returns null if no type with this name is found. The type name is a
- * compound name relative to this type eg. if this type is X and we're looking for Y.X.A.B then a type name would be {X, A, B}
- */
- public TypeDeclaration declarationOfType(char[][] typeName) {
-
- int typeNameLength = typeName.length;
- if (typeNameLength < 1 || !CharOperation.equals(typeName[0], this.name)) {
- return null;
- }
- if (typeNameLength == 1) {
- return this;
- }
- char[][] subTypeName = new char[typeNameLength - 1][];
- System.arraycopy(typeName, 1, subTypeName, 0, typeNameLength - 1);
- for (int i = 0; i < this.memberTypes.length; i++) {
- TypeDeclaration typeDecl = this.memberTypes[i].declarationOfType(subTypeName);
- if (typeDecl != null) {
- return typeDecl;
- }
- }
- return null;
- }
-
- /**
- * Generic bytecode generation for type
- */
- // public void generateCode(ClassFile enclosingClassFile) {
- //
- // if (hasBeenGenerated)
- // return;
- // hasBeenGenerated = true;
- // if (ignoreFurtherInvestigation) {
- // if (binding == null)
- // return;
- // ClassFile.createProblemType(
- // this,
- // scope.referenceCompilationUnit().compilationResult);
- // return;
- // }
- // try {
- // // create the result for a compiled type
- // ClassFile classFile = new ClassFile(binding, enclosingClassFile, false);
- // // generate all fiels
- // classFile.addFieldInfos();
- //
- // // record the inner type inside its own .class file to be able
- // // to generate inner classes attributes
- // if (binding.isMemberType())
- // classFile.recordEnclosingTypeAttributes(binding);
- // if (binding.isLocalType()) {
- // enclosingClassFile.recordNestedLocalAttribute(binding);
- // classFile.recordNestedLocalAttribute(binding);
- // }
- // if (memberTypes != null) {
- // for (int i = 0, max = memberTypes.length; i < max; i++) {
- // // record the inner type inside its own .class file to be able
- // // to generate inner classes attributes
- // classFile.recordNestedMemberAttribute(memberTypes[i].binding);
- // memberTypes[i].generateCode(scope, classFile);
- // }
- // }
- // // generate all methods
- // classFile.setForMethodInfos();
- // if (methods != null) {
- // for (int i = 0, max = methods.length; i < max; i++) {
- // methods[i].generateCode(scope, classFile);
- // }
- // }
- //
- // classFile.generateMissingAbstractMethods(this.missingAbstractMethods, scope.referenceCompilationUnit().compilationResult);
- //
- // // generate all methods
- // classFile.addSpecialMethods();
- //
- // if (ignoreFurtherInvestigation) { // trigger problem type generation for code gen errors
- // throw new AbortType(scope.referenceCompilationUnit().compilationResult);
- // }
- //
- // // finalize the compiled type result
- // classFile.addAttributes();
- // scope.referenceCompilationUnit().compilationResult.record(
- // binding.constantPoolName(),
- // classFile);
- // } catch (AbortType e) {
- // if (binding == null)
- // return;
- // ClassFile.createProblemType(
- // this,
- // scope.referenceCompilationUnit().compilationResult);
- // }
- // }
- /**
- * Bytecode generation for a local inner type (API as a normal statement code gen)
- */
- // public void generateCode(BlockScope blockScope, CodeStream codeStream) {
- //
- // if (hasBeenGenerated) return;
- // int pc = codeStream.position;
- // if (binding != null) ((NestedTypeBinding) binding).computeSyntheticArgumentSlotSizes();
- // generateCode(codeStream.classFile);
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- // }
- /**
- * Bytecode generation for a member inner type
- */
- // public void generateCode(ClassScope classScope, ClassFile enclosingClassFile) {
- //
- // if (hasBeenGenerated) return;
- // if (binding != null) ((NestedTypeBinding) binding).computeSyntheticArgumentSlotSizes();
- // generateCode(enclosingClassFile);
- // }
- /**
- * Bytecode generation for a package member
- */
- // public void generateCode(CompilationUnitScope unitScope) {
- //
- // generateCode((ClassFile) null);
- // }
- public boolean hasErrors() {
- return this.ignoreFurtherInvestigation;
- }
-
- /**
- * Common flow analysis for all types
- *
- */
- public void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) {
-
- if (this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
- if (!scope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
- scope.problemReporter().unusedPrivateType(this);
- }
- }
-
- ReferenceBinding[] defaultHandledExceptions = new ReferenceBinding[] { scope.getJavaLangThrowable() }; // tolerate any kind of
- // exception
- InitializationFlowContext initializerContext = new InitializationFlowContext(null, this, initializerScope);
- InitializationFlowContext staticInitializerContext = new InitializationFlowContext(null, this, staticInitializerScope);
- FlowInfo nonStaticFieldInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
- FlowInfo staticFieldInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
- if (fields != null) {
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldDeclaration field = fields[i];
- if (field.isStatic()) {
- /*
- * if (field.isField()){ staticInitializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2 }
- * else {
- */
- staticInitializerContext.handledExceptions = defaultHandledExceptions; // tolerate them all, and record them
- /* } */
- staticFieldInfo = field.analyseCode(staticInitializerScope, staticInitializerContext, staticFieldInfo);
- // in case the initializer is not reachable, use a reinitialized flowInfo and enter a fake reachable
- // branch, since the previous initializer already got the blame.
- if (staticFieldInfo == FlowInfo.DEAD_END) {
- staticInitializerScope.problemReporter().initializerMustCompleteNormally(field);
- staticFieldInfo = FlowInfo.initial(maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
- }
- } else {
- /*
- * if (field.isField()){ initializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2 } else {
- */
- initializerContext.handledExceptions = defaultHandledExceptions; // tolerate them all, and record them
- /* } */
- nonStaticFieldInfo = field.analyseCode(initializerScope, initializerContext, nonStaticFieldInfo);
- // in case the initializer is not reachable, use a reinitialized flowInfo and enter a fake reachable
- // branch, since the previous initializer already got the blame.
- if (nonStaticFieldInfo == FlowInfo.DEAD_END) {
- initializerScope.problemReporter().initializerMustCompleteNormally(field);
- nonStaticFieldInfo = FlowInfo.initial(maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
- }
- }
- }
- }
- if (memberTypes != null) {
- for (int i = 0, count = memberTypes.length; i < count; i++) {
- if (flowContext != null) { // local type
- memberTypes[i].analyseCode(scope, flowContext, nonStaticFieldInfo.copy());
- } else {
- memberTypes[i].analyseCode(scope);
- }
- }
- }
- if (methods != null) {
- UnconditionalFlowInfo outerInfo = flowInfo.copy().unconditionalInits().discardFieldInitializations();
- FlowInfo constructorInfo = nonStaticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(
- outerInfo);
- for (int i = 0, count = methods.length; i < count; i++) {
- AbstractMethodDeclaration method = methods[i];
- if (method.ignoreFurtherInvestigation)
- continue;
- if (method.isInitializationMethod()) {
- if (method.isStatic()) { //
- method.analyseCode(scope, staticInitializerContext, staticFieldInfo.unconditionalInits()
- .discardNonFieldInitializations().addInitializationsFrom(outerInfo));
- } else { // constructor
- method.analyseCode(scope, initializerContext, constructorInfo.copy());
- }
- } else { // regular method
- method.analyseCode(scope, null, flowInfo.copy());
- }
- }
- }
- }
-
- public boolean isInterface() {
-
- return (modifiers & AccInterface) != 0;
- }
-
- /*
- * Access emulation for a local type force to emulation of access to direct enclosing instance. By using the initializer scope, we
- * actually only request an argument emulation, the field is not added until actually used. However we will force allocations to
- * be qualified with an enclosing instance. 15.9.2
- */
- public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
-
- NestedTypeBinding nestedType = (NestedTypeBinding) binding;
-
- MethodScope methodScope = currentScope.methodScope();
- if (!methodScope.isStatic && !methodScope.isConstructorCall) {
-
- nestedType.addSyntheticArgumentAndField(binding.enclosingType());
- }
- // add superclass enclosing instance arg for anonymous types (if necessary)
- if (binding.isAnonymousType()) {
- ReferenceBinding superclass = binding.superclass;
- if (superclass.enclosingType() != null && !superclass.isStatic()) {
- if (!binding.superclass.isLocalType()
- || ((NestedTypeBinding) binding.superclass).getSyntheticField(superclass.enclosingType(), true) != null) {
-
- nestedType.addSyntheticArgument(superclass.enclosingType());
- }
- }
- }
- }
-
- /*
- * Access emulation for a local member type force to emulation of access to direct enclosing instance. By using the initializer
- * scope, we actually only request an argument emulation, the field is not added until actually used. However we will force
- * allocations to be qualified with an enclosing instance.
- *
- * Local member cannot be static.
- */
- public void manageEnclosingInstanceAccessIfNecessary(ClassScope currentScope) {
-
- NestedTypeBinding nestedType = (NestedTypeBinding) binding;
- nestedType.addSyntheticArgumentAndField(binding.enclosingType());
- }
-
- /**
- * A will be requested as soon as static fields or assertions are present. It will be eliminated during classfile creation
- * if no bytecode was actually produced based on some optimizations/compiler settings.
- */
- public final boolean needClassInitMethod() {
-
- // always need a when assertions are present
- if ((this.bits & AddAssertionMASK) != 0)
- return true;
- if (fields == null)
- return false;
- if (isInterface())
- return true; // fields are implicitly statics
- for (int i = fields.length; --i >= 0;) {
- FieldDeclaration field = fields[i];
- //need to test the modifier directly while there is no binding yet
- if ((field.modifiers & AccStatic) != 0)
- return true;
- }
- return false;
- }
-
- public void parseMethod(UnitParser parser, CompilationUnitDeclaration unit) {
-
- //connect method bodies
- if (unit.ignoreMethodBodies)
- return;
-
- // no scope were created, so cannot report further errors
- // if (binding == null)
- // return;
-
- //members
- if (memberTypes != null) {
- int length = memberTypes.length;
- for (int i = 0; i < length; i++)
- memberTypes[i].parseMethod(parser, unit);
- }
-
- //methods
- if (methods != null) {
- int length = methods.length;
- for (int i = 0; i < length; i++)
- methods[i].parseStatements(parser, unit);
- }
-
- //initializers
- if (fields != null) {
- int length = fields.length;
- for (int i = 0; i < length; i++) {
- if (fields[i] instanceof Initializer) {
- ((Initializer) fields[i]).parseStatements(parser, this, unit);
- }
- }
- }
- }
-
- public void resolve() {
-
- if (binding == null) {
- ignoreFurtherInvestigation = true;
- return;
- }
-
- try {
- // check superclass & interfaces
- if (binding.superclass != null) // watch out for Object ! (and other roots)
- if (isTypeUseDeprecated(binding.superclass, scope))
- scope.problemReporter().deprecatedType(binding.superclass, superclass);
- if (superInterfaces != null)
- for (int i = superInterfaces.length; --i >= 0;)
- if (superInterfaces[i].resolvedType != null)
- if (isTypeUseDeprecated(superInterfaces[i].resolvedType, scope))
- scope.problemReporter().deprecatedType(superInterfaces[i].resolvedType, superInterfaces[i]);
- maxFieldCount = 0;
- int lastFieldID = -1;
- if (fields != null) {
- for (int i = 0, count = fields.length; i < count; i++) {
- FieldDeclaration field = fields[i];
- if (field.isField()) {
- if (field.binding == null) {
- // still discover secondary errors
- if (field.initialization != null)
- field.initialization.resolve(field.isStatic() ? staticInitializerScope : initializerScope);
- ignoreFurtherInvestigation = true;
- continue;
- }
- maxFieldCount++;
- lastFieldID = field.binding.id;
- } else { // initializer
- ((Initializer) field).lastFieldID = lastFieldID + 1;
- }
- field.resolve(field.isStatic() ? staticInitializerScope : initializerScope);
- }
- }
- if (memberTypes != null) {
- for (int i = 0, count = memberTypes.length; i < count; i++) {
- memberTypes[i].resolve(scope);
- }
- }
- int missingAbstractMethodslength = this.missingAbstractMethods == null ? 0 : this.missingAbstractMethods.length;
- int methodsLength = this.methods == null ? 0 : methods.length;
- if ((methodsLength + missingAbstractMethodslength) > 0xFFFF) {
- scope.problemReporter().tooManyMethods(this);
- }
-
- if (methods != null) {
- for (int i = 0, count = methods.length; i < count; i++) {
- methods[i].resolve(scope);
- }
- }
- } catch (AbortType e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
- ;
- }
-
- public void resolve(BlockScope blockScope) {
- // local type declaration
-
- // need to build its scope first and proceed with binding's creation
- blockScope.addLocalType(this);
-
- // and TC....
- if (binding != null) {
- // remember local types binding for innerclass emulation propagation
- blockScope.referenceCompilationUnit().record((LocalTypeBinding) binding);
-
- // binding is not set if the receiver could not be created
- resolve();
- updateMaxFieldCount();
- }
- }
-
- public void resolve(ClassScope upperScope) {
- // member scopes are already created
- // request the construction of a binding if local member type
-
- if (binding != null && binding instanceof LocalTypeBinding) {
- // remember local types binding for innerclass emulation propagation
- upperScope.referenceCompilationUnit().record((LocalTypeBinding) binding);
- }
- resolve();
- updateMaxFieldCount();
- }
-
- public void resolve(CompilationUnitScope upperScope) {
- // top level : scope are already created
-
- resolve();
- updateMaxFieldCount();
- }
-
- public void tagAsHavingErrors() {
- ignoreFurtherInvestigation = true;
- }
-
- public StringBuffer print(int indent, StringBuffer output) {
-
- // if ((this.bits & IsAnonymousTypeMASK) == 0) {
- printIndent(indent, output);
- printHeader(0, output);
- // }
- return printBody(indent, output);
- }
-
- public StringBuffer printBody(int indent, StringBuffer output) {
-
- output.append(" {"); //$NON-NLS-1$
- if (memberTypes != null) {
- for (int i = 0; i < memberTypes.length; i++) {
- if (memberTypes[i] != null) {
- output.append('\n');
- memberTypes[i].print(indent + 1, output);
- }
- }
- }
- if (fields != null) {
- for (int fieldI = 0; fieldI < fields.length; fieldI++) {
- if (fields[fieldI] != null) {
- output.append('\n');
- fields[fieldI].print(indent + 1, output);
- }
- }
- }
- if (methods != null) {
- for (int i = 0; i < methods.length; i++) {
- if (methods[i] != null) {
- output.append('\n');
- methods[i].print(indent + 1, output);
- }
- }
- }
- output.append('\n');
- return printIndent(indent, output).append('}');
- }
-
- public StringBuffer printHeader(int indent, StringBuffer output) {
-
- printModifiers(this.modifiers, output);
- output.append(isInterface() ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$
- output.append(name);
- if (superclass != null) {
- output.append(" extends "); //$NON-NLS-1$
- superclass.print(0, output);
- }
- if (superInterfaces != null && superInterfaces.length > 0) {
- output.append(isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
- for (int i = 0; i < superInterfaces.length; i++) {
- if (i > 0)
- output.append(", "); //$NON-NLS-1$
- superInterfaces[i].print(0, output);
- }
- }
- return output;
- }
-
- public StringBuffer printStatement(int tab, StringBuffer output) {
- return print(tab, output);
- }
-
- public String toString(int tab) {
-
- return tabString(tab) + toStringHeader() + toStringBody(tab);
- }
-
- public String toStringBody(int tab) {
-
- String s = " {"; //$NON-NLS-1$
- if (memberTypes != null) {
- for (int i = 0; i < memberTypes.length; i++) {
- if (memberTypes[i] != null) {
- s += "\n" + memberTypes[i].toString(tab + 1); //$NON-NLS-1$
- }
- }
- }
- if (fields != null) {
- for (int fieldI = 0; fieldI < fields.length; fieldI++) {
- if (fields[fieldI] != null) {
- s += "\n" + fields[fieldI].toString(tab + 1); //$NON-NLS-1$
- if (fields[fieldI].isField())
- s += ";"; //$NON-NLS-1$
- }
- }
- }
- if (methods != null) {
- for (int i = 0; i < methods.length; i++) {
- if (methods[i] != null) {
- s += "\n" + methods[i].toString(tab + 1); //$NON-NLS-1$
- }
- }
- }
- s += "\n" + tabString(tab) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-
- public String toStringHeader() {
-
- String s = ""; //$NON-NLS-1$
- if (modifiers != AccDefault) {
- s += modifiersString(modifiers);
- }
- s += (isInterface() ? "interface " : "class ") + new String(name);//$NON-NLS-1$ //$NON-NLS-2$
- if (superclass != null)
- s += " extends " + superclass.toString(0); //$NON-NLS-1$
- if (superInterfaces != null && superInterfaces.length > 0) {
- s += (isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
- for (int i = 0; i < superInterfaces.length; i++) {
- s += superInterfaces[i].toString(0);
- if (i != superInterfaces.length - 1)
- s += ", "; //$NON-NLS-1$
- }
- ;
- }
- ;
- return s;
- }
-
- /**
- * Iteration for a local innertype
- *
- */
- public void traverse(ASTVisitor visitor, BlockScope blockScope) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, blockScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
- }
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- // local type cannot have static fields
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
-
- /**
- * Iteration for a member innertype
- *
- */
- public void traverse(ASTVisitor visitor, ClassScope classScope) {
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, classScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
- }
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
-
- /**
- * Iteration for a package member type
- *
- */
- public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, unitScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
- }
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
- }
- if (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
- FieldDeclaration field;
- if ((field = fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, unitScope);
- } catch (AbortType e) {
- }
- }
-
- /**
- * MaxFieldCount's computation is necessary so as to reserve space for the flow info field portions. It corresponds to the maximum
- * amount of fields this class or one of its innertypes have.
- *
- * During name resolution, types are traversed, and the max field count is recorded on the outermost type. It is then propagated
- * down during the flow analysis.
- *
- * This method is doing either up/down propagation.
- */
- void updateMaxFieldCount() {
-
- if (binding == null)
- return; // error scenario
- TypeDeclaration outerMostType = scope.outerMostClassScope().referenceType();
- if (maxFieldCount > outerMostType.maxFieldCount) {
- outerMostType.maxFieldCount = maxFieldCount; // up
- } else {
- maxFieldCount = outerMostType.maxFieldCount; // down
- }
- }
-}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeReference.java
deleted file mode 100644
index 0d28662..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/TypeReference.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public abstract class TypeReference extends Expression {
-
-public TypeReference() {
- super () ;
- }
-
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- return flowInfo;
-}
-
-// allows us to trap completion & selection nodes
-public void aboutToResolve(Scope scope) {}
-/*
- * Answer a base type reference (can be an array of base type).
- */
-//public static final TypeReference baseTypeReference(int baseType, int dim) {
-//
-// if (dim == 0) {
-// switch (baseType) {
-// case (T_void) :
-// return new SingleTypeReference(VoidBinding.simpleName, 0);
-// case (T_boolean) :
-// return new SingleTypeReference(BooleanBinding.simpleName, 0);
-// case (T_char) :
-// return new SingleTypeReference(CharBinding.simpleName, 0);
-// case (T_float) :
-// return new SingleTypeReference(FloatBinding.simpleName, 0);
-// case (T_double) :
-// return new SingleTypeReference(DoubleBinding.simpleName, 0);
-// case (T_byte) :
-// return new SingleTypeReference(ByteBinding.simpleName, 0);
-// case (T_short) :
-// return new SingleTypeReference(ShortBinding.simpleName, 0);
-// case (T_int) :
-// return new SingleTypeReference(IntBinding.simpleName, 0);
-// default : //T_long
-// return new SingleTypeReference(LongBinding.simpleName, 0);
-// }
-// }
-// switch (baseType) {
-// case (T_void) :
-// return new ArrayTypeReference(VoidBinding.simpleName, dim, 0);
-// case (T_boolean) :
-// return new ArrayTypeReference(BooleanBinding.simpleName, dim, 0);
-// case (T_char) :
-// return new ArrayTypeReference(CharBinding.simpleName, dim, 0);
-// case (T_float) :
-// return new ArrayTypeReference(FloatBinding.simpleName, dim, 0);
-// case (T_double) :
-// return new ArrayTypeReference(DoubleBinding.simpleName, dim, 0);
-// case (T_byte) :
-// return new ArrayTypeReference(ByteBinding.simpleName, dim, 0);
-// case (T_short) :
-// return new ArrayTypeReference(ShortBinding.simpleName, dim, 0);
-// case (T_int) :
-// return new ArrayTypeReference(IntBinding.simpleName, dim, 0);
-// default : //T_long
-// return new ArrayTypeReference(LongBinding.simpleName, dim, 0);
-// }
-//}
-public abstract TypeReference copyDims(int dim);
-public int dimensions() {
- return 0;
-}
-public abstract TypeBinding getTypeBinding(Scope scope);
-/**
- * @return char[][]
- */
-public abstract char [][] getTypeName() ;
-public boolean isTypeReference() {
- return true;
-}
-public TypeBinding resolveType(BlockScope scope) {
- // handle the error here
- constant = NotAConstant;
- if (this.resolvedType != null) { // is a shared type reference which was already resolved
- if (!this.resolvedType.isValidBinding())
- return null; // already reported error
- } else {
- this.resolvedType = getTypeBinding(scope);
- if (!this.resolvedType.isValidBinding()) {
- scope.problemReporter().invalidType(this, this.resolvedType);
- return null;
- }
- if (isTypeUseDeprecated(this.resolvedType, scope))
- scope.problemReporter().deprecatedType(this.resolvedType, this);
- }
- return this.resolvedType;
-}
-public abstract void traverse(ASTVisitor visitor, ClassScope classScope);
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/UnaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/UnaryExpression.java
deleted file mode 100644
index c46764e..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/UnaryExpression.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class UnaryExpression extends OperatorExpression {
-
- public Expression expression;
- public Constant optimizedBooleanConstant;
-
- public UnaryExpression(Expression expression, int operator) {
- this.expression = expression;
- this.bits |= operator << OperatorSHIFT; // encode operator
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- if (((bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
- return this.expression
- .analyseCode(currentScope, flowContext, flowInfo)
- .asNegatedCondition();
- } else {
- return this.expression.analyseCode(currentScope, flowContext, flowInfo);
- }
- }
-
- public Constant optimizedBooleanConstant() {
-
- return this.optimizedBooleanConstant == null
- ? this.constant
- : this.optimizedBooleanConstant;
- }
-
- /**
- * Code generation for an unary operation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
- */
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Label falseLabel, endifLabel;
-// if (this.constant != Constant.NotAConstant) {
-// // inlined value
-// if (valueRequired) {
-// codeStream.generateConstant(this.constant, this.implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
-// case NOT :
-// switch (this.expression.implicitConversion >> 4) /* runtime type */ {
-// case T_boolean :
-// // !
-// // Generate code for the condition
-// this.expression.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_0();
-// if (falseLabel.hasForwardReferences()) {
-// codeStream.goto_(endifLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_1();
-// endifLabel.place();
-// }
-// } else { // 6596: if (!(a && b)){} - must still place falseLabel
-// falseLabel.place();
-// }
-// break;
-// }
-// break;
-// case TWIDDLE :
-// switch (this.expression.implicitConversion >> 4 /* runtime */
-// ) {
-// case T_int :
-// // ~int
-// this.expression.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_m1();
-// codeStream.ixor();
-// }
-// break;
-// case T_long :
-// this.expression.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.ldc2_w(-1L);
-// codeStream.lxor();
-// }
-// }
-// break;
-// case MINUS :
-// // -
-// if (this.constant != NotAConstant) {
-// if (valueRequired) {
-// switch (this.expression.implicitConversion >> 4){ /* runtime */
-// case T_int :
-// codeStream.generateInlinedValue(this.constant.intValue() * -1);
-// break;
-// case T_float :
-// codeStream.generateInlinedValue(this.constant.floatValue() * -1.0f);
-// break;
-// case T_long :
-// codeStream.generateInlinedValue(this.constant.longValue() * -1L);
-// break;
-// case T_double :
-// codeStream.generateInlinedValue(this.constant.doubleValue() * -1.0);
-// }
-// }
-// } else {
-// this.expression.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// switch (expression.implicitConversion >> 4){ /* runtime type */
-// case T_int :
-// codeStream.ineg();
-// break;
-// case T_float :
-// codeStream.fneg();
-// break;
-// case T_long :
-// codeStream.lneg();
-// break;
-// case T_double :
-// codeStream.dneg();
-// }
-// }
-// }
-// break;
-// case PLUS :
-// this.expression.generateCode(currentScope, codeStream, valueRequired);
-// }
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(this.implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-//
-// /**
-// * Boolean operator code generation
-// * Optimized operations are: &&, ||, <, <=, >, >=, &, |, ^
-// */
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// if ((this.constant != Constant.NotAConstant) && (this.constant.typeID() == T_boolean)) {
-// super.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// }
-// if (((this.bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
-// this.expression.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// falseLabel,
-// trueLabel,
-// valueRequired);
-// } else {
-// super.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// }
-
- public TypeBinding resolveType(BlockScope scope) {
-
- TypeBinding expressionType = this.expression.resolveType(scope);
- if (expressionType == null) {
- this.constant = NotAConstant;
- return null;
- }
- int expressionId = expressionType.id;
- if (expressionId > 15) {
- this.constant = NotAConstant;
- scope.problemReporter().invalidOperator(this, expressionType);
- return null;
- }
-
- int tableId;
- switch ((bits & OperatorMASK) >> OperatorSHIFT) {
- case NOT :
- tableId = AND_AND;
- break;
- case TWIDDLE :
- tableId = LEFT_SHIFT;
- break;
- default :
- tableId = MINUS;
- } //+ and - cases
-
- // the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
- int result = ResolveTypeTables[tableId][(expressionId << 4) + expressionId];
- this.expression.implicitConversion = result >>> 12;
- this.bits |= result & 0xF;
- switch (result & 0xF) { // only switch on possible result type.....
- case T_boolean :
- this.resolvedType = BooleanBinding;
- break;
- case T_byte :
- this.resolvedType = ByteBinding;
- break;
- case T_char :
- this.resolvedType = CharBinding;
- break;
- case T_double :
- this.resolvedType = DoubleBinding;
- break;
- case T_float :
- this.resolvedType = FloatBinding;
- break;
- case T_int :
- this.resolvedType = IntBinding;
- break;
- case T_long :
- this.resolvedType = LongBinding;
- break;
- default : //error........
- this.constant = Constant.NotAConstant;
- if (expressionId != T_undefined)
- scope.problemReporter().invalidOperator(this, expressionType);
- return null;
- }
- // compute the constant when valid
- if (this.expression.constant != Constant.NotAConstant) {
- this.constant =
- Constant.computeConstantOperation(
- this.expression.constant,
- expressionId,
- (bits & OperatorMASK) >> OperatorSHIFT);
- } else {
- this.constant = Constant.NotAConstant;
- if (((bits & OperatorMASK) >> OperatorSHIFT) == NOT) {
- Constant cst = expression.optimizedBooleanConstant();
- if (cst != Constant.NotAConstant)
- this.optimizedBooleanConstant = Constant.fromValue(!cst.booleanValue());
- }
- }
- return this.resolvedType;
- }
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
-
- output.append(operatorToString()).append(' ');
- return this.expression.printExpression(0, output);
- }
- public String toStringExpressionNoParenthesis() {
-
- return operatorToString() + " " + this.expression.toStringExpression(); //$NON-NLS-1$
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- this.expression.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/WhileStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/WhileStatement.java
deleted file mode 100644
index 982efc1..0000000
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/WhileStatement.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package net.sourceforge.phpeclipse.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
-import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
-import net.sourceforge.phpdt.internal.compiler.flow.LoopingFlowContext;
-import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-
-public class WhileStatement extends Statement {
-
- public Expression condition;
- public Statement action;
- private Label breakLabel, continueLabel;
- int preCondInitStateIndex = -1;
- int condIfTrueInitStateIndex = -1;
- int mergedInitStateIndex = -1;
-
- public WhileStatement(Expression condition, Statement action, int s, int e) {
-
- this.condition = condition;
- this.action = action;
- sourceStart = s;
- sourceEnd = e;
- }
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- breakLabel = new Label();
- continueLabel = new Label();
-
- Constant cst = this.condition.constant;
- boolean isConditionTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isConditionFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- cst = this.condition.optimizedBooleanConstant();
- boolean isConditionOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isConditionOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
-
- preCondInitStateIndex =
- currentScope.methodScope().recordInitializationStates(flowInfo);
- LoopingFlowContext condLoopContext;
- FlowInfo postCondInfo =
- this.condition.analyseCode(
- currentScope,
- (condLoopContext =
- new LoopingFlowContext(flowContext, this, null, null, currentScope)),
- flowInfo);
-
- LoopingFlowContext loopingContext;
- FlowInfo actionInfo;
-// if (action == null
-// || (action.isEmptyBlock() && currentScope.environment().options.complianceLevel <= CompilerOptions.JDK1_3)) {
-// condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo);
-// if (isConditionTrue) {
-// return FlowInfo.DEAD_END;
-// } else {
-// FlowInfo mergedInfo = postCondInfo.initsWhenFalse().unconditionalInits();
-// if (isConditionOptimizedTrue){
-// mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
-// }
-// mergedInitStateIndex =
-// currentScope.methodScope().recordInitializationStates(mergedInfo);
-// return mergedInfo;
-// }
-// } else {
- // in case the condition was inlined to false, record the fact that there is no way to reach any
- // statement inside the looping action
- loopingContext =
- new LoopingFlowContext(
- flowContext,
- this,
- breakLabel,
- continueLabel,
- currentScope);
- if (isConditionFalse) {
- actionInfo = FlowInfo.DEAD_END;
- } else {
- actionInfo = postCondInfo.initsWhenTrue().copy();
- if (isConditionOptimizedFalse){
- actionInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- }
-
- // for computing local var attributes
- condIfTrueInitStateIndex =
- currentScope.methodScope().recordInitializationStates(
- postCondInfo.initsWhenTrue());
-
- if (!actionInfo.complainIfUnreachable(action, currentScope, false)) {
- actionInfo = action.analyseCode(currentScope, loopingContext, actionInfo);
- }
-
- // code generation can be optimized when no need to continue in the loop
- if (!actionInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
- continueLabel = null;
- } else {
- // TODO: (philippe) should simplify in one Loop context
- condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo);
- loopingContext.complainOnFinalAssignmentsInLoop(currentScope, actionInfo);
- }
-// }
-
- // infinite loop
- FlowInfo mergedInfo;
- if (isConditionOptimizedTrue) {
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(
- mergedInfo = loopingContext.initsOnBreak);
- return mergedInfo;
- }
-
- // end of loop: either condition false or break
- mergedInfo =
- postCondInfo.initsWhenFalse().unconditionalInits().mergedWith(
- loopingContext.initsOnBreak);
- if (isConditionOptimizedTrue && continueLabel == null){
- mergedInfo.setReachMode(FlowInfo.UNREACHABLE);
- }
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
- return mergedInfo;
- }
-
- /**
- * While code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- */
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// breakLabel.codeStream = codeStream;
-//
-// // generate condition
-// if (continueLabel == null) {
-// // no need to reverse condition
-// if (condition.constant == NotAConstant) {
-// condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// breakLabel,
-// true);
-// }
-// } else {
-// continueLabel.codeStream = codeStream;
-// if (!(((condition.constant != NotAConstant)
-// && (condition.constant.booleanValue() == true))
-// || (action == null)
-// || action.isEmptyBlock())) {
-// int jumpPC = codeStream.position;
-// codeStream.goto_(continueLabel);
-// codeStream.recordPositionsFrom(jumpPC, condition.sourceStart);
-// }
-// }
-// // generate the action
-// Label actionLabel;
-// (actionLabel = new Label(codeStream)).place();
-// if (action != null) {
-// // Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
-// if (condIfTrueInitStateIndex != -1) {
-// // insert all locals initialized inside the condition into the action generated prior to the condition
-// codeStream.addDefinitelyAssignedVariables(
-// currentScope,
-// condIfTrueInitStateIndex);
-// }
-// action.generateCode(currentScope, codeStream);
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (preCondInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// preCondInitStateIndex);
-// }
-//
-// }
-// // output condition and branch back to the beginning of the repeated action
-// if (continueLabel != null) {
-// continueLabel.place();
-// condition.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// actionLabel,
-// null,
-// true);
-// }
-// breakLabel.place();
-//
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public void resetStateForCodeGeneration() {
- if (this.breakLabel != null) {
- this.breakLabel.resetStateForCodeGeneration();
- }
- if (this.continueLabel != null) {
- this.continueLabel.resetStateForCodeGeneration();
- }
- }
- public StringBuffer printStatement(int tab, StringBuffer output) {
-
- printIndent(tab, output).append("while ("); //$NON-NLS-1$
- condition.printExpression(0, output).append(')');
- if (action == null)
- output.append(';');
- else
- action.printStatement(tab + 1, output);
- return output;
- }
- public void resolve(BlockScope scope) {
-
- TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
- if (action != null)
- action.resolve(scope);
- }
-
- public String toString(int tab) {
-
- String s = tabString(tab);
- s = s + "while (" + condition.toStringExpression() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- if (action == null)
- s = s + " {} ;"; //$NON-NLS-1$
- else if (action instanceof Block)
- s = s + "\n" + action.toString(tab + 1); //$NON-NLS-1$
- else
- s = s + " {\n" + action.toString(tab + 1) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
-
- if (visitor.visit(this, blockScope)) {
- condition.traverse(visitor, blockScope);
- if (action != null)
- action.traverse(visitor, blockScope);
- }
- visitor.endVisit(this, blockScope);
- }
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java
index 2de1ec7..7154b21 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java
@@ -29,6 +29,7 @@ import net.sourceforge.phpdt.core.ToolFactory;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
import net.sourceforge.phpdt.internal.compiler.DefaultErrorHandlingPolicies;
+import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
import net.sourceforge.phpdt.internal.compiler.parser.SyntaxError;
@@ -36,6 +37,8 @@ import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
import net.sourceforge.phpdt.internal.compiler.parser.VariableInfo;
import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
+import net.sourceforge.phpdt.internal.core.CompilationUnit;
+import net.sourceforge.phpdt.internal.core.SourceType;
import net.sourceforge.phpdt.internal.corext.template.php.JavaContext;
import net.sourceforge.phpdt.internal.corext.template.php.JavaContextType;
import net.sourceforge.phpdt.internal.ui.text.PHPCodeReader;
@@ -49,7 +52,6 @@ import net.sourceforge.phpdt.internal.ui.text.template.contentassist.TemplateEng
import net.sourceforge.phpdt.ui.IWorkingCopyManager;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
-import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
@@ -71,9 +73,6 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
-// import com.quantum.ExternalInterface;
-// import com.quantum.util.connection.NotConnectedException;
-
/**
* Example PHP completion processor.
*/
@@ -154,44 +153,40 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
}
};
- private class TableName {
- String fTableName;
-
- TableName() {
- fTableName = null;
- }
-
- /**
- * @return Returns the tableName.
- */
- public String getTableName() {
- if (fTableName == null) {
- return "";
- }
- return fTableName;
- }
-
- /**
- * @param tableName
- * The tableName to set.
- */
- public void setTableName(String tableName) {
- fTableName = tableName;
- }
- }
+// private class TableName {
+// String fTableName;
+//
+// TableName() {
+// fTableName = null;
+// }
+//
+// /**
+// * @return Returns the tableName.
+// */
+// public String getTableName() {
+// if (fTableName == null) {
+// return "";
+// }
+// return fTableName;
+// }
+//
+// /**
+// * @param tableName
+// * The tableName to set.
+// */
+// public void setTableName(String tableName) {
+// fTableName = tableName;
+// }
+// }
private char[] fProposalAutoActivationSet;
- protected IContextInformationValidator fValidator = null;// = new
-
- // Validator();
+ protected IContextInformationValidator fValidator = null;
private TemplateEngine fTemplateEngine;
private PHPCompletionProposalComparator fComparator;
- private int fNumberOfComputedResults = 0;
-
private IEditorPart fEditor;
protected IWorkingCopyManager fManager;
@@ -207,7 +202,7 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
/**
* Tells this processor to order the proposals alphabetically.
- *
+ *
* @param order
* true
if proposals should be ordered.
*/
@@ -218,7 +213,7 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
/**
* Sets this processor's set of characters triggering the activation of the
* completion proposal computation.
- *
+ *
* @param activationSet
* the activation set
*/
@@ -234,10 +229,11 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
return internalComputeCompletionProposals(viewer, documentOffset, contextInformationPosition);
}
- private int getLastToken(List list, ITextViewer viewer, int completionPosition, JavaContext context, TableName tableName) {
+ private int getLastToken(List list, ITextViewer viewer, int completionPosition, JavaContext context) {
+// TableName tableName) {
IDocument document = viewer.getDocument();
int start = context.getStart();
- int end = context.getEnd();
+// int end = context.getEnd();
String startText;
int lastSignificantToken = ITerminalSymbols.TokenNameEOF;
try {
@@ -266,7 +262,7 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
}
int token = ITerminalSymbols.TokenNameEOF;
// token = getLastSQLToken(startText);
- tableName.setTableName(getLastSQLTableName(startText));
+// tableName.setTableName(getLastSQLTableName(startText));
Scanner scanner = ToolFactory.createScanner(false, false, false);
scanner.setSource(startText.toCharArray());
scanner.setPHPMode(true);
@@ -336,184 +332,150 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
return "";
}
- private String getLastSQLTableName(String startText) {
- int token;
- // scan for sql identifiers
- char ch = ' ';
- int currentSQLPosition = startText.length();
- int identEnd = -1;
- String ident = null;
- boolean whiteSpace = true;
- try {
- while (true) {
- ch = startText.charAt(--currentSQLPosition);
- if (Scanner.isSQLIdentifierPart(ch)) {
- // if (ch >= 'A' && ch <= 'Z') {
- if (identEnd < 0) {
- identEnd = currentSQLPosition + 1;
- }
- // } else if (ch >= 'a' && ch <= 'z') {
- // if (identEnd < 0) {
- // identEnd = currentSQLPosition + 1;
- // }
- } else if (identEnd >= 0) {
- ident = startText.substring(currentSQLPosition + 1, identEnd);
- // select -- from -- where --
- // update -- set -- where --
- // insert into -- ( -- ) values ( -- )
- if (ident.length() >= 4 && ident.length() <= 6) {
- ident = ident.toLowerCase();
- switch (ident.length()) {
- // case 3 :
- // if (ident.equals("set")) {
- // // System.out.println("set");
- // token = ITerminalSymbols.TokenNameSQLset;
- // return token;
- // }
- // break;
- case 4:
- if (ident.equals("from")) {
- // System.out.println("from");
- token = ITerminalSymbols.TokenNameSQLfrom;
- return getSQLTableName(startText, identEnd);
- } else if (ident.equals("into")) {
- // System.out.println("into");
- token = ITerminalSymbols.TokenNameSQLinto;
- return getSQLTableName(startText, identEnd);
- }
- break;
- // case 5 :
- // if (ident.equals("where")) {
- // // System.out.println("where");
- // token = ITerminalSymbols.TokenNameSQLwhere;
- // return token;
- // }
- // break;
- case 6:
- // if (ident.equals("select")) {
- // // System.out.println("select");
- // token = ITerminalSymbols.TokenNameSQLselect;
- // return token;
- // } else if (ident.equals("insert")) {
- // // System.out.println("insert");
- // token = ITerminalSymbols.TokenNameSQLinsert;
- // return token;
- // } else
- if (ident.equals("update")) {
- // System.out.println("update");
- token = ITerminalSymbols.TokenNameSQLupdate;
- return getSQLTableName(startText, identEnd);
- }
- // else if (ident.equals("values")) {
- // // System.out.println("values");
- // token = ITerminalSymbols.TokenNameSQLvalues;
- // return token;
- // }
- break;
- }
- }
- whiteSpace = false;
- identEnd = -1;
- } else if (Character.isWhitespace(ch)) {
- } else {
- whiteSpace = false;
- }
- }
- } catch (IndexOutOfBoundsException e) {
- }
- return "";
- }
+// private String getLastSQLTableName(String startText) {
+// // scan for sql identifiers
+// char ch = ' ';
+// int currentSQLPosition = startText.length();
+// int identEnd = -1;
+// String ident = null;
+// try {
+// while (true) {
+// ch = startText.charAt(--currentSQLPosition);
+// if (Scanner.isSQLIdentifierPart(ch)) {
+// // if (ch >= 'A' && ch <= 'Z') {
+// if (identEnd < 0) {
+// identEnd = currentSQLPosition + 1;
+// }
+// // } else if (ch >= 'a' && ch <= 'z') {
+// // if (identEnd < 0) {
+// // identEnd = currentSQLPosition + 1;
+// // }
+// } else if (identEnd >= 0) {
+// ident = startText.substring(currentSQLPosition + 1, identEnd);
+// // select -- from -- where --
+// // update -- set -- where --
+// // insert into -- ( -- ) values ( -- )
+// if (ident.length() >= 4 && ident.length() <= 6) {
+// ident = ident.toLowerCase();
+// switch (ident.length()) {
+// // case 3 :
+// // if (ident.equals("set")) {
+// // // System.out.println("set");
+// // token = ITerminalSymbols.TokenNameSQLset;
+// // return token;
+// // }
+// // break;
+// case 4:
+// if (ident.equals("from")) {
+// // System.out.println("from");
+// return getSQLTableName(startText, identEnd);
+// } else if (ident.equals("into")) {
+// // System.out.println("into");
+// return getSQLTableName(startText, identEnd);
+// }
+// break;
+// case 6:
+// if (ident.equals("update")) {
+// // System.out.println("update");
+// return getSQLTableName(startText, identEnd);
+// }
+// break;
+// }
+// }
+// identEnd = -1;
+// } else if (Character.isWhitespace(ch)) {
+// }
+// }
+// } catch (IndexOutOfBoundsException e) {
+// }
+// return "";
+// }
/**
* Detect the last significant SQL token in the text before the completion
- *
+ *
* @param startText
*/
- private int getLastSQLToken(String startText) {
- int token;
- // scan for sql identifiers
- char ch = ' ';
- int currentSQLPosition = startText.length();
- int identEnd = -1;
- String ident = null;
- boolean whiteSpace = true;
- try {
- while (true) {
- ch = startText.charAt(--currentSQLPosition);
- if (ch >= 'A' && ch <= 'Z') {
- if (identEnd < 0) {
- identEnd = currentSQLPosition + 1;
- }
- } else if (ch >= 'a' && ch <= 'z') {
- if (identEnd < 0) {
- identEnd = currentSQLPosition + 1;
- }
- } else if (identEnd >= 0) {
- ident = startText.substring(currentSQLPosition + 1, identEnd);
- // select -- from -- where --
- // update -- set -- where --
- // insert into -- ( -- ) values ( -- )
- if (ident.length() >= 3 && ident.length() <= 6) {
- ident = ident.toLowerCase();
- switch (ident.length()) {
- case 3:
- if (ident.equals("set")) {
- // System.out.println("set");
- token = ITerminalSymbols.TokenNameSQLset;
- return token;
- }
- break;
- case 4:
- if (ident.equals("from")) {
- // System.out.println("from");
- token = ITerminalSymbols.TokenNameSQLfrom;
- // getSQLTableName();
- return token;
- } else if (ident.equals("into")) {
- // System.out.println("into");
- token = ITerminalSymbols.TokenNameSQLinto;
- return token;
- }
- break;
- case 5:
- if (ident.equals("where")) {
- // System.out.println("where");
- token = ITerminalSymbols.TokenNameSQLwhere;
- return token;
- }
- break;
- case 6:
- if (ident.equals("select")) {
- // System.out.println("select");
- token = ITerminalSymbols.TokenNameSQLselect;
- return token;
- } else if (ident.equals("insert")) {
- // System.out.println("insert");
- token = ITerminalSymbols.TokenNameSQLinsert;
- return token;
- } else if (ident.equals("update")) {
- // System.out.println("update");
- token = ITerminalSymbols.TokenNameSQLupdate;
- return token;
- } else if (ident.equals("values")) {
- // System.out.println("values");
- token = ITerminalSymbols.TokenNameSQLvalues;
- return token;
- }
- break;
- }
- }
- whiteSpace = false;
- identEnd = -1;
- } else if (Character.isWhitespace(ch)) {
- } else {
- whiteSpace = false;
- }
- }
- } catch (IndexOutOfBoundsException e) {
- }
- return ITerminalSymbols.TokenNameEOF;
- }
+// private int getLastSQLToken(String startText) {
+// int token;
+// // scan for sql identifiers
+// char ch = ' ';
+// int currentSQLPosition = startText.length();
+// int identEnd = -1;
+// String ident = null;
+// try {
+// while (true) {
+// ch = startText.charAt(--currentSQLPosition);
+// if (ch >= 'A' && ch <= 'Z') {
+// if (identEnd < 0) {
+// identEnd = currentSQLPosition + 1;
+// }
+// } else if (ch >= 'a' && ch <= 'z') {
+// if (identEnd < 0) {
+// identEnd = currentSQLPosition + 1;
+// }
+// } else if (identEnd >= 0) {
+// ident = startText.substring(currentSQLPosition + 1, identEnd);
+// // select -- from -- where --
+// // update -- set -- where --
+// // insert into -- ( -- ) values ( -- )
+// if (ident.length() >= 3 && ident.length() <= 6) {
+// ident = ident.toLowerCase();
+// switch (ident.length()) {
+// case 3:
+// if (ident.equals("set")) {
+// // System.out.println("set");
+// token = ITerminalSymbols.TokenNameSQLset;
+// return token;
+// }
+// break;
+// case 4:
+// if (ident.equals("from")) {
+// // System.out.println("from");
+// token = ITerminalSymbols.TokenNameSQLfrom;
+// // getSQLTableName();
+// return token;
+// } else if (ident.equals("into")) {
+// // System.out.println("into");
+// token = ITerminalSymbols.TokenNameSQLinto;
+// return token;
+// }
+// break;
+// case 5:
+// if (ident.equals("where")) {
+// // System.out.println("where");
+// token = ITerminalSymbols.TokenNameSQLwhere;
+// return token;
+// }
+// break;
+// case 6:
+// if (ident.equals("select")) {
+// // System.out.println("select");
+// token = ITerminalSymbols.TokenNameSQLselect;
+// return token;
+// } else if (ident.equals("insert")) {
+// // System.out.println("insert");
+// token = ITerminalSymbols.TokenNameSQLinsert;
+// return token;
+// } else if (ident.equals("update")) {
+// // System.out.println("update");
+// token = ITerminalSymbols.TokenNameSQLupdate;
+// return token;
+// } else if (ident.equals("values")) {
+// // System.out.println("values");
+// token = ITerminalSymbols.TokenNameSQLvalues;
+// return token;
+// }
+// break;
+// }
+// }
+// identEnd = -1;
+// }
+// }
+// } catch (IndexOutOfBoundsException e) {
+// }
+// return ITerminalSymbols.TokenNameEOF;
+// }
private ICompletionProposal[] internalComputeCompletionProposals(ITextViewer viewer, int offset, int contextOffset) {
ICompilationUnit unit = fManager.getWorkingCopy(fEditor.getEditorInput());
@@ -571,13 +533,13 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
// HashMap typeVariables = null;
HashMap unitVariables = null;
ICompilationUnit compilationUnit = (ICompilationUnit) context.findEnclosingElement(IJavaElement.COMPILATION_UNIT);
- // if (compilationUnit != null) {
- // unitVariables = ((CompilationUnit) compilationUnit).variables;
- // }
- // IType type = (IType) context.findEnclosingElement(IJavaElement.TYPE);
- // if (type != null) {
- // typeVariables = ((SourceType) type).variables;
- // }
+// if (compilationUnit != null) {
+// unitVariables = ((CompilationUnit) compilationUnit).variables;
+// }
+ IType type = (IType) context.findEnclosingElement(IJavaElement.TYPE);
+ if (type != null) {
+// typeVariables = ((SourceType) type).variables;
+ }
IMethod method = (IMethod) context.findEnclosingElement(IJavaElement.METHOD);
// if (method != null) {
// methodVariables = ((SourceMethod) method).variables;
@@ -586,9 +548,8 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
boolean emptyPrefix = prefix == null || prefix.equals("");
IPHPCompletionProposal[] localVariableResults = new IPHPCompletionProposal[0];
- if (!emptyPrefix && prefix.length() >= 1 && prefix.charAt(0) == '$') { // php
- // Variable
- // ?
+ if (!emptyPrefix && prefix.length() >= 1 && prefix.charAt(0) == '$') {
+ // php Variable ?
String lowerCasePrefix = prefix.toLowerCase();
HashSet localVariables = new HashSet();
if (compilationUnit != null) {
@@ -604,10 +565,10 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
}
}
- TableName sqlTable = new TableName();
+// TableName sqlTable = new TableName();
ArrayList list = new ArrayList();
list.add(null);
- int lastSignificantToken = getLastToken(list, viewer, offset, context, sqlTable);
+ int lastSignificantToken = getLastToken(list, viewer, offset, context); //, sqlTable);
boolean useClassMembers = (lastSignificantToken == ITerminalSymbols.TokenNameMINUS_GREATER)
|| (lastSignificantToken == ITerminalSymbols.TokenNameVariable) || (lastSignificantToken == ITerminalSymbols.TokenNamenew)
|| (lastSignificantToken == ITerminalSymbols.TokenNamethis_PHP_COMPLETION);
@@ -647,7 +608,6 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
if (info != null && info.typeIdentifier != null) {
typeRef = new String(info.typeIdentifier);
}
-
}
}
if (typeRef != null) {
@@ -668,7 +628,6 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
IPHPCompletionProposal[] builtinResults = new IPHPCompletionProposal[0];
if ((!useClassMembers) && syntaxbuffer != null) {
BuiltInEngine builtinEngine;
- String proposal;
JavaContextType contextType = (JavaContextType) PHPeclipsePlugin.getDefault().getTemplateContextRegistry().getContextType(
"php"); //$NON-NLS-1$
if (contextType != null) {
@@ -702,7 +661,7 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
System.arraycopy(localVariableResults, 0, total, templateResults.length + identifierResults.length + builtinResults.length
+ declarationResults.length, localVariableResults.length);
results = total;
- fNumberOfComputedResults = (results == null ? 0 : results.length);
+// fNumberOfComputedResults = (results == null ? 0 : results.length);
/*
* Order here and not in result collector to make sure that the order
* applies to all proposals and not just those of the compilation unit.
@@ -911,13 +870,13 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
// sqlList.add(new SQLProposal(columnNames[i], context, region, viewer,
// PHPUiImages.get(PHPUiImages.IMG_TABLE)));
// }
- //
+ //
// sqlResults = new IPHPCompletionProposal[sqlList.size()];
// for (int i = 0; i < sqlList.size(); i++) {
// sqlResults[i] = (SQLProposal) sqlList.get(i);
// }
// } catch (Exception /* NotConnectedException */ e) {
- //
+ //
// }
// // }
// }
--
1.7.1