Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for js.lib on Haxe dev #18

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions format/js/haxe/CallStack.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package haxe;

#if js
import jstack.js.JStack;
#if haxe4
import js.lib.Error;
#else
import js.Error;
#end
#end

using StringTools;
Expand All @@ -19,9 +24,9 @@ enum StackItem {
**/
class CallStack {
#if js
static var lastException:js.Error;
static var lastException:Error;

static function getStack(e:js.Error):Array<StackItem> {
static function getStack(e:Error):Array<StackItem> {
if (e == null) return [];
// https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
var oldValue = (untyped Error).prepareStackTrace;
Expand Down Expand Up @@ -57,7 +62,7 @@ class CallStack {
**/
public static function callStack() : Array<StackItem> {
try {
throw new js.Error();
throw new Error();
} catch( e : Dynamic ) {
var a = getStack(e);
a.shift(); // remove Stack.callStack()
Expand Down
6 changes: 5 additions & 1 deletion src/jstack/js/JStack.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package jstack.js;

import haxe.CallStack;
import sourcemap.SourcePos;
import js.Error;
import haxe.io.Path;
import js.Browser;
import haxe.Http;
#if haxe4
import js.lib.Error;
#else
import js.Error;
#end

/**
* Handles source map
Expand Down