Strong mode cleanup (#30)

diff --git a/benchmark/benchmark.dart b/benchmark/benchmark.dart
index 183b921..946693f 100644
--- a/benchmark/benchmark.dart
+++ b/benchmark/benchmark.dart
@@ -39,7 +39,7 @@
     var context = new p.Context(style: style);
     var files = genericPaths.toList()..addAll(platformPaths[style]);
 
-    benchmark(name, function) {
+    benchmark(String name, Function function) {
       runBenchmark("${style.name}-$name", 100000, () {
         for (var file in files) {
           function(file);
@@ -47,7 +47,7 @@
       });
     }
 
-    benchmarkPairs(name, function) {
+    benchmarkPairs(String name, Function function) {
       runBenchmark("${style.name}-$name", 1000, () {
         for (var file1 in files) {
           for (var file2 in files) {
@@ -68,7 +68,7 @@
     benchmark('isRootRelative', context.isRootRelative);
     benchmark('normalize', context.normalize);
     benchmark('relative', context.relative);
-    benchmarkPairs('relative from', (file, from) {
+    benchmarkPairs('relative from', (String file, String from) {
       try {
         return context.relative(file, from: from);
       } on p.PathException {
diff --git a/lib/src/context.dart b/lib/src/context.dart
index a00ca29..108955b 100644
--- a/lib/src/context.dart
+++ b/lib/src/context.dart
@@ -343,8 +343,8 @@
   bool _needsNormalization(String path) {
     var start = 0;
     var codeUnits = path.codeUnits;
-    var previousPrevious;
-    var previous;
+    int previousPrevious;
+    int previous;
 
     // Skip past the root before we start looking for snippets that need
     // normalization. We want to normalize "//", but not when it's part of
@@ -566,7 +566,7 @@
     var result = _isWithinOrEqualsFast(parent, child);
     if (result != _PathRelation.inconclusive) return result;
 
-    var relative;
+    String relative;
     try {
       relative = this.relative(child, from: parent);
     } on PathException catch (_) {
@@ -958,10 +958,7 @@
   /// If [uri] is relative, a relative path will be returned.
   ///
   ///     path.fromUri('path/to/foo'); // -> 'path/to/foo'
-  String fromUri(uri) {
-    if (uri is String) uri = Uri.parse(uri);
-    return style.pathFromUri(uri);
-  }
+  String fromUri(uri) => style.pathFromUri(_parseUri(uri));
 
   /// Returns the URI that represents [path].
   ///
@@ -1013,13 +1010,16 @@
   ///         // -> r'a/b.dart'
   ///     context.prettyUri('file:///root/path'); // -> 'file:///root/path'
   String prettyUri(uri) {
-    if (uri is String) uri = Uri.parse(uri);
-    if (uri.scheme == 'file' && style == Style.url) return uri.toString();
-    if (uri.scheme != 'file' && uri.scheme != '' && style != Style.url) {
-      return uri.toString();
+    var typedUri = _parseUri(uri);
+    if (typedUri.scheme == 'file' && style == Style.url) {
+      return typedUri.toString();
+    } else if (typedUri.scheme != 'file' &&
+        typedUri.scheme != '' &&
+        style != Style.url) {
+      return typedUri.toString();
     }
 
-    var path = normalize(fromUri(uri));
+    var path = normalize(fromUri(typedUri));
     var rel = relative(path);
 
     // Only return a relative path if it's actually shorter than the absolute
@@ -1031,14 +1031,23 @@
   ParsedPath _parse(String path) => new ParsedPath.parse(path, style);
 }
 
+/// Parses argument if it's a [String] or returns it intact if it's a [Uri].
+///
+/// Throws an [ArgumentError] otherwise.
+Uri _parseUri(uri) {
+  if (uri is String) return Uri.parse(uri);
+  if (uri is Uri) return uri;
+  throw new ArgumentError.value(uri, 'uri', 'Value must be a String or a Uri');
+}
+
 /// Validates that there are no non-null arguments following a null one and
 /// throws an appropriate [ArgumentError] on failure.
-_validateArgList(String method, List<String> args) {
+void _validateArgList(String method, List<String> args) {
   for (var i = 1; i < args.length; i++) {
     // Ignore nulls hanging off the end.
     if (args[i] == null || args[i - 1] != null) continue;
 
-    var numArgs;
+    int numArgs;
     for (numArgs = args.length; numArgs >= 1; numArgs--) {
       if (args[numArgs - 1] != null) break;
     }