OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 /** | 7 /** |
8 * The base class for all function types. | 8 * The base class for all function types. |
9 * | 9 * |
10 * A function value, or an instance of a class with a "call" method, is a | 10 * A function value, or an instance of a class with a "call" method, is a |
(...skipping 15 matching lines...) Expand all Loading... |
26 * namedArguments[const Symbol("f")] = 4; | 26 * namedArguments[const Symbol("f")] = 4; |
27 * namedArguments[const Symbol("g")] = 5; | 27 * namedArguments[const Symbol("g")] = 5; |
28 * Function.apply(foo, [1,2,3], namedArguments); | 28 * Function.apply(foo, [1,2,3], namedArguments); |
29 * | 29 * |
30 * gives exactly the same result as | 30 * gives exactly the same result as |
31 * foo(1, 2, 3, f: 4, g: 5). | 31 * foo(1, 2, 3, f: 4, g: 5). |
32 * | 32 * |
33 * If [positionalArguments] is null, it's considered an empty list. | 33 * If [positionalArguments] is null, it's considered an empty list. |
34 * If [namedArguments] is omitted or null, it is considered an empty map. | 34 * If [namedArguments] is omitted or null, it is considered an empty map. |
35 */ | 35 */ |
36 external static apply(Function function, | 36 external static apply(Function function, List positionalArguments, |
37 List positionalArguments, | 37 [Map<Symbol, dynamic> namedArguments]); |
38 [Map<Symbol, dynamic> namedArguments]); | |
39 | 38 |
40 /** | 39 /** |
41 * Returns a hash code value that is compatible with `operator==`. | 40 * Returns a hash code value that is compatible with `operator==`. |
42 */ | 41 */ |
43 int get hashCode; | 42 int get hashCode; |
44 | 43 |
45 /** | 44 /** |
46 * Test whether another object is equal to this function. | 45 * Test whether another object is equal to this function. |
47 * | 46 * |
48 * System-created function objects are only equal to other functions. | 47 * System-created function objects are only equal to other functions. |
49 * | 48 * |
50 * Two function objects are known to represent the same function if | 49 * Two function objects are known to represent the same function if |
51 * | 50 * |
52 * - It is the same object. Static and top-level functions are compile time | 51 * - It is the same object. Static and top-level functions are compile time |
53 * constants when used as values, so referring to the same function twice | 52 * constants when used as values, so referring to the same function twice |
54 * always give the same object, | 53 * always give the same object, |
55 * - or if they refer to the same member method extracted from the same object
. | 54 * - or if they refer to the same member method extracted from the same object
. |
56 * Extracting a member method as a function value twice gives equal, but | 55 * Extracting a member method as a function value twice gives equal, but |
57 * not necessarily identical, function values. | 56 * not necessarily identical, function values. |
58 * | 57 * |
59 * Function expressions never give rise to equal function objects. Each time | 58 * Function expressions never give rise to equal function objects. Each time |
60 * a function expression is evaluated, it creates a new closure value that | 59 * a function expression is evaluated, it creates a new closure value that |
61 * is not known to be equal to other closures created by the same expression. | 60 * is not known to be equal to other closures created by the same expression. |
62 * | 61 * |
63 * Classes implementing `Function` by having a `call` method should have their | 62 * Classes implementing `Function` by having a `call` method should have their |
64 * own `operator==` and `hashCode` depending on the object. | 63 * own `operator==` and `hashCode` depending on the object. |
65 */ | 64 */ |
66 bool operator==(Object other); | 65 bool operator ==(Object other); |
67 } | 66 } |
OLD | NEW |