Use only interned (unique) strings.

This commit is contained in:
Roberto Raggi
2010-11-11 14:28:05 +01:00
parent 7f4792bf6e
commit 06df2e2d29
3 changed files with 18 additions and 18 deletions

View File

@@ -460,7 +460,7 @@ switch(ruleno) {
variable_identifier ::= IDENTIFIER ; variable_identifier ::= IDENTIFIER ;
/. /.
case $rule_number: { case $rule_number: {
ast(1) = new IdentifierExpression(*sym(1).string); ast(1) = new IdentifierExpression(sym(1).string);
} break; } break;
./ ./

View File

@@ -286,7 +286,7 @@ public:
class GLSL_EXPORT IdentifierExpression: public Expression class GLSL_EXPORT IdentifierExpression: public Expression
{ {
public: public:
IdentifierExpression(const std::string &_name) IdentifierExpression(const std::string *_name)
: Expression(Kind_Identifier), name(_name) {} : Expression(Kind_Identifier), name(_name) {}
~IdentifierExpression(); ~IdentifierExpression();
@@ -295,13 +295,13 @@ public:
virtual void accept0(Visitor *visitor); virtual void accept0(Visitor *visitor);
public: // attributes public: // attributes
std::string name; const std::string *name;
}; };
class GLSL_EXPORT LiteralExpression: public Expression class GLSL_EXPORT LiteralExpression: public Expression
{ {
public: public:
LiteralExpression(const std::string &_value) LiteralExpression(const std::string *_value)
: Expression(Kind_Literal), value(_value) {} : Expression(Kind_Literal), value(_value) {}
~LiteralExpression(); ~LiteralExpression();
@@ -310,7 +310,7 @@ public:
virtual void accept0(Visitor *visitor); virtual void accept0(Visitor *visitor);
public: // attributes public: // attributes
std::string value; const std::string *value;
}; };
class GLSL_EXPORT BinaryExpression: public Expression class GLSL_EXPORT BinaryExpression: public Expression
@@ -380,7 +380,7 @@ public: // attributes
class GLSL_EXPORT MemberAccessExpression: public Expression class GLSL_EXPORT MemberAccessExpression: public Expression
{ {
public: public:
MemberAccessExpression(Expression *_expr, const std::string &_field) MemberAccessExpression(Expression *_expr, const std::string *_field)
: Expression(Kind_MemberAccess), expr(_expr), field(_field) {} : Expression(Kind_MemberAccess), expr(_expr), field(_field) {}
~MemberAccessExpression(); ~MemberAccessExpression();
@@ -390,15 +390,15 @@ public:
public: // attributes public: // attributes
Expression *expr; Expression *expr;
std::string field; const std::string *field;
}; };
class GLSL_EXPORT FunctionCallExpression: public Expression class GLSL_EXPORT FunctionCallExpression: public Expression
{ {
public: public:
FunctionCallExpression(const std::string &_name) FunctionCallExpression(const std::string *_name)
: Expression(Kind_FunctionCall), expr(0), name(_name) {} : Expression(Kind_FunctionCall), expr(0), name(_name) {}
FunctionCallExpression(Expression *_expr, const std::string &_name) FunctionCallExpression(Expression *_expr, const std::string *_name)
: Expression(Kind_MemberFunctionCall), expr(_expr), name(_name) {} : Expression(Kind_MemberFunctionCall), expr(_expr), name(_name) {}
~FunctionCallExpression(); ~FunctionCallExpression();
@@ -410,7 +410,7 @@ public:
public: // attributes public: // attributes
Expression *expr; Expression *expr;
std::string name; const std::string *name;
std::vector<Expression *> arguments; std::vector<Expression *> arguments;
}; };
@@ -632,7 +632,7 @@ public: // attributes
class GLSL_EXPORT NamedType: public Type class GLSL_EXPORT NamedType: public Type
{ {
public: public:
NamedType(const std::string &_name) : Type(Kind_NamedType), name(_name) {} NamedType(const std::string *_name) : Type(Kind_NamedType), name(_name) {}
~NamedType(); ~NamedType();
virtual NamedType *asNamedType() { return this; } virtual NamedType *asNamedType() { return this; }
@@ -645,7 +645,7 @@ public:
virtual Type *clone() const; virtual Type *clone() const;
public: // attributes public: // attributes
std::string name; const std::string *name;
}; };
class GLSL_EXPORT ArrayType: public Type class GLSL_EXPORT ArrayType: public Type
@@ -675,7 +675,7 @@ class GLSL_EXPORT StructType: public Type
{ {
public: public:
StructType() : Type(Kind_AnonymousStructType) {} StructType() : Type(Kind_AnonymousStructType) {}
StructType(const std::string &_name) StructType(const std::string *_name)
: Type(Kind_StructType), name(_name) {} : Type(Kind_StructType), name(_name) {}
~StructType(); ~StructType();
@@ -691,13 +691,13 @@ public:
class Field: public AST class Field: public AST
{ {
public: public:
Field(const std::string &_name) Field(const std::string *_name)
: AST(Kind_StructField), name(_name), type(0) {} : AST(Kind_StructField), name(_name), type(0) {}
// Takes the outer shell of an array type with the innermost // Takes the outer shell of an array type with the innermost
// element type set to null. The fixInnerTypes() method will // element type set to null. The fixInnerTypes() method will
// set the innermost element type to a meaningful value. // set the innermost element type to a meaningful value.
Field(const std::string &_name, Type *_type) Field(const std::string *_name, Type *_type)
: AST(Kind_StructField), name(_name), type(_type) {} : AST(Kind_StructField), name(_name), type(_type) {}
~Field(); ~Field();
@@ -706,7 +706,7 @@ public:
void setInnerType(Type *innerType); void setInnerType(Type *innerType);
std::string name; const std::string *name;
Type *type; Type *type;
}; };
@@ -717,7 +717,7 @@ public:
void addFields(const std::vector<Field *> &list); void addFields(const std::vector<Field *> &list);
public: // attributes public: // attributes
std::string name; const std::string *name;
std::vector<Field *> fields; std::vector<Field *> fields;
}; };

View File

@@ -167,7 +167,7 @@ switch(ruleno) {
#line 461 "./glsl.g" #line 461 "./glsl.g"
case 0: { case 0: {
ast(1) = new IdentifierExpression(*sym(1).string); ast(1) = new IdentifierExpression(sym(1).string);
} break; } break;
#line 468 "./glsl.g" #line 468 "./glsl.g"