| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import('dart:uri'); | 5 #import('dart:uri'); |
| 6 #import('parser_helper.dart'); | 6 #import('parser_helper.dart'); |
| 7 #import('mock_compiler.dart'); | 7 #import('mock_compiler.dart'); |
| 8 #import("../../../lib/compiler/compiler.dart"); | 8 #import("../../../lib/compiler/compiler.dart"); |
| 9 #import("../../../lib/compiler/implementation/leg.dart", prefix:'leg'); | 9 #import("../../../lib/compiler/implementation/leg.dart", prefix:'leg'); |
| 10 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); | 10 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 testUnparse('var x=new List<List<List<List<int>>>>();'); | 117 testUnparse('var x=new List<List<List<List<int>>>>();'); |
| 118 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); | 118 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); |
| 119 } | 119 } |
| 120 | 120 |
| 121 testForLoop() { | 121 testForLoop() { |
| 122 testUnparse('for(;i<100;i++ ){}'); | 122 testUnparse('for(;i<100;i++ ){}'); |
| 123 testUnparse('for(i=0;i<100;i++ ){}'); | 123 testUnparse('for(i=0;i<100;i++ ){}'); |
| 124 } | 124 } |
| 125 | 125 |
| 126 testEmptyList() { | 126 testEmptyList() { |
| 127 testUnparse('var x=[];'); | 127 testUnparse('var x=[] ;'); |
| 128 } | 128 } |
| 129 | 129 |
| 130 testClosure() { | 130 testClosure() { |
| 131 testUnparse('var x=(var x)=>x;'); | 131 testUnparse('var x=(var x)=>x;'); |
| 132 } | 132 } |
| 133 | 133 |
| 134 testIndexedOperatorDecl() { | 134 testIndexedOperatorDecl() { |
| 135 testUnparseMember('operator[](int i)=>null;'); | 135 testUnparseMember('operator[](int i)=>null;'); |
| 136 testUnparseMember('operator[]=(int i,int j)=>null;'); | 136 testUnparseMember('operator[]=(int i,int j)=>null;'); |
| 137 } | 137 } |
| 138 | 138 |
| 139 testNativeMethods() { | 139 testNativeMethods() { |
| 140 testUnparseMember('foo()native;'); | 140 testUnparseMember('foo()native;'); |
| 141 testUnparseMember('foo()native "bar";'); | 141 testUnparseMember('foo()native "bar";'); |
| 142 testUnparseMember('foo()native "this.x = 41";'); | 142 testUnparseMember('foo()native "this.x = 41";'); |
| 143 } | 143 } |
| 144 | 144 |
| 145 testPrefixIncrements() { | 145 testPrefixIncrements() { |
| 146 testUnparse(' ++i;'); | 146 testUnparse(' ++i;'); |
| 147 testUnparse(' ++a[i];'); | 147 testUnparse(' ++a[i];'); |
| 148 testUnparse(' ++a[ ++b[i]];'); | 148 testUnparse(' ++a[ ++b[i]];'); |
| 149 } | 149 } |
| 150 | 150 |
| 151 testConstModifier() { | 151 testConstModifier() { |
| 152 testUnparse('foo([var a=const[]]){}'); | 152 testUnparse('foo([var a=const[] ]){}'); |
| 153 testUnparse('foo([var a=const{}]){}'); | 153 testUnparse('foo([var a=const{}]){}'); |
| 154 testUnparse('foo(){var a=const[];var b=const{};}'); | 154 testUnparse('foo(){var a=const[] ;var b=const{};}'); |
| 155 testUnparse('foo([var a=const[const{"a":const[1,2,3]}]]){}'); | 155 testUnparse('foo([var a=const[const{"a":const[1,2,3]}]]){}'); |
| 156 } | 156 } |
| 157 | 157 |
| 158 testSimpleFileUnparse() { | 158 testSimpleFileUnparse() { |
| 159 final src = ''' | 159 final src = ''' |
| 160 should_be_dropped() { | 160 should_be_dropped() { |
| 161 } | 161 } |
| 162 | 162 |
| 163 should_be_kept() { | 163 should_be_kept() { |
| 164 } | 164 } |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 testDoubleMains(); | 848 testDoubleMains(); |
| 849 testInterfaceDefaultAnotherLib(); | 849 testInterfaceDefaultAnotherLib(); |
| 850 testStaticAccessIoLib(); | 850 testStaticAccessIoLib(); |
| 851 testLocalFunctionPlaceholder(); | 851 testLocalFunctionPlaceholder(); |
| 852 testMinification(); | 852 testMinification(); |
| 853 testClosureLocalsMinified(); | 853 testClosureLocalsMinified(); |
| 854 testParametersMinified(); | 854 testParametersMinified(); |
| 855 testTypeVariablesInDifferentLibraries(); | 855 testTypeVariablesInDifferentLibraries(); |
| 856 testDeclarationTypePlaceholders(); | 856 testDeclarationTypePlaceholders(); |
| 857 } | 857 } |
| OLD | NEW |