| 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 #library('native'); | 5 #library('native'); |
| 6 #import('leg.dart'); | 6 #import('leg.dart'); |
| 7 #import('elements/elements.dart'); | 7 #import('elements/elements.dart'); |
| 8 #import('scanner/scannerlib.dart'); | 8 #import('scanner/scannerlib.dart'); |
| 9 #import('ssa/ssa.dart'); | 9 #import('ssa/ssa.dart'); |
| 10 #import('tree/tree.dart'); | 10 #import('tree/tree.dart'); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // otherwise it will only be parsed if there is a call to | 23 // otherwise it will only be parsed if there is a call to |
| 24 // one of its constructor. | 24 // one of its constructor. |
| 25 element.parseNode(compiler); | 25 element.parseNode(compiler); |
| 26 // Resolve to setup the inheritance. | 26 // Resolve to setup the inheritance. |
| 27 element.resolve(compiler); | 27 element.resolve(compiler); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 void checkNativeSupport(Compiler compiler, LibraryElement library) { | 33 void checkNativeSupport(Compiler compiler, |
| 34 if (library.script.name.contains('dart/frog/tests/native/src')) { | 34 LibraryElement library, |
| 35 [libraryName = '']) { |
| 36 if (library.script.name.contains('dart/frog/tests/native/src') |
| 37 || libraryName == 'dart:dom' |
| 38 || libraryName == 'dart:html') { |
| 35 library.define(new ForeignElement( | 39 library.define(new ForeignElement( |
| 36 const SourceString('native'), library), compiler); | 40 const SourceString('native'), library), compiler); |
| 37 } | 41 } |
| 38 } | 42 } |
| 39 | 43 |
| 40 Token handleNativeBlockToSkip(Listener listener, Token token) { | 44 Token handleNativeBlockToSkip(Listener listener, Token token) { |
| 41 token = token.next; | 45 token = token.next; |
| 42 if (token.kind === STRING_TOKEN) { | 46 if (token.kind === STRING_TOKEN) { |
| 43 token = token.next; | 47 token = token.next; |
| 44 } | 48 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } else if (!node.arguments.tail.isEmpty()) { | 213 } else if (!node.arguments.tail.isEmpty()) { |
| 210 builder.compiler.cancel('More than one argument to native'); | 214 builder.compiler.cancel('More than one argument to native'); |
| 211 } else { | 215 } else { |
| 212 LiteralString jsCode = node.arguments.head; | 216 LiteralString jsCode = node.arguments.head; |
| 213 int start = jsCode.value.slowToString()[0] === '@' ? 1 : 0; | 217 int start = jsCode.value.slowToString()[0] === '@' ? 1 : 0; |
| 214 builder.push(new HForeign(builder.unquote(jsCode, start), | 218 builder.push(new HForeign(builder.unquote(jsCode, start), |
| 215 const SourceString('Object'), | 219 const SourceString('Object'), |
| 216 <HInstruction>[])); | 220 <HInstruction>[])); |
| 217 } | 221 } |
| 218 } | 222 } |
| OLD | NEW |