Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions to Variable related to variable substitution #27

Closed
2 tasks done
rcjsuen opened this issue May 18, 2018 · 1 comment
Closed
2 tasks done

Add functions to Variable related to variable substitution #27

rcjsuen opened this issue May 18, 2018 · 1 comment
Assignees

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented May 18, 2018

At the moment, Variable is defined like so...

export declare class Variable {
    getName(): string;
    getNameRange(): Range;
    getRange(): Range;
    isDefined(): boolean;
    isBuildVariable(): boolean;
    isEnvironmentVariable(): boolean;
}

It has no functions for:

@rcjsuen rcjsuen self-assigned this May 19, 2018
@rcjsuen
Copy link
Owner Author

rcjsuen commented May 23, 2018

A new getModifier() function has been added to the Variable class in 448117a. I wrote the wrong issue number in the commit message so it didn't get linked here.

rcjsuen added a commit that referenced this issue May 24, 2018
If the modifier is the ':' character, the substition value would
incorrectly also have ':' as its prefix. The substition value should
not be including the modifier character in its string.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
rcjsuen added a commit that referenced this issue May 24, 2018
In the exceptional cases of ${:} or ${variable:}, getModifier() will
return the empty string "" instead of "}". The "}" is used to mark
the end of the variable so it should be interpreted in that way
instead.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
rcjsuen added a commit that referenced this issue May 24, 2018
Changed Variable's getSubstitutionValue() to return the empty string
in the case where a modifier character has been defined but it is
immediately followed by a bracket such as ${variable:+}. In cases
where no modifier character has been defined such as $variable,
${variable}, or ${variable:}, null will be returned instead. This
should hopefully make the function a little more predictable and
easier to use.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
rcjsuen added a commit that referenced this issue May 25, 2018
Variable's getSubstitutionValue() gives the impression that the
resolved value will be returned when it is merely returning the raw
string. The function has been renamed to getSubstitutionParameter()
to hopefully not mislead anyone calling this API.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant