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

Side by Side Diff: mojo/public/dart/third_party/analyzer/lib/src/generated/utilities_dart.dart

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library engine.utilities.dart;
6
7 import 'java_core.dart';
8
9 /**
10 * Check whether [uri1] starts with (or 'is prefixed by') [uri2] by checking
11 * path segments.
12 */
13 bool startsWith(Uri uri1, Uri uri2) {
14 List<String> uri1Segments = uri1.pathSegments;
15 List<String> uri2Segments = uri2.pathSegments.toList();
16 // Punt if empty (https://github.com/dart-lang/sdk/issues/24126)
17 if (uri2Segments.isEmpty) {
18 return false;
19 }
20 // Trim trailing empty segments ('/foo/' => ['foo', ''])
21 if (uri2Segments.last == '') {
22 uri2Segments.removeLast();
23 }
24
25 if (uri2Segments.length > uri1Segments.length) {
26 return false;
27 }
28
29 for (int i = 0; i < uri2Segments.length; ++i) {
30 if (uri2Segments[i] != uri1Segments[i]) {
31 return false;
32 }
33 }
34 return true;
35 }
36
37 /**
38 * The enumeration `ParameterKind` defines the different kinds of parameters. Th ere are two
39 * basic kinds of parameters: required and optional. Optional parameters are fur ther divided into
40 * two kinds: positional optional and named optional.
41 */
42 class ParameterKind extends Enum<ParameterKind> {
43 static const ParameterKind REQUIRED =
44 const ParameterKind('REQUIRED', 0, false);
45
46 static const ParameterKind POSITIONAL =
47 const ParameterKind('POSITIONAL', 1, true);
48
49 static const ParameterKind NAMED = const ParameterKind('NAMED', 2, true);
50
51 static const List<ParameterKind> values = const [REQUIRED, POSITIONAL, NAMED];
52
53 /**
54 * A flag indicating whether this is an optional parameter.
55 */
56 final bool isOptional;
57
58 /**
59 * Initialize a newly created kind with the given state.
60 *
61 * @param isOptional `true` if this is an optional parameter
62 */
63 const ParameterKind(String name, int ordinal, this.isOptional)
64 : super(name, ordinal);
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698