| OLD | NEW |
| 1 #!/usr/bin/env node | 1 #!/usr/bin/env node |
| 2 // ********** Library dart:core ************** | 2 // ********** Library dart:core ************** |
| 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. */ |
| (...skipping 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4600 case const$191/*Keyword.CLASS*/: | 4600 case const$191/*Keyword.CLASS*/: |
| 4601 | 4601 |
| 4602 token = this.parseClass(token); | 4602 token = this.parseClass(token); |
| 4603 break; | 4603 break; |
| 4604 | 4604 |
| 4605 case const$219/*Keyword.TYPEDEF*/: | 4605 case const$219/*Keyword.TYPEDEF*/: |
| 4606 | 4606 |
| 4607 token = this.parseNamedFunctionAlias(token); | 4607 token = this.parseNamedFunctionAlias(token); |
| 4608 break; | 4608 break; |
| 4609 | 4609 |
| 4610 case const$237/*const SourceString("#")*/: | |
| 4611 | |
| 4612 token = this.parseLibraryTags(token); | |
| 4613 break; | |
| 4614 | |
| 4615 default: | 4610 default: |
| 4616 | 4611 |
| 4617 token = this.parseTopLevelMember(token); | 4612 if ($eq(token.get$value(), const$237/*const SourceString("#")*/)) { |
| 4613 token = this.parseLibraryTags(token); |
| 4614 } |
| 4615 else { |
| 4616 token = this.parseTopLevelMember(token); |
| 4617 } |
| 4618 break; | 4618 break; |
| 4619 | 4619 |
| 4620 } | 4620 } |
| 4621 } | 4621 } |
| 4622 } | 4622 } |
| 4623 Parser.prototype.parseInterface = function(token) { | 4623 Parser.prototype.parseInterface = function(token) { |
| 4624 this.listener.beginInterface(token); | 4624 this.listener.beginInterface(token); |
| 4625 token = this.parseIdentifier(this.next(token)); | 4625 token = this.parseIdentifier(this.next(token)); |
| 4626 token = this.parseTypeVariablesOpt(token); | 4626 token = this.parseTypeVariablesOpt(token); |
| 4627 token = this.parseSupertypesClauseOpt(token); | 4627 token = this.parseSupertypesClauseOpt(token); |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5282 this.interfaceCount = 0 | 5282 this.interfaceCount = 0 |
| 5283 this.libraryTagCount = 0 | 5283 this.libraryTagCount = 0 |
| 5284 this.topLevelMemberCount = 0 | 5284 this.topLevelMemberCount = 0 |
| 5285 this.previousIdentifier = null | 5285 this.previousIdentifier = null |
| 5286 this.canceler = canceler; | 5286 this.canceler = canceler; |
| 5287 this.builders = const$227/*const EmptyLink<DeclarationBuilder>()*/; | 5287 this.builders = const$227/*const EmptyLink<DeclarationBuilder>()*/; |
| 5288 this.topLevelElements = const$227/*const EmptyLink<DeclarationBuilder>()*/; | 5288 this.topLevelElements = const$227/*const EmptyLink<DeclarationBuilder>()*/; |
| 5289 // Initializers done | 5289 // Initializers done |
| 5290 } | 5290 } |
| 5291 Listener.prototype.beginLibraryTag = function(token) { | 5291 Listener.prototype.beginLibraryTag = function(token) { |
| 5292 this.canceler.cancel("Cannot handle library tags"); |
| 5292 this.libraryTagCount++; | 5293 this.libraryTagCount++; |
| 5293 } | 5294 } |
| 5294 Listener.prototype.beginClass = function(token) { | 5295 Listener.prototype.beginClass = function(token) { |
| 5295 this.classCount++; | 5296 this.classCount++; |
| 5296 this.push(token, this.get$buildClassElement()); | 5297 this.push(token, this.get$buildClassElement()); |
| 5297 } | 5298 } |
| 5298 Listener.prototype.buildClassElement = function(declaration) { | 5299 Listener.prototype.buildClassElement = function(declaration) { |
| 5299 return null; | 5300 this.canceler.cancel("Cannot handle classes"); |
| 5300 } | 5301 } |
| 5301 Listener.prototype.get$buildClassElement = function() { | 5302 Listener.prototype.get$buildClassElement = function() { |
| 5302 return Listener.prototype.buildClassElement.bind(this); | 5303 return Listener.prototype.buildClassElement.bind(this); |
| 5303 } | 5304 } |
| 5304 Listener.prototype.endClass = function(token) { | 5305 Listener.prototype.endClass = function(token) { |
| 5305 this.handleDeclaration(this.pop(), token); | 5306 this.handleDeclaration(this.pop(), token); |
| 5306 } | 5307 } |
| 5307 Listener.prototype.beginInterface = function(token) { | 5308 Listener.prototype.beginInterface = function(token) { |
| 5308 this.interfaceCount++; | 5309 this.interfaceCount++; |
| 5309 this.push(token, this.get$buildInterfaceElement()); | 5310 this.push(token, this.get$buildInterfaceElement()); |
| 5310 } | 5311 } |
| 5311 Listener.prototype.buildInterfaceElement = function(declaration) { | 5312 Listener.prototype.buildInterfaceElement = function(declaration) { |
| 5312 return null; | 5313 this.canceler.cancel("Cannot handle interfaces"); |
| 5313 } | 5314 } |
| 5314 Listener.prototype.get$buildInterfaceElement = function() { | 5315 Listener.prototype.get$buildInterfaceElement = function() { |
| 5315 return Listener.prototype.buildInterfaceElement.bind(this); | 5316 return Listener.prototype.buildInterfaceElement.bind(this); |
| 5316 } | 5317 } |
| 5317 Listener.prototype.endInterface = function(token) { | 5318 Listener.prototype.endInterface = function(token) { |
| 5318 this.handleDeclaration(this.pop(), token); | 5319 this.handleDeclaration(this.pop(), token); |
| 5319 } | 5320 } |
| 5320 Listener.prototype.beginFunctionTypeAlias = function(token) { | 5321 Listener.prototype.beginFunctionTypeAlias = function(token) { |
| 5321 this.aliasCount++; | 5322 this.aliasCount++; |
| 5322 this.push(token, this.get$buildFunctionTypeAliasElement()); | 5323 this.push(token, this.get$buildFunctionTypeAliasElement()); |
| 5323 } | 5324 } |
| 5324 Listener.prototype.buildFunctionTypeAliasElement = function(declaration) { | 5325 Listener.prototype.buildFunctionTypeAliasElement = function(declaration) { |
| 5325 return null; | 5326 this.canceler.cancel("Cannot handle typedefs"); |
| 5326 } | 5327 } |
| 5327 Listener.prototype.get$buildFunctionTypeAliasElement = function() { | 5328 Listener.prototype.get$buildFunctionTypeAliasElement = function() { |
| 5328 return Listener.prototype.buildFunctionTypeAliasElement.bind(this); | 5329 return Listener.prototype.buildFunctionTypeAliasElement.bind(this); |
| 5329 } | 5330 } |
| 5330 Listener.prototype.endFunctionTypeAlias = function(token) { | 5331 Listener.prototype.endFunctionTypeAlias = function(token) { |
| 5331 this.handleDeclaration(this.pop(), token); | 5332 this.handleDeclaration(this.pop(), token); |
| 5332 } | 5333 } |
| 5333 Listener.prototype.beginTopLevelMember = function(token) { | 5334 Listener.prototype.beginTopLevelMember = function(token) { |
| 5334 this.topLevelMemberCount++; | 5335 this.topLevelMemberCount++; |
| 5335 } | 5336 } |
| 5336 Listener.prototype.topLevelMethod = function(token) { | 5337 Listener.prototype.topLevelMethod = function(token) { |
| 5337 this.push(token, this.get$buildMethod()); | 5338 this.push(token, this.get$buildMethod()); |
| 5338 this.builders.get$head().name = this.previousIdentifier.get$source(); | 5339 this.builders.get$head().name = this.previousIdentifier.get$source(); |
| 5339 } | 5340 } |
| 5340 Listener.prototype.buildMethod = function(declaration) { | 5341 Listener.prototype.buildMethod = function(declaration) { |
| 5341 return new PartialFunctionElement(declaration.name, declaration.beginToken, de
claration.endToken); | 5342 return new PartialFunctionElement(declaration.name, declaration.beginToken, de
claration.endToken); |
| 5342 } | 5343 } |
| 5343 Listener.prototype.get$buildMethod = function() { | 5344 Listener.prototype.get$buildMethod = function() { |
| 5344 return Listener.prototype.buildMethod.bind(this); | 5345 return Listener.prototype.buildMethod.bind(this); |
| 5345 } | 5346 } |
| 5346 Listener.prototype.topLevelField = function(token) { | 5347 Listener.prototype.topLevelField = function(token) { |
| 5347 this.push(token, this.get$buildField()); | 5348 this.push(token, this.get$buildField()); |
| 5348 this.builders.get$head().name = this.previousIdentifier.get$source(); | 5349 this.builders.get$head().name = this.previousIdentifier.get$source(); |
| 5349 } | 5350 } |
| 5350 Listener.prototype.buildField = function(declaration) { | 5351 Listener.prototype.buildField = function(declaration) { |
| 5351 return null; | 5352 this.canceler.cancel("Cannot handle fields"); |
| 5352 } | 5353 } |
| 5353 Listener.prototype.get$buildField = function() { | 5354 Listener.prototype.get$buildField = function() { |
| 5354 return Listener.prototype.buildField.bind(this); | 5355 return Listener.prototype.buildField.bind(this); |
| 5355 } | 5356 } |
| 5356 Listener.prototype.endTopLevelMember = function(token) { | 5357 Listener.prototype.endTopLevelMember = function(token) { |
| 5357 this.handleDeclaration(this.pop(), token); | 5358 this.handleDeclaration(this.pop(), token); |
| 5358 } | 5359 } |
| 5359 Listener.prototype.beginTypeVariable = function(token) { | 5360 Listener.prototype.beginTypeVariable = function(token) { |
| 5360 | 5361 |
| 5361 } | 5362 } |
| (...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7687 this.visit(node.body); | 7688 this.visit(node.body); |
| 7688 this.expectedReturnType = previous; | 7689 this.expectedReturnType = previous; |
| 7689 return functionType; | 7690 return functionType; |
| 7690 } | 7691 } |
| 7691 TypeCheckerVisitor.prototype.visitIdentifier = function(node) { | 7692 TypeCheckerVisitor.prototype.visitIdentifier = function(node) { |
| 7692 this.fail(node); | 7693 this.fail(node); |
| 7693 } | 7694 } |
| 7694 TypeCheckerVisitor.prototype.visitSend = function(node) { | 7695 TypeCheckerVisitor.prototype.visitSend = function(node) { |
| 7695 var target = this.elements.$index(node); | 7696 var target = this.elements.$index(node); |
| 7696 if (target != null) { | 7697 if (target != null) { |
| 7697 var funType = target.type; | 7698 var funType = target.computeType(this.compiler, this.types); |
| 7698 var formals = funType.parameterTypes; | 7699 var formals = funType.parameterTypes; |
| 7699 var arguments = node.get$arguments(); | 7700 var arguments = node.get$arguments(); |
| 7700 while ((!formals.isEmpty()) && (!arguments.isEmpty())) { | 7701 while ((!formals.isEmpty()) && (!arguments.isEmpty())) { |
| 7701 this.compiler.cancel('parameters not supported.'); | 7702 this.compiler.cancel('parameters not supported.'); |
| 7702 var argumentType = this.visit(arguments.get$head()); | 7703 var argumentType = this.visit(arguments.get$head()); |
| 7703 if (!this.types.isAssignable(formals.get$head(), argumentType)) { | 7704 if (!this.types.isAssignable(formals.get$head(), argumentType)) { |
| 7704 var warning = CompilerError.NOT_ASSIGNABLE(argumentType, formals.get$hea
d()); | 7705 var warning = CompilerError.NOT_ASSIGNABLE(argumentType, formals.get$hea
d()); |
| 7705 this.compiler.reportWarning(node, warning); | 7706 this.compiler.reportWarning(node, warning); |
| 7706 } | 7707 } |
| 7707 formals = formals.get$tail(); | 7708 formals = formals.get$tail(); |
| (...skipping 9897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17605 INTERFACE, | 17606 INTERFACE, |
| 17606 LIBRARY, | 17607 LIBRARY, |
| 17607 NATIVE, | 17608 NATIVE, |
| 17608 NEGATE, | 17609 NEGATE, |
| 17609 OPERATOR, | 17610 OPERATOR, |
| 17610 SET, | 17611 SET, |
| 17611 SOURCE, | 17612 SOURCE, |
| 17612 STATIC, | 17613 STATIC, |
| 17613 TYPEDEF ]*/; | 17614 TYPEDEF ]*/; |
| 17614 main(); | 17615 main(); |
| OLD | NEW |