Jeff Hardy avatar Jeff Hardy committed 63bad42

Make it compile for 2.6

Comments (0)

Files changed (2)

             }
 
             object _orig;
-            if(!(_context.BuiltinModuleInstance.TryGetName(SymbolTable.StringToId("compile"), out _orig) || astOnly))
+            if (!(_context.BuiltinModuleDict.TryGetValue("compile", out _orig) || astOnly))
                 throw new Exception("Could not get builin compile function.");
 
-            CodeContext context = new CodeContext(new PythonDictionary(), _context);
+            CodeContext context = new CodeContext(new PythonDictionary(), new ModuleContext(new PythonDictionary(), _context));
 
             if (!astOnly)
                 return PythonOps.CallWithContext(context, _orig, args);
                 if (stmt.Finally != null)
                 {
                     PythonList body;
-                    if (stmt.Handlers.Count != 0)
+                    if (stmt.Handlers != null && stmt.Handlers.Count != 0)
                         body = PythonOps.MakeListNoCopy(new TryExcept(stmt));
                     else
                         body = ConvertStatements(stmt.Body);
                 expr ast;
 
                 if (expr.Value == null)
-                    return new Name(SymbolId.Empty, Load.Instance);
+                    return new Name("None", Load.Instance);
 
                 if (expr.Value is int || expr.Value is double || expr.Value is Int64 || expr.Value is BigInteger || expr.Value is Complex64)
                     ast = new Num(expr.Value);
                 else if (expr.Value is string)
                     ast = new Str((string)expr.Value);
+                else if (expr.Value is IronPython.Runtime.Bytes)
+                    ast = new Str(Converter.ConvertToString(expr.Value));
                 else if (expr.Value == PythonOps.Ellipsis)
                     ast = Ellipsis.Instance;
                 else
 
             internal Raise(RaiseStatement stmt) : this()
             {
-                if (stmt.Type != null)
-                    _type = Convert(stmt.Type);
+                if (stmt.ExceptType != null)
+                    _type = Convert(stmt.ExceptType);
                 if (stmt.Value != null)
                     _inst = Convert(stmt.Value);
                 if (stmt.Traceback != null)
             public Return(ReturnStatement statement) : this()
             {
                 // statement.Expression is never null
-                _value = Convert(statement.Expression);
+                //or is it?
+                if (statement.Expression == null)
+                    _value = null;
+                else
+                    _value = Convert(statement.Expression);
             }
 
             public expr value
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>_ast</RootNamespace>
     <AssemblyName>_ast</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkSubset>
+    </TargetFrameworkSubset>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
   <ItemGroup>
     <Reference Include="IronPython, Version=2.6.10920.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\..\Bin\IronPython-2.6\IronPython.dll</HintPath>
+      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.6\IronPython.dll</HintPath>
     </Reference>
     <Reference Include="IronPython.Modules, Version=2.6.10920.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\..\Bin\IronPython-2.6\IronPython.Modules.dll</HintPath>
+      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.6\IronPython.Modules.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.Dynamic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\..\Bin\IronPython-2.6\Microsoft.Dynamic.dll</HintPath>
+      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.6\Microsoft.Dynamic.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\..\Bin\IronPython-2.6\Microsoft.Scripting.dll</HintPath>
+      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.6\Microsoft.Scripting.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.Scripting.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\..\Bin\IronPython-2.6\Microsoft.Scripting.Core.dll</HintPath>
+      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\IronPython 2.6\Microsoft.Scripting.Core.dll</HintPath>
     </Reference>
     <Reference Include="System" />
-    <Reference Include="System.Core">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
   </Target>
   -->
   <PropertyGroup>
-    <PostBuildEvent>copy /Y "$(TargetPath)" "C:\Users\Jeff\Bin\IronPython-2.0\DLLs"</PostBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
   </PropertyGroup>
 </Project>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.