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

Side by Side Diff: test/generated_sdk/lib/core/function.dart

Issue 1162723007: remove generated_sdk from checked in code (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « test/generated_sdk/lib/core/expando.dart ('k') | test/generated_sdk/lib/core/identical.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of dart.core;
6
7 /**
8 * The base class for all function types.
9 *
10 * A function value, or an instance of a class with a "call" method, is a
11 * subtype of a function type, and as such, a subtype of [Function].
12 */
13 abstract class Function {
14 /**
15 * Dynamically call [function] with the specified arguments.
16 *
17 * Acts the same as calling function with positional arguments
18 * corresponding to the elements of [positionalArguments] and
19 * named arguments corresponding to the elements of [namedArguments].
20 *
21 * This includes giving the same errors if [function] isn't callable or
22 * if it expects different parameters.
23 *
24 * Example:
25 * Map<Symbol, dynamic> namedArguments = new Map<Symbol, dynamic>();
26 * namedArguments[const Symbol("f")] = 4;
27 * namedArguments[const Symbol("g")] = 5;
28 * Function.apply(foo, [1,2,3], namedArguments);
29 *
30 * gives exactly the same result as
31 * foo(1, 2, 3, f: 4, g: 5).
32 *
33 * If [positionalArguments] is null, it's considered an empty list.
34 * If [namedArguments] is omitted or null, it is considered an empty map.
35 */
36 static apply(Function f,
37 List positionalArguments,
38 [Map<Symbol, dynamic> namedArguments]) {
39 // TODO(vsm): Handle named args.
40 // See: https://github.com/dart-lang/dev_compiler/issues/176
41 return JS('', 'dart.dcall.apply(null, [#].concat(#))', f, positionalArgument s);
42 }
43
44 /**
45 * Returns a hash code value that is compatible with `operator==`.
46 */
47 int get hashCode;
48
49 /**
50 * Test whether another object is equal to this function.
51 *
52 * System-created function objects are only equal to other functions.
53 *
54 * Two function objects are known to represent the same function if
55 *
56 * - It is the same object. Static and top-level functions are compile time
57 * constants when used as values, so referring to the same function twice
58 * always give the same object,
59 * - or if they refer to the same member method extracted from the same object .
60 * Extracting a member method as a function value twice gives equal, but
61 * not necessarily identical, function values.
62 *
63 * Function expressions never give rise to equal function objects. Each time
64 * a function expression is evaluated, it creates a new closure value that
65 * is not known to be equal to other closures created by the same expression.
66 *
67 * Classes implementing `Function` by having a `call` method should have their
68 * own `operator==` and `hashCode` depending on the object.
69 */
70 bool operator==(Object other);
71
72 static Map<String, dynamic> _toMangledNames(
73 Map<Symbol, dynamic> namedArguments) {
74 Map<String, dynamic> result = {};
75 namedArguments.forEach((symbol, value) {
76 result[_symbolToString(symbol)] = value;
77 });
78 return result;
79 }
80 }
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/core/expando.dart ('k') | test/generated_sdk/lib/core/identical.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698