From 9cd6d6f00103693b3b81313dcf48abddad31b12e Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 30 Dec 2013 16:39:25 -0800 Subject: [PATCH] updated Dart sample to align with best practices --- lib/linguist/samples.json | 23 ++++++++++++++--------- samples/Dart/point.dart | 16 ++++++++++------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 58d519ae..c72f97c3 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -527,7 +527,7 @@ ".gemrc" ] }, - "tokens_total": 439962, + "tokens_total": 439968, "languages_total": 515, "tokens": { "ABAP": { @@ -15843,29 +15843,34 @@ "return": 1 }, "Dart": { + "import": 1, + "as": 1, + "math": 1, + ";": 9, "class": 1, - "Point": 7, + "Point": 5, "{": 3, + "num": 2, + "x": 2, + "y": 2, "(": 7, "this.x": 1, "this.y": 1, ")": 7, - ";": 8, "distanceTo": 1, "other": 1, - "var": 3, + "var": 4, "dx": 3, - "x": 2, "-": 2, "other.x": 1, "dy": 3, - "y": 2, "other.y": 1, "return": 1, - "Math.sqrt": 1, + "math.sqrt": 1, "*": 2, "+": 1, "}": 3, + "void": 1, "main": 1, "p": 1, "new": 2, @@ -47095,7 +47100,7 @@ "Creole": 134, "CSS": 43867, "Cuda": 290, - "Dart": 68, + "Dart": 74, "Diff": 16, "DM": 169, "ECL": 281, @@ -47350,5 +47355,5 @@ "Xtend": 2, "YAML": 1 }, - "md5": "5703f25c45f067de03050cf5a2b5c401" + "md5": "d3bb6995f8f7fe57109f73fe079c19d2" } \ No newline at end of file diff --git a/samples/Dart/point.dart b/samples/Dart/point.dart index 5bb74b29..ee91239b 100644 --- a/samples/Dart/point.dart +++ b/samples/Dart/point.dart @@ -1,15 +1,19 @@ +import 'dart:math' as math; + class Point { + num x, y; + Point(this.x, this.y); - distanceTo(Point other) { + + num distanceTo(Point other) { var dx = x - other.x; var dy = y - other.y; - return Math.sqrt(dx * dx + dy * dy); + return math.sqrt(dx * dx + dy * dy); } - var x, y; } -main() { - Point p = new Point(2, 3); - Point q = new Point(3, 4); +void main() { + var p = new Point(2, 3); + var q = new Point(3, 4); print('distance from p to q = ${p.distanceTo(q)}'); }