Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 // ********** Library dart:core ************** | 2 // ********** Library dart:core ************** |
|
zundel
2011/11/07 19:26:53
I take it you don't mean to check in this file.
| |
| 3 // ********** Natives core.js ************** | 3 // ********** Natives core.js ************** |
| 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 5 // for details. All rights reserved. Use of this source code is governed by a | 5 // for details. All rights reserved. Use of this source code is governed by a |
| 6 // BSD-style license that can be found in the LICENSE file. | 6 // BSD-style license that can be found in the LICENSE file. |
| 7 | 7 |
| 8 // TODO(jimhug): Completeness - see tests/corelib | 8 // TODO(jimhug): Completeness - see tests/corelib |
| 9 | 9 |
| 10 /** Implements extends for dart classes on javascript prototypes. */ | 10 /** Implements extends for dart classes on javascript prototypes. */ |
| 11 function $inherits(child, parent) { | 11 function $inherits(child, parent) { |
| 12 if (child.prototype.__proto__) { | 12 if (child.prototype.__proto__) { |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 807 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 808 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 808 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 809 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { | 809 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { |
| 810 this._grow(this._keys.length); | 810 this._grow(this._keys.length); |
| 811 } | 811 } |
| 812 } | 812 } |
| 813 HashMapImplementation._isPowerOfTwo = function(x) { | 813 HashMapImplementation._isPowerOfTwo = function(x) { |
| 814 return ((x & (x - 1)) == 0); | 814 return ((x & (x - 1)) == 0); |
| 815 } | 815 } |
| 816 HashMapImplementation.prototype._grow = function(newCapacity) { | 816 HashMapImplementation.prototype._grow = function(newCapacity) { |
| 817 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "/usr/local/google/home/ngeoffray/dart-all2/bleeding_edge/dart/corelib /src/implementation/hash_map_set.dart", 153, 12); | 817 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "/home/kasperl/Dart/dart/corelib/src/implementation/hash_map_set.dart" , 153, 12); |
| 818 var capacity = this._keys.length; | 818 var capacity = this._keys.length; |
| 819 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 819 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 820 var oldKeys = this._keys; | 820 var oldKeys = this._keys; |
| 821 var oldValues = this._values; | 821 var oldValues = this._values; |
| 822 this._keys = new ListFactory(newCapacity); | 822 this._keys = new ListFactory(newCapacity); |
| 823 this._values = new ListFactory$V(newCapacity); | 823 this._values = new ListFactory$V(newCapacity); |
| 824 for (var i = 0; | 824 for (var i = 0; |
| 825 $notnull_bool(i < capacity); i++) { | 825 $notnull_bool(i < capacity); i++) { |
| 826 var key = oldKeys.$index(i); | 826 var key = oldKeys.$index(i); |
| 827 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey)) { | 827 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey)) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 964 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; | 964 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; |
| 965 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; | 965 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; |
| 966 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { | 966 if ($notnull_bool(this._numberOfDeleted > numberOfFree)) { |
| 967 this._grow(this._keys.length); | 967 this._grow(this._keys.length); |
| 968 } | 968 } |
| 969 } | 969 } |
| 970 HashMapImplementation$E$E._isPowerOfTwo = function(x) { | 970 HashMapImplementation$E$E._isPowerOfTwo = function(x) { |
| 971 return ((x & (x - 1)) == 0); | 971 return ((x & (x - 1)) == 0); |
| 972 } | 972 } |
| 973 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { | 973 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { |
| 974 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "/usr/local/google/home/ngeoffray/dart-all2/bleeding_edge/dart/corelib /src/implementation/hash_map_set.dart", 153, 12); | 974 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "/home/kasperl/Dart/dart/corelib/src/implementation/hash_map_set.dart" , 153, 12); |
| 975 var capacity = this._keys.length; | 975 var capacity = this._keys.length; |
| 976 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); | 976 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); |
| 977 var oldKeys = this._keys; | 977 var oldKeys = this._keys; |
| 978 var oldValues = this._values; | 978 var oldValues = this._values; |
| 979 this._keys = new ListFactory(newCapacity); | 979 this._keys = new ListFactory(newCapacity); |
| 980 this._values = new ListFactory$E(newCapacity); | 980 this._values = new ListFactory$E(newCapacity); |
| 981 for (var i = 0; | 981 for (var i = 0; |
| 982 $notnull_bool(i < capacity); i++) { | 982 $notnull_bool(i < capacity); i++) { |
| 983 var key = oldKeys.$index(i); | 983 var key = oldKeys.$index(i); |
| 984 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey)) { | 984 if ($notnull_bool(key == null || key === HashMapImplementation._deletedKey)) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1329 if ($notnull_bool(entry == null)) return null; | 1329 if ($notnull_bool(entry == null)) return null; |
| 1330 return entry.get$element().get$value(); | 1330 return entry.get$element().get$value(); |
| 1331 } | 1331 } |
| 1332 LinkedHashMapImplementation.prototype.getKeys = function() { | 1332 LinkedHashMapImplementation.prototype.getKeys = function() { |
| 1333 var list = new ListFactory$K(this.get$length()); | 1333 var list = new ListFactory$K(this.get$length()); |
| 1334 var index = 0; | 1334 var index = 0; |
| 1335 this._list.forEach(function _(entry) { | 1335 this._list.forEach(function _(entry) { |
| 1336 list.$setindex(index++, entry.key); | 1336 list.$setindex(index++, entry.key); |
| 1337 } | 1337 } |
| 1338 ); | 1338 ); |
| 1339 $assert(index == this.get$length(), "index == length", "/usr/local/google/home /ngeoffray/dart-all2/bleeding_edge/dart/corelib/src/implementation/linked_hash_m ap.dart", 75, 12); | 1339 $assert(index == this.get$length(), "index == length", "/home/kasperl/Dart/dar t/corelib/src/implementation/linked_hash_map.dart", 75, 12); |
| 1340 return list; | 1340 return list; |
| 1341 } | 1341 } |
| 1342 LinkedHashMapImplementation.prototype.getValues = function() { | 1342 LinkedHashMapImplementation.prototype.getValues = function() { |
| 1343 var list = new ListFactory$V(this.get$length()); | 1343 var list = new ListFactory$V(this.get$length()); |
| 1344 var index = 0; | 1344 var index = 0; |
| 1345 this._list.forEach(function _(entry) { | 1345 this._list.forEach(function _(entry) { |
| 1346 list.$setindex(index++, entry.value); | 1346 list.$setindex(index++, entry.value); |
| 1347 } | 1347 } |
| 1348 ); | 1348 ); |
| 1349 $assert(index == this.get$length(), "index == length", "/usr/local/google/home /ngeoffray/dart-all2/bleeding_edge/dart/corelib/src/implementation/linked_hash_m ap.dart", 86, 12); | 1349 $assert(index == this.get$length(), "index == length", "/home/kasperl/Dart/dar t/corelib/src/implementation/linked_hash_map.dart", 86, 12); |
| 1350 return list; | 1350 return list; |
| 1351 } | 1351 } |
| 1352 LinkedHashMapImplementation.prototype.forEach = function(f) { | 1352 LinkedHashMapImplementation.prototype.forEach = function(f) { |
| 1353 this._list.forEach(function _(entry) { | 1353 this._list.forEach(function _(entry) { |
| 1354 f(entry.key, entry.value); | 1354 f(entry.key, entry.value); |
| 1355 } | 1355 } |
| 1356 ); | 1356 ); |
| 1357 } | 1357 } |
| 1358 LinkedHashMapImplementation.prototype.containsKey = function(key) { | 1358 LinkedHashMapImplementation.prototype.containsKey = function(key) { |
| 1359 return this._map.containsKey(key); | 1359 return this._map.containsKey(key); |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2953 } | 2953 } |
| 2954 AbstractLink.prototype.prepend = function(element) { | 2954 AbstractLink.prototype.prepend = function(element) { |
| 2955 return LinkFactory.Link$factory(element, this); | 2955 return LinkFactory.Link$factory(element, this); |
| 2956 } | 2956 } |
| 2957 AbstractLink.prototype.iterator = function() { | 2957 AbstractLink.prototype.iterator = function() { |
| 2958 return this.toList().iterator(); | 2958 return this.toList().iterator(); |
| 2959 } | 2959 } |
| 2960 AbstractLink.prototype.printOn = function(buffer, separatedBy) { | 2960 AbstractLink.prototype.printOn = function(buffer, separatedBy) { |
| 2961 var $0; | 2961 var $0; |
| 2962 if ($notnull_bool(this.isEmpty())) return; | 2962 if ($notnull_bool(this.isEmpty())) return; |
| 2963 buffer.add($notnull_bool(this.get$head() == null) ? 'null' : this.get$head()); | 2963 buffer.add(this.get$head()); |
| 2964 for (var link = this.get$tail(); | 2964 for (var link = this.get$tail(); |
| 2965 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link())) { | 2965 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link())) { |
| 2966 buffer.add(separatedBy); | 2966 buffer.add(separatedBy); |
| 2967 buffer.add(link.get$head()); | 2967 buffer.add(link.get$head()); |
| 2968 } | 2968 } |
| 2969 } | 2969 } |
| 2970 AbstractLink.prototype.toString = function() { | 2970 AbstractLink.prototype.toString = function() { |
| 2971 var buffer = new StringBufferImpl(""); | 2971 var buffer = new StringBufferImpl(""); |
| 2972 buffer.add('[ '); | 2972 buffer.add('[ '); |
| 2973 this.printOn(buffer, ', '); | 2973 this.printOn(buffer, ', '); |
| (...skipping 5047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8021 } | 8021 } |
| 8022 ResolverTask.prototype.resolve = function(tree) { | 8022 ResolverTask.prototype.resolve = function(tree) { |
| 8023 var $this = this; // closure support | 8023 var $this = this; // closure support |
| 8024 return this.measure((function () { | 8024 return this.measure((function () { |
| 8025 var visitor = new ResolverVisitor($this.compiler); | 8025 var visitor = new ResolverVisitor($this.compiler); |
| 8026 visitor.visit(tree); | 8026 visitor.visit(tree); |
| 8027 return visitor.mapping; | 8027 return visitor.mapping; |
| 8028 }) | 8028 }) |
| 8029 ); | 8029 ); |
| 8030 } | 8030 } |
| 8031 // ********** Code for ErrorMessages ************** | |
| 8032 function ErrorMessages() {} | |
| 8033 ErrorMessages.canNotResolve = function(id) { | |
| 8034 return ("cannot resolve " + id + ""); | |
| 8035 } | |
| 8036 ErrorMessages.duplicateDefinition = function(id) { | |
| 8037 return ("duplicate definition of " + id + ""); | |
| 8038 } | |
| 8039 // ********** Code for ResolverVisitor ************** | 8031 // ********** Code for ResolverVisitor ************** |
| 8040 function ResolverVisitor(compiler0) { | 8032 function ResolverVisitor(compiler0) { |
| 8041 this.compiler = compiler0; | 8033 this.compiler = compiler0; |
| 8042 this.mapping = new HashMapImplementation$Node$Element(); | 8034 this.mapping = new HashMapImplementation$Node$Element(); |
| 8043 this.context = new Scope(new TopScope(compiler0.universe)); | 8035 this.context = new Scope(new TopScope(compiler0.universe)); |
| 8044 // Initializers done | 8036 // Initializers done |
| 8045 } | 8037 } |
| 8046 ResolverVisitor.prototype.fail = function(node, message) { | 8038 ResolverVisitor.prototype.fail = function(node) { |
| 8047 this.compiler.cancel(message); | 8039 this.compiler.cancel(('cannot resolve ' + node + '')); |
| 8048 } | 8040 } |
| 8049 ResolverVisitor.prototype.visit = function(node) { | 8041 ResolverVisitor.prototype.visit = function(node) { |
| 8050 if ($notnull_bool(node == null)) return null; | 8042 if ($notnull_bool(node == null)) return null; |
| 8051 return node.accept(this); | 8043 var element = node.accept(this); |
| 8044 if ($notnull_bool(element != null)) { | |
| 8045 this.mapping.$setindex(node, element); | |
| 8046 } | |
| 8047 return element; | |
| 8052 } | 8048 } |
| 8053 ResolverVisitor.prototype.visitIn = function(node, scope) { | 8049 ResolverVisitor.prototype.visitIn = function(node, scope) { |
| 8054 this.context = scope; | 8050 this.context = scope; |
| 8055 var element = this.visit(node); | 8051 var element = this.visit(node); |
| 8056 this.context = this.context.parent; | 8052 this.context = this.context.parent; |
| 8057 return element; | 8053 return element; |
| 8058 } | 8054 } |
| 8059 ResolverVisitor.prototype.visitBlock = function(node) { | 8055 ResolverVisitor.prototype.visitBlock = function(node) { |
| 8060 this.visitIn(node.statements, new Scope(this.context)); | 8056 this.visitIn(node.statements, new Scope(this.context)); |
| 8061 } | 8057 } |
| 8062 ResolverVisitor.prototype.visitExpressionStatement = function(node) { | 8058 ResolverVisitor.prototype.visitExpressionStatement = function(node) { |
| 8063 this.visit(node.expression); | 8059 this.visit(node.expression); |
| 8064 } | 8060 } |
| 8065 ResolverVisitor.prototype.visitFunctionExpression = function(node) { | 8061 ResolverVisitor.prototype.visitFunctionExpression = function(node) { |
| 8066 if ($notnull_bool(!$notnull_bool(node.parameters.nodes.isEmpty()))) this.fail( node, "Unimplemented in the resolver"); | 8062 if ($notnull_bool(!$notnull_bool(node.parameters.nodes.isEmpty()))) this.fail( node); |
| 8067 var enclosingElement = this.visit(node.name); | 8063 var enclosingElement = this.visit(node.name); |
| 8068 this.visitIn(node.body, new Scope.enclosing$ctor(this.context, enclosingElemen t)); | 8064 this.visitIn(node.body, new Scope.enclosing$ctor(this.context, enclosingElemen t)); |
| 8069 return enclosingElement; | 8065 return enclosingElement; |
| 8070 } | 8066 } |
| 8071 ResolverVisitor.prototype.visitIdentifier = function(node) { | 8067 ResolverVisitor.prototype.visitIdentifier = function(node) { |
| 8072 var element = this.context.lookup(node.get$source()); | 8068 var element = this.context.lookup(node.get$source()); |
| 8073 if ($notnull_bool(element == null)) this.fail(node, ErrorMessages.canNotResolv e(node)); | 8069 if ($notnull_bool(element == null)) this.fail(node); |
| 8074 this.useElement(node, element); | |
| 8075 return element; | 8070 return element; |
| 8076 } | 8071 } |
| 8077 ResolverVisitor.prototype.visitIf = function(node) { | 8072 ResolverVisitor.prototype.visitIf = function(node) { |
| 8078 this.visit(node.condition); | 8073 this.visit(node.condition); |
| 8079 this.visit(node.thenPart); | 8074 this.visit(node.thenPart); |
| 8080 this.visit(node.elsePart); | 8075 this.visit(node.elsePart); |
| 8081 } | 8076 } |
| 8082 ResolverVisitor.prototype.visitSend = function(node) { | 8077 ResolverVisitor.prototype.visitSend = function(node) { |
| 8078 var $0; | |
| 8083 var target = null; | 8079 var target = null; |
| 8084 this.visit(node.receiver); | 8080 this.visit(node.receiver); |
| 8085 var name = node.selector.get$source(); | 8081 var name = node.selector.get$source(); |
| 8086 if ($notnull_bool($eq(name, const$231/*const SourceString('print')*/) || $eq(n ame, const$232/*const SourceString('+')*/) || $eq(name, const$233/*const SourceS tring('-')*/) || $eq(name, const$234/*const SourceString('*')*/) || $eq(name, co nst$235/*const SourceString('/')*/) || $eq(name, const$236/*const SourceString(' ~/')*/))) { | 8082 if ($notnull_bool($eq(name, const$231/*const SourceString('print')*/) || $eq(n ame, const$232/*const SourceString('+')*/) || $eq(name, const$233/*const SourceS tring('-')*/) || $eq(name, const$234/*const SourceString('*')*/) || $eq(name, co nst$235/*const SourceString('/')*/) || $eq(name, const$236/*const SourceString(' ~/')*/))) { |
| 8087 } | 8083 } |
| 8088 else { | 8084 else { |
| 8089 this.visit(node.selector); | 8085 target = (($0 = this.visit(node.selector)) && $0.is$Element()); |
| 8086 if ($notnull_bool(target == null)) { | |
| 8087 this.fail(node); | |
| 8088 } | |
| 8090 } | 8089 } |
| 8091 this.visit(node.argumentsNode); | 8090 this.visit(node.argumentsNode); |
| 8092 return target; | 8091 return target; |
| 8093 } | 8092 } |
| 8094 ResolverVisitor.prototype.visitSendSet = function(node) { | 8093 ResolverVisitor.prototype.visitSendSet = function(node) { |
| 8095 this.compiler.unimplemented('ResolverVisitor::visitSendSet'); | 8094 this.compiler.unimplemented('ResolverVisitor::visitSendSet'); |
| 8096 } | 8095 } |
| 8097 ResolverVisitor.prototype.visitLiteralInt = function(node) { | 8096 ResolverVisitor.prototype.visitLiteralInt = function(node) { |
| 8098 | 8097 |
| 8099 } | 8098 } |
| 8100 ResolverVisitor.prototype.visitLiteralDouble = function(node) { | 8099 ResolverVisitor.prototype.visitLiteralDouble = function(node) { |
| 8101 | 8100 |
| 8102 } | 8101 } |
| 8103 ResolverVisitor.prototype.visitLiteralBool = function(node) { | 8102 ResolverVisitor.prototype.visitLiteralBool = function(node) { |
| 8104 | 8103 |
| 8105 } | 8104 } |
| 8106 ResolverVisitor.prototype.visitLiteralString = function(node) { | 8105 ResolverVisitor.prototype.visitLiteralString = function(node) { |
| 8107 | 8106 |
| 8108 } | 8107 } |
| 8109 ResolverVisitor.prototype.visitNodeList = function(node) { | 8108 ResolverVisitor.prototype.visitNodeList = function(node) { |
| 8110 var $0; | 8109 var $0; |
| 8111 for (var link = node.nodes; | 8110 for (var link = node.nodes; |
| 8112 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 8111 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { |
| 8113 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8112 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8114 } | 8113 } |
| 8115 } | 8114 } |
| 8116 ResolverVisitor.prototype.visitOperator = function(node) { | 8115 ResolverVisitor.prototype.visitOperator = function(node) { |
| 8117 this.fail(node, "Unimplemented in the resolver"); | 8116 this.fail(node); |
| 8118 } | 8117 } |
| 8119 ResolverVisitor.prototype.visitReturn = function(node) { | 8118 ResolverVisitor.prototype.visitReturn = function(node) { |
| 8120 this.visit(node.expression); | 8119 this.visit(node.expression); |
| 8121 return null; | 8120 return null; |
| 8122 } | 8121 } |
| 8123 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { | 8122 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { |
| 8124 | 8123 |
| 8125 } | 8124 } |
| 8126 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { | 8125 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { |
| 8127 var visitor = new VariableDefinitionsVisitor(node, this); | 8126 var visitor = new VariableDefinitionsVisitor(node, this); |
| 8128 visitor.visit(node.definitions); | 8127 visitor.visit(node.definitions); |
| 8129 } | 8128 } |
| 8130 ResolverVisitor.prototype.defineElement = function(node, element) { | 8129 ResolverVisitor.prototype.setElement = function(node, element) { |
| 8131 this.mapping.$setindex(node, element); | 8130 this.mapping.$setindex(node, element); |
| 8132 return this.context.add(element); | 8131 this.context.add(element); |
| 8133 } | |
| 8134 ResolverVisitor.prototype.useElement = function(node, element) { | |
| 8135 this.mapping.$setindex(node, element); | |
| 8136 } | 8132 } |
| 8137 // ********** Code for VariableDefinitionsVisitor ************** | 8133 // ********** Code for VariableDefinitionsVisitor ************** |
| 8138 function VariableDefinitionsVisitor(definitions, resolver) { | 8134 function VariableDefinitionsVisitor(definitions, resolver) { |
| 8139 this.definitions = definitions; | 8135 this.definitions = definitions; |
| 8140 this.resolver = resolver; | 8136 this.resolver = resolver; |
| 8141 // Initializers done | 8137 // Initializers done |
| 8142 } | 8138 } |
| 8143 VariableDefinitionsVisitor.prototype.visitSend = function(node) { | 8139 VariableDefinitionsVisitor.prototype.visitSend = function(node) { |
| 8144 var $0; | 8140 var $0; |
| 8145 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt y()", "leg/resolver.dart", 158, 12); | 8141 $assert(node.get$arguments().get$tail().isEmpty(), "node.arguments.tail.isEmpt y()", "leg/resolver.dart", 153, 12); |
| 8146 var selector = node.selector; | 8142 var selector = node.selector; |
| 8147 var name = selector.get$source(); | 8143 var name = selector.get$source(); |
| 8148 $assert($eq(name, const$237/*const SourceString('=')*/), "name == const Source String('=')", "leg/resolver.dart", 161, 12); | 8144 $assert($eq(name, const$237/*const SourceString('=')*/), "name == const Source String('=')", "leg/resolver.dart", 156, 12); |
| 8149 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); | 8145 this.resolver.visit((($0 = node.get$arguments().get$head()) && $0.is$Node())); |
| 8150 this.visit(node.receiver); | 8146 this.visit(node.receiver); |
| 8151 } | 8147 } |
| 8152 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { | 8148 VariableDefinitionsVisitor.prototype.visitIdentifier = function(node) { |
| 8153 var variableElement = new Element(node.get$source(), this.resolver.context.enc losingElement); | 8149 var variableElement = new Element(node.get$source(), this.resolver.context.enc losingElement); |
| 8154 var existing = this.resolver.defineElement(node, variableElement); | 8150 this.resolver.setElement(node, variableElement); |
| 8155 if ($notnull_bool($ne(existing, variableElement))) { | |
| 8156 this.resolver.fail(node, ErrorMessages.duplicateDefinition(node)); | |
| 8157 } | |
| 8158 } | 8151 } |
| 8159 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { | 8152 VariableDefinitionsVisitor.prototype.visitNodeList = function(node) { |
| 8160 var $0; | 8153 var $0; |
| 8161 for (var link = node.nodes; | 8154 for (var link = node.nodes; |
| 8162 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { | 8155 $notnull_bool(!$notnull_bool(link.isEmpty())); link = (($0 = link.get$tail()) && $0.is$Link$Node())) { |
| 8163 this.visit((($0 = link.get$head()) && $0.is$Node())); | 8156 this.visit((($0 = link.get$head()) && $0.is$Node())); |
| 8164 } | 8157 } |
| 8165 } | 8158 } |
| 8166 VariableDefinitionsVisitor.prototype.visit = function(node) { | 8159 VariableDefinitionsVisitor.prototype.visit = function(node) { |
| 8167 return node.accept(this); | 8160 return node.accept(this); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 8185 // Initializers done | 8178 // Initializers done |
| 8186 } | 8179 } |
| 8187 Scope.enclosing$ctor.prototype = Scope.prototype; | 8180 Scope.enclosing$ctor.prototype = Scope.prototype; |
| 8188 Scope.prototype.get$parent = function() { return this.parent; }; | 8181 Scope.prototype.get$parent = function() { return this.parent; }; |
| 8189 Scope.prototype.lookup = function(name) { | 8182 Scope.prototype.lookup = function(name) { |
| 8190 var element = this.elements.$index(name); | 8183 var element = this.elements.$index(name); |
| 8191 if ($notnull_bool(element != null)) return element; | 8184 if ($notnull_bool(element != null)) return element; |
| 8192 return this.parent.lookup(name); | 8185 return this.parent.lookup(name); |
| 8193 } | 8186 } |
| 8194 Scope.prototype.add = function(element) { | 8187 Scope.prototype.add = function(element) { |
| 8195 if ($notnull_bool(this.elements.containsKey(element.name))) return this.elemen ts.$index(element.name); | |
| 8196 this.elements.$setindex(element.name, element); | 8188 this.elements.$setindex(element.name, element); |
| 8197 return element; | |
| 8198 } | 8189 } |
| 8199 // ********** Code for TopScope ************** | 8190 // ********** Code for TopScope ************** |
| 8200 function TopScope(universe) { | 8191 function TopScope(universe) { |
| 8201 this.universe = universe; | 8192 this.universe = universe; |
| 8202 Scope.top$ctor.call(this); | 8193 Scope.top$ctor.call(this); |
| 8203 // Initializers done | 8194 // Initializers done |
| 8204 } | 8195 } |
| 8205 $inherits(TopScope, Scope); | 8196 $inherits(TopScope, Scope); |
| 8206 TopScope.prototype.lookup = function(name) { | 8197 TopScope.prototype.lookup = function(name) { |
| 8207 return this.universe.find(name); | 8198 return this.universe.find(name); |
| (...skipping 10419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18627 INTERFACE, | 18618 INTERFACE, |
| 18628 LIBRARY, | 18619 LIBRARY, |
| 18629 NATIVE, | 18620 NATIVE, |
| 18630 NEGATE, | 18621 NEGATE, |
| 18631 OPERATOR, | 18622 OPERATOR, |
| 18632 SET, | 18623 SET, |
| 18633 SOURCE, | 18624 SOURCE, |
| 18634 STATIC, | 18625 STATIC, |
| 18635 TYPEDEF ]*/; | 18626 TYPEDEF ]*/; |
| 18636 main(); | 18627 main(); |
| OLD | NEW |