Refactor extend statement: remove unnecessary "as" keyword and push "this" variable context to the extend-statement scope

This commit is contained in:
2020-03-17 20:52:47 +01:00
parent 4cb234bdba
commit 70cb2e85bc
8 changed files with 47 additions and 45 deletions

View File

@@ -14,7 +14,7 @@ function _flatten(list: list, output: list) {
return output;
}
extend list as this {
extend list {
function flatten() {
return flatten(this);
}

View File

@@ -1,4 +1,4 @@
extend map as this {
extend map {
function containsKey(key) {
return this.keys.contains(key);
}

View File

@@ -1,4 +1,4 @@
extend note as this {
extend note {
function withOctave(octave: int) {
return Note(this.pitch, octave, this.duration.get("numerator"), this.duration.get("denominator"));
}

View File

@@ -1,4 +1,4 @@
extend string as this {
extend string {
function find(char: string) {
if(char.length > 1) {
throw "Only single character can act as a pattern to be found";