Qt 4.8
Public Functions | Properties | List of all members
QDeclarativeRewrite::SharedBindingTester Class Reference

#include <qdeclarativerewrite_p.h>

Inheritance diagram for QDeclarativeRewrite::SharedBindingTester:
QDeclarativeJS::AST::Visitor

Public Functions

bool isSharable (const QString &code)
 
bool isSharable (AST::Node *Node)
 
virtual bool visit (AST::FunctionDeclaration *)
 
virtual bool visit (AST::FunctionExpression *)
 
virtual bool visit (AST::CallExpression *)
 

Properties

bool _sharable
 

Additional Inherited Members

- Protected Functions inherited from QDeclarativeJS::AST::Visitor
virtual void endVisit (UiProgram *)
 
virtual void endVisit (UiImportList *)
 
virtual void endVisit (UiImport *)
 
virtual void endVisit (UiPublicMember *)
 
virtual void endVisit (UiSourceElement *)
 
virtual void endVisit (UiObjectDefinition *)
 
virtual void endVisit (UiObjectInitializer *)
 
virtual void endVisit (UiObjectBinding *)
 
virtual void endVisit (UiScriptBinding *)
 
virtual void endVisit (UiArrayBinding *)
 
virtual void endVisit (UiObjectMemberList *)
 
virtual void endVisit (UiArrayMemberList *)
 
virtual void endVisit (UiQualifiedId *)
 
virtual void endVisit (UiSignature *)
 
virtual void endVisit (UiFormalList *)
 
virtual void endVisit (UiFormal *)
 
virtual void endVisit (ThisExpression *)
 
virtual void endVisit (IdentifierExpression *)
 
virtual void endVisit (NullExpression *)
 
virtual void endVisit (TrueLiteral *)
 
virtual void endVisit (FalseLiteral *)
 
virtual void endVisit (StringLiteral *)
 
virtual void endVisit (NumericLiteral *)
 
virtual void endVisit (RegExpLiteral *)
 
virtual void endVisit (ArrayLiteral *)
 
virtual void endVisit (ObjectLiteral *)
 
virtual void endVisit (ElementList *)
 
virtual void endVisit (Elision *)
 
virtual void endVisit (PropertyNameAndValueList *)
 
virtual void endVisit (NestedExpression *)
 
virtual void endVisit (IdentifierPropertyName *)
 
virtual void endVisit (StringLiteralPropertyName *)
 
virtual void endVisit (NumericLiteralPropertyName *)
 
virtual void endVisit (ArrayMemberExpression *)
 
virtual void endVisit (FieldMemberExpression *)
 
virtual void endVisit (NewMemberExpression *)
 
virtual void endVisit (NewExpression *)
 
virtual void endVisit (CallExpression *)
 
virtual void endVisit (ArgumentList *)
 
virtual void endVisit (PostIncrementExpression *)
 
virtual void endVisit (PostDecrementExpression *)
 
virtual void endVisit (DeleteExpression *)
 
virtual void endVisit (VoidExpression *)
 
virtual void endVisit (TypeOfExpression *)
 
virtual void endVisit (PreIncrementExpression *)
 
virtual void endVisit (PreDecrementExpression *)
 
virtual void endVisit (UnaryPlusExpression *)
 
virtual void endVisit (UnaryMinusExpression *)
 
virtual void endVisit (TildeExpression *)
 
virtual void endVisit (NotExpression *)
 
virtual void endVisit (BinaryExpression *)
 
virtual void endVisit (ConditionalExpression *)
 
virtual void endVisit (Expression *)
 
virtual void endVisit (Block *)
 
virtual void endVisit (StatementList *)
 
virtual void endVisit (VariableStatement *)
 
virtual void endVisit (VariableDeclarationList *)
 
virtual void endVisit (VariableDeclaration *)
 
virtual void endVisit (EmptyStatement *)
 
virtual void endVisit (ExpressionStatement *)
 
virtual void endVisit (IfStatement *)
 
virtual void endVisit (DoWhileStatement *)
 
virtual void endVisit (WhileStatement *)
 
virtual void endVisit (ForStatement *)
 
virtual void endVisit (LocalForStatement *)
 
virtual void endVisit (ForEachStatement *)
 
virtual void endVisit (LocalForEachStatement *)
 
virtual void endVisit (ContinueStatement *)
 
virtual void endVisit (BreakStatement *)
 
virtual void endVisit (ReturnStatement *)
 
virtual void endVisit (WithStatement *)
 
virtual void endVisit (SwitchStatement *)
 
virtual void endVisit (CaseBlock *)
 
virtual void endVisit (CaseClauses *)
 
virtual void endVisit (CaseClause *)
 
virtual void endVisit (DefaultClause *)
 
virtual void endVisit (LabelledStatement *)
 
virtual void endVisit (ThrowStatement *)
 
virtual void endVisit (TryStatement *)
 
virtual void endVisit (Catch *)
 
virtual void endVisit (Finally *)
 
virtual void endVisit (FunctionDeclaration *)
 
virtual void endVisit (FunctionExpression *)
 
virtual void endVisit (FormalParameterList *)
 
virtual void endVisit (FunctionBody *)
 
virtual void endVisit (Program *)
 
virtual void endVisit (SourceElements *)
 
virtual void endVisit (FunctionSourceElement *)
 
virtual void endVisit (StatementSourceElement *)
 
virtual void endVisit (DebuggerStatement *)
 
virtual void postVisit (Node *)
 
virtual bool preVisit (Node *)
 
virtual bool visit (UiProgram *)
 
virtual bool visit (UiImportList *)
 
virtual bool visit (UiImport *)
 
virtual bool visit (UiPublicMember *)
 
virtual bool visit (UiSourceElement *)
 
virtual bool visit (UiObjectDefinition *)
 
virtual bool visit (UiObjectInitializer *)
 
virtual bool visit (UiObjectBinding *)
 
virtual bool visit (UiScriptBinding *)
 
virtual bool visit (UiArrayBinding *)
 
virtual bool visit (UiObjectMemberList *)
 
virtual bool visit (UiArrayMemberList *)
 
virtual bool visit (UiQualifiedId *)
 
virtual bool visit (UiSignature *)
 
virtual bool visit (UiFormalList *)
 
virtual bool visit (UiFormal *)
 
virtual bool visit (ThisExpression *)
 
virtual bool visit (IdentifierExpression *)
 
virtual bool visit (NullExpression *)
 
virtual bool visit (TrueLiteral *)
 
virtual bool visit (FalseLiteral *)
 
virtual bool visit (StringLiteral *)
 
virtual bool visit (NumericLiteral *)
 
virtual bool visit (RegExpLiteral *)
 
virtual bool visit (ArrayLiteral *)
 
virtual bool visit (ObjectLiteral *)
 
virtual bool visit (ElementList *)
 
virtual bool visit (Elision *)
 
virtual bool visit (PropertyNameAndValueList *)
 
virtual bool visit (NestedExpression *)
 
virtual bool visit (IdentifierPropertyName *)
 
virtual bool visit (StringLiteralPropertyName *)
 
virtual bool visit (NumericLiteralPropertyName *)
 
virtual bool visit (ArrayMemberExpression *)
 
virtual bool visit (FieldMemberExpression *)
 
virtual bool visit (NewMemberExpression *)
 
virtual bool visit (NewExpression *)
 
virtual bool visit (ArgumentList *)
 
virtual bool visit (PostIncrementExpression *)
 
virtual bool visit (PostDecrementExpression *)
 
virtual bool visit (DeleteExpression *)
 
virtual bool visit (VoidExpression *)
 
virtual bool visit (TypeOfExpression *)
 
virtual bool visit (PreIncrementExpression *)
 
virtual bool visit (PreDecrementExpression *)
 
virtual bool visit (UnaryPlusExpression *)
 
virtual bool visit (UnaryMinusExpression *)
 
virtual bool visit (TildeExpression *)
 
virtual bool visit (NotExpression *)
 
virtual bool visit (BinaryExpression *)
 
virtual bool visit (ConditionalExpression *)
 
virtual bool visit (Expression *)
 
virtual bool visit (Block *)
 
virtual bool visit (StatementList *)
 
virtual bool visit (VariableStatement *)
 
virtual bool visit (VariableDeclarationList *)
 
virtual bool visit (VariableDeclaration *)
 
virtual bool visit (EmptyStatement *)
 
virtual bool visit (ExpressionStatement *)
 
virtual bool visit (IfStatement *)
 
virtual bool visit (DoWhileStatement *)
 
virtual bool visit (WhileStatement *)
 
virtual bool visit (ForStatement *)
 
virtual bool visit (LocalForStatement *)
 
virtual bool visit (ForEachStatement *)
 
virtual bool visit (LocalForEachStatement *)
 
virtual bool visit (ContinueStatement *)
 
virtual bool visit (BreakStatement *)
 
virtual bool visit (ReturnStatement *)
 
virtual bool visit (WithStatement *)
 
virtual bool visit (SwitchStatement *)
 
virtual bool visit (CaseBlock *)
 
virtual bool visit (CaseClauses *)
 
virtual bool visit (CaseClause *)
 
virtual bool visit (DefaultClause *)
 
virtual bool visit (LabelledStatement *)
 
virtual bool visit (ThrowStatement *)
 
virtual bool visit (TryStatement *)
 
virtual bool visit (Catch *)
 
virtual bool visit (Finally *)
 
virtual bool visit (FormalParameterList *)
 
virtual bool visit (FunctionBody *)
 
virtual bool visit (Program *)
 
virtual bool visit (SourceElements *)
 
virtual bool visit (FunctionSourceElement *)
 
virtual bool visit (StatementSourceElement *)
 
virtual bool visit (DebuggerStatement *)
 
 Visitor ()
 
virtual ~Visitor ()
 

Detailed Description

Definition at line 66 of file qdeclarativerewrite_p.h.

Functions

◆ isSharable() [1/2]

bool QDeclarativeRewrite::SharedBindingTester::isSharable ( const QString code)

Definition at line 54 of file qdeclarativerewrite.cpp.

Referenced by QDeclarativeRewrite::RewriteBinding::operator()().

55 {
56  Engine engine;
57  NodePool pool(QString(), &engine);
58  Lexer lexer(&engine);
59  Parser parser(&engine);
60  lexer.setCode(code, 0);
61  parser.parseStatement();
62  if (!parser.statement())
63  return false;
64 
65  return isSharable(parser.statement());
66 }
The QString class provides a Unicode character string.
Definition: qstring.h:83

◆ isSharable() [2/2]

bool QDeclarativeRewrite::SharedBindingTester::isSharable ( AST::Node Node)

Definition at line 68 of file qdeclarativerewrite.cpp.

69 {
70  _sharable = true;
71  AST::Node::acceptChild(node, this);
72  return _sharable;
73 }

◆ visit() [1/3]

virtual bool QDeclarativeRewrite::SharedBindingTester::visit ( AST::FunctionDeclaration )
inlinevirtual

Reimplemented from QDeclarativeJS::AST::Visitor.

Definition at line 73 of file qdeclarativerewrite_p.h.

73 { _sharable = false; return false; }

◆ visit() [2/3]

virtual bool QDeclarativeRewrite::SharedBindingTester::visit ( AST::FunctionExpression )
inlinevirtual

Reimplemented from QDeclarativeJS::AST::Visitor.

Definition at line 74 of file qdeclarativerewrite_p.h.

74 { _sharable = false; return false; }

◆ visit() [3/3]

virtual bool QDeclarativeRewrite::SharedBindingTester::visit ( AST::CallExpression )
inlinevirtual

Reimplemented from QDeclarativeJS::AST::Visitor.

Definition at line 75 of file qdeclarativerewrite_p.h.

75 { _sharable = false; return false; }

Properties

◆ _sharable

bool QDeclarativeRewrite::SharedBindingTester::_sharable
private

Definition at line 68 of file qdeclarativerewrite_p.h.

Referenced by isSharable().


The documentation for this class was generated from the following files: