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

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

Issue 959913003: cleanup patch generation to preseve comments and remove @patch (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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/errors.dart ('k') | test/generated_sdk/lib/core/function.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * An [Expando] allows adding new properties to objects. 8 * An [Expando] allows adding new properties to objects.
9 * 9 *
10 * Does not work on numbers, strings, booleans or null. 10 * Does not work on numbers, strings, booleans or null.
(...skipping 12 matching lines...) Expand all
23 * since they will stay alive forever. 23 * since they will stay alive forever.
24 */ 24 */
25 class Expando<T> { 25 class Expando<T> {
26 26
27 /** 27 /**
28 * The name of the this [Expando] as passed to the constructor. If 28 * The name of the this [Expando] as passed to the constructor. If
29 * no name was passed to the constructor, the name is [:null:]. 29 * no name was passed to the constructor, the name is [:null:].
30 */ 30 */
31 final String name; 31 final String name;
32 32
33 @patch 33 /**
34 * Creates a new [Expando]. The optional name is only used for
35 * debugging purposes and creating two different [Expando]s with the
36 * same name yields two [Expando]s that work on different properties
37 * of the objects they are used on.
38 */
34 Expando([String name]) : this.name = name; 39 Expando([String name]) : this.name = name;
35 40
36 /** 41 /**
37 * Expando toString method override. 42 * Expando toString method override.
38 */ 43 */
39 String toString() => "Expando:$name"; 44 String toString() => "Expando:$name";
40 45
41 @patch 46 /**
47 * Gets the value of this [Expando]'s property on the given
48 * object. If the object hasn't been expanded, the method returns
49 * [:null:].
50 *
51 * The object must not be a number, a string, a boolean or null.
52 */
42 T operator[](Object object) { 53 T operator[](Object object) {
43 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME); 54 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME);
44 return (values == null) ? null : Primitives.getProperty(values, _getKey()); 55 return (values == null) ? null : Primitives.getProperty(values, _getKey());
45 } 56 }
46 57
47 @patch 58 /**
59 * Sets the value of this [Expando]'s property on the given
60 * object. Properties can effectively be removed again by setting
61 * their value to null.
62 *
63 * The object must not be a number, a string, a boolean or null.
64 */
48 void operator[]=(Object object, T value) { 65 void operator[]=(Object object, T value) {
49 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME); 66 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME);
50 if (values == null) { 67 if (values == null) {
51 values = new Object(); 68 values = new Object();
52 Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, values); 69 Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, values);
53 } 70 }
54 Primitives.setProperty(values, _getKey(), value); 71 Primitives.setProperty(values, _getKey(), value);
55 } 72 }
56 73
57 } 74 }
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/core/errors.dart ('k') | test/generated_sdk/lib/core/function.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698