Chromium Code Reviews| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 Element get currentElement; | 8 Element get currentElement; |
| 9 Set<Node> get superUses; | 9 Set<Node> get superUses; |
| 10 | 10 |
| (...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 visitLiteralString(LiteralString node) { | 2483 visitLiteralString(LiteralString node) { |
| 2484 world.registerInstantiatedClass(compiler.stringClass, mapping); | 2484 world.registerInstantiatedClass(compiler.stringClass, mapping); |
| 2485 } | 2485 } |
| 2486 | 2486 |
| 2487 visitLiteralNull(LiteralNull node) { | 2487 visitLiteralNull(LiteralNull node) { |
| 2488 world.registerInstantiatedClass(compiler.nullClass, mapping); | 2488 world.registerInstantiatedClass(compiler.nullClass, mapping); |
| 2489 } | 2489 } |
| 2490 | 2490 |
| 2491 visitLiteralSymbol(LiteralSymbol node) { | |
|
ngeoffray
2013/09/04 07:14:17
You should report that to the backend!!! :-) You c
Johnni Winther
2013/09/10 09:09:07
Done.
| |
| 2492 world.registerInstantiatedClass(compiler.symbolClass, mapping); | |
| 2493 world.registerStaticUse(compiler.symbolConstructor.declaration); | |
| 2494 world.registerConstSymbol(node.slowNameString, mapping); | |
| 2495 if (!validateSymbol(node, node.slowNameString, reportError: false)) { | |
| 2496 compiler.reportError(node, MessageKind.UNSUPPORTED_LITERAL_SYMBOL, | |
| 2497 {'value': node.slowNameString}); | |
| 2498 } | |
| 2499 } | |
| 2500 | |
| 2491 visitStringJuxtaposition(StringJuxtaposition node) { | 2501 visitStringJuxtaposition(StringJuxtaposition node) { |
| 2492 world.registerInstantiatedClass(compiler.stringClass, mapping); | 2502 world.registerInstantiatedClass(compiler.stringClass, mapping); |
| 2493 node.visitChildren(this); | 2503 node.visitChildren(this); |
| 2494 } | 2504 } |
| 2495 | 2505 |
| 2496 visitNodeList(NodeList node) { | 2506 visitNodeList(NodeList node) { |
| 2497 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { | 2507 for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) { |
| 2498 visit(link.head); | 2508 visit(link.head); |
| 2499 } | 2509 } |
| 2500 } | 2510 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2672 } | 2682 } |
| 2673 world.registerNewSymbol(mapping); | 2683 world.registerNewSymbol(mapping); |
| 2674 } | 2684 } |
| 2675 } else if (isMirrorsUsedConstant) { | 2685 } else if (isMirrorsUsedConstant) { |
| 2676 compiler.mirrorUsageAnalyzerTask.validate(node, mapping); | 2686 compiler.mirrorUsageAnalyzerTask.validate(node, mapping); |
| 2677 } | 2687 } |
| 2678 | 2688 |
| 2679 return null; | 2689 return null; |
| 2680 } | 2690 } |
| 2681 | 2691 |
| 2682 bool validateSymbol(Node node, String name) { | 2692 bool validateSymbol(Node node, String name, {bool reportError: true}) { |
| 2683 if (name.isEmpty) return true; | 2693 if (name.isEmpty) return true; |
| 2684 if (name.startsWith('_')) { | 2694 if (name.startsWith('_')) { |
| 2685 compiler.reportError(node, MessageKind.PRIVATE_IDENTIFIER, | 2695 if (reportError) { |
| 2686 {'value': name}); | 2696 compiler.reportError(node, MessageKind.PRIVATE_IDENTIFIER, |
| 2697 {'value': name}); | |
| 2698 } | |
| 2687 return false; | 2699 return false; |
| 2688 } | 2700 } |
| 2689 if (!symbolValidationPattern.hasMatch(name)) { | 2701 if (!symbolValidationPattern.hasMatch(name)) { |
| 2690 compiler.reportError(node, MessageKind.INVALID_SYMBOL, | 2702 if (reportError) { |
| 2691 {'value': name}); | 2703 compiler.reportError(node, MessageKind.INVALID_SYMBOL, |
| 2704 {'value': name}); | |
| 2705 } | |
| 2692 return false; | 2706 return false; |
| 2693 } | 2707 } |
| 2694 return true; | 2708 return true; |
| 2695 } | 2709 } |
| 2696 | 2710 |
| 2697 | 2711 |
| 2698 /** | 2712 /** |
| 2699 * Try to resolve the constructor that is referred to by [node]. | 2713 * Try to resolve the constructor that is referred to by [node]. |
| 2700 * Note: this function may return an ErroneousFunctionElement instead of | 2714 * Note: this function may return an ErroneousFunctionElement instead of |
| 2701 * [null], if there is no corresponding constructor, class or library. | 2715 * [null], if there is no corresponding constructor, class or library. |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4093 return e; | 4107 return e; |
| 4094 } | 4108 } |
| 4095 | 4109 |
| 4096 /// Assumed to be called by [resolveRedirectingFactory]. | 4110 /// Assumed to be called by [resolveRedirectingFactory]. |
| 4097 Element visitReturn(Return node) { | 4111 Element visitReturn(Return node) { |
| 4098 Node expression = node.expression; | 4112 Node expression = node.expression; |
| 4099 return finishConstructorReference(visit(expression), | 4113 return finishConstructorReference(visit(expression), |
| 4100 expression, expression); | 4114 expression, expression); |
| 4101 } | 4115 } |
| 4102 } | 4116 } |
| OLD | NEW |