Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: frog/frogsh

Issue 8485002: more negative test fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/evaluator.dart ('k') | frog/gen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8437 matching lines...) Expand 10 before | Expand all | Expand 10 after
8448 this.writeType((ct && ct.is$lang_Type())); 8448 this.writeType((ct && ct.is$lang_Type()));
8449 } 8449 }
8450 } 8450 }
8451 } 8451 }
8452 if ($notnull_bool(type.typeCheckCode != null)) { 8452 if ($notnull_bool(type.typeCheckCode != null)) {
8453 this.writer.writeln(type.typeCheckCode); 8453 this.writer.writeln(type.typeCheckCode);
8454 } 8454 }
8455 } 8455 }
8456 } 8456 }
8457 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) { 8457 WorldGenerator.prototype.genMethod = function(meth, enclosingMethod) {
8458 if ($notnull_bool(!meth.isGenerated && meth.declaringType.get$isClass() && $ne (meth.get$definition(), null) && !meth.get$isAbstract())) { 8458 if ($notnull_bool(!meth.isGenerated && !meth.get$isAbstract() && $ne(meth.get$ definition(), null))) {
8459 new MethodGenerator(meth, enclosingMethod).run(); 8459 new MethodGenerator(meth, enclosingMethod).run();
8460 } 8460 }
8461 } 8461 }
8462 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { 8462 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) {
8463 if ($notnull_bool(!checkType.isTested)) return; 8463 if ($notnull_bool(!checkType.isTested)) return;
8464 var value = 'false'; 8464 var value = 'false';
8465 if ($notnull_bool(onType.isSubtypeOf(checkType))) { 8465 if ($notnull_bool(onType.isSubtypeOf(checkType))) {
8466 value = 'function(){return this;}'; 8466 value = 'function(){return this;}';
8467 } 8467 }
8468 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';')); 8468 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';'));
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
8878 else if ($notnull_bool(this.method.get$isStatic())) { 8878 else if ($notnull_bool(this.method.get$isStatic())) {
8879 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {')); 8879 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {'));
8880 } 8880 }
8881 else { 8881 else {
8882 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); 8882 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {'));
8883 } 8883 }
8884 if ($notnull_bool(this.needsThis)) { 8884 if ($notnull_bool(this.needsThis)) {
8885 defWriter.writeln('var \$this = this; // closure support'); 8885 defWriter.writeln('var \$this = this; // closure support');
8886 } 8886 }
8887 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length > 0)) { 8887 if ($notnull_bool(this._usedTemps.get$length() > 0 || this._freeTemps.length > 0)) {
8888 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 653, 14); 8888 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 652, 14);
8889 this._freeTemps.addAll(this._usedTemps); 8889 this._freeTemps.addAll(this._usedTemps);
8890 this._freeTemps.sort((function (x, y) { 8890 this._freeTemps.sort((function (x, y) {
8891 return x.compareTo(y); 8891 return x.compareTo(y);
8892 }) 8892 })
8893 ); 8893 );
8894 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); 8894 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';'));
8895 } 8895 }
8896 defWriter.writeln(this.writer.get$text()); 8896 defWriter.writeln(this.writer.get$text());
8897 if ($notnull_bool($ne(names, null))) { 8897 if ($notnull_bool($ne(names, null))) {
8898 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')')); 8898 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')'));
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
10007 } 10007 }
10008 MethodGenerator.prototype.visitSuperExpression = function(node) { 10008 MethodGenerator.prototype.visitSuperExpression = function(node) {
10009 return this._makeSuperValue(node); 10009 return this._makeSuperValue(node);
10010 } 10010 }
10011 MethodGenerator.prototype.visitNullExpression = function(node) { 10011 MethodGenerator.prototype.visitNullExpression = function(node) {
10012 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); 10012 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null);
10013 } 10013 }
10014 MethodGenerator.prototype.visitLiteralExpression = function(node) { 10014 MethodGenerator.prototype.visitLiteralExpression = function(node) {
10015 var $0; 10015 var $0;
10016 var type = node.type.type; 10016 var type = node.type.type;
10017 $assert($ne(type, null), "type != null", "gen.dart", 2020, 12); 10017 $assert($ne(type, null), "type != null", "gen.dart", 2019, 12);
10018 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { 10018 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) {
10019 var items = []; 10019 var items = [];
10020 var $list = node.value; 10020 var $list = node.value;
10021 for (var $i = node.value.iterator(); $i.hasNext(); ) { 10021 for (var $i = node.value.iterator(); $i.hasNext(); ) {
10022 var item = $i.next(); 10022 var item = $i.next();
10023 var val = this.visitValue((item && item.is$lang_Expression())); 10023 var val = this.visitValue((item && item.is$lang_Expression()));
10024 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 10024 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
10025 var code = val.code; 10025 var code = val.code;
10026 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) { 10026 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) {
10027 code = ('(' + code + ')'); 10027 code = ('(' + code + ')');
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
10573 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) { 10573 if ($notnull_bool(method.get$isStatic() && this.type.get$hasTypeParams())) {
10574 world.error('using type parameter in static context', this.definition.span); 10574 world.error('using type parameter in static context', this.definition.span);
10575 } 10575 }
10576 if ($notnull_bool(this.definition.value != null)) { 10576 if ($notnull_bool(this.definition.value != null)) {
10577 if ($notnull_bool((this.definition.value instanceof NullExpression) && this. definition.value.span.start == this.definition.span.start)) { 10577 if ($notnull_bool((this.definition.value instanceof NullExpression) && this. definition.value.span.start == this.definition.span.start)) {
10578 return; 10578 return;
10579 } 10579 }
10580 if ($notnull_bool(method.get$isAbstract())) { 10580 if ($notnull_bool(method.get$isAbstract())) {
10581 world.error('default value not allowed on abstract methods', this.definiti on.span); 10581 world.error('default value not allowed on abstract methods', this.definiti on.span);
10582 } 10582 }
10583 else if ($notnull_bool(!inType.get$isClass())) {
10584 world.error('default value not allowed on interface methods', this.definit ion.span);
10585 }
10586 else if ($notnull_bool(method.name == '\$call' && method.get$definition().bo dy == null)) { 10583 else if ($notnull_bool(method.name == '\$call' && method.get$definition().bo dy == null)) {
10587 world.error('default value not allowed on function type', this.definition. span); 10584 world.error('default value not allowed on function type', this.definition. span);
10588 } 10585 }
10589 } 10586 }
10590 } 10587 }
10591 lang_Parameter.prototype.genValue = function(method, context) { 10588 lang_Parameter.prototype.genValue = function(method, context) {
10592 var $0; 10589 var $0;
10593 if ($notnull_bool(this.definition.value == null || this.value != null)) return ; 10590 if ($notnull_bool(this.definition.value == null || this.value != null)) return ;
10594 if ($notnull_bool(context == null)) { 10591 if ($notnull_bool(context == null)) {
10595 context = new MethodGenerator(method, null); 10592 context = new MethodGenerator(method, null);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
10679 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 10676 world.error('static members can not hide parent members', this.get$span(), o ther.get$span());
10680 return false; 10677 return false;
10681 } 10678 }
10682 else if ($notnull_bool(other.get$isStatic())) { 10679 else if ($notnull_bool(other.get$isStatic())) {
10683 world.error('can not override static member', this.get$span(), other.get$spa n()); 10680 world.error('can not override static member', this.get$span(), other.get$spa n());
10684 return false; 10681 return false;
10685 } 10682 }
10686 return true; 10683 return true;
10687 } 10684 }
10688 Member.prototype.get$generatedFactoryName = function() { 10685 Member.prototype.get$generatedFactoryName = function() {
10689 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 157, 12); 10686 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 154, 12);
10690 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$'); 10687 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$');
10691 if ($notnull_bool(this.name == '')) { 10688 if ($notnull_bool(this.name == '')) {
10692 return ('' + prefix + 'factory'); 10689 return ('' + prefix + 'factory');
10693 } 10690 }
10694 else { 10691 else {
10695 return ('' + prefix + '' + this.name + '\$factory'); 10692 return ('' + prefix + '' + this.name + '\$factory');
10696 } 10693 }
10697 } 10694 }
10698 Member.prototype.get_$3 = function($0, $1, $2) { 10695 Member.prototype.get_$3 = function($0, $1, $2) {
10699 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value())); 10696 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()));
(...skipping 29 matching lines...) Expand all
10729 TypeMember.prototype.get$canGet = function() { 10726 TypeMember.prototype.get$canGet = function() {
10730 return true; 10727 return true;
10731 } 10728 }
10732 TypeMember.prototype.get$canSet = function() { 10729 TypeMember.prototype.get$canSet = function() {
10733 return false; 10730 return false;
10734 } 10731 }
10735 TypeMember.prototype.resolve = function(inType) { 10732 TypeMember.prototype.resolve = function(inType) {
10736 10733
10737 } 10734 }
10738 TypeMember.prototype.get_ = function(context, node, target, isDynamic) { 10735 TypeMember.prototype.get_ = function(context, node, target, isDynamic) {
10739 $assert(target == null || target.type.get$isTop(), "target == null || target.t ype.isTop", "member.dart", 195, 12); 10736 $assert(target == null || target.type.get$isTop(), "target == null || target.t ype.isTop", "member.dart", 192, 12);
10740 return new Value(this.type, this.type.get$jsname(), false, false, true); 10737 return new Value(this.type, this.type.get$jsname(), false, false, true);
10741 } 10738 }
10742 TypeMember.prototype.set_ = function(context, node, target, value, isDynamic) { 10739 TypeMember.prototype.set_ = function(context, node, target, value, isDynamic) {
10743 world.error('can not set type', this.type.definition.span); 10740 world.error('can not set type', this.type.definition.span);
10744 } 10741 }
10745 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { 10742 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
10746 world.error('can not invoke type', this.type.definition.span); 10743 world.error('can not invoke type', this.type.definition.span);
10747 } 10744 }
10748 TypeMember.prototype.get_$3 = function($0, $1, $2) { 10745 TypeMember.prototype.get_$3 = function($0, $1, $2) {
10749 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 10746 return this.get_(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
11701 if ($notnull_bool(this.name == '\$call')) { 11698 if ($notnull_bool(this.name == '\$call')) {
11702 this.declaringType.markUsed(); 11699 this.declaringType.markUsed();
11703 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar gsCode && argsCode.is$List$String()), ", ") + ')'), false, true, false); 11700 return new Value(this.returnType, ('' + target.code + '(' + Strings.join((ar gsCode && argsCode.is$List$String()), ", ") + ')'), false, true, false);
11704 } 11701 }
11705 return target.invokeSpecial(this.get$jsname(), args, this.returnType); 11702 return target.invokeSpecial(this.get$jsname(), args, this.returnType);
11706 } 11703 }
11707 MethodMember.prototype.resolve = function(inType) { 11704 MethodMember.prototype.resolve = function(inType) {
11708 this.isStatic = inType.get$isTop(); 11705 this.isStatic = inType.get$isTop();
11709 this.isConst = false; 11706 this.isConst = false;
11710 this.isFactory = false; 11707 this.isFactory = false;
11711 this.isAbstract = false; 11708 this.isAbstract = !this.declaringType.get$isClass();
11712 if ($notnull_bool(this.definition.modifiers != null)) { 11709 if ($notnull_bool(this.definition.modifiers != null)) {
11713 var $list = this.definition.modifiers; 11710 var $list = this.definition.modifiers;
11714 for (var $i = 0;$i < $list.length; $i++) { 11711 for (var $i = 0;$i < $list.length; $i++) {
11715 var mod = $list.$index($i); 11712 var mod = $list.$index($i);
11716 if ($notnull_bool(mod.kind == 86/*TokenKind.STATIC*/)) { 11713 if ($notnull_bool(mod.kind == 86/*TokenKind.STATIC*/)) {
11717 if ($notnull_bool(this.isStatic)) { 11714 if ($notnull_bool(this.isStatic)) {
11718 world.error('duplicate static modifier', mod.get$span()); 11715 world.error('duplicate static modifier', mod.get$span());
11719 } 11716 }
11720 this.isStatic = true; 11717 this.isStatic = true;
11721 } 11718 }
11722 else if ($notnull_bool(this.get$isConstructor() && mod.kind == 91/*TokenKi nd.CONST*/)) { 11719 else if ($notnull_bool(this.get$isConstructor() && mod.kind == 91/*TokenKi nd.CONST*/)) {
11723 if ($notnull_bool(this.isConst)) { 11720 if ($notnull_bool(this.isConst)) {
11724 world.error('duplicate const modifier', mod.get$span()); 11721 world.error('duplicate const modifier', mod.get$span());
11725 } 11722 }
11726 this.isConst = true; 11723 this.isConst = true;
11727 } 11724 }
11728 else if ($notnull_bool(mod.kind == 75/*TokenKind.FACTORY*/)) { 11725 else if ($notnull_bool(mod.kind == 75/*TokenKind.FACTORY*/)) {
11729 if ($notnull_bool(this.isFactory)) { 11726 if ($notnull_bool(this.isFactory)) {
11730 world.error('duplicate factory modifier', mod.get$span()); 11727 world.error('duplicate factory modifier', mod.get$span());
11731 } 11728 }
11732 this.isFactory = true; 11729 this.isFactory = true;
11733 } 11730 }
11734 else if ($notnull_bool(mod.kind == 71/*TokenKind.ABSTRACT*/)) { 11731 else if ($notnull_bool(mod.kind == 71/*TokenKind.ABSTRACT*/)) {
11735 if ($notnull_bool(this.isAbstract)) { 11732 if ($notnull_bool(this.isAbstract)) {
11736 world.error('duplicate abstract modifier', mod.get$span()); 11733 if ($notnull_bool(this.declaringType.get$isClass())) {
11734 world.error('duplicate abstract modifier', mod.get$span());
11735 }
11736 else {
11737 world.error('abstract modifier not allowed on interface members', mo d.get$span());
11738 }
11737 } 11739 }
11738 this.isAbstract = true; 11740 this.isAbstract = true;
11739 } 11741 }
11740 else { 11742 else {
11741 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); 11743 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ());
11742 } 11744 }
11743 } 11745 }
11744 } 11746 }
11745 if ($notnull_bool(this.isFactory)) { 11747 if ($notnull_bool(this.isFactory)) {
11746 this.isStatic = true; 11748 this.isStatic = true;
11747 } 11749 }
11748 if ($notnull_bool(this.isAbstract)) { 11750 if ($notnull_bool(this.isAbstract)) {
11749 if ($notnull_bool(this.definition.body != null)) { 11751 if ($notnull_bool(this.definition.body != null && !(this.declaringType.get$d efinition() instanceof FunctionTypeDefinition))) {
11750 world.error('abstract method can not have a body', this.definition.body.sp an); 11752 world.error('abstract method can not have a body', this.definition.body.sp an);
11751 } 11753 }
11752 if ($notnull_bool(this.isStatic)) { 11754 if ($notnull_bool(this.isStatic && !(this.declaringType.get$definition() ins tanceof FunctionTypeDefinition))) {
11753 world.error('static method can not be abstract', this.definition.span); 11755 world.error('static method can not be abstract', this.definition.span);
11754 } 11756 }
11755 } 11757 }
11756 else { 11758 else {
11759 if ($notnull_bool(this.definition.body == null && !this.get$isConstructor()) ) {
11760 world.error('method needs a body', this.get$span());
11761 }
11757 } 11762 }
11758 if ($notnull_bool(this.get$isConstructor())) { 11763 if ($notnull_bool(this.get$isConstructor())) {
11759 this.returnType = this.declaringType; 11764 this.returnType = this.declaringType;
11760 } 11765 }
11761 else { 11766 else {
11762 this.returnType = inType.resolveType(this.definition.returnType, false); 11767 this.returnType = inType.resolveType(this.definition.returnType, false);
11763 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) { 11768 if ($notnull_bool(this.isStatic && this.returnType.get$hasTypeParams())) {
11764 world.error('using type parameter in static context', this.definition.retu rnType.span); 11769 world.error('using type parameter in static context', this.definition.retu rnType.span);
11765 } 11770 }
11766 } 11771 }
(...skipping 6652 matching lines...) Expand 10 before | Expand all | Expand 10 after
18419 INTERFACE, 18424 INTERFACE,
18420 LIBRARY, 18425 LIBRARY,
18421 NATIVE, 18426 NATIVE,
18422 NEGATE, 18427 NEGATE,
18423 OPERATOR, 18428 OPERATOR,
18424 SET, 18429 SET,
18425 SOURCE, 18430 SOURCE,
18426 STATIC, 18431 STATIC,
18427 TYPEDEF ]*/; 18432 TYPEDEF ]*/;
18428 main(); 18433 main();
OLDNEW
« no previous file with comments | « frog/evaluator.dart ('k') | frog/gen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698