Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Variable name is expected to be in uppercase only #44

Closed
iflan opened this issue Oct 23, 2015 · 1 comment
Closed

Variable name is expected to be in uppercase only #44

iflan opened this issue Oct 23, 2015 · 1 comment
Assignees

Comments

@iflan
Copy link
Member

iflan commented Oct 23, 2015

Originally reported on Google Code with ID 25

What steps will reproduce the problem?
1. Define a variable e.g: @def width 10
2. Use this variable in style as .style1 { width: width; }
3. width is not replaced with the value 10.

What is the expected output? What do you see instead?
Expected output is width to be assigned value 10 which instead is being set as width.

What version of the product are you using? On what operating system?
closure-stylesheet version: using jar closure-stylesheets-20111230.jar
OS: windows7

Please provide any additional information below.
It is no where documented that variable name must be in upper case. It is documented
only for mixins. In code, the condition isDefinitionReference of CssConstantReferenceNode
class is used both for mixins and variable verification and only throws error for mixins
and not variables. Hence, the pareser silently moves forward without replacing the
lower case variable values and we get the issues at later stages.


Reported by nitu.mca on 2012-08-07 10:44:57

@iflan
Copy link
Member Author

iflan commented Jun 7, 2016

This has been "fixed" because we now emit a warning when an lowercase identifier is found.

@def width 10;
.style1 { width: width; }

produces:

$ java -jar ../closure-stylesheets/build/closure-stylesheets.jar --pretty-print test-bug-44.gss
WARNING for invalid @def name width. We will ignore this. in test-bug-44.gss at line 1 column 6:
@def width 10;
     ^

0 error(s), 1 warning(s)

.style1 {
  width: width;
}

@iflan iflan closed this as completed Jun 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant