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

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

Issue 2752163002: Format all dart dev compiler files (Closed)
Patch Set: 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) : this._name = name;
14 : this._name = name;
15 14
16 @patch 15 @patch
17 int get hashCode { 16 int get hashCode {
18 int hash = JS('int|Null', '#._hashCode', this); 17 int hash = JS('int|Null', '#._hashCode', this);
19 if (hash != null) return hash; 18 if (hash != null) return hash;
20 const arbitraryPrime = 664597; 19 const arbitraryPrime = 664597;
21 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode); 20 hash = 0x1fffffff & (arbitraryPrime * _name.hashCode);
22 JS('', '#._hashCode = #', this, hash); 21 JS('', '#._hashCode = #', this, hash);
23 return hash; 22 return hash;
24 } 23 }
25 24
26 @patch 25 @patch
27 toString() => 'Symbol("$_name")'; 26 toString() => 'Symbol("$_name")';
28 } 27 }
29 28
30 /// Used internally by DDC to map ES6 symbols to Dart. 29 /// Used internally by DDC to map ES6 symbols to Dart.
31 class PrivateSymbol implements core.Symbol { 30 class PrivateSymbol implements core.Symbol {
32 // TODO(jmesserly): could also get this off the native symbol instead of 31 // TODO(jmesserly): could also get this off the native symbol instead of
33 // storing it. Mirrors already does this conversion. 32 // storing it. Mirrors already does this conversion.
34 final String _name; 33 final String _name;
35 final Object _nativeSymbol; 34 final Object _nativeSymbol;
36 35
37 const PrivateSymbol(this._name, this._nativeSymbol); 36 const PrivateSymbol(this._name, this._nativeSymbol);
38 37
39 static String getName(core.Symbol symbol) => 38 static String getName(core.Symbol symbol) => (symbol as PrivateSymbol)._name;
40 (symbol as PrivateSymbol)._name;
41 39
42 static Object getNativeSymbol(core.Symbol symbol) { 40 static Object getNativeSymbol(core.Symbol symbol) {
43 if (symbol is PrivateSymbol) return symbol._nativeSymbol; 41 if (symbol is PrivateSymbol) return symbol._nativeSymbol;
44 return null; 42 return null;
45 } 43 }
46 44
47 bool operator ==(other) => other is PrivateSymbol && 45 bool operator ==(other) =>
48 identical(_nativeSymbol, other._nativeSymbol); 46 other is PrivateSymbol && identical(_nativeSymbol, other._nativeSymbol);
49 47
50 // TODO(jmesserly): is this equivalent to _nativeSymbol toString? 48 // TODO(jmesserly): is this equivalent to _nativeSymbol toString?
51 toString() => 'Symbol("$_name")'; 49 toString() => 'Symbol("$_name")';
52 } 50 }
53 51
54 @patch 52 @patch
55 void printToConsole(String line) { 53 void printToConsole(String line) {
56 printString('$line'); 54 printString('$line');
57 } 55 }
58 56
59 @patch 57 @patch
60 List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) { 58 List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) {
61 JSArray.markFixedList(growableList); 59 JSArray.markFixedList(growableList);
62 return growableList; 60 return growableList;
63 } 61 }
64 62
65 @patch 63 @patch
66 List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) { 64 List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) {
67 JSArray.markUnmodifiableList(fixedLengthList); 65 JSArray.markUnmodifiableList(fixedLengthList);
68 return fixedLengthList; 66 return fixedLengthList;
69 } 67 }
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