Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1485)

Side by Side Diff: pkg/analyzer/lib/src/generated/utilities_dart.dart

Issue 1223833008: Package map source factory support [FIXED]. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.utilities.dart; 8 library engine.utilities.dart;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 20 matching lines...) Expand all
31 final bool isOptional; 31 final bool isOptional;
32 32
33 /** 33 /**
34 * Initialize a newly created kind with the given state. 34 * Initialize a newly created kind with the given state.
35 * 35 *
36 * @param isOptional `true` if this is an optional parameter 36 * @param isOptional `true` if this is an optional parameter
37 */ 37 */
38 const ParameterKind(String name, int ordinal, this.isOptional) 38 const ParameterKind(String name, int ordinal, this.isOptional)
39 : super(name, ordinal); 39 : super(name, ordinal);
40 } 40 }
41
42 /**
43 * Check whether [uri1] starts with (or 'is prefixed by') [uri2] by checking
44 * path segments.
45 */
46 bool startsWith(Uri uri1, Uri uri2) {
47 List<String> uri1Segments = uri1.pathSegments;
48 List<String> uri2Segments = uri2.pathSegments.toList();
49 // Trim trailing empty segments ('/foo/' => ['foo', ''])
50 if (uri2Segments.last == '') {
51 uri2Segments.removeLast();
52 }
53
54 if (uri2Segments.length > uri1Segments.length) {
55 return false;
56 }
57
58 for (int i = 0; i < uri2Segments.length; ++i) {
59 if (uri2Segments[i] != uri1Segments[i]) {
60 return false;
61 }
62 }
63 return true;
64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698