| 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 abstract class TreeElements { | 5 abstract class TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 DartType getType(TypeAnnotation annotation); | 8 DartType getType(TypeAnnotation annotation); |
| 9 bool isParameterChecked(Element element); | 9 bool isParameterChecked(Element element); |
| 10 } | 10 } |
| (...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 mapping[node.target] = label; | 2071 mapping[node.target] = label; |
| 2072 } | 2072 } |
| 2073 mapping[node] = target; | 2073 mapping[node] = target; |
| 2074 } | 2074 } |
| 2075 | 2075 |
| 2076 registerImplicitInvocation(SourceString name, int arity) { | 2076 registerImplicitInvocation(SourceString name, int arity) { |
| 2077 Selector selector = new Selector.call(name, null, arity); | 2077 Selector selector = new Selector.call(name, null, arity); |
| 2078 world.registerDynamicInvocation(name, selector); | 2078 world.registerDynamicInvocation(name, selector); |
| 2079 } | 2079 } |
| 2080 | 2080 |
| 2081 registerImplicitFieldGet(SourceString name) { |
| 2082 Selector selector = new Selector.getter(name, null); |
| 2083 world.registerDynamicGetter(name, selector); |
| 2084 } |
| 2085 |
| 2081 visitForIn(ForIn node) { | 2086 visitForIn(ForIn node) { |
| 2082 for (final name in const [ | 2087 for (final name in const [ |
| 2083 const SourceString('iterator'), | 2088 const SourceString('iterator'), |
| 2084 const SourceString('next'), | 2089 const SourceString('next')]) { |
| 2085 const SourceString('hasNext')]) { | |
| 2086 registerImplicitInvocation(name, 0); | 2090 registerImplicitInvocation(name, 0); |
| 2087 } | 2091 } |
| 2092 registerImplicitFieldGet(const SourceString('hasNext')); |
| 2088 visit(node.expression); | 2093 visit(node.expression); |
| 2089 Scope blockScope = new BlockScope(scope); | 2094 Scope blockScope = new BlockScope(scope); |
| 2090 Node declaration = node.declaredIdentifier; | 2095 Node declaration = node.declaredIdentifier; |
| 2091 visitIn(declaration, blockScope); | 2096 visitIn(declaration, blockScope); |
| 2092 visitLoopBodyIn(node, node.body, blockScope); | 2097 visitLoopBodyIn(node, node.body, blockScope); |
| 2093 | 2098 |
| 2094 // TODO(lrn): Also allow a single identifier. | 2099 // TODO(lrn): Also allow a single identifier. |
| 2095 if ((declaration is !Send || declaration.asSend().selector is !Identifier | 2100 if ((declaration is !Send || declaration.asSend().selector is !Identifier |
| 2096 || declaration.asSend().receiver != null) | 2101 || declaration.asSend().receiver != null) |
| 2097 && (declaration is !VariableDefinitions || | 2102 && (declaration is !VariableDefinitions || |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 return result; | 3196 return result; |
| 3192 } | 3197 } |
| 3193 Element lookup(SourceString name) => localLookup(name); | 3198 Element lookup(SourceString name) => localLookup(name); |
| 3194 Element lexicalLookup(SourceString name) => localLookup(name); | 3199 Element lexicalLookup(SourceString name) => localLookup(name); |
| 3195 | 3200 |
| 3196 Element add(Element newElement) { | 3201 Element add(Element newElement) { |
| 3197 throw "Cannot add an element in a patch library scope"; | 3202 throw "Cannot add an element in a patch library scope"; |
| 3198 } | 3203 } |
| 3199 String toString() => 'PatchLibraryScope($origin,$patch)'; | 3204 String toString() => 'PatchLibraryScope($origin,$patch)'; |
| 3200 } | 3205 } |
| OLD | NEW |