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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart

Issue 2611423002: Fix type error in js_dart2js.dart caught by DDC. (Closed)
Patch Set: Fix noSuchMethod handling of methods that are also extension methods. Fix noSuchMethod handling of … Created 3 years, 11 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'dart:_foreign_helper' show JS; 8 import 'dart:_foreign_helper' show JS;
9 import 'dart:_internal' as _internal; 9 import 'dart:_internal' as _internal;
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 typedef T _Lazy<T>(); 78 typedef T _Lazy<T>();
79 79
80 dynamic _getESSymbol(Symbol symbol) => 80 dynamic _getESSymbol(Symbol symbol) =>
81 _internal.Symbol.getNativeSymbol(symbol as _internal.Symbol); 81 _internal.Symbol.getNativeSymbol(symbol as _internal.Symbol);
82 82
83 dynamic _getMember(Symbol symbol) { 83 dynamic _getMember(Symbol symbol) {
84 var privateSymbol = _getESSymbol(symbol); 84 var privateSymbol = _getESSymbol(symbol);
85 if (privateSymbol != null) { 85 if (privateSymbol != null) {
86 return privateSymbol; 86 return privateSymbol;
87 } 87 }
88 return getName(symbol); 88 var name = getName(symbol);
89 // TODO(jacobr): this code is duplicated in code_generator.dart
90 switch (name) {
91 case '[]':
92 name = '_get';
93 break;
94 case '[]=':
95 name = '_set';
96 break;
97 case 'unary-':
98 name = '_negate';
99 break;
100 case 'constructor':
101 case 'prototype':
102 name = '_$name';
103 break;
104 }
105 return name;
89 } 106 }
90 107
91 String _getNameForESSymbol(member) { 108 String _getNameForESSymbol(member) {
92 // Convert private JS symbol "Symbol(_foo)" to string "_foo". 109 // Convert private JS symbol "Symbol(_foo)" to string "_foo".
93 assert(JS('bool', 'typeof # == "symbol"', member)); 110 assert(JS('bool', 'typeof # == "symbol"', member));
94 var str = member.toString(); 111 var str = member.toString();
95 assert(str.startsWith('Symbol(') && str.endsWith(')')); 112 assert(str.startsWith('Symbol(') && str.endsWith(')'));
96 return str.substring(7, str.length - 1); 113 return str.substring(7, str.length - 1);
97 } 114 }
98 115
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 // TODO(vsm): Recover the param name. 627 // TODO(vsm): Recover the param name.
611 var param = new JsParameterMirror._(new Symbol(''), _wrap(type), metadata) ; 628 var param = new JsParameterMirror._(new Symbol(''), _wrap(type), metadata) ;
612 params[i + args.length] = param; 629 params[i + args.length] = param;
613 } 630 }
614 631
615 _params = new List.unmodifiable(params); 632 _params = new List.unmodifiable(params);
616 } 633 }
617 634
618 String toString() => "MethodMirror on '$_name'"; 635 String toString() => "MethodMirror on '$_name'";
619 } 636 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/code_generator.dart ('k') | tests/lib_strong/collection/list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698