| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class TreeElements { | 5 class TreeElements { |
| 6 Map<Node, Element> map; | 6 Map<Node, Element> map; |
| 7 TreeElements() : map = new LinkedHashMap<Node, Element>(); | 7 TreeElements() : map = new LinkedHashMap<Node, Element>(); |
| 8 operator []=(Node node, Element element) => map[node] = element; | 8 operator []=(Node node, Element element) => map[node] = element; |
| 9 operator [](Node node) => map[node]; | 9 operator [](Node node) => map[node]; |
| 10 } | 10 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (name.stringValue === '&') return const SourceString('and'); | 256 if (name.stringValue === '&') return const SourceString('and'); |
| 257 if (name.stringValue === '^') return const SourceString('xor'); | 257 if (name.stringValue === '^') return const SourceString('xor'); |
| 258 | 258 |
| 259 // Relational operators. | 259 // Relational operators. |
| 260 if (name.stringValue === '<') return const SourceString('lt'); | 260 if (name.stringValue === '<') return const SourceString('lt'); |
| 261 if (name.stringValue === '<=') return const SourceString('le'); | 261 if (name.stringValue === '<=') return const SourceString('le'); |
| 262 if (name.stringValue === '>') return const SourceString('gt'); | 262 if (name.stringValue === '>') return const SourceString('gt'); |
| 263 if (name.stringValue === '>=') return const SourceString('ge'); | 263 if (name.stringValue === '>=') return const SourceString('ge'); |
| 264 | 264 |
| 265 if (name.stringValue === '==') return const SourceString('eq'); | 265 if (name.stringValue === '==') return const SourceString('eq'); |
| 266 if (name.stringValue === '!=') return const SourceString('eq'); |
| 266 | 267 |
| 267 // Index operator. | 268 // Index operator. |
| 268 if (name.stringValue === '[]') return const SourceString('index'); | 269 if (name.stringValue === '[]') return const SourceString('index'); |
| 269 unreachable(); | 270 compiler.unimplemented("mapOperatorToMethodName"); |
| 270 } | 271 } |
| 271 | 272 |
| 272 SourceString mapAssignmentOperatorToMethodName(SourceString name) { | 273 SourceString mapAssignmentOperatorToMethodName(SourceString name) { |
| 273 if (name.stringValue === '+=') return const SourceString('add'); | 274 if (name.stringValue === '+=') return const SourceString('add'); |
| 274 if (name.stringValue === '-=') return const SourceString('sub'); | 275 if (name.stringValue === '-=') return const SourceString('sub'); |
| 275 if (name.stringValue === '*=') return const SourceString('mul'); | 276 if (name.stringValue === '*=') return const SourceString('mul'); |
| 276 if (name.stringValue === '/=') return const SourceString('div'); | 277 if (name.stringValue === '/=') return const SourceString('div'); |
| 277 if (name.stringValue === '~/=') return const SourceString('tdiv'); | 278 if (name.stringValue === '~/=') return const SourceString('tdiv'); |
| 278 if (name.stringValue === '%=') return const SourceString('mod'); | 279 if (name.stringValue === '%=') return const SourceString('mod'); |
| 279 if (name.stringValue === '<<=') return const SourceString('shl'); | 280 if (name.stringValue === '<<=') return const SourceString('shl'); |
| 280 if (name.stringValue === '>>=') return const SourceString('shr'); | 281 if (name.stringValue === '>>=') return const SourceString('shr'); |
| 281 if (name.stringValue === '|=') return const SourceString('or'); | 282 if (name.stringValue === '|=') return const SourceString('or'); |
| 282 if (name.stringValue === '&=') return const SourceString('and'); | 283 if (name.stringValue === '&=') return const SourceString('and'); |
| 283 if (name.stringValue === '^=') return const SourceString('xor'); | 284 if (name.stringValue === '^=') return const SourceString('xor'); |
| 284 if (name.stringValue === '++') return const SourceString('add'); | 285 if (name.stringValue === '++') return const SourceString('add'); |
| 285 if (name.stringValue === '--') return const SourceString('sub'); | 286 if (name.stringValue === '--') return const SourceString('sub'); |
| 286 unreachable(); | 287 compiler.unimplemented("mapAssignmentOperatorToMethodName"); |
| 287 } | 288 } |
| 288 | 289 |
| 289 Element resolveSend(Send node) { | 290 Element resolveSend(Send node) { |
| 290 Element receiver = visit(node.receiver); | 291 Element receiver = visit(node.receiver); |
| 291 visit(node.argumentsNode); | 292 visit(node.argumentsNode); |
| 292 | 293 |
| 293 Identifier selector = node.selector; | 294 Identifier selector = node.selector; |
| 294 SourceString name = selector.source; | 295 SourceString name = selector.source; |
| 295 // No need to assign an element for a logical operation. | 296 // No need to assign an element for a logical operation. |
| 296 if (isLogicalOperator(selector)) return null; | 297 if (isLogicalOperator(selector)) return null; |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 class TopScope extends Scope { | 612 class TopScope extends Scope { |
| 612 Universe universe; | 613 Universe universe; |
| 613 | 614 |
| 614 TopScope(Universe this.universe) : super(null, null); | 615 TopScope(Universe this.universe) : super(null, null); |
| 615 Element lookup(SourceString name) => universe.find(name); | 616 Element lookup(SourceString name) => universe.find(name); |
| 616 | 617 |
| 617 Element add(Element element) { | 618 Element add(Element element) { |
| 618 throw "Cannot add an element in the top scope"; | 619 throw "Cannot add an element in the top scope"; |
| 619 } | 620 } |
| 620 } | 621 } |
| OLD | NEW |