less / less/less.js

Built-in functions are not available in certain contexts (impl. details).

Open
#3,054 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug low priority research needed
Dominant language
JavaScript
Stars
17k
Forks
3.4k
Avg merge
7h 42m
Merged PRs (30d)
26

Description

Example:

@bar: pi();
@import "foo-@{bar}.less";

Result:

SyntaxError: Cannot read property 'get' of undefined in *.less on line 2, column 1

The error simply means that the pi function is undefined at that point.
This happens because each context/frame has its own copy of the functions set, but the set is copied there too late to be available for a (preeval only?) visitor (e.g. like the import visitor above). This obviously prevents any (preeval?) visitor to be able to evaluate any code involving a function call.
Not sure if it still applies to the 3.x branch.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how each context/frame copies the functions set and how the import or other preeval visitor evaluates the example using pi(). Reproduce the reported SyntaxError, then verify that built-in functions are available when function calls are evaluated in those contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.