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

Unified Diff: test/generated_sdk/lib/core/expando.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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/generated_sdk/lib/core/exceptions.dart ('k') | test/generated_sdk/lib/core/function.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/generated_sdk/lib/core/expando.dart
diff --git a/test/generated_sdk/lib/core/expando.dart b/test/generated_sdk/lib/core/expando.dart
deleted file mode 100644
index 26577ad274bf86c758f273fff307f41f26bf952d..0000000000000000000000000000000000000000
--- a/test/generated_sdk/lib/core/expando.dart
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.core;
-
-/**
- * An [Expando] allows adding new properties to objects.
- *
- * Does not work on numbers, strings, booleans or null.
- *
- * An `Expando` does not hold on to the added property value after an object
- * becomes inacessible.
- *
- * Since you can always create a new number that is identical to an existing
- * number, it means that an expando property on a number could never be
- * released. To avoid this, expando properties cannot be added to numbers.
- * The same argument applies to strings, booleans and null, which also have
- * literals that evaluate to identical values when they occur more than once.
- *
- * There is no restriction on other classes, even for compile time constant
- * objects. Be careful if adding expando properties to compile time constants,
- * since they will stay alive forever.
- */
-class Expando<T> {
-
- /**
- * The name of the this [Expando] as passed to the constructor. If
- * no name was passed to the constructor, the name is [:null:].
- */
- final String name;
-
- /**
- * Creates a new [Expando]. The optional name is only used for
- * debugging purposes and creating two different [Expando]s with the
- * same name yields two [Expando]s that work on different properties
- * of the objects they are used on.
- */
- Expando([String name]) : this.name = name;
-
- /**
- * Expando toString method override.
- */
- String toString() => "Expando:$name";
-
- /**
- * Gets the value of this [Expando]'s property on the given
- * object. If the object hasn't been expanded, the method returns
- * [:null:].
- *
- * The object must not be a number, a string, a boolean or null.
- */
- T operator[](Object object) {
- var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME);
- return (values == null) ? null : Primitives.getProperty(values, _getKey());
- }
-
- /**
- * Sets the value of this [Expando]'s property on the given
- * object. Properties can effectively be removed again by setting
- * their value to null.
- *
- * The object must not be a number, a string, a boolean or null.
- */
- void operator[]=(Object object, T value) {
- var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME);
- if (values == null) {
- values = new Object();
- Primitives.setProperty(object, _EXPANDO_PROPERTY_NAME, values);
- }
- Primitives.setProperty(values, _getKey(), value);
- }
-
- String _getKey() {
- String key = Primitives.getProperty(this, _KEY_PROPERTY_NAME);
- if (key == null) {
- key = "expando\$key\$${_keyCount++}";
- Primitives.setProperty(this, _KEY_PROPERTY_NAME, key);
- }
- return key;
- }
-
- static const String _KEY_PROPERTY_NAME = 'expando\$key';
-
- static const String _EXPANDO_PROPERTY_NAME = 'expando\$values';
-
- static int _keyCount = 0;
-
-}
« no previous file with comments | « test/generated_sdk/lib/core/exceptions.dart ('k') | test/generated_sdk/lib/core/function.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698