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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart

Issue 2698353003: unfork DDC's copy of most SDK libraries (Closed)
Patch Set: revert core_patch Created 3 years, 9 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:_js_primitives' show printString; 5 import 'dart:_js_primitives' show printString;
6 import 'dart:_js_helper' show patch; 6 import 'dart:_js_helper' show patch;
7 import 'dart:_interceptors' show JSArray; 7 import 'dart:_interceptors' show JSArray;
8 import 'dart:_foreign_helper' show JS; 8 import 'dart:_foreign_helper' show JS;
9 9
10 @patch 10 @patch
11 class Symbol implements core.Symbol { 11 class Symbol implements core.Symbol {
12 @patch 12 @patch
13 const Symbol(String name) 13 const Symbol(String name)
14 : this._name = name, this._nativeSymbol = null; 14 : this._name = name;
15
16 @patch
17 const Symbol.es6(String name, dynamic nativeSymbol)
18 : this._name = name, this._nativeSymbol = nativeSymbol;
19 15
20 @patch 16 @patch
21 int get hashCode { 17 int get hashCode {
22 int hash = JS('int|Null', '#._hashCode', this); 18 int hash = JS('int|Null', '#._hashCode', this);
23 if (hash != null) return hash; 19 if (hash != null) return hash;
24 const arbitraryPrime = 664597; 20 const arbitraryPrime = 664597;
25 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode); 21 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode);
26 JS('', '#._hashCode = #', this, hash); 22 JS('', '#._hashCode = #', this, hash);
27 return hash; 23 return hash;
28 } 24 }
25
26 @patch
27 toString() => 'Symbol("$_name")';
28 }
29
30 /// Used internally by DDC to map ES6 symbols to Dart.
31 class PrivateSymbol implements core.Symbol {
32 // TODO(jmesserly): could also get this off the native symbol instead of
33 // storing it. Mirrors already does this conversion.
34 final String _name;
35 final Object _nativeSymbol;
36
37 const PrivateSymbol(this._name, this._nativeSymbol);
38
39 static String getName(core.Symbol symbol) =>
40 (symbol as PrivateSymbol)._name;
41
42 static Object getNativeSymbol(core.Symbol symbol) {
43 if (symbol is PrivateSymbol) return symbol._nativeSymbol;
44 return null;
45 }
46
47 bool operator ==(other) => other is PrivateSymbol &&
48 identical(_nativeSymbol, other._nativeSymbol);
49
50 // TODO(jmesserly): is this equivalent to _nativeSymbol toString?
51 toString() => 'Symbol("$_name")';
29 } 52 }
30 53
31 @patch 54 @patch
32 void printToConsole(String line) { 55 void printToConsole(String line) {
33 printString('$line'); 56 printString('$line');
34 } 57 }
35 58
36 @patch 59 @patch
37 List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) { 60 List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) {
38 JSArray.markFixedList(growableList); 61 JSArray.markFixedList(growableList);
39 return growableList; 62 return growableList;
40 } 63 }
41 64
42 @patch 65 @patch
43 List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) { 66 List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) {
44 JSArray.markUnmodifiableList(fixedLengthList); 67 JSArray.markUnmodifiableList(fixedLengthList);
45 return fixedLengthList; 68 return fixedLengthList;
46 } 69 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart ('k') | pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698