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

Side by Side Diff: dart/pkg/dartdoc/mirrors/dart2js_mirror.dart

Issue 10870066: Support unary - operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix unparser to handle that negate is no longer a keyword. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « dart/lib/compiler/implementation/universe.dart ('k') | dart/tests/co19/co19-dart2js.status » ('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 #library('mirrors.dart2js'); 5 #library('mirrors.dart2js');
6 6
7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); 7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics');
8 #import('../../../lib/compiler/implementation/elements/elements.dart'); 8 #import('../../../lib/compiler/implementation/elements/elements.dart');
9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); 9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api');
10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); 10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart');
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const Dart2JsMethodKind(this.text); 118 const Dart2JsMethodKind(this.text);
119 119
120 String toString() => text; 120 String toString() => text;
121 } 121 }
122 122
123 123
124 String _getOperatorFromOperatorName(String name) { 124 String _getOperatorFromOperatorName(String name) {
125 Map<String, String> mapping = const { 125 Map<String, String> mapping = const {
126 'eq': '==', 126 'eq': '==',
127 'not': '~', 127 'not': '~',
128 'negate': 'negate', // Will change.
129 'index': '[]', 128 'index': '[]',
130 'indexSet': '[]=', 129 'indexSet': '[]=',
131 'mul': '*', 130 'mul': '*',
132 'div': '/', 131 'div': '/',
133 'mod': '%', 132 'mod': '%',
134 'tdiv': '~/', 133 'tdiv': '~/',
135 'add': '+', 134 'add': '+',
136 'sub': '-', 135 'sub': '-',
137 'shl': '<<', 136 'shl': '<<',
138 'shr': '>>', 137 'shr': '>>',
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 && _function.modifiers.isFactory()) { 1236 && _function.modifiers.isFactory()) {
1238 _constructorName = ''; 1237 _constructorName = '';
1239 int dollarPos = _name.indexOf('\$'); 1238 int dollarPos = _name.indexOf('\$');
1240 if (dollarPos != -1) { 1239 if (dollarPos != -1) {
1241 _constructorName = _name.substring(dollarPos+1); 1240 _constructorName = _name.substring(dollarPos+1);
1242 _name = _name.substring(0, dollarPos); 1241 _name = _name.substring(0, dollarPos);
1243 } 1242 }
1244 _kind = Dart2JsMethodKind.FACTORY; 1243 _kind = Dart2JsMethodKind.FACTORY;
1245 // canonical name is TypeName.constructorName 1244 // canonical name is TypeName.constructorName
1246 _canonicalName = '$_name.$_constructorName'; 1245 _canonicalName = '$_name.$_constructorName';
1246 } else if (_name == 'negate') {
1247 _operatorName = _name;
1248 _name = 'operator';
1249 _kind = Dart2JsMethodKind.OPERATOR;
1250 // canonical name is 'operator operatorName'
1251 _canonicalName = 'operator $_operatorName';
1247 } else if (_name.startsWith('operator\$')) { 1252 } else if (_name.startsWith('operator\$')) {
1248 String str = _name.substring(9); 1253 String str = _name.substring(9);
1249 _name = 'operator'; 1254 _name = 'operator';
1250 _kind = Dart2JsMethodKind.OPERATOR; 1255 _kind = Dart2JsMethodKind.OPERATOR;
1251 _operatorName = _getOperatorFromOperatorName(str); 1256 _operatorName = _getOperatorFromOperatorName(str);
1252 // canonical name is 'operator operatorName' 1257 // canonical name is 'operator operatorName'
1253 _canonicalName = 'operator $_operatorName'; 1258 _canonicalName = 'operator $_operatorName';
1254 } else { 1259 } else {
1255 _kind = Dart2JsMethodKind.NORMAL; 1260 _kind = Dart2JsMethodKind.NORMAL;
1256 _canonicalName = _name; 1261 _canonicalName = _name;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 if (node !== null) { 1377 if (node !== null) {
1373 var span = system.compiler.spanFromNode(node, script.uri); 1378 var span = system.compiler.spanFromNode(node, script.uri);
1374 return new Dart2JsLocation(script, span); 1379 return new Dart2JsLocation(script, span);
1375 } else { 1380 } else {
1376 var span = system.compiler.spanFromElement(_variable); 1381 var span = system.compiler.spanFromElement(_variable);
1377 return new Dart2JsLocation(script, span); 1382 return new Dart2JsLocation(script, span);
1378 } 1383 }
1379 } 1384 }
1380 } 1385 }
1381 1386
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/universe.dart ('k') | dart/tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698