55 lines
865 B
Plaintext
Raw Normal View History

2020-06-30 12:49:37 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
class A {
private _x: number = 0;
private y: number = 0;
public get x() { // Noncompliant: field 'x' is not used in the return value
return this.y;
}
public setX(val: number) { // Noncompliant: field 'x' is not updated
this.y = val;
}
public getY() { // Noncompliant: field 'y' is not used in the return value
return this.x;
}
}
----
== Compliant Solution
----
class A {
private _x: number = 0;
private y: number = 0;
public get x() {
return this._x;
}
public setX(val: number) {
this.x = val;
}
public getY() {
return this.y;
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
endif::env-github,rspecator-view[]