| OLD | NEW |
| 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('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 String r = receiver.slowToString(); | 1292 String r = receiver.slowToString(); |
| 1293 String s = selector.slowToString(); | 1293 String s = selector.slowToString(); |
| 1294 return new SourceString('$r\$$s'); | 1294 return new SourceString('$r\$$s'); |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 static final SourceString OPERATOR_EQUALS = | 1297 static final SourceString OPERATOR_EQUALS = |
| 1298 const SourceString(@'operator$eq'); | 1298 const SourceString(@'operator$eq'); |
| 1299 | 1299 |
| 1300 static SourceString constructOperatorName(SourceString receiver, | 1300 static SourceString constructOperatorName(SourceString receiver, |
| 1301 SourceString selector, | 1301 SourceString selector, |
| 1302 [bool isPrefix = false]) { | 1302 [bool isUnary = false]) { |
| 1303 String str = selector.stringValue; | 1303 String str = selector.stringValue; |
| 1304 if (str === '==' || str === '!=') return OPERATOR_EQUALS; | 1304 if (str === '==' || str === '!=') return OPERATOR_EQUALS; |
| 1305 | 1305 |
| 1306 if (str === '~') str = 'not'; | 1306 if (str === '~') str = 'not'; |
| 1307 else if (str === 'negate' || (str === '-' && isPrefix)) str = 'negate'; | 1307 else if (str === 'negate' || (str === '-' && isUnary)) str = 'negate'; |
| 1308 else if (str === '[]') str = 'index'; | 1308 else if (str === '[]') str = 'index'; |
| 1309 else if (str === '[]=') str = 'indexSet'; | 1309 else if (str === '[]=') str = 'indexSet'; |
| 1310 else if (str === '*' || str === '*=') str = 'mul'; | 1310 else if (str === '*' || str === '*=') str = 'mul'; |
| 1311 else if (str === '/' || str === '/=') str = 'div'; | 1311 else if (str === '/' || str === '/=') str = 'div'; |
| 1312 else if (str === '%' || str === '%=') str = 'mod'; | 1312 else if (str === '%' || str === '%=') str = 'mod'; |
| 1313 else if (str === '~/' || str === '~/=') str = 'tdiv'; | 1313 else if (str === '~/' || str === '~/=') str = 'tdiv'; |
| 1314 else if (str === '+' || str === '+=') str = 'add'; | 1314 else if (str === '+' || str === '+=') str = 'add'; |
| 1315 else if (str === '-' || str === '-=') str = 'sub'; | 1315 else if (str === '-' || str === '-=') str = 'sub'; |
| 1316 else if (str === '<<' || str === '<<=') str = 'shl'; | 1316 else if (str === '<<' || str === '<<=') str = 'shl'; |
| 1317 else if (str === '>>' || str === '>>=') str = 'shr'; | 1317 else if (str === '>>' || str === '>>=') str = 'shr'; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 Node parseNode(compiler) => cachedNode; | 1412 Node parseNode(compiler) => cachedNode; |
| 1413 | 1413 |
| 1414 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1414 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1415 | 1415 |
| 1416 TypeVariableElement cloneTo(Element enclosing, DiagnosticListener listener) { | 1416 TypeVariableElement cloneTo(Element enclosing, DiagnosticListener listener) { |
| 1417 TypeVariableElement result = | 1417 TypeVariableElement result = |
| 1418 new TypeVariableElement(name, enclosing, node, type, bound); | 1418 new TypeVariableElement(name, enclosing, node, type, bound); |
| 1419 return result; | 1419 return result; |
| 1420 } | 1420 } |
| 1421 } | 1421 } |
| OLD | NEW |