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

Side by Side Diff: frog/frogsh

Issue 8481023: cleanup errors and fix a couple field negative tests (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 | « no previous file | 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 8760 matching lines...) Expand 10 before | Expand all | Expand 10 after
8771 this._usedTemps = new HashSetImplementation(); 8771 this._usedTemps = new HashSetImplementation();
8772 this._freeTemps = []; 8772 this._freeTemps = [];
8773 } 8773 }
8774 MethodGenerator.prototype.is$MethodGenerator = function(){return this;}; 8774 MethodGenerator.prototype.is$MethodGenerator = function(){return this;};
8775 MethodGenerator.prototype.findMembers = function(name) { 8775 MethodGenerator.prototype.findMembers = function(name) {
8776 return this.method.get$library()._findMembers(name); 8776 return this.method.get$library()._findMembers(name);
8777 } 8777 }
8778 MethodGenerator.prototype.get$isClosure = function() { 8778 MethodGenerator.prototype.get$isClosure = function() {
8779 return (this.enclosingMethod != null); 8779 return (this.enclosingMethod != null);
8780 } 8780 }
8781 MethodGenerator.prototype.get$isStatic = function() {
8782 return this.method.get$isStatic();
8783 }
8781 MethodGenerator.prototype.getTemp = function(value) { 8784 MethodGenerator.prototype.getTemp = function(value) {
8782 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value; 8785 return $notnull_bool(value.needsTemp) ? this.forceTemp(value) : value;
8783 } 8786 }
8784 MethodGenerator.prototype.forceTemp = function(value) { 8787 MethodGenerator.prototype.forceTemp = function(value) {
8785 var name; 8788 var name;
8786 if ($notnull_bool(this._freeTemps.length > 0)) { 8789 if ($notnull_bool(this._freeTemps.length > 0)) {
8787 name = $assert_String(this._freeTemps.removeLast()); 8790 name = $assert_String(this._freeTemps.removeLast());
8788 } 8791 }
8789 else { 8792 else {
8790 name = '\$' + this._usedTemps.get$length(); 8793 name = '\$' + this._usedTemps.get$length();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
8875 else if ($notnull_bool(this.method.get$isStatic())) { 8878 else if ($notnull_bool(this.method.get$isStatic())) {
8876 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 + ' {'));
8877 } 8880 }
8878 else { 8881 else {
8879 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 + ' {'));
8880 } 8883 }
8881 if ($notnull_bool(this.needsThis)) { 8884 if ($notnull_bool(this.needsThis)) {
8882 defWriter.writeln('var \$this = this; // closure support'); 8885 defWriter.writeln('var \$this = this; // closure support');
8883 } 8886 }
8884 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)) {
8885 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 651, 14); 8888 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 653, 14);
8886 this._freeTemps.addAll(this._usedTemps); 8889 this._freeTemps.addAll(this._usedTemps);
8887 this._freeTemps.sort((function (x, y) { 8890 this._freeTemps.sort((function (x, y) {
8888 return x.compareTo(y); 8891 return x.compareTo(y);
8889 }) 8892 })
8890 ); 8893 );
8891 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); 8894 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';'));
8892 } 8895 }
8893 defWriter.writeln(this.writer.get$text()); 8896 defWriter.writeln(this.writer.get$text());
8894 if ($notnull_bool($ne(names, null))) { 8897 if ($notnull_bool($ne(names, null))) {
8895 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')')); 8898 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')'));
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
9524 } 9527 }
9525 var value = this.visitVoid(node.body); 9528 var value = this.visitVoid(node.body);
9526 this.writer.writeln(('' + value.code + ';')); 9529 this.writer.writeln(('' + value.code + ';'));
9527 return false; 9530 return false;
9528 } 9531 }
9529 MethodGenerator.prototype.visitEmptyStatement = function(node) { 9532 MethodGenerator.prototype.visitEmptyStatement = function(node) {
9530 this.writer.writeln(';'); 9533 this.writer.writeln(';');
9531 return false; 9534 return false;
9532 } 9535 }
9533 MethodGenerator.prototype._checkNonStatic = function(node) { 9536 MethodGenerator.prototype._checkNonStatic = function(node) {
9534 if ($notnull_bool(this.method.get$isStatic())) { 9537 if ($notnull_bool(this.get$isStatic())) {
9535 world.warning('not allowed in static method', node.span); 9538 world.warning('not allowed in static method', node.span);
9536 } 9539 }
9537 } 9540 }
9538 MethodGenerator.prototype._makeSuperValue = function(node) { 9541 MethodGenerator.prototype._makeSuperValue = function(node) {
9539 var parentType = this.method.declaringType.get$parent(); 9542 var parentType = this.method.declaringType.get$parent();
9540 this._checkNonStatic(node); 9543 this._checkNonStatic(node);
9541 if ($notnull_bool(parentType == null)) { 9544 if ($notnull_bool(parentType == null)) {
9542 world.error('no super class', node.span); 9545 world.error('no super class', node.span);
9543 } 9546 }
9544 return new Value(parentType, 'this', true, true, false); 9547 return new Value(parentType, 'this', true, true, false);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
10004 } 10007 }
10005 MethodGenerator.prototype.visitSuperExpression = function(node) { 10008 MethodGenerator.prototype.visitSuperExpression = function(node) {
10006 return this._makeSuperValue(node); 10009 return this._makeSuperValue(node);
10007 } 10010 }
10008 MethodGenerator.prototype.visitNullExpression = function(node) { 10011 MethodGenerator.prototype.visitNullExpression = function(node) {
10009 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null); 10012 return EvaluatedValue.EvaluatedValue$factory(null, null, 'null', null);
10010 } 10013 }
10011 MethodGenerator.prototype.visitLiteralExpression = function(node) { 10014 MethodGenerator.prototype.visitLiteralExpression = function(node) {
10012 var $0; 10015 var $0;
10013 var type = node.type.type; 10016 var type = node.type.type;
10014 $assert($ne(type, null), "type != null", "gen.dart", 2018, 12); 10017 $assert($ne(type, null), "type != null", "gen.dart", 2020, 12);
10015 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) { 10018 if ($notnull_bool(!!(($0 = node.value) && $0.is$List))) {
10016 var items = []; 10019 var items = [];
10017 var $list = node.value; 10020 var $list = node.value;
10018 for (var $i = node.value.iterator(); $i.hasNext(); ) { 10021 for (var $i = node.value.iterator(); $i.hasNext(); ) {
10019 var item = $i.next(); 10022 var item = $i.next();
10020 var val = this.visitValue((item && item.is$lang_Expression())); 10023 var val = this.visitValue((item && item.is$lang_Expression()));
10021 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 10024 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
10022 var code = val.code; 10025 var code = val.code;
10023 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) { 10026 if ($notnull_bool((item instanceof BinaryExpression) || (item instanceof C onditionalExpression))) {
10024 code = ('(' + code + ')'); 10027 code = ('(' + code + ')');
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
10285 var imported = $list.$index($i); 10288 var imported = $list.$index($i);
10286 var newRet = null; 10289 var newRet = null;
10287 if ($notnull_bool(imported.prefix == null)) { 10290 if ($notnull_bool(imported.prefix == null)) {
10288 newRet = imported.get$library().types.$index(name0); 10291 newRet = imported.get$library().types.$index(name0);
10289 } 10292 }
10290 else if ($notnull_bool(imported.prefix == name0)) { 10293 else if ($notnull_bool(imported.prefix == name0)) {
10291 newRet = imported.get$library().topType; 10294 newRet = imported.get$library().topType;
10292 } 10295 }
10293 if ($notnull_bool($ne(newRet, null))) { 10296 if ($notnull_bool($ne(newRet, null))) {
10294 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 10297 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
10295 world.error(('conflicting types for "' + name0 + '"'), ret.get$span()); 10298 world.error(('conflicting types for "' + name0 + '"'), ret.get$span(), n ewRet.get$span());
10296 world.error(('conflicting types for "' + name0 + '"'), newRet.get$span() );
10297 } 10299 }
10298 else { 10300 else {
10299 ret = newRet; 10301 ret = newRet;
10300 } 10302 }
10301 } 10303 }
10302 } 10304 }
10303 return ret; 10305 return ret;
10304 } 10306 }
10305 Library.prototype.lookup = function(name0, span0) { 10307 Library.prototype.lookup = function(name0, span0) {
10306 var retType = this.findTypeByName(name0); 10308 var retType = this.findTypeByName(name0);
10307 var ret = null; 10309 var ret = null;
10308 if ($notnull_bool($ne(retType, null))) { 10310 if ($notnull_bool($ne(retType, null))) {
10309 ret = retType.get$typeMember(); 10311 ret = retType.get$typeMember();
10310 } 10312 }
10311 var newRet = this.topType.getMember(name0); 10313 var newRet = this.topType.getMember(name0);
10312 if ($notnull_bool($ne(newRet, null))) { 10314 if ($notnull_bool($ne(newRet, null))) {
10313 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 10315 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
10314 world.error(('conflicting members for "' + name0 + '"'), span0); 10316 world.error(('conflicting members for "' + name0 + '"'), span0, ret.get$sp an(), newRet.get$span());
10315 world.error(('conflicting members for "' + name0 + '"'), ret.get$span());
10316 world.error(('conflicting members for "' + name0 + '"'), newRet.get$span() );
10317 } 10317 }
10318 else { 10318 else {
10319 ret = newRet; 10319 ret = newRet;
10320 } 10320 }
10321 } 10321 }
10322 var $list = this.imports; 10322 var $list = this.imports;
10323 for (var $i = 0;$i < $list.length; $i++) { 10323 for (var $i = 0;$i < $list.length; $i++) {
10324 var imported = $list.$index($i); 10324 var imported = $list.$index($i);
10325 if ($notnull_bool(imported.prefix == null)) { 10325 if ($notnull_bool(imported.prefix == null)) {
10326 newRet = imported.get$library().topType.getMember(name0); 10326 newRet = imported.get$library().topType.getMember(name0);
10327 if ($notnull_bool($ne(newRet, null))) { 10327 if ($notnull_bool($ne(newRet, null))) {
10328 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) { 10328 if ($notnull_bool($ne(ret, null) && $ne(ret, newRet))) {
10329 world.error(('conflicting members for "' + name0 + '"'), span0); 10329 world.error(('conflicting members for "' + name0 + '"'), span0, ret.ge t$span(), newRet.get$span());
10330 world.error(('conflicting members for "' + name0 + '"'), ret.get$span( ));
10331 world.error(('conflicting members for "' + name0 + '"'), newRet.get$sp an());
10332 } 10330 }
10333 else { 10331 else {
10334 ret = newRet; 10332 ret = newRet;
10335 } 10333 }
10336 } 10334 }
10337 } 10335 }
10338 } 10336 }
10339 return ret; 10337 return ret;
10340 } 10338 }
10341 Library.prototype.resolve = function() { 10339 Library.prototype.resolve = function() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
10404 world.error(('duplicate source file "' + source.filename + '"')); 10402 world.error(('duplicate source file "' + source.filename + '"'));
10405 return; 10403 return;
10406 } 10404 }
10407 this.library.sources.add(source); 10405 this.library.sources.add(source);
10408 var parser = new lang_Parser(source, options.dietParse, 0); 10406 var parser = new lang_Parser(source, options.dietParse, 0);
10409 var unit = parser.compilationUnit(); 10407 var unit = parser.compilationUnit();
10410 unit.forEach((function (def) { 10408 unit.forEach((function (def) {
10411 return def.visit($this); 10409 return def.visit($this);
10412 }) 10410 })
10413 ); 10411 );
10414 $assert(this.sources.length == 0 || this.isTop, "sources.length == 0 || isTop" , "library.dart", 296, 12); 10412 $assert(this.sources.length == 0 || this.isTop, "sources.length == 0 || isTop" , "library.dart", 293, 12);
10415 this.isTop = false; 10413 this.isTop = false;
10416 var newSources = this.sources; 10414 var newSources = this.sources;
10417 this.sources = []; 10415 this.sources = [];
10418 for (var $i = newSources.iterator(); $i.hasNext(); ) { 10416 for (var $i = newSources.iterator(); $i.hasNext(); ) {
10419 var source0 = $i.next(); 10417 var source0 = $i.next();
10420 this.addSource((source0 && source0.is$SourceFile())); 10418 this.addSource((source0 && source0.is$SourceFile()));
10421 } 10419 }
10422 } 10420 }
10423 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { 10421 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
10424 if ($notnull_bool(!this.isTop)) { 10422 if ($notnull_bool(!this.isTop)) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
10461 if ($notnull_bool($eq(prefix, ''))) prefix = null; 10459 if ($notnull_bool($eq(prefix, ''))) prefix = null;
10462 var filename = this.library.makeFullPath($assert_String(name)); 10460 var filename = this.library.makeFullPath($assert_String(name));
10463 if ($notnull_bool(this.library.imports.some((function (li) { 10461 if ($notnull_bool(this.library.imports.some((function (li) {
10464 return $eq(li.get$library().baseSource, filename); 10462 return $eq(li.get$library().baseSource, filename);
10465 }) 10463 })
10466 ))) { 10464 ))) {
10467 world.error(('duplicate import of "' + name + '"'), node.span); 10465 world.error(('duplicate import of "' + name + '"'), node.span);
10468 return; 10466 return;
10469 } 10467 }
10470 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix)); 10468 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix));
10471 if ($notnull_bool(newLib.get$name() == null && !filename.startsWith('dart: '))) {
10472 world.info(('imported library "' + name + '" has no #library directive') , node.span);
10473 }
10474 break; 10469 break;
10475 10470
10476 case "source": 10471 case "source":
10477 10472
10478 this.seenSource = true; 10473 this.seenSource = true;
10479 name = this.getSingleStringArg(node); 10474 name = this.getSingleStringArg(node);
10480 this.addSourceFromName($assert_String(name), node.span); 10475 this.addSourceFromName($assert_String(name), node.span);
10481 if ($notnull_bool(this.seenResource)) { 10476 if ($notnull_bool(this.seenResource)) {
10482 world.error('#sources must come before any #resource', node.span); 10477 world.error('#sources must come before any #resource', node.span);
10483 } 10478 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
10838 } 10833 }
10839 else { 10834 else {
10840 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( )); 10835 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( ));
10841 } 10836 }
10842 } 10837 }
10843 } 10838 }
10844 this.type = inType.resolveType(this.definition.type, false); 10839 this.type = inType.resolveType(this.definition.type, false);
10845 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) { 10840 if ($notnull_bool(this.isStatic && this.type.get$hasTypeParams())) {
10846 world.error('using type parameter in static context', this.definition.type.s pan); 10841 world.error('using type parameter in static context', this.definition.type.s pan);
10847 } 10842 }
10843 if ($notnull_bool(this.isStatic && this.isFinal && this.value == null)) {
10844 world.error('static final field is missing initializer', this.get$span());
10845 }
10848 this.get$library()._addMember(this); 10846 this.get$library()._addMember(this);
10849 } 10847 }
10850 FieldMember.prototype.computeValue = function() { 10848 FieldMember.prototype.computeValue = function() {
10851 var $0; 10849 var $0;
10852 if ($notnull_bool(this.value == null)) return null; 10850 if ($notnull_bool(this.value == null)) return null;
10853 if ($notnull_bool(this._computedValue == null)) { 10851 if ($notnull_bool(this._computedValue == null)) {
10854 if ($notnull_bool(this._computing)) { 10852 if ($notnull_bool(this._computing)) {
10855 world.error('circular reference', this.value.span); 10853 world.error('circular reference', this.value.span);
10856 return null; 10854 return null;
10857 } 10855 }
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
11804 } 11802 }
11805 MemberSet.prototype.get$containsMethods = function() { 11803 MemberSet.prototype.get$containsMethods = function() {
11806 return this.members.some((function (m) { 11804 return this.members.some((function (m) {
11807 return (m instanceof MethodMember); 11805 return (m instanceof MethodMember);
11808 }) 11806 })
11809 ); 11807 );
11810 } 11808 }
11811 MemberSet.prototype.add = function(member) { 11809 MemberSet.prototype.add = function(member) {
11812 return this.members.add(member); 11810 return this.members.add(member);
11813 } 11811 }
11812 MemberSet.prototype.get$isStatic = function() {
11813 return this.members.length == 1 && this.members.$index(0).get$isStatic();
11814 }
11814 MemberSet.prototype.canInvoke = function(context, args) { 11815 MemberSet.prototype.canInvoke = function(context, args) {
11815 return this.members.some((function (m) { 11816 return this.members.some((function (m) {
11816 return m.canInvoke(context, args); 11817 return m.canInvoke(context, args);
11817 }) 11818 })
11818 ); 11819 );
11819 } 11820 }
11820 MemberSet.prototype._makeError = function(node, target, action) { 11821 MemberSet.prototype._makeError = function(node, target, action) {
11821 if ($notnull_bool(!target.type.get$isVar())) { 11822 if ($notnull_bool(!target.type.get$isVar())) {
11822 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); 11823 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span);
11823 } 11824 }
(...skipping 4883 matching lines...) Expand 10 before | Expand all | Expand 10 after
16707 if ($notnull_bool(method.get$isConstructor())) { 16708 if ($notnull_bool(method.get$isConstructor())) {
16708 if ($notnull_bool(this.constructors.containsKey(method.get$constructorName() ))) { 16709 if ($notnull_bool(this.constructors.containsKey(method.get$constructorName() ))) {
16709 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition0.span); 16710 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition0.span);
16710 return; 16711 return;
16711 } 16712 }
16712 this.constructors.$setindex(method.get$constructorName(), method); 16713 this.constructors.$setindex(method.get$constructorName(), method);
16713 return; 16714 return;
16714 } 16715 }
16715 if ($notnull_bool(definition0.modifiers != null && definition0.modifiers.lengt h == 1 && definition0.modifiers.$index(0).kind == 75/*TokenKind.FACTORY*/)) { 16716 if ($notnull_bool(definition0.modifiers != null && definition0.modifiers.lengt h == 1 && definition0.modifiers.$index(0).kind == 75/*TokenKind.FACTORY*/)) {
16716 if ($notnull_bool(this.factories.getFactory(method.get$constructorName(), $a ssert_String(method.get$name())) != null)) { 16717 if ($notnull_bool(this.factories.getFactory(method.get$constructorName(), $a ssert_String(method.get$name())) != null)) {
16717 world.error(('duplicate factory definition of ' + method.get$name() + ''), definition0.span); 16718 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition0.span);
16718 return; 16719 return;
16719 } 16720 }
16720 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); 16721 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member()));
16721 return; 16722 return;
16722 } 16723 }
16723 if ($notnull_bool(methodName.startsWith('get\$') || methodName.startsWith('set \$'))) { 16724 if ($notnull_bool(methodName.startsWith('get\$') || methodName.startsWith('set \$'))) {
16724 var propName = methodName.substring(4); 16725 var propName = methodName.substring(4);
16725 var prop = this.members.$index(propName); 16726 var prop = this.members.$index(propName);
16726 if ($notnull_bool(prop == null)) { 16727 if ($notnull_bool(prop == null)) {
16727 prop = new PropertyMember($assert_String(propName), this); 16728 prop = new PropertyMember($assert_String(propName), this);
16728 this.members.$setindex(propName, prop); 16729 this.members.$setindex(propName, prop);
16729 } 16730 }
16730 if ($notnull_bool(!(prop instanceof PropertyMember))) { 16731 if ($notnull_bool(!(prop instanceof PropertyMember))) {
16731 world.error(('property conflicts with field name: ' + propName + ''), defi nition0.span); 16732 world.error(('property conflicts with field "' + propName + '"'), definiti on0.span);
16732 return; 16733 return;
16733 } 16734 }
16734 if ($notnull_bool(methodName[0] == 'g')) { 16735 if ($notnull_bool(methodName[0] == 'g')) {
16735 if ($notnull_bool(prop.getter != null)) { 16736 if ($notnull_bool(prop.getter != null)) {
16736 world.error(('duplicate getter definition for ' + propName + ''), defini tion0.span); 16737 world.error(('duplicate getter definition for "' + propName + '"'), defi nition0.span);
16737 } 16738 }
16738 prop.getter = (method && method.is$MethodMember()); 16739 prop.getter = (method && method.is$MethodMember());
16739 } 16740 }
16740 else { 16741 else {
16741 if ($notnull_bool(prop.setter != null)) { 16742 if ($notnull_bool(prop.setter != null)) {
16742 world.error(('duplicate setter definition for ' + propName + ''), defini tion0.span); 16743 world.error(('duplicate setter definition for "' + propName + '"'), defi nition0.span);
16743 } 16744 }
16744 prop.setter = (method && method.is$MethodMember()); 16745 prop.setter = (method && method.is$MethodMember());
16745 } 16746 }
16746 return; 16747 return;
16747 } 16748 }
16748 if ($notnull_bool(this.members.containsKey(methodName))) { 16749 if ($notnull_bool(this.members.containsKey(methodName))) {
16749 world.error(('duplicate method definition of ' + method.get$name() + ''), de finition0.span); 16750 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition0.span);
16750 return; 16751 return;
16751 } 16752 }
16752 this.members.$setindex(methodName, method); 16753 this.members.$setindex(methodName, method);
16753 } 16754 }
16754 DefinedType.prototype.addField = function(definition0) { 16755 DefinedType.prototype.addField = function(definition0) {
16755 for (var i = 0; 16756 for (var i = 0;
16756 $notnull_bool(i < definition0.names.length); i++) { 16757 $notnull_bool(i < definition0.names.length); i++) {
16757 var name0 = definition0.names.$index(i).get$name(); 16758 var name0 = definition0.names.$index(i).get$name();
16758 if ($notnull_bool(this.members.containsKey(name0))) { 16759 if ($notnull_bool(this.members.containsKey(name0))) {
16759 world.error(('duplicate field definition of ' + name0 + ''), definition0.s pan); 16760 world.error(('duplicate field definition of "' + name0 + '"'), definition0 .span);
16760 return; 16761 return;
16761 } 16762 }
16762 var value = null; 16763 var value = null;
16763 if ($notnull_bool(definition0.values != null)) { 16764 if ($notnull_bool(definition0.values != null)) {
16764 value = definition0.values.$index(i); 16765 value = definition0.values.$index(i);
16765 } 16766 }
16766 var field = new FieldMember($assert_String(name0), this, definition0, value) ; 16767 var field = new FieldMember($assert_String(name0), this, definition0, value) ;
16767 this.members.$setindex(name0, field); 16768 this.members.$setindex(name0, field);
16768 if ($notnull_bool(this.isNativeType)) { 16769 if ($notnull_bool(this.isNativeType)) {
16769 field.isNative = true; 16770 field.isNative = true;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
16979 } 16980 }
16980 else { 16981 else {
16981 world.internalError('unknown type reference', node.span); 16982 world.internalError('unknown type reference', node.span);
16982 } 16983 }
16983 return node.type; 16984 return node.type;
16984 } 16985 }
16985 DefinedType.prototype.resolveTypeParams = function(inType) { 16986 DefinedType.prototype.resolveTypeParams = function(inType) {
16986 return this; 16987 return this;
16987 } 16988 }
16988 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 16989 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
16989 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1136, 12); 16990 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1135, 12);
16990 var names = [this.name]; 16991 var names = [this.name];
16991 var typeMap = $map([]); 16992 var typeMap = $map([]);
16992 for (var i = 0; 16993 for (var i = 0;
16993 $notnull_bool(i < typeArgs.length); i++) { 16994 $notnull_bool(i < typeArgs.length); i++) {
16994 var paramName = this.typeParameters.$index(i).get$name(); 16995 var paramName = this.typeParameters.$index(i).get$name();
16995 typeMap.$setindex(paramName, typeArgs.$index(i)); 16996 typeMap.$setindex(paramName, typeArgs.$index(i));
16996 names.add(typeArgs.$index(i).get$name()); 16997 names.add(typeArgs.$index(i).get$name());
16997 } 16998 }
16998 var concreteName = Strings.join((names && names.is$List$String()), '\$'); 16999 var concreteName = Strings.join((names && names.is$List$String()), '\$');
16999 var ret = this._concreteTypes.$index(concreteName); 17000 var ret = this._concreteTypes.$index(concreteName);
17000 if ($notnull_bool(ret == null)) { 17001 if ($notnull_bool(ret == null)) {
17001 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs ); 17002 ret = new ConcreteType($assert_String(concreteName), this, typeMap, typeArgs );
17002 this._concreteTypes.$setindex(concreteName, ret); 17003 this._concreteTypes.$setindex(concreteName, ret);
17003 } 17004 }
17004 return ret; 17005 return ret;
17005 } 17006 }
17006 DefinedType.prototype.getCallStub = function(args) { 17007 DefinedType.prototype.getCallStub = function(args) {
17007 $assert(this.get$isFunction(), "isFunction", "type.dart", 1156, 12); 17008 $assert(this.get$isFunction(), "isFunction", "type.dart", 1155, 12);
17008 var name0 = _getCallStubName('call', args); 17009 var name0 = _getCallStubName('call', args);
17009 if ($notnull_bool(this.varStubs == null)) this.varStubs = $map([]); 17010 if ($notnull_bool(this.varStubs == null)) this.varStubs = $map([]);
17010 var stub = this.varStubs.$index(name0); 17011 var stub = this.varStubs.$index(name0);
17011 if ($notnull_bool(stub == null)) { 17012 if ($notnull_bool(stub == null)) {
17012 stub = new VarFunctionStub($assert_String(name0), args); 17013 stub = new VarFunctionStub($assert_String(name0), args);
17013 this.varStubs.$setindex(name0, stub); 17014 this.varStubs.$setindex(name0, stub);
17014 } 17015 }
17015 return stub; 17016 return stub;
17016 } 17017 }
17017 // ********** Code for FixedCollection ************** 17018 // ********** Code for FixedCollection **************
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
17150 member = this.type.resolveMember(name); 17151 member = this.type.resolveMember(name);
17151 } 17152 }
17152 } 17153 }
17153 if ($notnull_bool(member == null)) { 17154 if ($notnull_bool(member == null)) {
17154 member = context.findMembers(name); 17155 member = context.findMembers(name);
17155 } 17156 }
17156 return member; 17157 return member;
17157 } 17158 }
17158 Value.prototype._resolveMember = function(context, name, node) { 17159 Value.prototype._resolveMember = function(context, name, node) {
17159 var member = this._tryResolveMember(context, name); 17160 var member = this._tryResolveMember(context, name);
17160 if ($notnull_bool(member == null)) { 17161 if ($notnull_bool($ne(member, null))) {
17162 if ($notnull_bool(this.isType && !member.get$isStatic())) {
17163 world.error('can not refer to instance member as static', node.span);
17164 }
17165 return member;
17166 }
17167 else {
17161 if ($notnull_bool(this._tryResolveMember(context, 'noSuchMethod').members.le ngth > 1)) { 17168 if ($notnull_bool(this._tryResolveMember(context, 'noSuchMethod').members.le ngth > 1)) {
17162 return null; 17169 return null;
17163 } 17170 }
17164 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$library ().name : this.type.name; 17171 var typeName = $notnull_bool(this.type.name == null) ? this.type.get$library ().name : this.type.name;
17165 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); 17172 var message = ('can not resolve "' + name + '" on "' + typeName + '"');
17166 if ($notnull_bool(this.isType)) { 17173 if ($notnull_bool(this.isType)) {
17167 world.error($assert_String(message), node.span); 17174 world.error($assert_String(message), node.span);
17168 } 17175 }
17169 else { 17176 else {
17170 world.warning($assert_String(message), node.span); 17177 world.warning($assert_String(message), node.span);
17171 } 17178 }
17172 if ($notnull_bool(context.findMembers(name) == null)) { 17179 if ($notnull_bool(context.findMembers(name) == null)) {
17173 world.warning(('' + name + ' is not defined anywhere in the world.'), node .span); 17180 world.warning(('' + name + ' is not defined anywhere in the world.'), node .span);
17174 } 17181 }
17182 return null;
17175 } 17183 }
17176 return member;
17177 } 17184 }
17178 Value.prototype.checkFirstClass = function(span) { 17185 Value.prototype.checkFirstClass = function(span) {
17179 if ($notnull_bool(this.isType)) { 17186 if ($notnull_bool(this.isType)) {
17180 world.error('Types are not first class', span); 17187 world.error('Types are not first class', span);
17181 } 17188 }
17182 } 17189 }
17183 Value.prototype._varCall = function(context, args) { 17190 Value.prototype._varCall = function(context, args) {
17184 var stub = world.functionType.getCallStub(args); 17191 var stub = world.functionType.getCallStub(args);
17185 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge tCode() + ')'), false, true, false); 17192 return new Value(null, ('' + this.code + '.' + stub.get$name() + '(' + args.ge tCode() + ')'), false, true, false);
17186 } 17193 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
17321 for (var i = 0; 17328 for (var i = 0;
17322 $notnull_bool(i < args.get$length()); i++) { 17329 $notnull_bool(i < args.get$length()); i++) {
17323 argsCode.add(args.values.$index(i).code); 17330 argsCode.add(args.values.$index(i).code);
17324 } 17331 }
17325 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 17332 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
17326 } 17333 }
17327 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true, false), new Value(world.listType, ('[' + pos + ']'), false, true, false)]; 17334 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), false, true, false), new Value(world.listType, ('[' + pos + ']'), false, true, false)];
17328 return this._tryResolveMember(context, 'noSuchMethod').invoke$4(context, node, this, new Arguments(null, noSuchArgs)); 17335 return this._tryResolveMember(context, 'noSuchMethod').invoke$4(context, node, this, new Arguments(null, noSuchArgs));
17329 } 17336 }
17330 Value.prototype.invokeSpecial = function(name, args, returnType) { 17337 Value.prototype.invokeSpecial = function(name, args, returnType) {
17331 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 410, 12 ); 17338 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 417, 12 );
17332 $assert(!args.get$hasNames(), "!args.hasNames", "value.dart", 411, 12); 17339 $assert(!args.get$hasNames(), "!args.hasNames", "value.dart", 418, 12);
17333 var argsString = args.getCode(); 17340 var argsString = args.getCode();
17334 if ($notnull_bool(name == '\$index' || name == '\$setindex')) { 17341 if ($notnull_bool(name == '\$index' || name == '\$setindex')) {
17335 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), false, true, false); 17342 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), false, true, false);
17336 } 17343 }
17337 else { 17344 else {
17338 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + ''); 17345 if ($notnull_bool(argsString.length > 0)) argsString = (', ' + argsString + '');
17339 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), false, true, false); 17346 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), false, true, false);
17340 } 17347 }
17341 } 17348 }
17342 Value.prototype.get_$3 = function($0, $1, $2) { 17349 Value.prototype.get_$3 = function($0, $1, $2) {
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
17738 return library; 17745 return library;
17739 } 17746 }
17740 World.prototype.resolveAll = function() { 17747 World.prototype.resolveAll = function() {
17741 var $0; 17748 var $0;
17742 var $list = this.libraries.getValues(); 17749 var $list = this.libraries.getValues();
17743 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) { 17750 for (var $i = this.libraries.getValues().iterator(); $i.hasNext(); ) {
17744 var lib = $i.next(); 17751 var lib = $i.next();
17745 lib.resolve(); 17752 lib.resolve();
17746 } 17753 }
17747 } 17754 }
17748 World.prototype._message = function(message, span, span1, throwing) { 17755 World.prototype._message = function(message, span, span1, span2, throwing) {
17749 var text = message; 17756 var text = message;
17750 if ($notnull_bool(span != null)) { 17757 if ($notnull_bool(span != null)) {
17751 text = span.toMessageString(message); 17758 text = span.toMessageString(message);
17752 } 17759 }
17753 print(text); 17760 print(text);
17754 if ($notnull_bool(span1 != null)) { 17761 if ($notnull_bool(span1 != null)) {
17755 print(span1.toMessageString(message)); 17762 print(span1.toMessageString(message));
17756 } 17763 }
17764 if ($notnull_bool(span2 != null)) {
17765 print(span2.toMessageString(message));
17766 }
17757 if ($notnull_bool(throwing)) { 17767 if ($notnull_bool(throwing)) {
17758 $throw(new CompilerException(message, span)); 17768 $throw(new CompilerException(message, span));
17759 } 17769 }
17760 } 17770 }
17761 World.prototype.error = function(message, span, span1) { 17771 World.prototype.error = function(message, span, span1, span2) {
17762 this.errors++; 17772 this.errors++;
17763 this._message(('error: ' + message + ''), span, span1, options.throwOnErrors); 17773 this._message(('error: ' + message + ''), span, span1, span2, options.throwOnE rrors);
17764 } 17774 }
17765 World.prototype.warning = function(message, span, span1) { 17775 World.prototype.warning = function(message, span, span1, span2) {
17766 this.warnings++; 17776 this.warnings++;
17767 if ($notnull_bool(options.showWarnings)) { 17777 if ($notnull_bool(options.showWarnings)) {
17768 this._message(('warning: ' + message + ''), span, span1, options.throwOnWarn ings); 17778 this._message(('warning: ' + message + ''), span, span1, span2, options.thro wOnWarnings);
17769 } 17779 }
17770 } 17780 }
17771 World.prototype.fatal = function(message, span, span1) { 17781 World.prototype.fatal = function(message, span, span1, span2) {
17772 this.errors++; 17782 this.errors++;
17773 this.seenFatal = true; 17783 this.seenFatal = true;
17774 this._message(('fatal: ' + message + ''), span, span1, $assert_bool(options.th rowOnFatal || options.throwOnErrors)); 17784 this._message(('fatal: ' + message + ''), span, span1, span2, $assert_bool(opt ions.throwOnFatal || options.throwOnErrors));
17775 } 17785 }
17776 World.prototype.internalError = function(message, span, span1) { 17786 World.prototype.internalError = function(message, span, span1, span2) {
17777 this._message(('We are sorry, but... ' + message + ''), span, span1, true); 17787 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr ue);
17778 } 17788 }
17779 World.prototype.info = function(message, span, span1) { 17789 World.prototype.info = function(message, span, span1, span2) {
17780 if ($notnull_bool(options.showInfo)) { 17790 if ($notnull_bool(options.showInfo)) {
17781 this._message(('info: ' + message + ''), span, span1, false); 17791 this._message(('info: ' + message + ''), span, span1, span2, false);
17782 } 17792 }
17783 } 17793 }
17784 World.prototype.get$hasErrors = function() { 17794 World.prototype.get$hasErrors = function() {
17785 return this.errors > 0; 17795 return this.errors > 0;
17786 } 17796 }
17787 World.prototype.printStatus = function() { 17797 World.prototype.printStatus = function() {
17788 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes Written + ' bytes JS')); 17798 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes Written + ' bytes JS'));
17789 if ($notnull_bool(this.get$hasErrors())) { 17799 if ($notnull_bool(this.get$hasErrors())) {
17790 print(('compilation failed with ' + this.errors + ' errors')); 17800 print(('compilation failed with ' + this.errors + ' errors'));
17791 } 17801 }
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
18409 INTERFACE, 18419 INTERFACE,
18410 LIBRARY, 18420 LIBRARY,
18411 NATIVE, 18421 NATIVE,
18412 NEGATE, 18422 NEGATE,
18413 OPERATOR, 18423 OPERATOR,
18414 SET, 18424 SET,
18415 SOURCE, 18425 SOURCE,
18416 STATIC, 18426 STATIC,
18417 TYPEDEF ]*/; 18427 TYPEDEF ]*/;
18418 main(); 18428 main();
OLDNEW
« no previous file with comments | « no previous file | frog/gen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698