Chromium Code Reviews| 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 unreachable(); |
|
ahe
2011/12/21 14:15:33
Not unreachable.
ngeoffray
2011/12/21 14:27:06
Done.
ahe
2012/01/03 18:01:49
Well, not really. We need to remember to pass a no
| |
| 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'); |
| (...skipping 331 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 |