mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
updated Dart sample to align with best practices
This commit is contained in:
@@ -527,7 +527,7 @@
|
|||||||
".gemrc"
|
".gemrc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tokens_total": 439962,
|
"tokens_total": 439968,
|
||||||
"languages_total": 515,
|
"languages_total": 515,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"ABAP": {
|
"ABAP": {
|
||||||
@@ -15843,29 +15843,34 @@
|
|||||||
"return": 1
|
"return": 1
|
||||||
},
|
},
|
||||||
"Dart": {
|
"Dart": {
|
||||||
|
"import": 1,
|
||||||
|
"as": 1,
|
||||||
|
"math": 1,
|
||||||
|
";": 9,
|
||||||
"class": 1,
|
"class": 1,
|
||||||
"Point": 7,
|
"Point": 5,
|
||||||
"{": 3,
|
"{": 3,
|
||||||
|
"num": 2,
|
||||||
|
"x": 2,
|
||||||
|
"y": 2,
|
||||||
"(": 7,
|
"(": 7,
|
||||||
"this.x": 1,
|
"this.x": 1,
|
||||||
"this.y": 1,
|
"this.y": 1,
|
||||||
")": 7,
|
")": 7,
|
||||||
";": 8,
|
|
||||||
"distanceTo": 1,
|
"distanceTo": 1,
|
||||||
"other": 1,
|
"other": 1,
|
||||||
"var": 3,
|
"var": 4,
|
||||||
"dx": 3,
|
"dx": 3,
|
||||||
"x": 2,
|
|
||||||
"-": 2,
|
"-": 2,
|
||||||
"other.x": 1,
|
"other.x": 1,
|
||||||
"dy": 3,
|
"dy": 3,
|
||||||
"y": 2,
|
|
||||||
"other.y": 1,
|
"other.y": 1,
|
||||||
"return": 1,
|
"return": 1,
|
||||||
"Math.sqrt": 1,
|
"math.sqrt": 1,
|
||||||
"*": 2,
|
"*": 2,
|
||||||
"+": 1,
|
"+": 1,
|
||||||
"}": 3,
|
"}": 3,
|
||||||
|
"void": 1,
|
||||||
"main": 1,
|
"main": 1,
|
||||||
"p": 1,
|
"p": 1,
|
||||||
"new": 2,
|
"new": 2,
|
||||||
@@ -47095,7 +47100,7 @@
|
|||||||
"Creole": 134,
|
"Creole": 134,
|
||||||
"CSS": 43867,
|
"CSS": 43867,
|
||||||
"Cuda": 290,
|
"Cuda": 290,
|
||||||
"Dart": 68,
|
"Dart": 74,
|
||||||
"Diff": 16,
|
"Diff": 16,
|
||||||
"DM": 169,
|
"DM": 169,
|
||||||
"ECL": 281,
|
"ECL": 281,
|
||||||
@@ -47350,5 +47355,5 @@
|
|||||||
"Xtend": 2,
|
"Xtend": 2,
|
||||||
"YAML": 1
|
"YAML": 1
|
||||||
},
|
},
|
||||||
"md5": "5703f25c45f067de03050cf5a2b5c401"
|
"md5": "d3bb6995f8f7fe57109f73fe079c19d2"
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
|
import 'dart:math' as math;
|
||||||
|
|
||||||
class Point {
|
class Point {
|
||||||
|
num x, y;
|
||||||
|
|
||||||
Point(this.x, this.y);
|
Point(this.x, this.y);
|
||||||
distanceTo(Point other) {
|
|
||||||
|
num distanceTo(Point other) {
|
||||||
var dx = x - other.x;
|
var dx = x - other.x;
|
||||||
var dy = y - other.y;
|
var dy = y - other.y;
|
||||||
return Math.sqrt(dx * dx + dy * dy);
|
return math.sqrt(dx * dx + dy * dy);
|
||||||
}
|
}
|
||||||
var x, y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
void main() {
|
||||||
Point p = new Point(2, 3);
|
var p = new Point(2, 3);
|
||||||
Point q = new Point(3, 4);
|
var q = new Point(3, 4);
|
||||||
print('distance from p to q = ${p.distanceTo(q)}');
|
print('distance from p to q = ${p.distanceTo(q)}');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user